ZTS: update upgrade_readonly_pool.ksh

Modify the test case to use the `zfs mount` command instead
of directly calling the mount command, create a dedicated dataset,
and use the default mount point.  These changes are intended to
preserve the intent of the original test case and resolve some
spurious mount failures which have been observed by the CI.

Reviewed-by: Igor Kozhukhov <igor@dilos.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #17785
This commit is contained in:
Brian Behlendorf 2025-09-25 09:31:10 -07:00
parent 6dad2f61a3
commit 9bd8f4379c
2 changed files with 9 additions and 7 deletions

View File

@ -39,6 +39,6 @@
verify_runnable "global" verify_runnable "global"
# create a pool without any features # create a pool without any features
log_must mkfile 128m $TMPDEV log_must truncate -s $MINVDEVSIZE $TMPDEV
log_pass log_pass

View File

@ -35,17 +35,19 @@
verify_runnable "global" verify_runnable "global"
TESTFILE="$TESTDIR/file.bin"
log_assert "User accounting upgrade should not be executed on readonly pool" log_assert "User accounting upgrade should not be executed on readonly pool"
log_onexit cleanup_upgrade log_onexit cleanup_upgrade
# 1. Create a pool with the feature@userobj_accounting disabled to simulate # 1. Create a pool with the feature@userobj_accounting disabled to simulate
# a legacy pool from a previous ZFS version. # a legacy pool from a previous ZFS version.
log_must zpool create -d -m $TESTDIR $TESTPOOL $TMPDEV log_must zpool create -d $TESTPOOL $TMPDEV
log_must zfs create $TESTPOOL/$TESTFS
MNTPNT=$(get_prop mountpoint $TESTPOOL/$TESTFS)
TESTFILE="$MNTPNT/file.bin"
# 2. Create a file on the "legecy" dataset # 2. Create a file on the "legecy" dataset
log_must touch $TESTDIR/file.bin log_must touch $TESTFILE
# 3. Enable feature@userobj_accounting on the pool and verify it is only # 3. Enable feature@userobj_accounting on the pool and verify it is only
# "enabled" and not "active": upgrading starts when the filesystem is mounted # "enabled" and not "active": upgrading starts when the filesystem is mounted
@ -54,12 +56,12 @@ log_must test "enabled" == "$(get_pool_prop 'feature@userobj_accounting' $TESTPO
# 4. Export the pool and re-import is readonly, without mounting any filesystem # 4. Export the pool and re-import is readonly, without mounting any filesystem
log_must zpool export $TESTPOOL log_must zpool export $TESTPOOL
log_must zpool import -o readonly=on -N -d "$(dirname $TMPDEV)" $TESTPOOL log_must zpool import -o readonly=on -N -d $TEST_BASE_DIR $TESTPOOL
# 5. Try to mount the root dataset manually without the "ro" option, then verify # 5. Try to mount the root dataset manually without the "ro" option, then verify
# filesystem status and the pool feature status (not "active") to ensure the # filesystem status and the pool feature status (not "active") to ensure the
# pool "readonly" status is enforced. # pool "readonly" status is enforced.
log_must mount -t zfs -o zfsutil $TESTPOOL $TESTDIR log_must zfs mount -R $TESTPOOL
log_must stat "$TESTFILE" log_must stat "$TESTFILE"
log_mustnot touch "$TESTFILE" log_mustnot touch "$TESTFILE"
log_must test "enabled" == "$(get_pool_prop 'feature@userobj_accounting' $TESTPOOL)" log_must test "enabled" == "$(get_pool_prop 'feature@userobj_accounting' $TESTPOOL)"