From 0e66228959c4ca37fee6da67f365cc242faef396 Mon Sep 17 00:00:00 2001 From: Adam Borowski Date: Mon, 24 Jan 2022 14:36:32 +0100 Subject: [PATCH] btrfs-progs: subvol delete: hide a warning on an unprivileged delete Checking the default subvolume uses TREE_SEARCH which is a CAP_SYS_ADMIN only operation, and thus will fail when unprivileged, even if we have permissions to actually delete the subvolume. This produces a warning even if all is ok. Let's hide it if we're not root (root but !CAP is odd enough to warn). Fixes 87804a3f0663 ("btrfs-progs: subvolume: check deleting default subvolume") Link: https://bugs.debian.org/998840 Signed-off-by: Adam Borowski Signed-off-by: David Sterba --- cmds/subvolume.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cmds/subvolume.c b/cmds/subvolume.c index 6aac7dd1..26c659da 100644 --- a/cmds/subvolume.c +++ b/cmds/subvolume.c @@ -376,7 +376,8 @@ again: err = btrfs_util_get_default_subvolume_fd(fd, &default_subvol_id); if (err) { - warning("cannot read default subvolume id: %m"); + if (geteuid() != 0) + warning("cannot read default subvolume id: %m"); default_subvol_id = 0; }