summaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorZhao Lei <zhaolei@cn.fujitsu.com>2015-12-31 18:48:54 +0800
committerDavid Sterba <dsterba@suse.com>2016-02-18 10:26:12 +0100
commit319450211842ba92d0604af6e4ddf15f445efbcf (patch)
treedfcde7d6d0048928a9cfd8ec4b2be64f506e0f98 /fs/btrfs
parent6a159d2ae488a835a8ca5f1f658db72b7e13d064 (diff)
downloadlinux-319450211842ba92d0604af6e4ddf15f445efbcf.tar.bz2
btrfs: reada: bypass adding extent when all zone failed
When failed adding all dev_zones for a reada_extent, the extent will have no chance to be selected to run, and keep in memory for ever. We should bypass this extent to avoid above case. Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/reada.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/btrfs/reada.c b/fs/btrfs/reada.c
index 27a2fe914c67..1d00de7369a8 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -330,6 +330,7 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root,
int nzones = 0;
unsigned long index = logical >> PAGE_CACHE_SHIFT;
int dev_replace_is_ongoing;
+ int have_zone = 0;
spin_lock(&fs_info->reada_lock);
re = radix_tree_lookup(&fs_info->reada_tree, index);
@@ -456,10 +457,14 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root,
btrfs_dev_replace_unlock(&fs_info->dev_replace);
goto error;
}
+ have_zone = 1;
}
spin_unlock(&fs_info->reada_lock);
btrfs_dev_replace_unlock(&fs_info->dev_replace);
+ if (!have_zone)
+ goto error;
+
btrfs_put_bbio(bbio);
return re;