]> git.apps.os.sepia.ceph.com Git - xfstests-dev.git/commitdiff
generic/032: fix pinned mount failure
authorDarrick J. Wong <djwong@kernel.org>
Mon, 3 Feb 2025 22:00:29 +0000 (14:00 -0800)
committerZorro Lang <zlang@kernel.org>
Tue, 18 Feb 2025 04:42:39 +0000 (12:42 +0800)
generic/032 now periodically fails with:

 --- /tmp/fstests/tests/generic/032.out 2025-01-05 11:42:14.427388698 -0800
 +++ /var/tmp/fstests/generic/032.out.bad 2025-01-06 18:20:17.122818195 -0800
 @@ -1,5 +1,7 @@
  QA output created by 032
  100 iterations
 -000000 cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd cd  >................<
 -*
 -100000
 +umount: /opt: target is busy.
 +mount: /opt: /dev/sda4 already mounted on /opt.
 +       dmesg(1) may have more information after failed mount system call.
 +cycle mount failed
 +(see /var/tmp/fstests/generic/032.full for details)

The root cause of this regression is the _syncloop subshell.  This
background process runs _scratch_sync, which is actually an xfs_io
process that calls syncfs on the scratch mount.

Unfortunately, while the test kills the _syncloop subshell, it doesn't
actually kill the xfs_io process.  If the xfs_io process is in D state
running the syncfs, it won't react to the signal, but it will pin the
mount.  Then the _scratch_cycle_mount fails because the mount is pinned.

Prior to commit 8973af00ec212f the _syncloop ran sync(1) which avoided
pinning the scratch filesystem.

Fix this by pgrepping for the xfs_io process and killing and waiting for
it if necessary.

Cc: <fstests@vger.kernel.org> # v2024.12.08
Fixes: 8973af00ec212f ("fstests: cleanup fsstress process management")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Zorro Lang <zlang@kernel.org>
common/rc
tests/generic/032

index 2925247fe93dec45c5948cdb73a8253dcbaba015..b39da65d6c8725de970a6f72d6941eecc0e8aacf 100644 (file)
--- a/common/rc
+++ b/common/rc
@@ -40,6 +40,16 @@ _pkill()
        fi
 }
 
+# Find only the test processes started by this test
+_pgrep()
+{
+       if [ "$FSTESTS_ISOL" = "setsid" ]; then
+               pgrep --session 0 "$@"
+       else
+               pgrep "$@"
+       fi
+}
+
 # Common execution handling for fsstress invocation.
 #
 # We need per-test fsstress binaries because of the way fsstress forks and
index 30290c7225a2fa88504483cec486fd40d4dcd634..48d594fe9315b8b5f56dad3d49dcddacea3b724c 100755 (executable)
@@ -81,6 +81,15 @@ echo $iters iterations
 kill $syncpid
 wait
 
+# The xfs_io instance started by _scratch_sync could be stuck in D state when
+# the subshell running _syncloop & is killed.  That xfs_io process pins the
+# mount so we must kill it and wait for it to die before cycling the mount.
+dead_syncfs_pid=$(_pgrep xfs_io)
+if [ -n "$dead_syncfs_pid" ]; then
+       _pkill xfs_io
+       wait $dead_syncfs_pid
+fi
+
 # clear page cache and dump the file
 _scratch_cycle_mount
 _hexdump $SCRATCH_MNT/file