Add new unprivileged ioctl BTRFS_IOC_GET_SUBVOL_INFO which returns
the information of subvolume containing this inode.
(i.e. returns the information in ROOT_ITEM and ROOT_BACKREF.)
Reviewed-by: Gu Jinxiang
Tested-by: Gu Jinxiang
Signed-off-by: Tomohiro Misono
---
v5 -> v6
-
refs than BTRFS_MAX_ROOTREF_BUFFER_NUM, -EOVERFLOW
is returned. Therefore the caller can just call this ioctl again without
changing the argument to continue search.
Reviewed-by: Qu Wenruo
Reviewed-by: Gu Jinxiang
Tested-by: Gu Jinxiang
Signed-off-by: Tomohiro Misono
---
v4 -> v5
- Update erro
ottom subvolume is also searched and filled.
Note that the maximum length of path is shorter 256 (BTRFS_VOL_NAME_MAX+1)
bytes than ino_lookup ioctl because of space of subvolume's name.
Reviewed-by: Gu Jinxiang
Reviewed-by: Qu Wenruo
Tested-by: Gu Jinxiang
Signed-off-by: Tomohiro Misono
-
tation of btrfs-progs can be found in the ML titled as follows:
[PATCH 0/11] btrfs-progs: Rework of "subvolume list/show" and relax the root
privileges of them
Tomohiro Misono (3):
btrfs: Add unprivileged ioctl which returns subvolume information
btrfs: Add unprivileged ioctl whic
relax the root
privileges of them
Tomohiro Misono (3):
btrfs: Add unprivileged ioctl which returns subvolume information
btrfs: Add unprivileged ioctl which returns subvolume's ROOT_REF
btrfs: Add unprivileged version of ino_lookup ioctl
fs/btrfs/ioctl.c | 431 +++
ottom subvolume is also searched and filled.
Note that the maximum length of path is shorter 256 (BTRFS_VOL_NAME_MAX+1)
bytes than ino_lookup ioctl because of space of subvolume's name.
Reviewed-by: Gu Jinxiang
Reviewed-by: Qu Wenruo
Signed-off-by: Tomohiro Misono
---
fs/btrfs/ioc
Add new unprivileged ioctl BTRFS_IOC_GET_SUBVOL_INFO which returns
the information of subvolume containing this inode.
(i.e. returns the information in ROOT_ITEM and ROOT_BACKREF.)
Signed-off-by: Tomohiro Misono
---
v5 -> v6
- Use brfs_read_fs_root_no_name() to get subvolume root
refs than BTRFS_MAX_ROOTREF_BUFFER_NUM, -EOVERFLOW
is returned. Therefore the caller can just call this ioctl again without
changing the argument to continue search.
Reviewed-by: Qu Wenruo
Signed-off-by: Tomohiro Misono
---
v4 -> v5
- Update error handling of btrfs_next_leaf() to cover all ca
features which only depend on kernel version. New attribute_group
"btrfs_static_feature_attr_group" is created for this purpose.
Signed-off-by: Tomohiro Misono
---
fs/btrfs/sysfs.c | 29 +
1 file changed, 29 insertions(+)
diff --git a/fs/btrfs/sysfs
nup and the second one is a main part.
Tomohiro Misono (2):
btrfs: sysfs: Use enum/define value intead of magic number
btrfs: sysfs: Add entry which shows rmdir(2) can work for subvolume
fs/btrfs/sysfs.c | 40 +++-
fs/btrfs/sysfs.h | 4 ++--
2 files chan
Signed-off-by: Tomohiro Misono
---
fs/btrfs/sysfs.c | 11 ++-
fs/btrfs/sysfs.h | 4 ++--
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/fs/btrfs/sysfs.c b/fs/btrfs/sysfs.c
index fa6c8c88b250..217d401fe8ae 100644
--- a/fs/btrfs/sysfs.c
+++ b/fs/btrfs/sysfs.c
@@ -514,10
Add new unprivileged ioctl BTRFS_IOC_GET_SUBVOL_INFO which returns
the information of subvolume containing this inode.
(i.e. returns the information in ROOT_ITEM and ROOT_BACKREF.)
Signed-off-by: Tomohiro Misono
---
v4 -> v5
- Update error handling of btrfs_next_leaf() to cover all ca
for more detals.
The implementation of btrfs-progs can be found in the ML titled as follows:
[PATCH 0/11] btrfs-progs: Rework of "subvolume list/show" and relax the root
privileges of them
Tomohiro Misono (3):
btrfs: Add unprivileged ioctl which returns subvolume information
btr
refs than BTRFS_MAX_ROOTREF_BUFFER_NUM, -EOVERFLOW
is returned. Therefore the caller can just call this ioctl again without
changing the argument to continue search.
Signed-off-by: Tomohiro Misono
---
v4 -> v5
- Update error handling of btrfs_next_leaf() to cover all cases
- Use btrfs_next_item()
name of bottom subvolume is also searched and filled.
Note that the maximum length of path is shorter 256 (BTRFS_VOL_NAME_MAX+1)
bytes than ino_lookup ioctl because of space of subvolume's name.
Signed-off-by: Tomohiro Misono
---
fs/btrfs/ioctl.c | 204 ++
fied path and list them as well
- Remove obsolete field (i.e. top-level) from output
Any comments are welcome.
Thanks,
Tomohiro Misono
[1] https://www.spinics.net/lists/linux-btrfs/msg76008.html
[2] https://www.spinics.net/lists/linux-btrfs/msg74917.html
Tomohiro Misono (11):
Signed-off-by: Tomohiro Misono
---
tests/cli-tests/009-subvolume-list/test.sh | 136 +
1 file changed, 136 insertions(+)
create mode 100755 tests/cli-tests/009-subvolume-list/test.sh
diff --git a/tests/cli-tests/009-subvolume-list/test.sh
b/tests/cli-tests/009
By using new ioctl (BTRFS_IOC_GET_SUBVOL_INFO), this commit allows
non-privileged user to call util_subvolume_info() as long as @id is zero
(user can only get the information of the subvolume which he can open).
Signed-off-by: Tomohiro Misono
---
libbtrfsutil/btrfsutil.h | 7
Factor out main logic of btrfs_util_subvolume_info_fd().
This is a preparation work to relax the root privilege of this function.
No functional change happens.
Signed-off-by: Tomohiro Misono
---
libbtrfsutil/subvolume.c | 45 ++---
1 file changed, 26
Test user 'progs-test' will be used to test the behavior of normal user.
In order to pass this check, add the user by "useradd -M progs-test".
Note that progs-test should not have root privileges.
Signed-off-by: Tomohiro Misono
---
tests/common | 10 ++
1 file ch
Factor out the main logic of btrfs_util_subvolume_iterator_next().
This is a prepareation work to update the behavior of this function
and relax the required root privilege.
No functional change happens.
Signed-off-by: Tomohiro Misono
---
libbtrfsutil/subvolume.c | 9 -
1 file changed
, non-privileged user can
also use the iterator. If @top is specified, the behavior is the same
as before (and thus non-privileged user cannot use).
Signed-off-by: Tomohiro Misono
---
libbtrfsutil/btrfsutil.h | 19 ++-
libbtrfsutil/errors.c| 4 +
libbtrfsutil/subvolume.c | 319
Sandoval
Signed-off-by: Tomohiro Misono
---
cmds-subvolume.c | 961 +--
1 file changed, 934 insertions(+), 27 deletions(-)
diff --git a/cmds-subvolume.c b/cmds-subvolume.c
index 45363a5a..06686943 100644
--- a/cmds-subvolume.c
+++ b/cmds
t;.
Signed-off-by: Tomohiro Misono
---
utils.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/utils.c b/utils.c
index d81d4980..84b81311 100644
--- a/utils.c
+++ b/utils.c
@@ -2048,6 +2048,9 @@ int find_mount_root(const char *path, char **mount_root)
char *longest_match = NUL
T_SUBVOL_INFO/BTRFS_IOC_GET_ROOTREF/
BTRFS_IOC_INO_LOOKUP_USER),
- the specified path can be non-subvolume directory.
- non-privileged user can also call it.
Note that root user can list all the subvolume in the fs with -a option
(the same behavior as before).
Signed-off-by: Tomohiro Misono
---
list all snapshots in the fs (inc. non-accessible ones)
user ... subvolume path is from mount point
list snapshots under the mountpoint
(to which the user has appropriate privileges)
Signed-off-by: Tomohiro Misono
---
cmds-subvolume.c | 90
Add 3 definitions of new unprivileged ioctl (BTRFS_IOC_GET_SUBVOL_INFO,
BTRFS_IOC_GET_SUBVOL_ROOTREF and BTRFS_IOC_INO_LOOKUP_USER). They will
be used to implement the user version of "btrfs subvolume list" etc.
Signed-off-by: Tomohiro Misono
---
ioctl.h
refs than BTRFS_MAX_ROOTREF_BUFFER_NUM, -EOVERFLOW
is returned. Therefore the caller can just call this ioctl again without
changing the argument to continue search.
Signed-off-by: Tomohiro Misono
---
fs/btrfs/ioctl.c | 102 +
include/uapi/linux/btr
Add new unprivileged ioctl BTRFS_IOC_GET_SUBVOL_INFO which returns
the information of subvolume containing this inode.
(i.e. returns the information in ROOT_ITEM and ROOT_BACKREF.)
Signed-off-by: Tomohiro Misono
---
fs/btrfs/ioctl.c | 129
name of bottom subvolume is also searched and filled.
Note that the maximum length of path is shorter 256 (BTRFS_VOL_NAME_MAX+1)
bytes than ino_lookup ioctl because of space of subvolume's name.
Signed-off-by: Tomohiro Misono
---
fs/btrfs/ioctl.c | 204 ++
quot;subvolume list/show" and relax the root
privileges of them
Tomohiro Misono (3):
btrfs: Add unprivileged ioctl which returns subvolume information
btrfs: Add unprivileged ioctl which returns subvolume's ROOT_REF
btrfs: Add unprivileged version of ino_lookup ioctl
31 matches
Mail list logo