diff options
author | Olaf Faaland <[email protected]> | 2018-08-20 10:05:23 -0700 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-08-20 10:05:23 -0700 |
commit | 34fe773e303e499e6a6e5fcd2ceeee4531579dab (patch) | |
tree | 2871fe497c6ce4ee775411d13f8b5d011564e8bf /tests | |
parent | edc05fdb34792e65508ac2ff91c58828b44f19b1 (diff) |
Skip import activity test in more zdb code paths
Since zdb opens the pools read-only, it cannot damage the pool in the
event the pool is already imported either on the same host or on
another one.
If the pool vdev structure is changing while zdb is importing the
pool, it may cause zdb to crash. However this is unlikely, and in any
case it's a user space process and can simply be run again.
For this reason, zdb should disable the multihost activity test on
import that is normally run.
This commit fixes a few zdb code paths where that had been overlooked.
It also adds tests to ensure that several common use cases handle this
properly in the future.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Gu Zheng <[email protected]>
Signed-off-by: Olaf Faaland <[email protected]>
Closes #7797
Closes #7801
Diffstat (limited to 'tests')
-rw-r--r-- | tests/runfiles/linux.run | 3 | ||||
-rw-r--r-- | tests/zfs-tests/tests/functional/mmp/Makefile.am | 1 | ||||
-rwxr-xr-x | tests/zfs-tests/tests/functional/mmp/mmp_on_zdb.ksh | 81 |
3 files changed, 84 insertions, 1 deletions
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run index 10c1200a4..445463cf8 100644 --- a/tests/runfiles/linux.run +++ b/tests/runfiles/linux.run @@ -597,7 +597,8 @@ tags = ['functional', 'mmap'] [tests/functional/mmp] tests = ['mmp_on_thread', 'mmp_on_uberblocks', 'mmp_on_off', 'mmp_interval', 'mmp_active_import', 'mmp_inactive_import', 'mmp_exported_import', - 'mmp_write_uberblocks', 'mmp_reset_interval', 'multihost_history'] + 'mmp_write_uberblocks', 'mmp_reset_interval', 'multihost_history', + 'mmp_on_zdb'] tags = ['functional', 'mmp'] [tests/functional/mount] diff --git a/tests/zfs-tests/tests/functional/mmp/Makefile.am b/tests/zfs-tests/tests/functional/mmp/Makefile.am index ecf16f806..f2d0ad0ea 100644 --- a/tests/zfs-tests/tests/functional/mmp/Makefile.am +++ b/tests/zfs-tests/tests/functional/mmp/Makefile.am @@ -10,6 +10,7 @@ dist_pkgdata_SCRIPTS = \ mmp_exported_import.ksh \ mmp_write_uberblocks.ksh \ mmp_reset_interval.ksh \ + mmp_on_zdb.ksh \ setup.ksh \ cleanup.ksh diff --git a/tests/zfs-tests/tests/functional/mmp/mmp_on_zdb.ksh b/tests/zfs-tests/tests/functional/mmp/mmp_on_zdb.ksh new file mode 100755 index 000000000..131fd21e8 --- /dev/null +++ b/tests/zfs-tests/tests/functional/mmp/mmp_on_zdb.ksh @@ -0,0 +1,81 @@ +#!/bin/ksh + +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright (c) 2018 Lawrence Livermore National Security, LLC. +# Copyright (c) 2018 by Nutanix. All rights reserved. +# + +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/tests/functional/mmp/mmp.cfg +. $STF_SUITE/tests/functional/mmp/mmp.kshlib + +# +# Description: +# zdb will work while multihost is enabled. +# +# Strategy: +# 1. Create a pool +# 2. Enable multihost +# 3. Run zdb -d with pool and dataset arguments. +# 4. Create a checkpoint +# 5. Run zdb -kd with pool and dataset arguments. +# 6. Discard the checkpoint +# 7. Export the pool +# 8. Run zdb -ed with pool and dataset arguments. +# + +function cleanup +{ + datasetexists $TESTPOOL && destroy_pool $TESTPOOL + for DISK in $DISKS; do + zpool labelclear -f $DEV_RDSKDIR/$DISK + done + log_must mmp_clear_hostid +} + +log_assert "Verify zdb -d works while multihost is enabled" +log_onexit cleanup + +verify_runnable "global" +verify_disk_count "$DISKS" 2 + +default_mirror_setup_noexit $DISKS +log_must mmp_set_hostid $HOSTID1 +log_must zpool set multihost=on $TESTPOOL +log_must zfs snap $TESTPOOL/$TESTFS@snap + +log_must zdb -d $TESTPOOL +log_must zdb -d $TESTPOOL/ +log_must zdb -d $TESTPOOL/$TESTFS +log_must zdb -d $TESTPOOL/$TESTFS@snap + +log_must zpool checkpoint $TESTPOOL +log_must zdb -kd $TESTPOOL +log_must zdb -kd $TESTPOOL/ +log_must zdb -kd $TESTPOOL/$TESTFS +log_must zdb -kd $TESTPOOL/$TESTFS@snap +log_must zpool checkpoint -d $TESTPOOL + +log_must zpool export $TESTPOOL + +log_must zdb -ed $TESTPOOL +log_must zdb -ed $TESTPOOL/ +log_must zdb -ed $TESTPOOL/$TESTFS +log_must zdb -ed $TESTPOOL/$TESTFS@snap + +log_must zpool import $TESTPOOL + +cleanup + +log_pass "zdb -d works while multihost is enabled" |