[PATCH 2/2] generic: only enable io_uring in fsstress explicitly

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Darrick J. Wong <djwong@xxxxxxxxxx>

Don't enable io_uring in fsstress unless someone asks for it explicitly,
just like fsx.  I think both tools should require explicit opt-in to
facilitate A/B testing between the old IO paths and this new one.

While I was playing with fstests+io_uring, I noticed quite a few
regressions in fstests, which fell into two classes:

The first class is umount failing with EBUSY.  Apparently this is due to
the kernel uring code hanging on to file references even after the
userspace program exits.  Tests that run fsstress and immediately
unmount now fail sporadically due to the EBUSY.  Unfortunately, the
metadata update stress tests, the recovery loop tests, the xfs online
fsck functional tests, and the xfs fuzz tests make heavy use of
"fsstress; umount" and they fail all over the place now.

Something's broken, Jens and Christian said it should get fixed, but in
the meantime this is getting in the way of me testing my own code.

The second problem I noticed is that fsstress now lodges complaints
about sporadic heap corruption.  I /think/ this is due to some kind of
memory mishandling bug when uring is active but IO requests fail, but I
haven't had the time to go figure out what's up with that.

Link: https://lore.kernel.org/linux-fsdevel/CAHk-=wj8RuUosugVZk+iqCAq7x6rs=7C-9sUXcO2heu4dCuOVw@xxxxxxxxxxxxxx/
Signed-off-by: Darrick J. Wong <djwong@xxxxxxxxxx>
---
 ltp/fsstress.c         |   17 ++++++++++++++---
 tests/generic/1220     |   43 +++++++++++++++++++++++++++++++++++++++++++
 tests/generic/1220.out |    2 ++
 3 files changed, 59 insertions(+), 3 deletions(-)
 create mode 100755 tests/generic/1220
 create mode 100644 tests/generic/1220.out


diff --git a/ltp/fsstress.c b/ltp/fsstress.c
index abe2874253..f8bb166646 100644
--- a/ltp/fsstress.c
+++ b/ltp/fsstress.c
@@ -339,8 +339,8 @@ struct opdesc	ops[OP_LAST]	= {
 	[OP_TRUNCATE]	   = {"truncate",      truncate_f,	2, 1 },
 	[OP_UNLINK]	   = {"unlink",	       unlink_f,	1, 1 },
 	[OP_UNRESVSP]	   = {"unresvsp",      unresvsp_f,	1, 1 },
-	[OP_URING_READ]	   = {"uring_read",    uring_read_f,	1, 0 },
-	[OP_URING_WRITE]   = {"uring_write",   uring_write_f,	1, 1 },
+	[OP_URING_READ]	   = {"uring_read",    uring_read_f,	-1, 0 },
+	[OP_URING_WRITE]   = {"uring_write",   uring_write_f,	-1, 1 },
 	[OP_WRITE]	   = {"write",	       write_f,		4, 1 },
 	[OP_WRITEV]	   = {"writev",	       writev_f,	4, 1 },
 	[OP_XCHGRANGE]	   = {"xchgrange",     xchgrange_f,	2, 1 },
@@ -507,7 +507,7 @@ int main(int argc, char **argv)
 	xfs_error_injection_t	        err_inj;
 	struct sigaction action;
 	int		loops = 1;
-	const char	*allopts = "cd:e:f:i:l:m:M:n:o:p:rRs:S:vVwx:X:zH";
+	const char	*allopts = "cd:e:f:i:l:m:M:n:o:p:rRs:S:UvVwx:X:zH";
 	long long	duration;
 
 	errrange = errtag = 0;
@@ -603,6 +603,12 @@ int main(int argc, char **argv)
 			printf("\n");
                         nousage=1;
 			break;
+		case 'U':
+			if (ops[OP_URING_READ].freq == -1)
+				ops[OP_URING_READ].freq = 1;
+			if (ops[OP_URING_WRITE].freq == -1)
+				ops[OP_URING_WRITE].freq = 1;
+			break;
 		case 'V':
 			verifiable_log = 1;
 			break;
@@ -640,6 +646,11 @@ int main(int argc, char **argv)
 		}
 	}
 
+	if (ops[OP_URING_READ].freq == -1)
+		ops[OP_URING_READ].freq = 0;
+	if (ops[OP_URING_WRITE].freq == -1)
+		ops[OP_URING_WRITE].freq = 0;
+
         if (!dirname) {
             /* no directory specified */
             if (!nousage) usage();
diff --git a/tests/generic/1220 b/tests/generic/1220
new file mode 100755
index 0000000000..ec8cafba71
--- /dev/null
+++ b/tests/generic/1220
@@ -0,0 +1,43 @@
+#! /bin/bash
+# SPDX-License-Identifier: GPL-2.0
+# Copyright (c) 2017 Oracle, Inc.  All Rights Reserved.
+#
+# FS QA Test No. 1220
+#
+# Run an all-writes fsstress run with multiple threads and io_uring to shake
+# out bugs in the write path.
+#
+. ./common/preamble
+_begin_fstest auto rw long_rw stress soak smoketest
+
+# Override the default cleanup function.
+_cleanup()
+{
+	cd /
+	rm -f $tmp.*
+	$KILLALL_PROG -9 fsstress > /dev/null 2>&1
+}
+
+# Import common functions.
+
+# Modify as appropriate.
+_supported_fs generic
+
+_require_scratch
+_require_command "$KILLALL_PROG" "killall"
+
+echo "Silence is golden."
+
+_scratch_mkfs > $seqres.full 2>&1
+_scratch_mount >> $seqres.full 2>&1
+
+nr_cpus=$((LOAD_FACTOR * 4))
+nr_ops=$((25000 * nr_cpus * TIME_FACTOR))
+fsstress_args=(-w -d $SCRATCH_MNT -n $nr_ops -p $nr_cpus -U)
+test -n "$SOAK_DURATION" && fsstress_args+=(--duration="$SOAK_DURATION")
+
+$FSSTRESS_PROG $FSSTRESS_AVOID "${fsstress_args[@]}" >> $seqres.full
+
+# success, all done
+status=0
+exit
diff --git a/tests/generic/1220.out b/tests/generic/1220.out
new file mode 100644
index 0000000000..2583a6bf73
--- /dev/null
+++ b/tests/generic/1220.out
@@ -0,0 +1,2 @@
+QA output created by 1220
+Silence is golden.




[Index of Archives]     [XFS Filesystem Development (older mail)]     [Linux Filesystem Development]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux RAID]     [Linux SCSI]


  Powered by Linux