From 31f7192f90a89a6f808a37c3a3cd30491bd50eba Mon Sep 17 00:00:00 2001 From: "Darrick J. Wong" Date: Tue, 20 Jan 2026 17:26:21 -0800 Subject: [PATCH] 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 --- ltp/fsstress.c | 5 ++++- ltp/fsx.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) 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); } -- 2.47.3