From: Darrick J. Wong Date: Wed, 21 Jan 2026 01:26:21 +0000 (-0800) Subject: misc: allow zero duration for fsstress and fsx X-Git-Tag: v2026.01.27~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=31f7192f90a89a6f808a37c3a3cd30491bd50eba;p=xfstests-dev.git misc: allow zero duration for fsstress and fsx Occasionally the common/fuzzy fuzz test helpers manage to time something just right such that fsx or fsstress get invoked with a zero second duration. It's harmless to exit immediately without doing anything, so allow this corner case. [zlang: No action is taken if duration is 0] Cc: fstests@vger.kernel.org # v2023.05.01 Fixes: 3e85dd4fe4236d ("misc: add duration for long soak tests") Signed-off-by: Darrick J. Wong Reviewed-by: Zorro Lang Reviewed-by: Christoph Hellwig Signed-off-by: Zorro Lang --- diff --git a/ltp/fsstress.c b/ltp/fsstress.c index dfd85db8..9d0ed32f 100644 --- a/ltp/fsstress.c +++ b/ltp/fsstress.c @@ -639,7 +639,10 @@ int main(int argc, char **argv) exit(87); } duration = strtoll(optarg, NULL, 0); - if (duration < 1) { + if (duration == 0) { + /* No action is taken if duration is 0 */ + exit(0); + } else if (duration < 0) { fprintf(stderr, "%lld: invalid duration\n", duration); exit(88); } diff --git a/ltp/fsx.c b/ltp/fsx.c index 8626662b..32b9d599 100644 --- a/ltp/fsx.c +++ b/ltp/fsx.c @@ -3375,7 +3375,10 @@ main(int argc, char **argv) exit(87); } duration = strtoll(optarg, NULL, 0); - if (duration < 1) { + if (duration == 0) { + /* No action is taken if duration is 0 */ + exit(0); + } else if (duration < 0) { fprintf(stderr, "%lld: invalid duration\n", duration); exit(88); }