]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
md/raid5: Make logic blocking check consistent with logic that blocks
authorLogan Gunthorpe <logang@deltatee.com>
Thu, 16 Jun 2022 19:19:31 +0000 (13:19 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 25 Aug 2022 09:45:47 +0000 (11:45 +0200)
[ Upstream commit 6e3f50d30af847bebce072182bd735e90a294c6a ]

The check in raid5_make_request differs very slightly from the logic
that causes it to block lower down. This likely does not cause a bug
as the check is fuzzy anyway (as reshape may move on between the first
check and the subsequent check). However, make it consistent so it can
be cleaned up in a subsequent patch.

The condition which causes the schedule is:

 !(mddev->reshape_backwards ? logical_sector < conf->reshape_progress :
   logical_sector >= conf->reshape_progress) &&
  (mddev->reshape_backwards ? logical_sector < conf->reshape_safe :
   logical_sector >= conf->reshape_safe)

The condition that causes the early bailout is made to match this.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Song Liu <song@kernel.org>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/md/raid5.c

index c8539d0e12dd76841e1ffe364d30c1ea65d9ddad..45482cebacdb197a06e171aa60c1e55592ec7c2b 100644 (file)
@@ -5841,7 +5841,7 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * bi)
        if ((bi->bi_opf & REQ_NOWAIT) &&
            (conf->reshape_progress != MaxSector) &&
            (mddev->reshape_backwards
-           ? (logical_sector > conf->reshape_progress && logical_sector <= conf->reshape_safe)
+           ? (logical_sector >= conf->reshape_progress && logical_sector < conf->reshape_safe)
            : (logical_sector >= conf->reshape_safe && logical_sector < conf->reshape_progress))) {
                bio_wouldblock_error(bi);
                if (rw == WRITE)