mbox series

[v4,0/3] btrfs-progs: Fix logical-resolve

Message ID 20201127193035.19171-1-marcos@mpdesouza.com (mailing list archive)
Headers show
Series btrfs-progs: Fix logical-resolve | expand

Message

Marcos Paulo de Souza Nov. 27, 2020, 7:30 p.m. UTC
From: Marcos Paulo de Souza <mpdesouza@suse.com>

In this forth iteration, only patch 0002 was changed. Previously the variable
full_path, which is passed by the user, was being overwritten in the inode loop.
Now we create a temp var to store the mount_point when the lookup is needed.

Please review.

Changes from v3:
* In patch 0002, do not overwrite full_path variable

Changes from v2:
* Make mnt_opts check more strict to avoid bind mounts (Qu)
* Print only inode/subvolume when the subvolume itself is not mounted
* Enhance the test by adding a snapshot (unmounted) to exercise the check above
* Enhance the test by adding a bind mount that would trick logical-resolve

Changes from v1:
* Patches 2 and 3 added
* Test created (David)
* Discard changed on btrfs_list_path_for_root and changing find_mount_root
  instead

Marcos Paulo de Souza (3):
  btrfs-progs: Adapt find_mount_root to verify other fields of mntent
    struct
  btrfs-progs: inspect: Fix logical-resolve file path lookup
  btrfs-progs: tests: Add new logical-resolve test

 cmds/inspect.c                                | 44 +++++++---
 cmds/receive.c                                |  3 +-
 cmds/send.c                                   |  6 +-
 common/utils.c                                | 32 +++++++-
 common/utils.h                                | 11 ++-
 .../test.sh                                   | 81 +++++++++++++++++++
 6 files changed, 160 insertions(+), 17 deletions(-)
 create mode 100755 tests/misc-tests/042-inspect-internal-logical-resolve/test.sh

Comments

Josef Bacik Dec. 2, 2020, 8:12 p.m. UTC | #1
On 11/27/20 2:30 PM, Marcos Paulo de Souza wrote:
> From: Marcos Paulo de Souza <mpdesouza@suse.com>
> 
> In this forth iteration, only patch 0002 was changed. Previously the variable
> full_path, which is passed by the user, was being overwritten in the inode loop.
> Now we create a temp var to store the mount_point when the lookup is needed.
> 
> Please review.

Reviewed-by: Josef Bacik <josef@toxicpanda.com>

Thanks,

Josef
David Sterba Jan. 14, 2021, 6:42 p.m. UTC | #2
On Fri, Nov 27, 2020 at 04:30:32PM -0300, Marcos Paulo de Souza wrote:
> From: Marcos Paulo de Souza <mpdesouza@suse.com>
> 
> In this forth iteration, only patch 0002 was changed. Previously the variable
> full_path, which is passed by the user, was being overwritten in the inode loop.
> Now we create a temp var to store the mount_point when the lookup is needed.
> 
> Please review.
> 
> Changes from v3:
> * In patch 0002, do not overwrite full_path variable

For the record, patches have been reworked as there some differences
between kernels 5.3 and 5.8 regarding bind mounts and what is printed in
/proc/ mounts due to 3ef3959b29c4 ("btrfs: don't show full path of bind
mounts in subvol=").

New version uses libmount to parse the information and distinguish
subvol= mounts and bind mounts. With a test.