diff --git a/0018-btrfs-progs-subvolume-fix-a-bug-that-leads-to-unnece.patch b/0018-btrfs-progs-subvolume-fix-a-bug-that-leads-to-unnece.patch new file mode 100644 index 0000000000000000000000000000000000000000..64295336f2616cca1ecb6a6665309fd1e164afae --- /dev/null +++ b/0018-btrfs-progs-subvolume-fix-a-bug-that-leads-to-unnece.patch @@ -0,0 +1,55 @@ +From 47caea649f52ed0aef53fd8fcb0f8f294ba6c1f4 Mon Sep 17 00:00:00 2001 +From: Qu Wenruo +Date: Fri, 1 Aug 2025 08:40:39 +0930 +Subject: [PATCH] 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 0e66228959c4 ("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 +Signed-off-by: Qu Wenruo +--- + cmds/subvolume.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/cmds/subvolume.c b/cmds/subvolume.c +index b01d5c8..1866e69 100644 +--- a/cmds/subvolume.c ++++ b/cmds/subvolume.c +@@ -508,7 +508,7 @@ again: + default_subvol_id = 0; + err = btrfs_util_get_default_subvolume_fd(fd, &default_subvol_id); + if (err == BTRFS_UTIL_ERROR_SEARCH_FAILED) { +- if (geteuid() != 0) ++ if (geteuid() == 0) + warning("cannot read default subvolume id: %m"); + } + +-- +2.43.0 + diff --git a/btrfs-progs.spec b/btrfs-progs.spec index 04bb2a86837a8e9de481b5294ff8db09d076c230..89afec4ada9f6f4da2d666fdddfbbb2779ea5db2 100644 --- a/btrfs-progs.spec +++ b/btrfs-progs.spec @@ -1,6 +1,6 @@ Name: btrfs-progs Version: 6.6.3 -Release: 18 +Release: 19 Summary: btrfs userspace programs License: GPLv2 and GPL+ and LGPL-2.1+ and GPL-3.0+ and LGPL-2.1 and MIT URL: https://btrfs.wiki.kernel.org/index.php/Main_Page @@ -23,6 +23,7 @@ Patch0014: 0014-btrfs-progs-image-fix-the-bug-that-filename-sanitiza.patch Patch0015: 0015-btrfs-progs-convert-fix-the-filename-output-when-rol.patch Patch0016: 0016-btrfs-progs-fix-the-wrong-size-from-device_get_parti.patch Patch0017: 0017-btrfs-progs-fix-the-incorrect-buffer-size-for-super-.patch +Patch0018: 0018-btrfs-progs-subvolume-fix-a-bug-that-leads-to-unnece.patch BuildRequires: python3-devel >= 3.4 BuildRequires: libacl-devel, e2fsprogs-devel, libblkid-devel, libuuid-devel, zlib-devel, libzstd-devel, lzo-devel, systemd-devel @@ -88,6 +89,10 @@ make mandir=%{_mandir} bindir=%{_sbindir} libdir=%{_libdir} incdir=%{_includedir %{_mandir}/man8/*.gz %changelog +* Fri Nov 7 2025 liuh - 6.6.3-19 +- sync patch from community + btrfs-progs: subvolume: fix a bug that leads to unnecessary error message + * Fri Oct 17 2025 liuh - 6.6.3-18 - sync patch from community btrfs-progs: fix the incorrect buffer size for super block structure