Commit 632be6f
btrfs-progs: subvolume: fix a bug that leads to unnecessary error message
[BUG]
When a btrfs is mounted with "user_subvol_rm_allowed" mount option,
unprivileged users are allowed to delete a subvolume using "btrfs
subvolume delete" command.
But in that case, there is always a warning message:
$ btrfs subvolume delete /mnt/btrfs/dir1/subv1/
WARNING: cannot read default subvolume id: Operation not permitted
Delete subvolume 257 (no-commit): '/mnt/btrfs/dir1/subv1'
[CAUSE]
The warning message is caused by tree search ioctl, which is to
determine if we're deleting the default subvolume.
This search is just to give a more helpful error message, and even
without it deleting the default subvolume will fail anyway.
Thus commit 0e66228 ("btrfs-progs: subvol delete: hide a warning on
an unprivileged delete") tries to hide the warning for unprivileged
users.
But unfortunately the function geteuid() returns the effective user id,
thus we should hide the warning for non-zero uid, not the opposite.
[FIX]
Change the condition to output the warning only when the uid is 0.
Reviewed-by: Boris Burkov <boris@bur.io>
Signed-off-by: Qu Wenruo <wqu@suse.com>1 parent 85ec48d commit 632be6f
1 file changed
+1
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
501 | | - | |
| 501 | + | |
502 | 502 | | |
503 | 503 | | |
504 | 504 | | |
| |||
0 commit comments