[PATCH 08/33] misc: convert _scratch_mount -o remount to _scratch_remount

Darrick J. Wong
2025-10-29T01:22:31Z

Use the purpose-built scratch filesystem remount helper so that we don't
waste time recomputing mount options. This is needed for any filesystem
with a mount helper (i.e. /sbin/fs/mount.$FSTYP) because mount(8)
assumes that every helper is smart enough to find an existing mount and
remount it... and some of them like fuse2fs are not that smart.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
---
tests/btrfs/015 | 2 +-
tests/btrfs/032 | 2 +-
tests/btrfs/082 | 2 +-
tests/f2fs/005 | 2 +-
tests/generic/082 | 4 ++--
tests/generic/235 | 4 ++--
tests/generic/294 | 2 +-
tests/xfs/017 | 4 ++--
tests/xfs/075 | 2 +-
tests/xfs/189 | 4 ++--
tests/xfs/199 | 2 +-
11 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/tests/btrfs/015 b/tests/btrfs/015
index fc4277ff357424..adcf9941ac1ce7 100755
--- a/tests/btrfs/015
+++ b/tests/btrfs/015
@@ -16,7 +16,7 @@ _require_scratch

_scratch_mkfs > /dev/null 2>&1
_scratch_mount -o ro
-_scratch_mount -o rw,remount
+_scratch_remount remount

$BTRFS_UTIL_PROG subvolume snapshot $SCRATCH_MNT $SCRATCH_MNT/snap >> $seqres.full 2>&1 \
|| _fail "couldn't create snapshot"
diff --git a/tests/btrfs/032 b/tests/btrfs/032
index 5a963145b5bf6e..9653ddd28aaa1f 100755
--- a/tests/btrfs/032
+++ b/tests/btrfs/032
@@ -19,6 +19,6 @@ _scratch_mount "-o flushoncommit"

$XFS_IO_PROG -f -c "pwrite 0 10M" "$SCRATCH_MNT/tmpfile" | _filter_xfs_io

-_scratch_mount "-o remount,ro"
+_scratch_remount "ro"

status=0 ; exit
diff --git a/tests/btrfs/082 b/tests/btrfs/082
index 13cd1a2874e4f6..db55d688af5fb1 100755
--- a/tests/btrfs/082
+++ b/tests/btrfs/082
@@ -25,7 +25,7 @@ _require_scratch
_scratch_mkfs >$seqres.full 2>&1

_scratch_mount "-o thread_pool=6"
-_scratch_mount "-o remount,thread_pool=10"
+_scratch_remount "thread_pool=10"

echo "Silence is golden"
status=0
diff --git a/tests/f2fs/005 b/tests/f2fs/005
index 33d4fdb9bc97ee..56969968d0e907 100755
--- a/tests/f2fs/005
+++ b/tests/f2fs/005
@@ -36,7 +36,7 @@ mv $tmpfile $tmpdir
# it runs out of free segment
dd if=/dev/zero of=$testfile bs=1M count=5 conv=notrunc conv=fsync 2>/dev/null

-_scratch_mount -o remount,checkpoint=enable
+_scratch_remount checkpoint=enable

# it may hang umount if tmpdir is still dirty during evict()
_scratch_unmount
diff --git a/tests/generic/082 b/tests/generic/082
index f078ef2ffff944..0b2fabd4c0923f 100755
--- a/tests/generic/082
+++ b/tests/generic/082
@@ -35,10 +35,10 @@ quotaon $SCRATCH_MNT >>$seqres.full 2>&1
# quota, but currently xfs doesn't fail in this case, the unknown option is
# just ignored, but quota is still on. This may change in future, let's
# re-consider the case then.
-_try_scratch_mount "-o remount,ro,nosuchopt" >>$seqres.full 2>&1
+_scratch_remount "ro,nosuchopt" >>$seqres.full 2>&1
quotaon -p $SCRATCH_MNT | _filter_scratch | filter_project_quota_line
# second remount should succeed, no oops or hang expected
-_try_scratch_mount "-o remount,ro" || _fail "second remount,ro failed"
+_scratch_remount "ro" || _fail "second remount,ro failed"

