All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <axboe@kernel.dk>
To: Vishal Verma <vverma@digitalocean.com>, Song Liu <song@kernel.org>
Cc: linux-raid <linux-raid@vger.kernel.org>, rgoldwyn@suse.de
Subject: Re: [RFC PATCH v4 4/4] md: raid456 add nowait support
Date: Mon, 13 Dec 2021 16:35:27 -0700	[thread overview]
Message-ID: <b70fded5-8f65-7767-25c1-d45b1dcbbddf@kernel.dk> (raw)
In-Reply-To: <998a933f-e3af-2f2c-79c6-ae5a75f286de@digitalocean.com>

On 12/13/21 3:43 PM, Vishal Verma wrote:
> 
> On 12/12/21 10:56 PM, Song Liu wrote:
>> On Fri, Dec 10, 2021 at 10:26 AM Vishal Verma <vverma@digitalocean.com> wrote:
>>>
>>> On 12/9/21 7:16 PM, Song Liu wrote:
>>>> On Wed, Nov 10, 2021 at 10:15 AM Vishal Verma <vverma@digitalocean.com> wrote:
>>>>> Returns EAGAIN in case the raid456 driver would block
>>>>> waiting for situations like:
>>>>>
>>>>>     - Reshape operation,
>>>>>     - Discard operation.
>>>>>
>>>>> Signed-off-by: Vishal Verma <vverma@digitalocean.com>
>>>>> ---
>>>>>    drivers/md/raid5.c | 14 ++++++++++++++
>>>>>    1 file changed, 14 insertions(+)
>>>>>
>>>>> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
>>>>> index 9c1a5877cf9f..fa64ee315241 100644
>>>>> --- a/drivers/md/raid5.c
>>>>> +++ b/drivers/md/raid5.c
>>>>> @@ -5710,6 +5710,11 @@ static void make_discard_request(struct mddev *mddev, struct bio *bi)
>>>>>                   int d;
>>>>>           again:
>>>>>                   sh = raid5_get_active_stripe(conf, logical_sector, 0, 0, 0);
>>>>> +               /* Bail out if REQ_NOWAIT is set */
>>>>> +               if (bi->bi_opf & REQ_NOWAIT) {
>>>>> +                       bio_wouldblock_error(bi);
>>>>> +                       return;
>>>>> +               }
>>>> This is not right. raid5_get_active_stripe() gets refcount on the sh,
>>>> we cannot simply
>>>> return here. I think we need the logic after raid5_release_stripe()
>>>> and before schedule().
>>>>
>>>>>                   prepare_to_wait(&conf->wait_for_overlap, &w,
>>>>>                                   TASK_UNINTERRUPTIBLE);
>>>>>                   set_bit(R5_Overlap, &sh->dev[sh->pd_idx].flags);
>>>>> @@ -5820,6 +5825,15 @@ static bool raid5_make_request(struct mddev *mddev, struct bio * 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 &&
>>>>> +           mddev->reshape_backwards
>>>>> +           ? logical_sector < conf->reshape_safe
>>>>> +           : logical_sector >= conf->reshape_safe) {
>>>>> +               bio_wouldblock_error(bi);
>>>>> +               return true;
>>>>> +       }
>>>> This is also problematic, and is the trigger of those error messages.
>>>> We only want to trigger -EAGAIN when logical_sector is between
>>>> reshape_progress and reshape_safe.
>>>>
>>>> Just to clarify, did you mean doing something like:
>>>> 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_safe)) {
>> I think this should be
>>    :   (logical_sector >= conf->reshape_safe && logical_sector <
>> conf->reshape_progress)
> 
> 
> 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_safe && 
> logical_sector < conf->reshape_progress))) {
>                          bio_wouldblock_error(bi);
>                          return true;
>          }
> 
> After making this change along with other changes, I ran some tests with 
> 100% reads, 70%read30%writes and 100% writes on a clean raid5 array.
> 
> Unfortunately, I ran into this following task hung with 100% writes 
> (with both libaio and io_uring):
> 
> [21876.856692] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" 
> disables this message.
> [21876.864518] task:md5_raid5       state:D stack:    0 pid:11675 
> ppid:     2 flags:0x00004000
> [21876.864522] Call Trace:
> [21876.864526]  __schedule+0x2d4/0x970
> [21876.864532]  ? wbt_cleanup_cb+0x20/0x20
> [21876.864535]  schedule+0x4e/0xb0
> [21876.864537]  io_schedule+0x3f/0x70
> [21876.864539]  rq_qos_wait+0xb9/0x130
> [21876.864542]  ? sysv68_partition+0x280/0x280
> [21876.864543]  ? wbt_cleanup_cb+0x20/0x20
> [21876.864545]  wbt_wait+0x92/0xc0
> [21876.864546]  __rq_qos_throttle+0x25/0x40
> [21876.864548]  blk_mq_submit_bio+0xc6/0x5d0
> [21876.864551]  ? submit_bio_checks+0x39e/0x5f0
> [21876.864554]  __submit_bio+0x1bc/0x1d0
> [21876.864555]  ? kmem_cache_free+0x378/0x3c0
> [21876.864558]  ? mempool_free_slab+0x17/0x20
> [21876.864562]  submit_bio_noacct+0x256/0x2a0
> [21876.864565]  0xffffffffc01fa6d9
> [21876.864568]  ? 0xffffffffc01f5d01
> [21876.864569]  raid5_get_active_stripe+0x16c0/0x3e00 [raid456]
> [21876.864571]  ? __wake_up_common_lock+0x8a/0xc0
> [21876.864575]  raid5_get_active_stripe+0x2839/0x3e00 [raid456]
> [21876.864577]  raid5_get_active_stripe+0x2d6e/0x3e00 [raid456]
> [21876.864579]  md_thread+0xae/0x170
> [21876.864581]  ? wait_woken+0x60/0x60
> [21876.864582]  ? md_start_sync+0x60/0x60
> [21876.864584]  kthread+0x127/0x150
> [21876.864586]  ? set_kthread_struct+0x40/0x40
> [21876.864588]  ret_from_fork+0x1f/0x30

