Skip to content

Commit 5fa31c4

Browse files
Zheng QixingYuKuai-huawei
authored andcommitted
md/raid1,raid10: strip REQ_NOWAIT from member bios
RAID layers don't implement proper non-blocking semantics for REQ_NOWAIT, making the flag potentially misleading when propagated to member disks. This patch clear REQ_NOWAIT from cloned bios in raid1/raid10. Retain original bio's REQ_NOWAIT flag for upper layer error handling. Maybe we can implement non-blocking I/O handling mechanisms within RAID in future work. Fixes: 9f346f7 ("md/raid1,raid10: don't handle IO error for REQ_RAHEAD and REQ_NOWAIT") Signed-off-by: Zheng Qixing <[email protected]> Link: https://lore.kernel.org/linux-raid/[email protected] Signed-off-by: Yu Kuai <[email protected]>
1 parent 43806c3 commit 5fa31c4

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

drivers/md/raid1.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio,
13991399
}
14001400
read_bio = bio_alloc_clone(mirror->rdev->bdev, bio, gfp,
14011401
&mddev->bio_set);
1402-
1402+
read_bio->bi_opf &= ~REQ_NOWAIT;
14031403
r1_bio->bios[rdisk] = read_bio;
14041404

14051405
read_bio->bi_iter.bi_sector = r1_bio->sector +
@@ -1649,6 +1649,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
16491649
wait_for_serialization(rdev, r1_bio);
16501650
}
16511651

1652+
mbio->bi_opf &= ~REQ_NOWAIT;
16521653
r1_bio->bios[i] = mbio;
16531654

16541655
mbio->bi_iter.bi_sector = (r1_bio->sector + rdev->data_offset);

drivers/md/raid10.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1224,6 +1224,7 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio,
12241224
r10_bio->master_bio = bio;
12251225
}
12261226
read_bio = bio_alloc_clone(rdev->bdev, bio, gfp, &mddev->bio_set);
1227+
read_bio->bi_opf &= ~REQ_NOWAIT;
12271228

12281229
r10_bio->devs[slot].bio = read_bio;
12291230
r10_bio->devs[slot].rdev = rdev;
@@ -1259,6 +1260,7 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio,
12591260
conf->mirrors[devnum].rdev;
12601261

12611262
mbio = bio_alloc_clone(rdev->bdev, bio, GFP_NOIO, &mddev->bio_set);
1263+
mbio->bi_opf &= ~REQ_NOWAIT;
12621264
if (replacement)
12631265
r10_bio->devs[n_copy].repl_bio = mbio;
12641266
else

0 commit comments

Comments
 (0)