zvol_wait: properly handle zvol_volmode sysctl being 3/none

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Pavel Zakharov <pavel.zakharov@delphix.com>
Reviewed-by: Ryan Moeller <ryan@iXsystems.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #11859
This commit is contained in:
наб 2021-04-09 18:12:07 +02:00 committed by Brian Behlendorf
parent 4640baab69
commit d08dc34515
1 changed files with 6 additions and 6 deletions

View File

@ -25,25 +25,25 @@ filter_out_deleted_zvols() {
} }
list_zvols() { list_zvols() {
read -r default_volmode < /sys/module/zfs/parameters/zvol_volmode
zfs list -t volume -H -o \ zfs list -t volume -H -o \
name,volmode,receive_resume_token,redact_snaps | name,volmode,receive_resume_token,redact_snaps |
while IFS=" " read -r name volmode token redacted; do # IFS=\t here! while IFS=" " read -r name volmode token redacted; do # IFS=\t here!
#
# /dev links are not created for zvols with volmode = "none" # /dev links are not created for zvols with volmode = "none"
# or for redacted zvols. # or for redacted zvols.
#
[ "$volmode" = "none" ] && continue [ "$volmode" = "none" ] && continue
[ "$volmode" = "default" ] && [ "$default_volmode" = "3" ] &&
continue
[ "$redacted" = "-" ] || continue [ "$redacted" = "-" ] || continue
#
# We also ignore partially received zvols if it is # We also ignore partially received zvols if it is
# not an incremental receive, as those won't even have a block # not an incremental receive, as those won't even have a block
# device minor node created yet. # device minor node created yet.
#
if [ "$token" != "-" ]; then if [ "$token" != "-" ]; then
#
# Incremental receives create an invisible clone that # Incremental receives create an invisible clone that
# is not automatically displayed by zfs list. # is not automatically displayed by zfs list.
#
if ! zfs list "$name/%recv" >/dev/null 2>&1; then if ! zfs list "$name/%recv" >/dev/null 2>&1; then
continue continue
fi fi