Signed-off-by: Anand Jain <anand.j...@oracle.com>
---
 btrfs-list.c | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/btrfs-list.c b/btrfs-list.c
index db3665c..0cc368c 100644
--- a/btrfs-list.c
+++ b/btrfs-list.c
@@ -1502,19 +1502,24 @@ int btrfs_list_subvols_print(int fd, struct 
btrfs_list_filter_set *filter_set,
 
 int btrfs_get_subvol(int fd, struct root_info *the_ri)
 {
-       int ret = -1;
+       int ret = 1, rr;
        struct root_lookup rl;
        struct rb_node *rbn;
        struct root_info *ri;
        u64 root_id = btrfs_list_get_path_rootid(fd);
 
        if (btrfs_list_subvols(fd, &rl))
-               return 1;
+               return ret;
 
        rbn = rb_first(&rl.root);
        while(rbn) {
                ri = rb_entry(rbn, struct root_info, rb_node);
-               resolve_root(&rl, ri, root_id);
+               rr = resolve_root(&rl, ri, root_id);
+               if (rr == -ENOENT) {
+                       ret = -ENOENT;
+                       rbn = rb_next(rbn);
+                       continue;
+               }
                if (!comp_entry_with_rootid(the_ri, ri, 0)) {
                        memcpy(the_ri, ri, offsetof(struct root_info, path));
                        if (ri->path)
-- 
1.8.1.227.g44fe835

--
To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to