Btrfs-progs: update btrfs_get_subvol to be inline with resolve_root ret changes
authorAnand Jain <anand.jain@oracle.com>
Fri, 1 Feb 2013 07:56:30 +0000 (15:56 +0800)
committerDavid Sterba <dsterba@suse.cz>
Fri, 1 Feb 2013 15:55:06 +0000 (16:55 +0100)
Signed-off-by: Anand Jain <anand.jain@oracle.com>
btrfs-list.c

index cfe62f3..d02d620 100644 (file)
@@ -1517,19 +1517,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)