summaryrefslogtreecommitdiffstats
path: root/sys/cddl
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2011-05-18 07:37:02 +0000
committermm <mm@FreeBSD.org>2011-05-18 07:37:02 +0000
commit36f936fb3cb5ac5781537dba4813fd62ccfdf458 (patch)
treecc0ae90246fc3bf4b6ac4bf11ad85c05cb66d2ac /sys/cddl
parentee7fc96df853b3fb7fe0e561cd719cb39ac2bf01 (diff)
downloadFreeBSD-src-36f936fb3cb5ac5781537dba4813fd62ccfdf458.zip
FreeBSD-src-36f936fb3cb5ac5781537dba4813fd62ccfdf458.tar.gz
Restore old (v15) behaviour for a recursive snapshot destroy.
(zfs destroy -r pool/dataset@snapshot) To destroy all descendent snapshots with the same name the top level snapshot was not required to exist. So if the top level snapshot does not exist, check permissions of the parent dataset instead. Filed as Illumos Bug #1043 Reviewed by: delphij Approved by: pjd MFC after: together with v28
Diffstat (limited to 'sys/cddl')
-rw-r--r--sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
index f8912ca..ba13747 100644
--- a/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
+++ b/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
@@ -689,6 +689,9 @@ zfs_secpolicy_destroy(zfs_cmd_t *zc, cred_t *cr)
* and destroying snapshots requires descendent permissions, a successfull
* check of the top level snapshot applies to snapshots of all descendent
* datasets as well.
+ *
+ * The top level snapshot may not exist when doing a recursive destroy.
+ * In this case fallback to permissions of the parent dataset.
*/
static int
zfs_secpolicy_destroy_snaps(zfs_cmd_t *zc, cred_t *cr)
@@ -700,6 +703,9 @@ zfs_secpolicy_destroy_snaps(zfs_cmd_t *zc, cred_t *cr)
error = zfs_secpolicy_destroy_perms(dsname, cr);
+ if (error == ENOENT)
+ error = zfs_secpolicy_destroy_perms(zc->zc_name, cr);
+
strfree(dsname);
return (error);
}
OpenPOWER on IntegriCloud