]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
md/raid10: wait barrier before returning discard request with REQ_NOWAIT
authorXiao Ni <xni@redhat.com>
Fri, 2 Jan 2026 20:37:22 +0000 (12:37 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 8 Jan 2026 09:15:00 +0000 (10:15 +0100)
[ Upstream commit 3db4404435397a345431b45f57876a3df133f3b4 ]

raid10_handle_discard should wait barrier before returning a discard bio
which has REQ_NOWAIT. And there is no need to print warning calltrace
if a discard bio has REQ_NOWAIT flag. Quality engineer usually checks
dmesg and reports error if dmesg has warning/error calltrace.

Fixes: c9aa889b035f ("md: raid10 add nowait support")
Signed-off-by: Xiao Ni <xni@redhat.com>
Acked-by: Coly Li <colyli@kernel.org>
Link: https://lore.kernel.org/linux-raid/20250306094938.48952-1-xni@redhat.com
Signed-off-by: Yu Kuai <yukuai3@huawei.com>
[Harshit: Clean backport to 6.12.y]
Signed-off-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/raid10.c

index b0062ad9b1d95fcf986e240416b387214deef35c..a91911a9fc036983725e4cc36752a19900af4d23 100644 (file)
@@ -1626,11 +1626,10 @@ static int raid10_handle_discard(struct mddev *mddev, struct bio *bio)
        if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery))
                return -EAGAIN;
 
-       if (WARN_ON_ONCE(bio->bi_opf & REQ_NOWAIT)) {
+       if (!wait_barrier(conf, bio->bi_opf & REQ_NOWAIT)) {
                bio_wouldblock_error(bio);
                return 0;
        }
-       wait_barrier(conf, false);
 
        /*
         * Check reshape again to avoid reshape happens after checking