Re: Curious problem: btrfs device stats & unpriviliged access

2018-10-08 Thread Hans van Kranenburg
On 10/08/2018 06:37 PM, Holger Hoffstätte wrote: > On 10/08/18 17:46, Hans van Kranenburg wrote: > >> fs.devices() also looks for dev_items in the chunk tree: >> >> https://github.com/knorrie/python-btrfs/blob/master/btrfs/ctree.py#L481 >> >> So, BOOM! you need root. >> >> Or just start a 0,

Re: Curious problem: btrfs device stats & unpriviliged access

2018-10-08 Thread Holger Hoffstätte
On 10/08/18 17:46, Hans van Kranenburg wrote: fs.devices() also looks for dev_items in the chunk tree: https://github.com/knorrie/python-btrfs/blob/master/btrfs/ctree.py#L481 So, BOOM! you need root. Or just start a 0, ignore errors and start trying all devids until you found num_devices

Re: Curious problem: btrfs device stats & unpriviliged access

2018-10-08 Thread Hans van Kranenburg
On 10/08/2018 05:29 PM, Holger Hoffstätte wrote: > On 10/08/18 16:40, Hans van Kranenburg wrote: >>> Looking at the kernel side of things in fs/btrfs/ioctl.c I see both >>> BTRFS_IOC_TREE_SEARCH[_V2} unconditionally require CAP_SYS_ADMIN. >> >> That's the tree search ioctl, for reading arbitrary

Re: Curious problem: btrfs device stats & unpriviliged access

2018-10-08 Thread Holger Hoffstätte
On 10/08/18 16:40, Hans van Kranenburg wrote: Looking at the kernel side of things in fs/btrfs/ioctl.c I see both BTRFS_IOC_TREE_SEARCH[_V2} unconditionally require CAP_SYS_ADMIN. That's the tree search ioctl, for reading arbitrary metadata. The device stats ioctl is IOC_GET_DEV_STATS...

Re: Curious problem: btrfs device stats & unpriviliged access

2018-10-08 Thread Hans van Kranenburg
On 10/08/2018 04:40 PM, Hans van Kranenburg wrote: > On 10/08/2018 04:27 PM, Holger Hoffstätte wrote: >> (moving the discussion here from GH [1]) >> >> Apparently there is something weird going on with the device stats >> ioctls. I cannot get them to work as regular user, while they work >> for

Re: Curious problem: btrfs device stats & unpriviliged access

2018-10-08 Thread Hans van Kranenburg
On 10/08/2018 04:27 PM, Holger Hoffstätte wrote: > (moving the discussion here from GH [1]) > > Apparently there is something weird going on with the device stats > ioctls. I cannot get them to work as regular user, while they work > for David. A friend confirms the same issue on his system - no

Curious problem: btrfs device stats & unpriviliged access

2018-10-08 Thread Holger Hoffstätte
(moving the discussion here from GH [1]) Apparently there is something weird going on with the device stats ioctls. I cannot get them to work as regular user, while they work for David. A friend confirms the same issue on his system - no access as non-root. So I made a new empty fs, mounted it,