Skip to content

Commit 992db13

Browse files
Martins3liu-song-6
authored andcommitted
md/raid1: free the r1bio before waiting for blocked rdev
Raid1 reshape will change mempool and r1conf::raid_disks which are needed to free r1bio. allow_barrier() make a concurrent raid1_reshape() possible. So, free the in-flight r1bio before waiting blocked rdev. Fixes: 6bfe0b4 ("md: support blocking writes to an array on device failure") Reviewed-by: Yu Kuai <[email protected]> Signed-off-by: Xueshi Hu <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Song Liu <[email protected]>
1 parent c5d736f commit 992db13

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

drivers/md/raid1.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1378,6 +1378,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
13781378
return;
13791379
}
13801380

1381+
retry_write:
13811382
r1_bio = alloc_r1bio(mddev, bio);
13821383
r1_bio->sectors = max_write_sectors;
13831384

@@ -1393,7 +1394,6 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
13931394
*/
13941395

13951396
disks = conf->raid_disks * 2;
1396-
retry_write:
13971397
blocked_rdev = NULL;
13981398
rcu_read_lock();
13991399
max_sectors = r1_bio->sectors;
@@ -1473,7 +1473,7 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio,
14731473
for (j = 0; j < i; j++)
14741474
if (r1_bio->bios[j])
14751475
rdev_dec_pending(conf->mirrors[j].rdev, mddev);
1476-
r1_bio->state = 0;
1476+
free_r1bio(r1_bio);
14771477
allow_barrier(conf, bio->bi_iter.bi_sector);
14781478

14791479
if (bio->bi_opf & REQ_NOWAIT) {

0 commit comments

Comments
 (0)