What kernel base are you using for your patches?

-- 
Jens Axboe


  reply	other threads:[~2021-12-13 23:35 UTC|newest]

Thread overview: 86+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-01 21:51 [PATCH] md: add support for REQ_NOWAIT Vishal Verma
2021-11-02  3:41 ` Li Feng
2021-11-02  5:01 ` Song Liu
2021-11-02 14:40   ` [PATCH v2] " Vishal Verma
2021-11-02 15:31     ` Jens Axboe
2021-11-02 18:35     ` Song Liu
2021-11-04  4:51       ` [PATCH v3 2/2] md: raid1 add nowait support Vishal Verma
2021-11-04  4:51         ` [PATCH v3 1/2] md: add support for REQ_NOWAIT Vishal Verma
2021-11-06 15:38           ` Guoqing Jiang
2021-11-07  0:16             ` Vishal Verma
2021-11-08 22:17           ` Song Liu
2021-11-08 22:36             ` Vishal Verma
2021-11-06 15:24         ` [PATCH v3 2/2] md: raid1 add nowait support Guoqing Jiang
2021-11-07  0:18           ` Vishal Verma
2021-11-08 22:32         ` Song Liu
2021-11-08 22:39           ` Vishal Verma
2021-11-09 20:59             ` Vishal Verma
2021-11-10 17:02               ` Song Liu
2021-11-10 17:04                 ` Vishal Verma
2021-11-10 18:14           ` [RFC PATCH v4 1/4] md: add support for REQ_NOWAIT Vishal Verma
2021-11-10 18:14             ` [RFC PATCH v4 2/4] md: raid1 add nowait support Vishal Verma
2021-11-10 18:14             ` [RFC PATCH v4 3/4] md: raid10 " Vishal Verma
2021-12-14  0:32               ` Song Liu
2021-12-14 15:27                 ` Vishal Verma
2021-11-10 18:14             ` [RFC PATCH v4 4/4] md: raid456 " Vishal Verma
2021-11-11 21:42               ` Song Liu
     [not found]                 ` <f8c2a2bc-a885-8254-2b39-fc0c969ac70d@digitalocean.com>
2021-11-19  4:07                   ` Song Liu
2021-11-19  4:20                     ` Vishal Verma
2021-12-09 16:53                     ` Vishal Verma
2021-12-09 16:59                       ` Song Liu
2021-12-09 17:01                         ` Vishal Verma
2021-12-10  2:16               ` Song Liu
2021-12-10  7:18                 ` Song Liu
2021-12-10 18:26                 ` Vishal Verma
2021-12-13  5:56                   ` Song Liu
2021-12-13 22:43                     ` Vishal Verma
2021-12-13 23:35                       ` Jens Axboe [this message]
     [not found]                         ` <78d5f029-791e-6d3f-4871-263ec6b5c09b@digitalocean.com>
