diff options
author | Chunwei Chen <[email protected]> | 2018-02-01 16:36:40 -0800 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2018-03-14 16:10:37 -0700 |
commit | 478754a8f5ff0f3b9f6dfe4ce272efc1681d243e (patch) | |
tree | 0fdbc624d7f3d17de27cc2424c90ba6717eccd57 /tests | |
parent | 31ff122aa2e20c7ed48617868085ddba7b4ad174 (diff) |
Fix zdb -ed on objset for exported pool
zdb -ed on objset for exported pool would failed with:
failed to own dataset 'qq/fs0': No such file or directory
The reason is that zdb pass objset name to spa_import, it uses that
name to create a spa. Later, when dmu_objset_own tries to lookup the spa
using real pool name, it can't find one.
We fix this by make sure we pass pool name rather than objset name to
spa_import.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: loli10K <[email protected]>
Signed-off-by: Chunwei Chen <[email protected]>
Closes #7099
Closes #6464
Diffstat (limited to 'tests')
4 files changed, 69 insertions, 4 deletions
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run index 303c27529..ea2dbb282 100644 --- a/tests/runfiles/linux.run +++ b/tests/runfiles/linux.run @@ -73,7 +73,7 @@ tags = ['functional', 'clean_mirror'] [tests/functional/cli_root/zdb] tests = ['zdb_001_neg', 'zdb_002_pos', 'zdb_003_pos', 'zdb_004_pos', - 'zdb_005_pos'] + 'zdb_005_pos', 'zdb_006_pos'] pre = post = tags = ['functional', 'cli_root', 'zdb'] diff --git a/tests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh b/tests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh index ac3bfbca8..fb0db312e 100755 --- a/tests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh +++ b/tests/zfs-tests/tests/functional/clean_mirror/cleanup.ksh @@ -38,10 +38,10 @@ df -F zfs -h | grep "$TESTFS " >/dev/null [[ $? == 0 ]] && log_must zfs umount -f $TESTDIR destroy_pool $TESTPOOL -if is_mpath_device $MIRROR_PRIMARY; then +if ( is_mpath_device $MIRROR_PRIMARY || is_loop_device $MIRROR_SECONDARY); then parted $DEV_DSKDIR/$MIRROR_PRIMARY -s rm 1 fi -if is_mpath_device $MIRROR_SECONDARY; then +if ( is_mpath_device $MIRROR_SECONDARY || is_loop_device $MIRROR_SECONDARY); then parted $DEV_DSKDIR/$MIRROR_SECONDARY -s rm 1 fi # recreate and destroy a zpool over the disks to restore the partitions to diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am b/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am index 51170fbc8..d37bcf607 100644 --- a/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am +++ b/tests/zfs-tests/tests/functional/cli_root/zdb/Makefile.am @@ -4,4 +4,5 @@ dist_pkgdata_SCRIPTS = \ zdb_002_pos.ksh \ zdb_003_pos.ksh \ zdb_004_pos.ksh \ - zdb_005_pos.ksh + zdb_005_pos.ksh \ + zdb_006_pos.ksh diff --git a/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_006_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_006_pos.ksh new file mode 100755 index 000000000..97b00e9e1 --- /dev/null +++ b/tests/zfs-tests/tests/functional/cli_root/zdb/zdb_006_pos.ksh @@ -0,0 +1,64 @@ +#!/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 by Nutanix. All rights reserved. +# + +. $STF_SUITE/include/libtest.shlib + +# +# Description: +# zdb -d will work on imported/exported pool with pool/dataset argument +# +# Strategy: +# 1. Create a pool +# 2. Run zdb -d with pool and dataset arguments. +# 3. Export the pool +# 4. 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_assert "Verify zdb -d works on imported/exported pool with pool/dataset argument" +log_onexit cleanup + +verify_runnable "global" +verify_disk_count "$DISKS" 2 + +default_mirror_setup_noexit $DISKS +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 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 on imported/exported pool with pool/dataset argument" |