summaryrefslogtreecommitdiffstats
path: root/drivers/md/raid10.c
diff options
context:
space:
mode:
authorDavid Jeffery <djeffery@redhat.com>2019-09-16 13:15:14 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-12-17 20:34:55 +0100
commita12c768df372747ebe0551fbc386b701f02c2b0b (patch)
tree164bb9c22421db601ec763fff8c60b57c1b7647c /drivers/md/raid10.c
parentd88d9321e88cce771734377577767db0b1fea0cf (diff)
downloadlinux-stable-a12c768df372747ebe0551fbc386b701f02c2b0b.tar.gz
linux-stable-a12c768df372747ebe0551fbc386b701f02c2b0b.tar.bz2
linux-stable-a12c768df372747ebe0551fbc386b701f02c2b0b.zip
md: improve handling of bio with REQ_PREFLUSH in md_flush_request()
commit 775d78319f1ceb32be8eb3b1202ccdc60e9cb7f1 upstream. If pers->make_request fails in md_flush_request(), the bio is lost. To fix this, pass back a bool to indicate if the original make_request call should continue to handle the I/O and instead of assuming the flush logic will push it to completion. Convert md_flush_request to return a bool and no longer calls the raid driver's make_request function. If the return is true, then the md flush logic has or will complete the bio and the md make_request call is done. If false, then the md make_request function needs to keep processing like it is a normal bio. Let the original call to md_handle_request handle any need to retry sending the bio to the raid driver's make_request function should it be needed. Also mark md_flush_request and the make_request function pointer as __must_check to issue warnings should these critical return values be ignored. Fixes: 2bc13b83e629 ("md: batch flush requests.") Cc: stable@vger.kernel.org # # v4.19+ Cc: NeilBrown <neilb@suse.com> Signed-off-by: David Jeffery <djeffery@redhat.com> Reviewed-by: Xiao Ni <xni@redhat.com> Signed-off-by: Song Liu <songliubraving@fb.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r--drivers/md/raid10.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 4cf3d8ad0b4a..02c5e390f89f 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1562,10 +1562,9 @@ static bool raid10_make_request(struct mddev *mddev, struct bio *bio)
int chunk_sects = chunk_mask + 1;
int sectors = bio_sectors(bio);
- if (unlikely(bio->bi_opf & REQ_PREFLUSH)) {
- md_flush_request(mddev, bio);
+ if (unlikely(bio->bi_opf & REQ_PREFLUSH)
+ && md_flush_request(mddev, bio))
return true;
- }
if (!md_write_start(mddev, bio))
return false;