-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relax refreservation constraints on ZVOLs
This change allow refreservation 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>
- Loading branch information
Showing
4 changed files
with
77 additions
and
3 deletions.
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
73 changes: 73 additions & 0 deletions
73
tests/zfs-tests/tests/functional/cli_root/zfs_reservation/zfs_reservation_bigger.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,73 @@ | ||
#!/bin/ksh -p | ||
# | ||
# CDDL HEADER START | ||
# | ||
# The contents of this file are subject to the terms of the | ||
# Common Development and Distribution License (the "License"). | ||
# You may not use this file except in compliance with the License. | ||
# | ||
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE | ||
# or http://www.opensolaris.org/os/licensing. | ||
# See the License for the specific language governing permissions | ||
# and limitations under the License. | ||
# | ||
# When distributing Covered Code, include this CDDL HEADER in each | ||
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. | ||
# If applicable, add the following below this CDDL HEADER, with the | ||
# fields enclosed by brackets "[]" replaced with your own identifying | ||
# information: Portions Copyright [yyyy] [name of copyright owner] | ||
# | ||
# CDDL HEADER END | ||
# | ||
|
||
# | ||
# Copyright 2017, loli10K <ezomori.nozomu@gmail.com>. All rights reserved. | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
|
||
# | ||
# DESCRIPTION: | ||
# | ||
# Verify refreservation can be set bigger than then current ZVOL size | ||
# | ||
# STRATEGY: | ||
# 1. Create a ZVOL with initial refreservation | ||
# 2. Remove the refreservation | ||
# 3. Verify we can set the old refreservation value again on the ZVOL | ||
# | ||
|
||
verify_runnable "both" | ||
|
||
function cleanup | ||
{ | ||
datasetexists $ZVOL && log_must_busy zfs destroy -f $ZVOL | ||
} | ||
|
||
log_onexit cleanup | ||
|
||
log_assert "Verify refreservation can be set bigger than then current ZVOL size" | ||
|
||
ZVOL="$TESTPOOL/$TESTVOL" | ||
volsize="$((1024 * 1024 * 64))" # 64M | ||
|
||
# 1. Create a ZVOL with initial refreservation | ||
log_must zfs create -V $volsize $ZVOL | ||
refreserv=`get_prop refreservation $ZVOL` | ||
if [[ $refreserv -le $volsize ]]; then | ||
log_fail "Unexpected refreservation on $ZVOL ($refreserv <= $volsize)" | ||
fi | ||
|
||
# 2. Remove the refreservation | ||
log_must zfs set refreservation=none $ZVOL | ||
if [[ `get_prop refreservation $ZVOL` != 0 ]]; then | ||
log_fail "Could not correctly remove refreservation on $ZVOL" | ||
fi | ||
|
||
# 3. Verify we can set the same refreservation value again on the ZVOL | ||
log_must zfs set refreservation=$refreserv $ZVOL | ||
if [[ `get_prop refreservation $ZVOL` != $refreserv ]]; then | ||
log_fail "Could not correctly set refreservation to old value on $ZVOL" | ||
fi | ||
|
||
log_pass "Successfully set refreservation on ZVOL" |