btrfs: propagate failures of __exclude_logged_extent to upper caller
authorGu Jinxiang <gujx@cn.fujitsu.com>
Tue, 22 May 2018 09:46:51 +0000 (17:46 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 29 May 2018 16:12:58 +0000 (18:12 +0200)
Function btrfs_exclude_logged_extents may call __exclude_logged_extent
which may fail.
Propagate the failures of __exclude_logged_extent to upper caller.

Signed-off-by: Gu Jinxiang <gujx@cn.fujitsu.com>
Reviewed-by: Nikolay Borisov <nborisov@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/extent-tree.c

index c25308722e81cdb56503f60697b3f7bb27392a19..7273dcddcdf499f9dc2450e2bf69addd892e6ad9 100644 (file)
@@ -6457,6 +6457,7 @@ int btrfs_exclude_logged_extents(struct btrfs_fs_info *fs_info,
        struct btrfs_key key;
        int found_type;
        int i;
+       int ret = 0;
 
        if (!btrfs_fs_incompat(fs_info, MIXED_GROUPS))
                return 0;
@@ -6473,10 +6474,12 @@ int btrfs_exclude_logged_extents(struct btrfs_fs_info *fs_info,
                        continue;
                key.objectid = btrfs_file_extent_disk_bytenr(eb, item);
                key.offset = btrfs_file_extent_disk_num_bytes(eb, item);
-               __exclude_logged_extent(fs_info, key.objectid, key.offset);
+               ret = __exclude_logged_extent(fs_info, key.objectid, key.offset);
+               if (ret)
+                       break;
        }
 
-       return 0;
+       return ret;
 }
 
 static void