-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
zvol: allow rename of in use ZVOL dataset #8371
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,6 @@ verify_runnable "global" | |
|
||
default_zvol_cleanup | ||
|
||
[[ -d $TESTDIR ]] && rm -rf $TESTDIR | ||
|
||
log_pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,4 +36,6 @@ verify_runnable "global" | |
|
||
default_zvol_setup $DISK $VOLSIZE | ||
|
||
log_must mkdir $TESTDIR | ||
|
||
log_pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
tests/zfs-tests/tests/functional/zvol/zvol_misc/zvol_misc_rename_inuse.ksh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/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 2019, loli10K <[email protected]>. All rights reserved. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
. $STF_SUITE/tests/functional/zvol/zvol_common.shlib | ||
. $STF_SUITE/tests/functional/zvol/zvol_misc/zvol_misc_common.kshlib | ||
|
||
# | ||
# DESCRIPTION: | ||
# Verify 'zfs rename' works on a ZVOL already in use as block device | ||
# | ||
# STRATEGY: | ||
# 1. Create a ZVOL | ||
# 2. Create a filesystem on the ZVOL device and mount it | ||
# 3. Rename the ZVOL dataset | ||
# 4. Receive a send stream with the same name as the old ZVOL dataset and verify | ||
# we don't trigger any issue like the one reported in #6263 | ||
# | ||
|
||
verify_runnable "global" | ||
|
||
function cleanup | ||
{ | ||
log_must umount "$MNTPFS" | ||
log_must rmdir "$MNTPFS" | ||
for ds in "$SENDFS" "$ZVOL" "$ZVOL-renamed"; do | ||
destroy_dataset "$ds" '-rf' | ||
done | ||
udev_wait | ||
} | ||
|
||
log_assert "Verify 'zfs rename' works on a ZVOL already in use as block device" | ||
log_onexit cleanup | ||
|
||
ZVOL="$TESTPOOL/vol.$$" | ||
ZDEV="$ZVOL_DEVDIR/$ZVOL" | ||
MNTPFS="$TESTDIR/zvol_inuse_rename" | ||
SENDFS="$TESTPOOL/sendfs.$$" | ||
|
||
# 1. Create a ZVOL | ||
log_must zfs create -V $VOLSIZE "$ZVOL" | ||
|
||
# 2. Create a filesystem on the ZVOL device and mount it | ||
udev_wait | ||
log_must eval "echo y | newfs $ZDEV >/dev/null 2>&1" | ||
log_must mkdir "$MNTPFS" | ||
log_must mount "$ZDEV" "$MNTPFS" | ||
|
||
# 3. Rename the ZVOL dataset | ||
log_must zfs rename "$ZVOL" "$ZVOL-renamed" | ||
|
||
# 4. Receive a send stream with the same name as the old ZVOL dataset and verify | ||
# we don't trigger any issue like the one reported in #6263 | ||
log_must zfs create "$SENDFS" | ||
log_must zfs snap "$SENDFS@snap" | ||
log_must eval "zfs send $SENDFS@snap | zfs recv $ZVOL" | ||
|
||
log_pass "Renaming in use ZVOL works successfully" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to the comment in #4344 (comment) this logic was added to make sure the
zv_name
wasn't updated while being accessed byzvol_ioctl()
. This was a concern because it was accessed outside thezv_state_lock
. Since this is no longer the case, this should be fine. This does mean the udev symlink name may change out from underneath us, which is arguably what we want to happen.