From: Christoph Hellwig Date: Fri, 29 May 2026 05:43:00 +0000 (+0200) Subject: md/raid1: move the exceed_read_errors condition out of fix_read_error X-Git-Url: http://git.ipfire.org/gitweb/?a=commitdiff_plain;h=6e3b0b91334d1dfaa20ca55eac835f5945a3b7c8;p=thirdparty%2Fkernel%2Flinux.git md/raid1: move the exceed_read_errors condition out of fix_read_error This condition much better fits into the only caller, limiting fix_read_error to actually fix up data devices after a read error. Signed-off-by: Christoph Hellwig Link: https://patch.msgid.link/20260529054308.2720300-3-hch@lst.de Signed-off-by: Yu Kuai --- diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 98476ab96c52c..85a17909d8fe7 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2418,11 +2418,6 @@ static void fix_read_error(struct r1conf *conf, struct r1bio *r1_bio) struct mddev *mddev = conf->mddev; struct md_rdev *rdev = conf->mirrors[read_disk].rdev; - if (exceed_read_errors(mddev, rdev)) { - r1_bio->bios[r1_bio->read_disk] = IO_BLOCKED; - return; - } - while(sectors) { int s = sectors; int d = read_disk; @@ -2659,7 +2654,10 @@ static void handle_read_error(struct r1conf *conf, struct r1bio *r1_bio) md_error(mddev, rdev); } else { freeze_array(conf, 1); - fix_read_error(conf, r1_bio); + if (exceed_read_errors(mddev, rdev)) + r1_bio->bios[r1_bio->read_disk] = IO_BLOCKED; + else + fix_read_error(conf, r1_bio); unfreeze_array(conf); }