# success, all done
status=0
diff --git a/tests/generic/235 b/tests/generic/235
index 037c29e806dbc4..1f97d5686d5a58 100755
--- a/tests/generic/235
+++ b/tests/generic/235
@@ -39,9 +39,9 @@ do_repquota
# https://bugzilla.redhat.com/show_bug.cgi?id=563267
#
# then you need a more recent mount binary.
-_try_scratch_mount "-o remount,ro" 2>&1 | tee -a $seqres.full | _filter_scratch
+_scratch_remount "ro" 2>&1 | tee -a $seqres.full | _filter_scratch
touch $SCRATCH_MNT/failed 2>&1 | tee -a $seqres.full | _filter_scratch
-_try_scratch_mount "-o remount,rw" 2>&1 | tee -a $seqres.full | _filter_scratch
+_scratch_remount "rw" 2>&1 | tee -a $seqres.full | _filter_scratch

touch $SCRATCH_MNT/testfile2
chown $qa_user:$qa_user $SCRATCH_MNT/testfile2
diff --git a/tests/generic/294 b/tests/generic/294
index b074591163714d..1381492879a9b7 100755
--- a/tests/generic/294
+++ b/tests/generic/294
@@ -40,7 +40,7 @@ rm -rf $THIS_TEST_DIR
mkdir $THIS_TEST_DIR || _fail "Could not create dir for test"

_create_files 2>&1 | _filter_scratch
-_try_scratch_mount -o remount,ro || _fail "Could not remount scratch readonly"
+_scratch_remount ro || _fail "Could not remount scratch readonly"
_create_files 2>&1 | _filter_scratch

# success, all done
diff --git a/tests/xfs/017 b/tests/xfs/017
index 263ecc7530ef7c..22ea0d78ed2ef8 100755
--- a/tests/xfs/017
+++ b/tests/xfs/017
@@ -35,7 +35,7 @@ do
FSSTRESS_ARGS=`_scale_fsstress_args -d $SCRATCH_MNT -n 1000`
_run_fsstress $FSSTRESS_ARGS

- _try_scratch_mount -o remount,ro \
+ _scratch_remount ro \
|| _fail "remount ro failed"

echo "" >>$seqres.full
@@ -49,7 +49,7 @@ do
echo "" >>$seqres.full
_scratch_xfs_repair -n >>$seqres.full 2>&1 \
|| _fail "xfs_repair -n failed"
- _try_scratch_mount -o remount,rw \
+ _scratch_remount rw \
|| _fail "remount rw failed"
done

diff --git a/tests/xfs/075 b/tests/xfs/075
index ab1d6cae85efac..3ac1bfc3a96cec 100755
--- a/tests/xfs/075
+++ b/tests/xfs/075
@@ -26,7 +26,7 @@ _scratch_mkfs_sized $((512 * 1024 * 1024)) >$seqres.full
_try_scratch_mount "-o ro,norecovery" >>$seqres.full 2>&1 \
|| _fail "First ro mount failed"
# make sure a following remount,rw fails
-_try_scratch_mount "-o remount,rw" >>$seqres.full 2>&1 \
+_scratch_remount "rw" >>$seqres.full 2>&1 \
&& _fail "Second rw remount succeeded"

# success, all done
diff --git a/tests/xfs/189 b/tests/xfs/189
index 1770023760fd88..bd2051b2e4a5cb 100755
--- a/tests/xfs/189
+++ b/tests/xfs/189
@@ -192,11 +192,11 @@ ENDL
[ $? -eq 0 ] || echo "mount failed unexpectedly!"
_check_mount rw

- _try_scratch_mount -o remount,nobarrier
+ _scratch_remount nobarrier
[ $? -eq 0 ] || _fail "remount nobarrier failed"
_check_mount rw nobarrier

- _try_scratch_mount -o remount,barrier
+ _scratch_remount barrier
[ $? -eq 0 ] || _fail "remount barrier failed"
_check_mount rw

diff --git a/tests/xfs/199 b/tests/xfs/199
index 7b9c8eeae1f9a3..fe41b372fd5f07 100755
--- a/tests/xfs/199
+++ b/tests/xfs/199
@@ -58,7 +58,7 @@ _scratch_xfs_db -x -c 'sb' -c 'write features2 0'
# And print the flags after a mount ro and remount rw
#
_scratch_mount -o ro
-_scratch_mount -o remount,rw
+_scratch_remount rw
_scratch_unmount
rof2=`_scratch_xfs_get_sb_field features2`