-
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
Relax (ref)reservation constraints on ZVOLs #6610
Conversation
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.
KISS
lib/libzfs/libzfs_dataset.c
Outdated
@@ -1459,7 +1459,6 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl, | |||
|
|||
switch (prop) { | |||
case ZFS_PROP_RESERVATION: |
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.
This whole case should go, reservations make even less sense than refreservations here.
tests/runfiles/linux.run
Outdated
@@ -151,7 +151,8 @@ tests = ['zfs_rename_001_pos', 'zfs_rename_002_pos', 'zfs_rename_003_pos', | |||
'zfs_rename_to_encrypted'] | |||
|
|||
[tests/functional/cli_root/zfs_reservation] | |||
tests = ['zfs_reservation_001_pos', 'zfs_reservation_002_pos'] | |||
tests = ['zfs_reservation_001_pos', 'zfs_reservation_002_pos', |
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.
No need to add a new test file.
In refreserv_005_pos.ksh remove the tests for "# Verify it is affected by volsize" and if you want to add a bigger than test, do it there.
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.
Is refreserv_005_pos.ksh
even working properly? I don't understand why it tries to zfs set refreservation=- testpool/testfs/vol
, does "-" have a different meaning on Illumos? On ZoL it will always fail with the following error: cannot set property for 'testpool/testfs/vol': bad numeric value '-'
source:
log_must zfs create -V 10M $vol
# Verify the parent filesystem does not affect volume
log_must zfs set quota=25M $fs
log_must zfs set refreservation=10M $vol
avail=$(get_prop mountpoint $vol)
log_mustnot zfs set refreservation=$avail $vol
log:
ASSERTION: Volume (ref)reservation is not limited by volsize
SUCCESS: zfs create -V 10M testpool/testfs/vol
SUCCESS: zfs set quota=25M testpool/testfs
SUCCESS: zfs set refreservation=10M testpool/testfs/vol
SUCCESS: zfs set refreservation=- testpool/testfs/vol exited 1
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.
great question! '-' is the response for "not set" and mountpoint is not appropriate for size or volumes. Methinks this should be more like:
avail=$(get_prop available $vol)
thus avail is the total space available in the pool, which we'll presume is always > the quota on the file system. In reality we just need to test if the refreservation is > the quota, which we set previously. A lazy way would be:
log_must zfs set quota=25M $fs
log_must zfs set refreservation=26M $vol
but this test is kinda silly, too and knowing the code, this test should only fail if we don't have the available space (which quota doesn't need to know)
methinks a simple test to set refreservation less than and greater than the initial estimate thusly:
initial=$(zfs get -p -H -o value refreservation $vol)
log_must zfs set refreservation=$((initial + 1)) $vol
log_must zfs set refreservation=$((initial - 1)) $vol
NB, get_prop returns the pretty value, not easy to do math against
8ff5933
to
502fed8
Compare
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.
Looks good. I was going to suggest updating the zfs.8
man page, but after reading the relevant sections I see that they make no mention of this specific case. Which is fine.
@richardelling could you please review and updated patch again and go ahead approve it if you're happy with it.
@@ -44,7 +44,7 @@ verify_runnable "both" | |||
|
|||
function cleanup | |||
{ | |||
log_must zpool export $TESTPOOL | |||
log_must_busy zpool export $TESTPOOL |
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.
Did you mean to include this in the PR? It looks like a fix for the occasional zfs_mount_remount
failures we see under Fedora 26 (which I'm all for fixing).
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.
Yes: i've seen it failing quite a lot on f26 and that seems to fix it. I tried to sneak it in even if it has nothing to do with the main issue.
Since now we have other recent issues reported on the ZTS (#6627) i'm ok with dropping this here and push it in a "ZTS-only fixes" PR.
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.
Got it. Yeah, let's drop it from this PR and make the fix in the context of #6627.
This change allow (ref)reservation to be set larger than the current ZVOL size: this is safe as we normally set refreservation > volsize at ZVOL creation time when we account for metadata. Signed-off-by: loli10K <ezomori.nozomu@gmail.com>
Looks good, thanks! |
This change allow (ref)reservation to be set larger than the current ZVOL size: this is safe as we normally set refreservation > volsize at ZVOL creation time when we account for metadata. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: George Melikov <mail@gmelikov.ru> Reviewed by: Richard Elling <Richard.Elling@RichardElling.com> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Signed-off-by: loli10K <ezomori.nozomu@gmail.com> Closes openzfs#2468 Closes openzfs#6610
Description
This change allow refreservation to be set larger than the current ZVOL size: this should be safe as we normally set refreservation > volsize at ZVOL creation time when we account for metadata.
Motivation and Context
Fix #2468
How Has This Been Tested?
Types of changes
Checklist:
Signed-off-by
.