Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 18 May 2011 07:37:03 +0000 (UTC)
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r222050 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs
Message-ID:  <201105180737.p4I7b3Up066297@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105180737.p4I7b3Up066297>