aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs/reada.c
diff options
context:
space:
mode:
authorNaohiro Aota <naohiro.aota@wdc.com>2019-06-06 03:54:44 -0400
committerDavid Sterba <dsterba@suse.com>2019-06-14 11:33:46 -0400
commitc4e0540d0ad49c8ceab06cceed1de27c4fe29f6e (patch)
tree8bf74f88f9e626c508832e3977c6d3c9269948cf /fs/btrfs/reada.c
parent8eaf40c0e24e98899a0f3ac9d25a33aafe13822a (diff)
btrfs: start readahead also in seed devices
Currently, btrfs does not consult seed devices to start readahead. As a result, if readahead zone is added to the seed devices, btrfs_reada_wait() indefinitely wait for the reada_ctl to finish. You can reproduce the hung by modifying btrfs/163 to have larger initial file size (e.g. xfs_io pwrite 4M instead of current 256K). Fixes: 7414a03fbf9e ("btrfs: initial readahead code and prototypes") Cc: stable@vger.kernel.org # 3.2+: ce7791ffee1e: Btrfs: fix race between readahead and device replace/removal Cc: stable@vger.kernel.org # 3.2+ Reviewed-by: Filipe Manana <fdmanana@suse.com> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com> Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/reada.c')
-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 10d9589001a9..bb5bd49573b4 100644
--- a/fs/btrfs/reada.c
+++ b/fs/btrfs/reada.c
@@ -747,6 +747,7 @@ static void __reada_start_machine(struct btrfs_fs_info *fs_info)
747 u64 total = 0; 747 u64 total = 0;
748 int i; 748 int i;
749 749
750again:
750 do { 751 do {
751 enqueued = 0; 752 enqueued = 0;
752 mutex_lock(&fs_devices->device_list_mutex); 753 mutex_lock(&fs_devices->device_list_mutex);
@@ -758,6 +759,10 @@ static void __reada_start_machine(struct btrfs_fs_info *fs_info)
758 mutex_unlock(&fs_devices->device_list_mutex); 759 mutex_unlock(&fs_devices->device_list_mutex);
759 total += enqueued; 760 total += enqueued;
760 } while (enqueued && total < 10000); 761 } while (enqueued && total < 10000);
762 if (fs_devices->seed) {
763 fs_devices = fs_devices->seed;
764 goto again;
765 }
761 766
762 if (enqueued == 0) 767 if (enqueued == 0)
763 return; 768 return;