Skip to content

Commit c069da4

Browse files
Martins3liu-song-6
authored andcommitted
md/raid1: hold the barrier until handle_read_error() finishes
handle_read_error() will call allow_barrier() to match the former barrier raising. However, it should put the allow_barrier() at the end to avoid a concurrent raid reshape. Fixes: 689389a ("md/raid1: simplify handle_read_error().") 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 992db13 commit c069da4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/md/raid1.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2511,6 +2511,7 @@ static void handle_read_error(struct r1conf *conf, struct r1bio *r1_bio)
25112511
struct mddev *mddev = conf->mddev;
25122512
struct bio *bio;
25132513
struct md_rdev *rdev;
2514+
sector_t sector;
25142515

25152516
clear_bit(R1BIO_ReadError, &r1_bio->state);
25162517
/* we got a read error. Maybe the drive is bad. Maybe just
@@ -2540,12 +2541,13 @@ static void handle_read_error(struct r1conf *conf, struct r1bio *r1_bio)
25402541
}
25412542

25422543
rdev_dec_pending(rdev, conf->mddev);
2543-
allow_barrier(conf, r1_bio->sector);
2544+
sector = r1_bio->sector;
25442545
bio = r1_bio->master_bio;
25452546

25462547
/* Reuse the old r1_bio so that the IO_BLOCKED settings are preserved */
25472548
r1_bio->state = 0;
25482549
raid1_read_request(mddev, bio, r1_bio->sectors, r1_bio);
2550+
allow_barrier(conf, sector);
25492551
}
25502552

25512553
static void raid1d(struct md_thread *thread)

0 commit comments

Comments
 (0)