Merge pull request #42203 from AkihiroSuda/btrfs-allow-unprivileged
btrfs: Allow unprivileged user to delete subvolumes (kernel >= 4.18)
This commit is contained in:
commit
1df3d5c1de
1 changed files with 8 additions and 1 deletions
|
@ -633,7 +633,14 @@ func (d *Driver) Remove(id string) error {
|
|||
d.updateQuotaStatus()
|
||||
|
||||
if err := subvolDelete(d.subvolumesDir(), id, d.quotaEnabled); err != nil {
|
||||
return err
|
||||
if d.quotaEnabled {
|
||||
return err
|
||||
}
|
||||
// If quota is not enabled, fallback to rmdir syscall to delete subvolumes.
|
||||
// This would allow unprivileged user to delete their owned subvolumes
|
||||
// in kernel >= 4.18 without user_subvol_rm_allowed mount option.
|
||||
//
|
||||
// From https://github.com/containers/storage/pull/508/commits/831e32b6bdcb530acc4c1cb9059d3c6dba14208c
|
||||
}
|
||||
if err := system.EnsureRemoveAll(dir); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue