-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Tighten up 'zpool remove' space check #11409
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
Closed
Closed
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 hidden or 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 hidden or 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 hidden or 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
56 changes: 56 additions & 0 deletions
56
tests/zfs-tests/tests/functional/removal/remove_minimum.ksh
This file contains hidden or 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,56 @@ | ||
#!/bin/ksh -p | ||
# | ||
# CDDL HEADER START | ||
# | ||
# 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. | ||
# | ||
# CDDL HEADER END | ||
# | ||
|
||
# | ||
# Copyright (c) 2020 by Lawrence Livermore National Security, LLC. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
. $STF_SUITE/tests/functional/removal/removal.kshlib | ||
|
||
# | ||
# DESCRIPTION: | ||
# Device removal is possible for minimum sized vdevs. | ||
# | ||
# STRATEGY: | ||
# 1. Create a pool with minimum sized removable devices | ||
# 2. Remove a top-level device | ||
# | ||
|
||
verify_runnable "global" | ||
|
||
function cleanup | ||
{ | ||
default_cleanup_noexit | ||
log_must rm -f $TEST_BASE_DIR/device-{1,2} | ||
} | ||
|
||
log_assert "Device removal is possible for minimum sized vdevs." | ||
log_onexit cleanup | ||
|
||
# 1. Create a pool with minimum sized removable devices | ||
log_must truncate -s $MINVDEVSIZE $TEST_BASE_DIR/device-{1,2} | ||
log_must default_setup_noexit "$TEST_BASE_DIR/device-1 $TEST_BASE_DIR/device-2" | ||
|
||
log_must dd if=/dev/urandom of=$TESTDIR/$TESTFILE0 bs=1M count=64 | ||
|
||
# 2. Remove a top-level device | ||
log_must zpool remove $TESTPOOL $TEST_BASE_DIR/device-1 | ||
log_must wait_for_removal $TESTPOOL | ||
|
||
log_note "Capacity $(get_pool_prop capacity $TESTPOOL)" | ||
|
||
log_pass "Device removal is possible for minimum sized vdevs" |
57 changes: 57 additions & 0 deletions
57
tests/zfs-tests/tests/functional/removal/remove_unbalanced.ksh
This file contains hidden or 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,57 @@ | ||
#!/bin/ksh -p | ||
# | ||
# CDDL HEADER START | ||
# | ||
# 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. | ||
# | ||
# CDDL HEADER END | ||
# | ||
|
||
# | ||
# Copyright (c) 2020 by Lawrence Livermore National Security, LLC. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
. $STF_SUITE/tests/functional/removal/removal.kshlib | ||
|
||
# | ||
# DESCRIPTION: | ||
# Device removal is possible for highly unbalanced vdevs. | ||
# | ||
# STRATEGY: | ||
# 1. Create a pool with unbalanced removable devices | ||
# 2. Remove the large top-level device | ||
# | ||
|
||
verify_runnable "global" | ||
|
||
function cleanup | ||
{ | ||
default_cleanup_noexit | ||
log_must rm -f $TEST_BASE_DIR/device-{1,2} | ||
} | ||
|
||
log_assert "Device removal is possible for highly unbalanced vdevs." | ||
log_onexit cleanup | ||
|
||
# 1. Create a pool with unbalanced removable devices | ||
log_must truncate -s 10G $TEST_BASE_DIR/device-1 | ||
log_must truncate -s 1T $TEST_BASE_DIR/device-2 | ||
log_must default_setup_noexit "$TEST_BASE_DIR/device-1 $TEST_BASE_DIR/device-2" | ||
|
||
log_must dd if=/dev/urandom of=$TESTDIR/$TESTFILE0 bs=1M count=32 | ||
|
||
# 2. Remove the large top-level device | ||
log_must zpool remove $TESTPOOL $TEST_BASE_DIR/device-1 | ||
log_must wait_for_removal $TESTPOOL | ||
|
||
log_note "Capacity $(get_pool_prop capacity $TESTPOOL)" | ||
|
||
log_pass "Device removal is possible for highly unbalanced vdevs" |
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.
Uh oh!
There was an error while loading. Please reload this page.
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.
I don't think this fixes the problem that removing a disproportionately-huge device can get ENOSPC when we want it to succeed. e.g. imagine a pool with a 1TB device and a 100TB device, with 0.5TB used. If we try to remove the 100TB device, the check would be 100.5 - 100 < 101*0.016, or 0.5 < 1.6, which is true. I think want to require that after removal, there is 1.6% space AVAIL.
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.
While you're right, @ahrens, and I'm on an old 2.0.4 version and currently unwilling to upgrade, if nothing has changed in this regards since 2.0.4 then a major tighten up would be massively beneficial, and/or a way to override this with -f when the user does indeed know better. I will tag you both where I record my story from the last 2 days.
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.
#13552 (comment)