Skip to content

Commit 3194502

Browse files
zhaoleiddkdave
authored andcommitted
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 <[email protected]> Signed-off-by: David Sterba <[email protected]>
1 parent 6a159d2 commit 3194502

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/btrfs/reada.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root,
330330
int nzones = 0;
331331
unsigned long index = logical >> PAGE_CACHE_SHIFT;
332332
int dev_replace_is_ongoing;
333+
int have_zone = 0;
333334

334335
spin_lock(&fs_info->reada_lock);
335336
re = radix_tree_lookup(&fs_info->reada_tree, index);
@@ -456,10 +457,14 @@ static struct reada_extent *reada_find_extent(struct btrfs_root *root,
456457
btrfs_dev_replace_unlock(&fs_info->dev_replace);
457458
goto error;
458459
}
460+
have_zone = 1;
459461
}
460462
spin_unlock(&fs_info->reada_lock);
461463
btrfs_dev_replace_unlock(&fs_info->dev_replace);
462464

465+
if (!have_zone)
466+
goto error;
467+
463468
btrfs_put_bbio(bbio);
464469
return re;
465470

0 commit comments

Comments
 (0)