Author: mm
Date: Wed May 18 07:37:02 2011
New Revision: 222050
URL: http://svn.freebsd.org/changeset/base/222050

Log:
  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

Modified:
  head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c

Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c
==============================================================================
--- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c     Wed May 
18 07:20:30 2011        (r222049)
+++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c     Wed May 
18 07:37:02 2011        (r222050)
@@ -689,6 +689,9 @@ zfs_secpolicy_destroy(zfs_cmd_t *zc, cre
  * 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 *z
 
        error = zfs_secpolicy_destroy_perms(dsname, cr);
 
+       if (error == ENOENT)
+               error = zfs_secpolicy_destroy_perms(zc->zc_name, cr);
+
        strfree(dsname);
        return (error);
 }
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to