Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

7291 Attempting to destroy ZFS filesystem and create ZFS volume with … #22

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions usr/src/pkg/manifests/system-test-zfstest.mf
Original file line number Diff line number Diff line change
Expand Up @@ -2275,6 +2275,8 @@ file path=opt/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_005_neg \
mode=0555
file path=opt/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_006_pos \
mode=0555
file path=opt/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_007_pos \
mode=0555
file path=opt/zfs-tests/tests/functional/zvol/zvol_swap/cleanup mode=0555
file path=opt/zfs-tests/tests/functional/zvol/zvol_swap/setup mode=0555
file path=opt/zfs-tests/tests/functional/zvol/zvol_swap/zvol_swap.cfg \
Expand Down
3 changes: 2 additions & 1 deletion usr/src/test/zfs-tests/runfiles/delphix.run
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,8 @@ tests = ['zvol_cli_001_pos', 'zvol_cli_002_pos', 'zvol_cli_003_neg']

[/opt/zfs-tests/tests/functional/zvol/zvol_misc]
tests = ['zvol_misc_001_neg', 'zvol_misc_002_pos', 'zvol_misc_003_neg',
'zvol_misc_004_pos', 'zvol_misc_005_neg', 'zvol_misc_006_pos']
'zvol_misc_004_pos', 'zvol_misc_005_neg', 'zvol_misc_006_pos',
'zvol_misc_007_pos']

[/opt/zfs-tests/tests/functional/libzfs]
tests = ['many_fds']
Expand Down
3 changes: 2 additions & 1 deletion usr/src/test/zfs-tests/runfiles/omnios.run
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,8 @@ tests = ['zvol_cli_001_pos', 'zvol_cli_002_pos', 'zvol_cli_003_neg']

[/opt/zfs-tests/tests/functional/zvol/zvol_misc]
tests = ['zvol_misc_001_neg', 'zvol_misc_002_pos', 'zvol_misc_003_neg',
'zvol_misc_004_pos', 'zvol_misc_005_neg', 'zvol_misc_006_pos']
'zvol_misc_004_pos', 'zvol_misc_005_neg', 'zvol_misc_006_pos',
'zvol_misc_007_pos']

[/opt/zfs-tests/tests/functional/zvol/zvol_swap]
tests = ['zvol_swap_001_pos', 'zvol_swap_002_pos', 'zvol_swap_003_pos',
Expand Down
3 changes: 2 additions & 1 deletion usr/src/test/zfs-tests/runfiles/openindiana.run
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,8 @@ tests = ['zvol_cli_001_pos', 'zvol_cli_002_pos', 'zvol_cli_003_neg']

[/opt/zfs-tests/tests/functional/zvol/zvol_misc]
tests = ['zvol_misc_001_neg', 'zvol_misc_002_pos', 'zvol_misc_003_neg',
'zvol_misc_004_pos', 'zvol_misc_005_neg', 'zvol_misc_006_pos']
'zvol_misc_004_pos', 'zvol_misc_005_neg', 'zvol_misc_006_pos',
'zvol_misc_007_pos']

[/opt/zfs-tests/tests/functional/zvol/zvol_swap]
tests = ['zvol_swap_001_pos', 'zvol_swap_002_pos', 'zvol_swap_003_pos',
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#! /usr/bin/ksh -p
#
#
# 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 2016 Nexenta Systems, Inc. All rights reserved.
#

. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/zvol/zvol_common.shlib

#
# DESCRIPTION:
# Verify name collision occurs when an attempt to destroy ZFS filesystem
# and create ZFS volume with the same name cannot cause system panic
#
# STRATEGY:
# 1. Create ZFS filesystems
# 2. Create nested ZFS volume
# 3. Read and displays information about the ZFS volume
# 4. Recursive destroy ZFS filesystems
# 5. Create ZFS volume with the same name as ZFS filesystem
# 6. Read and displays information about the ZFS volume
# 7. Verify the system continued work
#

verify_runnable "global"
log_assert "zfs can handle race volume create operation."
log_onexit cleanup

log_must $ZFS create $TESTPOOL/$TESTFS
log_must $ZFS create -V 1M $TESTPOOL/$TESTFS/$TESTVOL
log_must $STAT /dev/zvol/rdsk/$TESTPOOL/$TESTFS/$TESTVOL
log_must $ZFS destroy -r $TESTPOOL/$TESTFS
log_must $ZFS create -V 1M $TESTPOOL/$TESTFS
log_must $STAT /dev/zvol/rdsk/$TESTPOOL/$TESTFS

log_pass "zfs handle race volume create operation."
4 changes: 4 additions & 0 deletions usr/src/uts/common/fs/dev/sdev_subr.c
Original file line number Diff line number Diff line change
Expand Up @@ -2170,6 +2170,10 @@ devname_lookup_func(struct sdev_node *ddv, char *nm, struct vnode **vpp,
rw_exit(&ddv->sdev_contents);
rw_enter(&ddv->sdev_contents, RW_WRITER);
}

if (SDEVTOV(dv)->v_type == VDIR)
(void) sdev_cleandir(dv, NULL, SDEV_ENFORCE);

sdev_cache_update(ddv, &dv, nm, SDEV_CACHE_DELETE);
rw_downgrade(&ddv->sdev_contents);
SDEV_RELE(dv);
Expand Down