Skip to content

btrfs-progs: add subvol list options for sane path behavior

Omar Sandoval linux-btrfs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest8 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/8libbtrfsutil: fix accidentally closing fd passed to subvolume iteratorlibbtrfsutil/python/tests/test_subvolume.py libbtrfsutil/subvolume.c+20 -10 replies
2/8libbtrfsutil: don't check for UID 0 in subvolume_info()libbtrfsutil/subvolume.c+4 -20 replies
3/8libbtrfsutil: don't check for UID 0 in subvolume iteratorlibbtrfsutil/subvolume.c+28 -130 replies
4/8btrfs-progs: subvol list: remove unused raw layout codecmds/subvolume-list.c+4 -260 replies
5/8btrfs-progs: subvol list: remove unused filterscmds/subvolume-list.c+0 -140 replies
6/8btrfs-progs: subvol list: document and test actual behavior of pathsDocumentation/btrfs-subvolume.rst cmds/subvolume-list.c tests/cli-tests/026-subvolume-list-path-filtering/test.sh+143 -80 replies
7/8btrfs-progs: subvol list: use libbtrfsutilcmds/subvolume-list.c+259 -7080 replies
8/8btrfs-progs: subvol list: add sane -O and -A optionsDocumentation/btrfs-subvolume.rst cmds/subvolume-list.c tests/cli-tests/026-subvolume-list-path-filtering/test.sh+117 -150 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/8] btrfs-progs: add subvol list options for sane path behavior

From: Omar Sandoval <[email protected]>

Hello,

btrfs subvol list's path handling has been a constant source of confusion for users. None of -o, -a, or the default do what users expect. This has been broken for a decade; see [1].

This series adds two new options, -O and -A, which do what users actually want: list subvolumes below a path, or list all subvolumes, with minimal path shenanigans. This approach is conservative and tries to maintain backwards compatibility, but it's worth discussing whether we should instead fix the existing options/default, or more noisily deprecate the existing options.

One additional benefit of this is that -O can be used by unprivileged users.

Patch 1 fixes a libbtrfsutil bug I encountered while testing this. Patches 2 and 3 fix libbtrfsutil's privilege checks to work in user namespaces. Patches 4 and 5 remove some unused subvol list code. Patch 6 documents and tests the current, insane behavior. Patch 7 converts subvol list to use libbtrfsutil. This is a revival of one of my old patches [2], but is much easier now that libbtrfs has been pared down. Patch 8 adds the new options, including documentation and tests.

Thanks!
Omar

1: https://lore.kernel.org/all/[email protected]/
2: https://lore.kernel.org/all/6492726d6e89bf792627e4431f7ba7691f09c3d2.1518720598.git.osandov@fb.com/

Omar Sandoval (8):
libbtrfsutil: fix accidentally closing fd passed to subvolume iterator
libbtrfsutil: don't check for UID 0 in subvolume_info()
libbtrfsutil: don't check for UID 0 in subvolume iterator
btrfs-progs: subvol list: remove unused raw layout code
btrfs-progs: subvol list: remove unused filters
btrfs-progs: subvol list: document and test actual behavior of paths
btrfs-progs: subvol list: use libbtrfsutil
btrfs-progs: subvol list: add sane -O and -A options

 Documentation/btrfs-subvolume.rst             |   37 +-
 cmds/subvolume-list.c                         | 1081 +++++------------
 libbtrfsutil/python/tests/test_subvolume.py   |   18 +
 libbtrfsutil/subvolume.c                      |   50 +-
 .../026-subvolume-list-path-filtering/test.sh |  156 +++
 5 files changed, 565 insertions(+), 777 deletions(-)
 create mode 100755 tests/cli-tests/026-subvolume-list-path-filtering/test.sh
Signature · 1 line
2.45.2