Skip to content

Commit 0956fd7

Browse files
Artem-OSSRevivaltonyhutter
authored andcommitted
Add more descriptive destroy error message
Reviewed-by: Tony Hutter <[email protected]> Reviewed-by: Alexander Motin <[email protected]> Reviewed-by: Tino Reichardt <[email protected]> Reviewed by: Attila Fülöp <[email protected]> Signed-off-by: Artem-OSSRevival <[email protected]> Fixes: #14538 Closes: #17234 (cherry picked from commit 37a3e26)
1 parent 7bb7ff7 commit 0956fd7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

lib/libzfs/libzfs_dataset.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4022,6 +4022,26 @@ zfs_destroy_snaps_nvl(libzfs_handle_t *hdl, nvlist_t *snaps, boolean_t defer)
40224022
dgettext(TEXT_DOMAIN, "snapshot is cloned"));
40234023
ret = zfs_error(hdl, EZFS_EXISTS, errbuf);
40244024
break;
4025+
case EBUSY: {
4026+
nvlist_t *existing_holds;
4027+
int err = lzc_get_holds(nvpair_name(pair),
4028+
&existing_holds);
4029+
4030+
/* check the presence of holders */
4031+
if (err == 0 && !nvlist_empty(existing_holds)) {
4032+
zfs_error_aux(hdl,
4033+
dgettext(TEXT_DOMAIN, "it's being held. "
4034+
"Run 'zfs holds -r %s' to see holders."),
4035+
nvpair_name(pair));
4036+
ret = zfs_error(hdl, EBUSY, errbuf);
4037+
} else {
4038+
ret = zfs_standard_error(hdl, errno, errbuf);
4039+
}
4040+
4041+
if (err == 0)
4042+
nvlist_free(existing_holds);
4043+
break;
4044+
}
40254045
default:
40264046
ret = zfs_standard_error(hdl, errno, errbuf);
40274047
break;

0 commit comments

Comments
 (0)