[PATCH 4/4] md: use submit_bio_noacct_add_head for split bio sending back

dannyshih
2020-12-29T09:29:28Z

From: Danny Shih <dannyshih@synology.com>

Use submit_bio_noacct_add_head when sending split bio back to md device.
Otherwise, it might be handled after the lately split bio.

Signed-off-by: Danny Shih <dannyshih@synology.com>
Reviewed-by: Allen Peng <allenpeng@synology.com>
Reviewed-by: Alex Wu <alexwu@synology.com>
---
drivers/md/md-linear.c | 2 +-
drivers/md/raid0.c | 4 ++--
drivers/md/raid1.c | 4 ++--
drivers/md/raid10.c | 4 ++--
drivers/md/raid5.c | 2 +-
5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/md/md-linear.c b/drivers/md/md-linear.c
index 68cac7d..24418ee 100644
--- a/drivers/md/md-linear.c
+++ b/drivers/md/md-linear.c
@@ -243,7 +243,7 @@ static bool linear_make_request(struct mddev *mddev, struct bio *bio)
struct bio *split = bio_split(bio, end_sector - bio_sector,
GFP_NOIO, &mddev->bio_set);
bio_chain(split, bio);
- submit_bio_noacct(bio);
+ submit_bio_noacct_add_head(bio);
bio = split;
}

diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c
index 67f157f..92e82d5 100644
--- a/drivers/md/raid0.c
+++ b/drivers/md/raid0.c
@@ -447,7 +447,7 @@ static void raid0_handle_discard(struct mddev *mddev, struct bio *bio)
zone->zone_end - bio->bi_iter.bi_sector, GFP_NOIO,
&mddev->bio_set);
bio_chain(split, bio);
- submit_bio_noacct(bio);
+ submit_bio_noacct_add_head(bio);
bio = split;
end = zone->zone_end;
} else
@@ -552,7 +552,7 @@ static bool raid0_make_request(struct mddev *mddev, struct bio *bio)
struct bio *split = bio_split(bio, sectors, GFP_NOIO,
&mddev->bio_set);
bio_chain(split, bio);
- submit_bio_noacct(bio);
+ submit_bio_noacct_add_head(bio);
bio = split;
}

diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
index c034799..31cec76 100644
--- a/drivers/md/raid1.c
+++ b/drivers/md/raid1.c
@@ -1282,7 +1282,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,
struct bio *split = bio_split(bio, max_sectors,
gfp, &conf->bio_split);
bio_chain(split, bio);
- submit_bio_noacct(bio);
+ submit_bio_noacct_add_head(bio);
bio = split;
r1_bio->master_bio = bio;
r1_bio->sectors = max_sectors;
@@ -1453,7 +1453,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
struct bio *split = bio_split(bio, max_sectors,
GFP_NOIO, &conf->bio_split);
bio_chain(split, bio);
- submit_bio_noacct(bio);
+ submit_bio_noacct_add_head(bio);
bio = split;
r1_bio->master_bio = bio;
r1_bio->sectors = max_sectors;
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index c5d88ef..c4dc970 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -1177,7 +1177,7 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
gfp, &conf->bio_split);
bio_chain(split, bio);
allow_barrier(conf);
- submit_bio_noacct(bio);
+ submit_bio_noacct_add_head(bio);
wait_barrier(conf);
bio = split;
r10_bio->master_bio = bio;
@@ -1460,7 +1460,7 @@ static void raid10_write_request(struct mddev *mddev, struct bio *bio,
GFP_NOIO, &conf->bio_split);
bio_chain(split, bio);
allow_barrier(conf);
- submit_bio_noacct(bio);
+ submit_bio_noacct_add_head(bio);
wait_barrier(conf);
bio = split;
r10_bio->master_bio = bio;
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 3a90cc0..17458ac 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5490,7 +5490,7 @@ static struct bio *chunk_aligned_read(struct mddev *mddev, struct bio *raid_bio)
struct r5conf *conf = mddev->private;
split = bio_split(raid_bio, sectors, GFP_NOIO, &conf->bio_split);
bio_chain(split, raid_bio);
- submit_bio_noacct(raid_bio);
+ submit_bio_noacct_add_head(raid_bio);
raid_bio = split;
}

--
2.7.4