]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
misc: allow zero duration for fsstress and fsx
authorDarrick J. Wong <djwong@kernel.org>
Wed, 21 Jan 2026 01:26:21 +0000 (17:26 -0800)
committerZorro Lang <zlang@kernel.org>
Sun, 25 Jan 2026 16:05:29 +0000 (00:05 +0800)
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 <djwong@kernel.org>
Reviewed-by: Zorro Lang <zlang@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Zorro Lang <zlang@kernel.org>
ltp/fsstress.c
ltp/fsx.c

index dfd85db84b53b1f4a5b9ffad806f84e492cee181..9d0ed32f0a7986c9653d0f98f283414d8ccb8b06 100644 (file)
@@ -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);
                        }
index 8626662bfb9a2e69b1f20d9c5333d4cde8785834..32b9d5995d7dbf41179408bd297c770f4ccc59bd 100644 (file)
--- 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);
                        }