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
This commit is contained in:
parent
ee7fc96df8
commit
36f936fb3c
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user