Linux Btrfs filesystem development
 help / color / mirror / Atom feed
* cannot read default subvolume id?
@ 2025-07-27 17:46 Ulli Horlacher
  2025-07-27 22:36 ` Qu Wenruo
  0 siblings, 1 reply; 4+ messages in thread
From: Ulli Horlacher @ 2025-07-27 17:46 UTC (permalink / raw)
  To: linux-btrfs


Why is there a "cannot read default subvolume id"?

tux@quak:~: btrfs sub create xx
Create subvolume './xx'

tux@quak:~: btrfs sub del xx
WARNING: cannot read default subvolume id: Operation not permitted
Delete subvolume 292 (no-commit): '/home/tux/xx'

tux@quak:~: df -H .
Filesystem                   Size  Used Avail Use% Mounted on
/dev/mapper/nvme0n1p5_crypt  2,0T   64G  1,9T   4% /home

tux@quak:~: mount | grep /home
/dev/mapper/nvme0n1p5_crypt on /home type btrfs (rw,relatime,ssd,discard=async,space_cache=v2,user_subvol_rm_allowed,subvolid=257,subvol=/@home)

tux@quak:~: btrfs version
btrfs-progs v6.6.3

tux@quak:~: uname -a
Linux quak 6.14.0-24-generic #24~24.04.3-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul  7 16:39:17 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK
Universitaet Stuttgart         E-Mail: horlacher@tik.uni-stuttgart.de
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    https://www.tik.uni-stuttgart.de/
REF:<20250727174618.GD842273@tik.uni-stuttgart.de>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cannot read default subvolume id?
  2025-07-27 17:46 cannot read default subvolume id? Ulli Horlacher
@ 2025-07-27 22:36 ` Qu Wenruo
  2025-07-28 10:08   ` Ulli Horlacher
  0 siblings, 1 reply; 4+ messages in thread
From: Qu Wenruo @ 2025-07-27 22:36 UTC (permalink / raw)
  To: Ulli Horlacher, linux-btrfs



在 2025/7/28 03:16, Ulli Horlacher 写道:
> 
> Why is there a "cannot read default subvolume id"?
> 
> tux@quak:~: btrfs sub create xx
> Create subvolume './xx'
> 
> tux@quak:~: btrfs sub del xx
> WARNING: cannot read default subvolume id: Operation not permitted

It's a warning, not an error. And you can see on the next line, the 
deletion happened without any problem.

You're running as a non-root user, meanwhile default subvolume id search 
is done using tree search ioctl, which require root privilege.

Thanks,
Qu

> Delete subvolume 292 (no-commit): '/home/tux/xx'
> 
> tux@quak:~: df -H .
> Filesystem                   Size  Used Avail Use% Mounted on
> /dev/mapper/nvme0n1p5_crypt  2,0T   64G  1,9T   4% /home
> 
> tux@quak:~: mount | grep /home
> /dev/mapper/nvme0n1p5_crypt on /home type btrfs (rw,relatime,ssd,discard=async,space_cache=v2,user_subvol_rm_allowed,subvolid=257,subvol=/@home)
> 
> tux@quak:~: btrfs version
> btrfs-progs v6.6.3
> 
> tux@quak:~: uname -a
> Linux quak 6.14.0-24-generic #24~24.04.3-Ubuntu SMP PREEMPT_DYNAMIC Mon Jul  7 16:39:17 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
> 


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cannot read default subvolume id?
  2025-07-27 22:36 ` Qu Wenruo
@ 2025-07-28 10:08   ` Ulli Horlacher
  2025-07-28 10:44     ` Qu Wenruo
  0 siblings, 1 reply; 4+ messages in thread
From: Ulli Horlacher @ 2025-07-28 10:08 UTC (permalink / raw)
  To: linux-btrfs

On Mon 2025-07-28 (08:06), Qu Wenruo wrote:
> 
> 
> 圚 2025/7/28 03:16, Ulli Horlacher 写é":
> 
> >
> > Why is there a "cannot read default subvolume id"?
> >
> > tux@quak:~: btrfs sub create xx
> > Create subvolume './xx'
> >
> > tux@quak:~: btrfs sub del xx
> > WARNING: cannot read default subvolume id: Operation not permitted
> 
> It's a warning, not an error. And you can see on the next line, the
> deletion happened without any problem.

But this warning confuses a user: 
Is there a problem?
What is going wrong?
Have I made a mistake?


> You're running as a non-root user, meanwhile default subvolume id search
> is done using tree search ioctl, which require root privilege.

Why is this subvolume id search necessary for subvolume deletion and why 
is it just a warning and apparently no problem at all?
If it does not have any consequences, it should not be displayed.

-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK
Universitaet Stuttgart         E-Mail: horlacher@tik.uni-stuttgart.de
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    https://www.tik.uni-stuttgart.de/
REF:<d738f9b1-2717-4524-b5de-3c5636351b44@suse.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: cannot read default subvolume id?
  2025-07-28 10:08   ` Ulli Horlacher
@ 2025-07-28 10:44     ` Qu Wenruo
  0 siblings, 0 replies; 4+ messages in thread
From: Qu Wenruo @ 2025-07-28 10:44 UTC (permalink / raw)
  To: linux-btrfs



在 2025/7/28 19:38, Ulli Horlacher 写道:
> On Mon 2025-07-28 (08:06), Qu Wenruo wrote:
>>
>>
>> 圚 2025/7/28 03:16, Ulli Horlacher 写é":
>>
>>>
>>> Why is there a "cannot read default subvolume id"?
>>>
>>> tux@quak:~: btrfs sub create xx
>>> Create subvolume './xx'
>>>
>>> tux@quak:~: btrfs sub del xx
>>> WARNING: cannot read default subvolume id: Operation not permitted
>>
>> It's a warning, not an error. And you can see on the next line, the
>> deletion happened without any problem.
> 
> But this warning confuses a user:
> Is there a problem?
> What is going wrong?
> Have I made a mistake?

Yes, that's indeed confusing, and it should be hidden by commit 
0e66228959c4 ("btrfs-progs: subvol delete: hide a warning on an 
unprivileged delete"), which is included in v5.16.

Unfortunately that fix has a bug that the uid check is completely 
opposite...
> 
>> You're running as a non-root user, meanwhile default subvolume id search
>> is done using tree search ioctl, which require root privilege.
> 
> Why is this subvolume id search necessary for subvolume deletion and why
> is it just a warning and apparently no problem at all?
> If it does not have any consequences, it should not be displayed.
> 

It is an extra check to output a more meaningful error message if the 
end user is trying to delete the default subvolume.

Thus we need to search if the current subvolume is a default one.

Thanks,
Qu

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-07-28 10:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-07-27 17:46 cannot read default subvolume id? Ulli Horlacher
2025-07-27 22:36 ` Qu Wenruo
2025-07-28 10:08   ` Ulli Horlacher
2025-07-28 10:44     ` Qu Wenruo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox