From: Andriy Skulysh Date: Tue, 21 Oct 2014 07:06:43 +0000 (-0700) Subject: LU-4904 test: write_append_truncate failed with divide error X-Git-Tag: 2.5.3.90~53 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=88faf0ab6e2ebdbc3a3c70010fe04cf56f11ea97 LU-4904 test: write_append_truncate failed with divide error fix trunc_size calculation in case of append_size == 1 Don't allow to specify write_max and append_max < 2. This patch is back-ported from the following one: Lustre-commit: 85b037f5da6a022919783ef9a87ed6d2a4d102d2 Lustre-change: http://review.whamcloud.com/9948 Test-Parameters: alwaysuploadlogs \ envdefinitions=SLOW=yes,ENABLE_QUOTA=yes,ONLY=write_append_truncate \ mdtfilesystemtype=ldiskfs mdsfilesystemtype=ldiskfs ostfilesystemtype=ldiskfs \ mdtcount=4 mdssizegb=2 ostcount=7 ostsizegb=2 \ testlist=parallel-scale Xyratex-bug-id: MRP-1779 Signed-off-by: Andriy Skulysh Change-Id: Ia2cf141b3cc78e4f1488a96fc602b78b16869678 Reviewed-on: http://review.whamcloud.com/12358 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: Emoly Liu Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin --- diff --git a/lustre/tests/mpi/write_append_truncate.c b/lustre/tests/mpi/write_append_truncate.c index 0fdf0fc..3b53aeb 100644 --- a/lustre/tests/mpi/write_append_truncate.c +++ b/lustre/tests/mpi/write_append_truncate.c @@ -161,7 +161,7 @@ int main(int argc, char *argv[]) switch(c) { case 'a': append_max = strtoul(optarg, &end, 0); - if (append_max == 0 || *end) { + if (append_max < 2 || *end) { fprintf(stderr, "%s: bad append option '%s'\n", prog, optarg); usage(prog); @@ -202,7 +202,7 @@ int main(int argc, char *argv[]) break; case 'w': write_max = strtoul(optarg, &end, 0); - if (write_max == 0 || *end) { + if (write_max < 2 || *end) { fprintf(stderr, "%s: bad write option '%s'\n", prog, optarg); usage(prog); @@ -303,7 +303,8 @@ int main(int argc, char *argv[]) if (rank == 0) { write_size = (rand() % (write_max - 1)) + 1; append_size = (rand() % (append_max - 1)) + 1; - trunc_size = (rand() % ((trunc_max?: append_size)-1))+1; + trunc_size = (append_size == 1) ? 1 : + (rand() % ((trunc_max?: append_size)-1))+1; trunc_offset = write_size + trunc_size; if (verbose || n % 1000 == 0)