btrfs: start readahead also in seed devices
authorNaohiro Aota <naohiro.aota@wdc.com>
Thu, 6 Jun 2019 07:54:44 +0000 (16:54 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 25 Jun 2019 03:35:59 +0000 (11:35 +0800)
commitc592b1c3a994bb1fd3e8981a3f4d26a173a47511
tree125a377f81b0b1b627f4a1b7c3383dd40982446c
parent17f1dca21d16ef37b3c1d3e6b018ccfcecf7d834
btrfs: start readahead also in seed devices

commit c4e0540d0ad49c8ceab06cceed1de27c4fe29f6e upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/btrfs/reada.c