Btrfs-progs: fix to make list specified directory's subvolumes work
Steps to reproduce: # mkfs.btrfs -f /dev/sda8 # mount /dev/sda8 /mnt # mkdir /mnt/subvolumes # btrfs sub create /mnt/subvolumes/subv1 # btrfs sub create /mnt/subvolumes/subv1/subv1.1 # btrfs sub list -o /mnt/subvolumes/subv1 <----we did not list anything The problem is that we don't set @top_id right, fix it. Reported-by: Alex <alex@bpmit.com> Signed-off-by: Wang Shilong <wangsl.fnst@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.cz> Signed-off-by: Chris Mason <clm@fb.com>
This commit is contained in:
parent
62d02453e4
commit
4f5ebb3ef5
13
btrfs-list.c
13
btrfs-list.c
|
@ -578,23 +578,18 @@ static int resolve_root(struct root_lookup *rl, struct root_info *ri,
|
||||||
full_path = strdup(found->path);
|
full_path = strdup(found->path);
|
||||||
len = add_len;
|
len = add_len;
|
||||||
}
|
}
|
||||||
|
if (!ri->top_id)
|
||||||
|
ri->top_id = found->ref_tree;
|
||||||
|
|
||||||
next = found->ref_tree;
|
next = found->ref_tree;
|
||||||
|
if (next == top_id)
|
||||||
if (next == top_id) {
|
|
||||||
ri->top_id = top_id;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if the ref_tree = BTRFS_FS_TREE_OBJECTID,
|
* if the ref_tree = BTRFS_FS_TREE_OBJECTID,
|
||||||
* we are at the top
|
* we are at the top
|
||||||
*/
|
*/
|
||||||
if (next == BTRFS_FS_TREE_OBJECTID) {
|
if (next == BTRFS_FS_TREE_OBJECTID)
|
||||||
ri->top_id = next;
|
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if the ref_tree wasn't in our tree of roots, the
|
* if the ref_tree wasn't in our tree of roots, the
|
||||||
* subvolume was deleted.
|
* subvolume was deleted.
|
||||||
|
|
Loading…
Reference in New Issue