On Tue, Jul 29, 2025 at 07:29:51AM -0700, Darrick J. Wong wrote: > On Tue, Jul 22, 2025 at 12:19:34AM -0700, Christoph Hellwig wrote: > > Hi all, > > > > I've been hacking on some (XFS) code that in this state of development > > requires a mount options to be passed for every mount, and I noticed > > that even when running without a SCRATCH_DEV I have to add the required > > option to MOUNT_OPTIONS and not just TEST_FS_MOUNT_OPTS, which is a bit > > odd. I've been trying to track it down and despite multiple attempts > > failed to find my way through the bash code for it. > > > > But what is even more odd is that when running just a single test (e.g. > > generic/001), the test fs gets mounted four times, with the second > > and fourth time failing to apply the mount options. > > Huh, I observe the same thing. I wonder why it does that, but bash is > pretty awful for tracing and there's no obvious explanation. :( I tried to run generic/001 on xfs, then I got below dmesg output: ->[2252223.939937] XFS (sda5): Mounting V5 Filesystem 364c2734-5bec-4d6a-8057-6ced2ea53e95 [2252223.963840] XFS (sda5): Ending clean mount [2252224.892093] XFS (dm-3): Mounting V5 Filesystem 1de154c4-41cd-4b49-a09c-a55532f58ee9 [2252224.910117] XFS (dm-3): Ending clean mount [2252224.950702] XFS (dm-3): Unmounting Filesystem 1de154c4-41cd-4b49-a09c-a55532f58ee9 [2252226.047099] XFS (sda5): Unmounting Filesystem 364c2734-5bec-4d6a-8057-6ced2ea53e95 ->[2252226.168554] XFS (sda5): Mounting V5 Filesystem 364c2734-5bec-4d6a-8057-6ced2ea53e95 [2252226.190181] XFS (sda5): Ending clean mount [2252226.208104] run fstests generic/001 at 2025-07-31 17:18:04 [2252230.614153] XFS (sda5): Unmounting Filesystem 364c2734-5bec-4d6a-8057-6ced2ea53e95 ->[2252230.755666] XFS (sda5): Mounting V5 Filesystem 364c2734-5bec-4d6a-8057-6ced2ea53e95 [2252230.776979] XFS (sda5): Ending clean mount [2252230.820463] XFS (sda5): Unmounting Filesystem 364c2734-5bec-4d6a-8057-6ced2ea53e95 Some lines are outputed before "run fstests generic/001", some lines after it. ------ Before that line, my testing (./check generic/001) tried to mount TEST_DEV (sda5) twice, tried to mount SCRATCH_DEV (dm-3) once. Let's focus on TEST_DEV. By enable bash DEBUG_XTRACE (bash -x) in check and generic/001, I found these two places which mount $TEST_DEV in check: 1) _test_mount 2) _check_test_fs -> _check_xfs_filesystem -> _mount_or_remount_rw ------ ------ After that line, my testing tried to mount TEST_DEV once, that comes from: 1) _check_filesystems -> _check_test_fs ------ So the "_check_xfs_filesystem" set ok=1 by default, then does $XFS_REPAIR_PROG, and set ok=0 if it returns non-zero. Then if "ok isn't 0 and type=xfs", calls _mount_or_remount_rw to mount. This generates extra mount operations. Thanks, Zorro > > --D >