3 # This file and its contents are supplied under the terms of the
4 # Common Development and Distribution License ("CDDL"), version 1.0.
5 # You may only use this file in accordance with the terms of version
8 # A full copy of the text of the CDDL should have accompanied this
9 # source. A copy of the CDDL is also available via the Internet at
10 # http://www.illumos.org/license/CDDL.
14 # Copyright 2019, loli10K <ezomori.nozomu@gmail.com>. All rights reserved.
17 .
$STF_SUITE/tests
/functional
/upgrade
/upgrade_common.kshlib
21 # User accounting upgrade should not be executed on readonly pool
24 # 1. Create a pool with the feature@userobj_accounting disabled to simulate
25 # a legacy pool from a previous ZFS version.
26 # 2. Create a file on the "legecy" dataset and store its checksum
27 # 3. Enable feature@userobj_accounting on the pool and verify it is only
28 # "enabled" and not "active": upgrading starts when the filesystem is mounted
29 # 4. Export the pool and re-import is readonly, without mounting any filesystem
30 # 5. Try to mount the root dataset manually without the "ro" option, then verify
31 # filesystem status and the pool feature status (not "active") to ensure the
32 # pool "readonly" status is enforced.
35 verify_runnable
"global"
37 TESTFILE
="$TESTDIR/file.bin"
39 log_assert
"User accounting upgrade should not be executed on readonly pool"
40 log_onexit cleanup_upgrade
42 # 1. Create a pool with the feature@userobj_accounting disabled to simulate
43 # a legacy pool from a previous ZFS version.
44 log_must zpool create
-d -m $TESTDIR $TESTPOOL $TMPDEV
46 # 2. Create a file on the "legecy" dataset
47 log_must
touch $TESTDIR/file.bin
49 # 3. Enable feature@userobj_accounting on the pool and verify it is only
50 # "enabled" and not "active": upgrading starts when the filesystem is mounted
51 log_must zpool
set feature@userobj_accounting
=enabled
$TESTPOOL
52 log_must
test "enabled" == "$(get_pool_prop 'feature@userobj_accounting' $TESTPOOL)"
54 # 4. Export the pool and re-import is readonly, without mounting any filesystem
55 log_must zpool
export $TESTPOOL
56 log_must zpool import
-o readonly=on
-N -d "$(dirname $TMPDEV)" $TESTPOOL
58 # 5. Try to mount the root dataset manually without the "ro" option, then verify
59 # filesystem status and the pool feature status (not "active") to ensure the
60 # pool "readonly" status is enforced.
61 log_must mount
-t zfs
-o zfsutil
$TESTPOOL $TESTDIR
62 log_must stat
"$TESTFILE"
63 log_mustnot
touch "$TESTFILE"
64 log_must
test "enabled" == "$(get_pool_prop 'feature@userobj_accounting' $TESTPOOL)"
66 log_pass
"User accounting upgrade is not executed on readonly pool"