[PATCH openEuler-1.0-LTS] md/raid1,raid10: don't ignore IO flags

From: Yu Kuai <yukuai3@huawei.com> mainline inclusion from mainline-v6.15-rc1 commit e879a0d9cb086c8e52ce6c04e5bfa63825a6213c category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IC1QST CVE: CVE-2025-22125 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i... ------------------ If blk-wbt is enabled by default, it's found that raid write performance is quite bad because all IO are throttled by wbt of underlying disks, due to flag REQ_IDLE is ignored. And turns out this behaviour exist since blk-wbt is introduced. Other than REQ_IDLE, other flags should not be ignored as well, for example REQ_META can be set for filesystems, clearing it can cause priority reverse problems; And REQ_NOWAIT should not be cleared as well, because io will wait instead of failing directly in underlying disks. Fix those problems by keep IO flags from master bio. Fises: f51d46d0e7cb ("md: add support for REQ_NOWAIT") Fixes: e34cbd307477 ("blk-wbt: add general throttling mechanism") Fixes: 5404bc7a87b9 ("[PATCH] Allow file systems to differentiate between data and meta reads") Link: https://lore.kernel.org/linux-raid/20250227121657.832356-1-yukuai1@huaweiclo... Signed-off-by: Yu Kuai <yukuai3@huawei.com> Conflicts: drivers/md/raid1.c drivers/md/raid10.c [Due to not merging commit 3c5e514db58f ("md/raid1: Use the new blk_opf_t type"), commit cb1802ff82e1 ("md/raid10: Use the new blk_opf_t type"), commit c34b7ac65087 ("block: remove bio_set_op_attrs") and commit f2a38abf5f1c ("md/raid1: Atomic write support").] Signed-off-by: Zheng Qixing <zhengqixing@huawei.com> --- drivers/md/raid1.c | 4 ---- drivers/md/raid10.c | 7 ------- 2 files changed, 11 deletions(-) diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 6ad47783e974..0275dcb18692 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -1199,8 +1199,6 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, struct raid1_info *mirror; struct bio *read_bio; struct bitmap *bitmap = mddev->bitmap; - const int op = bio_op(bio); - const unsigned long do_sync = (bio->bi_opf & REQ_SYNC); int max_sectors; int rdisk; bool print_msg = !!r1_bio; @@ -1293,7 +1291,6 @@ static void raid1_read_request(struct mddev *mddev, struct bio *bio, mirror->rdev->data_offset; bio_set_dev(read_bio, mirror->rdev->bdev); read_bio->bi_end_io = raid1_end_read_request; - bio_set_op_attrs(read_bio, op, do_sync); if (test_bit(FailFast, &mirror->rdev->flags) && test_bit(R1BIO_FailFast, &r1_bio->state)) read_bio->bi_opf |= MD_FAILFAST; @@ -1519,7 +1516,6 @@ static void raid1_write_request(struct mddev *mddev, struct bio *bio, conf->mirrors[i].rdev->data_offset); bio_set_dev(mbio, conf->mirrors[i].rdev->bdev); mbio->bi_end_io = raid1_end_write_request; - mbio->bi_opf = bio_op(bio) | (bio->bi_opf & (REQ_SYNC | REQ_FUA)); if (test_bit(FailFast, &conf->mirrors[i].rdev->flags) && !test_bit(WriteMostly, &conf->mirrors[i].rdev->flags) && conf->raid_disks - mddev->degraded > 1) diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c index f8fea9593955..07d58e88eb7b 100644 --- a/drivers/md/raid10.c +++ b/drivers/md/raid10.c @@ -1166,8 +1166,6 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio, { struct r10conf *conf = mddev->private; struct bio *read_bio; - const int op = bio_op(bio); - const unsigned long do_sync = (bio->bi_opf & REQ_SYNC); int max_sectors; sector_t sectors; struct md_rdev *rdev; @@ -1264,7 +1262,6 @@ static void raid10_read_request(struct mddev *mddev, struct bio *bio, choose_data_offset(r10_bio, rdev); bio_set_dev(read_bio, rdev->bdev); read_bio->bi_end_io = raid10_end_read_request; - bio_set_op_attrs(read_bio, op, do_sync); if (test_bit(FailFast, &rdev->flags) && test_bit(R10BIO_FailFast, &r10_bio->state)) read_bio->bi_opf |= MD_FAILFAST; @@ -1282,9 +1279,6 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio, struct bio *bio, bool replacement, int n_copy) { - const int op = bio_op(bio); - const unsigned long do_sync = (bio->bi_opf & REQ_SYNC); - const unsigned long do_fua = (bio->bi_opf & REQ_FUA); unsigned long flags; struct blk_plug_cb *cb; struct raid10_plug_cb *plug = NULL; @@ -1313,7 +1307,6 @@ static void raid10_write_one_disk(struct mddev *mddev, struct r10bio *r10_bio, choose_data_offset(r10_bio, rdev)); bio_set_dev(mbio, rdev->bdev); mbio->bi_end_io = raid10_end_write_request; - bio_set_op_attrs(mbio, op, do_sync | do_fua); if (!replacement && test_bit(FailFast, &conf->mirrors[devnum].rdev->flags) && enough(conf, devnum)) -- 2.39.2

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/16104 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/TLH... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/16104 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/TLH...
participants (2)
-
patchwork bot
-
Zheng Qixing