[Ocfs2-test-devel] [PATCH 27/59] reflink_stress_test: abort if truncate reflinked file fail
Junxiao Bi
junxiao.bi at oracle.com
Sun Sep 13 19:44:13 PDT 2015
From: Jeff Liu <jeff.liu at oracle.com>
Truncate a reflinked file might failed during stress testing, we have to abort in
this situation. Otherwise, the test result should be wrong and confused the tester.
Signed-off-by: Jie Liu <jeff.liu at oracle.com>
Signed-off-by: Junxiao Bi <junxiao.bi at oracle.com>
---
programs/reflink_tests/multi_reflink_test.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/programs/reflink_tests/multi_reflink_test.c b/programs/reflink_tests/multi_reflink_test.c
index 619c2db..45c96fe 100755
--- a/programs/reflink_tests/multi_reflink_test.c
+++ b/programs/reflink_tests/multi_reflink_test.c
@@ -561,7 +561,6 @@ static int basic_test(void)
truncate_size = file_size / (rank + 1);
ret = truncate(dest, truncate_size);
-
if (ret < 0) {
if (write_buf)
free(write_buf);
@@ -1461,7 +1460,6 @@ static int stress_test(void)
MPI_Barrier_Sync();
if (rank) {
-
for (i = 0; i < ref_counts; i++) {
if (get_rand(0, 1))
@@ -1470,7 +1468,12 @@ static int stress_test(void)
snprintf(ref_path, PATH_MAX, "%s_%dr%ld", orig_path,
rank, i);
- truncate(ref_path, 0);
+ if (truncate(ref_path, 0) < 0) {
+ ret = errno;
+ abort_printf("truncate refcount file %s failed: %d:%s\n",
+ ref_path, ret, strerror(ret));
+ goto bail;
+ }
}
}
--
1.7.9.5
More information about the Ocfs2-test-devel
mailing list