RFE, Remove warning when deleting subvolume as a regular user with `user_subvol_rm_allowed`
Hi,
When deleting a subvol as a regular user with user_subvol_rm_allowed (See https://github.com/kdave/btrfs-progs/issues/252), a confusing WARNING is printed, even though the subvolume is properly deleted.
$ btrfs subvolume create bob
$ btrfs subvolume delete bob
WARNING: cannot read default subvolume id: Operation not permitted
Delete subvolume 332 (no-commit): '/home/user/Projets/Sandbox/bob'
Is is really necessary to print this warning ?
Have a good day
The default subvolume cannot be deleted and both userspace and kernel do the check. It's there to distinguish the "what you want to delete is possible but forbidden because it's default subvolume" and "you cannot delete the subvolume due to permissions". Even with user_subvol_rm_allowed you may not be able to delete the subvolume and it's not outright clear why. So if the warning explains that, I think it could stay. What do you think about that?
I think we should improve the message, so that if the deletion is an unprivileged one, we should not output that error message, or improve it to something like "unable to determine the default subvolume, skipping".
As if later it turns out to be the default one, kernel will reject it anyway.
The default subvolume cannot be deleted and both userspace and kernel do the check. It's there to distinguish the "what you want to delete is possible but forbidden because it's default subvolume" and "you cannot delete the subvolume due to permissions". Even with user_subvol_rm_allowed you may not be able to delete the subvolume and it's not outright clear why. So if the warning explains that, I think it could stay. What do you think about that?
Hmm, I'm confused, I'm not trying to delete the default subvolume at all.
Just create a random subvolume as a regular user, then try to delete it. With user_subvol_rm_allowed set, the subvolume is properly deleted, but a confusing warning is printed.
As a side note, shouldn't $ btrfs subvolume list /home/user work as a normal user? At least with user_subvol_rm_allowed set?
Does it make sense that a user can delete subvolumes, but not list them?
$ btrfs subvolume list /home/user
ERROR: can't perform the search: Operation not permitted
Fixed in 6.16 with https://github.com/kdave/btrfs-progs/commit/47caea649f52ed0aef53fd8fcb0f8f294ba6c1f4