2021-12-14  1:11                           ` Song Liu
2021-12-14  1:12                             ` Vishal Verma
2021-12-14 15:30                               ` Vishal Verma
2021-12-14 17:08                                 ` Song Liu
2021-12-14 18:09                                   ` Vishal Verma
2021-12-15  6:09                                   ` [PATCH v5 1/4] md: add support for REQ_NOWAIT Vishal Verma
2021-12-15  6:09                                     ` [PATCH v5 2/4] md: raid1 add nowait support Vishal Verma
2021-12-15 20:33                                       ` Song Liu
2021-12-15 22:20                                         ` Vishal Verma
2021-12-21 20:06                                           ` [PATCH v6 1/4] md: add support for REQ_NOWAIT Vishal Verma
2021-12-21 20:06                                             ` [PATCH v6 2/4] md: raid1 add nowait support Vishal Verma
2021-12-21 20:06                                             ` [PATCH v6 3/4] md: raid10 " Vishal Verma
2021-12-22 23:58                                               ` Song Liu
2021-12-23  1:47                                               ` Song Liu
2021-12-21 20:06                                             ` [PATCH v6 4/4] md: raid456 " Vishal Verma
2021-12-21 22:02                                               ` John Stoffel
2021-12-25  2:14                                               ` Song Liu
     [not found]                                                 ` <aadc6d52-bc6e-527a-3b9c-0be225f9b727@digitalocean.com>
2021-12-25 22:13                                                   ` Vishal Verma
2021-12-26  0:07                                                     ` Song Liu
2021-12-26  4:02                                                       ` Vishal Verma
2021-12-26 21:20                                                         ` Vishal Verma
2021-12-22 16:06                                             ` [PATCH v6 1/4] md: add support for REQ_NOWAIT Jens Axboe
2021-12-23  1:22                                             ` Song Liu
2021-12-23  2:57                                             ` Song Liu
2021-12-23  3:08                                               ` Vishal Verma
2022-01-02  0:11                                               ` Song Liu
2022-01-02  2:08                                                 ` Vishal Verma
2021-12-23  8:36                                             ` Christoph Hellwig
2021-12-15  6:09                                     ` [PATCH v5 3/4] md: raid10 add nowait support Vishal Verma
2021-12-15 20:42                                       ` Song Liu
2021-12-15 22:20                                         ` Vishal Verma
2021-12-16  0:30                                           ` Vishal Verma
2021-12-16 16:40                                             ` Vishal Verma
2021-12-16 16:42                                             ` Jens Axboe
2021-12-16 16:45                                               ` Vishal Verma
2021-12-16 18:49                                                 ` Jens Axboe
2021-12-16 19:40                                                   ` Vishal Verma
2021-12-16 20:18                                                     ` Song Liu
2021-12-16 20:37                                                       ` Vishal Verma
2021-12-16 23:50                                                         ` Song Liu
     [not found]                                                           ` <bd90d6e6-adb4-2696-3110-fad0b1ee00dc@digitalocean.com>
2021-12-21  8:13                                                             ` Song Liu
2021-12-21 15:29                                                               ` Vishal Verma
2021-12-21 15:59                                                                 ` Jens Axboe
2021-12-21 16:26                                                                   ` Vishal Verma
2021-12-16 18:14                                               ` Vishal Verma
2021-12-15  6:09                                     ` [PATCH v5 4/4] md: raid456 " Vishal Verma
2021-12-15 20:02                                     ` [PATCH v5 1/4] md: add support for REQ_NOWAIT Song Liu
2021-12-14  0:36                       ` [RFC PATCH v4 4/4] md: raid456 add nowait support Song Liu
2021-12-13 23:50             ` [RFC PATCH v4 1/4] md: add support for REQ_NOWAIT Song Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=b70fded5-8f65-7767-25c1-d45b1dcbbddf@kernel.dk \
    --to=axboe@kernel.dk \
    --cc=linux-raid@vger.kernel.org \
    --cc=rgoldwyn@suse.de \
    --cc=song@kernel.org \
    --cc=vverma@digitalocean.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.