Re: [PATCH v6 4/4] md: raid456 add nowait support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Dec 21, 2021 at 12:06 PM Vishal Verma <vverma@xxxxxxxxxxxxxxxx> wrote:
>
> Returns EAGAIN in case the raid456 driver would block
> waiting for situations like:
>
>   - Reshape operation,
>   - Discard operation.
>
> Signed-off-by: Vishal Verma <vverma@xxxxxxxxxxxxxxxx>

I think we will need the following fix for raid456:

============================ 8< ============================

diff --git i/drivers/md/raid5.c w/drivers/md/raid5.c
index 6ab22f29dacd..55d372ce3300 100644
--- i/drivers/md/raid5.c
+++ w/drivers/md/raid5.c
@@ -5717,6 +5717,7 @@ static void make_discard_request(struct mddev
*mddev, struct bio *bi)
                        raid5_release_stripe(sh);
                        /* Bail out if REQ_NOWAIT is set */
                        if (bi->bi_opf & REQ_NOWAIT) {
+                               finish_wait(&conf->wait_for_overlap, &w);
                                bio_wouldblock_error(bi);
                                return;
                        }
@@ -5734,6 +5735,7 @@ static void make_discard_request(struct mddev
*mddev, struct bio *bi)
                                raid5_release_stripe(sh);
                                /* Bail out if REQ_NOWAIT is set */
                                if (bi->bi_opf & REQ_NOWAIT) {
+
finish_wait(&conf->wait_for_overlap, &w);
                                        bio_wouldblock_error(bi);
                                        return;
                                }
@@ -5829,7 +5831,6 @@ static bool raid5_make_request(struct mddev
*mddev, struct bio * bi)
        last_sector = bio_end_sector(bi);
        bi->bi_next = NULL;

-       md_account_bio(mddev, &bi);
        /* Bail out if REQ_NOWAIT is set */
        if ((bi->bi_opf & REQ_NOWAIT) &&
            (conf->reshape_progress != MaxSector) &&
@@ -5837,9 +5838,11 @@ static bool raid5_make_request(struct mddev
*mddev, struct bio * bi)
            ? (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)
+                       md_write_end(mddev);
                return true;
        }
-
+       md_account_bio(mddev, &bi);
        prepare_to_wait(&conf->wait_for_overlap, &w, TASK_UNINTERRUPTIBLE);
        for (; logical_sector < last_sector; logical_sector +=
RAID5_STRIPE_SECTORS(conf)) {
                int previous;

============================ 8< ============================

Vishal, please try to trigger all these conditions (including raid1,
raid10) and make sure
they work properly.

For example, I triggered raid5 reshape and used something like the
following to make
sure the logic is triggered:

diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 55d372ce3300..e79de48a0027 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -5840,6 +5840,11 @@ static bool raid5_make_request(struct mddev
*mddev, struct bio * bi)
                bio_wouldblock_error(bi);
                if (rw == WRITE)
                        md_write_end(mddev);
+               {
+                       static int count = 0;
+                       if (count++ < 10)
+                               pr_info("%s REQ_NOWAIT return\n", __func__);
+               }
                return true;
        }
        md_account_bio(mddev, &bi);

Thanks,
Song



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux