diff options
author | Pavel Zakharov <[email protected]> | 2019-09-03 14:29:52 -0400 |
---|---|---|
committer | Tony Hutter <[email protected]> | 2019-09-25 11:27:51 -0700 |
commit | 5acba22ec0bd934894d746ca967d451fdc6d3368 (patch) | |
tree | fd0f0b94bff66adf63fe1a09211b278d4b006278 | |
parent | 38528476bf0b64e7462a1141ff73d016a94f3471 (diff) |
zvol_wait script should ignore partially received zvols
Partially received zvols won't have links in /dev/zvol.
Reviewed-by: Sebastien Roy <[email protected]>
Reviewed-by: Paul Dagnelie <[email protected]>
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Pavel Zakharov <[email protected]>
Closes #9260
-rwxr-xr-x | cmd/zvol_wait/zvol_wait | 23 |
1 files changed, 21 insertions, 2 deletions
diff --git a/cmd/zvol_wait/zvol_wait b/cmd/zvol_wait/zvol_wait index d512be41b..e5df82dd3 100755 --- a/cmd/zvol_wait/zvol_wait +++ b/cmd/zvol_wait/zvol_wait @@ -25,11 +25,30 @@ filter_out_deleted_zvols() { } list_zvols() { - zfs list -t volume -H -o name,volmode | while read -r zvol_line; do + zfs list -t volume -H -o name,volmode,receive_resume_token | + while read -r zvol_line; do name=$(echo "$zvol_line" | awk '{print $1}') volmode=$(echo "$zvol_line" | awk '{print $2}') + token=$(echo "$zvol_line" | awk '{print $3}') + # # /dev links are not created for zvols with volmode = "none". - [ "$volmode" = "none" ] || echo "$name" + # + [ "$volmode" = "none" ] && continue + # + # We also also ignore partially received zvols if it is + # not an incremental receive, as those won't even have a block + # device minor node created yet. + # + if [ "$token" != "-" ]; then + # + # Incremental receives create an invisible clone that + # is not automatically displayed by zfs list. + # + if ! zfs list "$name/%recv" >/dev/null 2>&1; then + continue + fi + fi + echo "$name" done } |