CEPH-Devel archive mirror
 help / color / mirror / Atom feed
From: Xiubo Li <xiubli@redhat.com>
To: Ilya Dryomov <idryomov@gmail.com>
Cc: ceph-devel@vger.kernel.org, jlayton@kernel.org,
	vshankar@redhat.com, mchangir@redhat.com
Subject: Re: [PATCH v3] libceph: remove the max extents check for sparse read
Date: Tue, 7 Nov 2023 18:42:57 +0800	[thread overview]
Message-ID: <19db51b8-841b-8433-2b42-7bc9c70e383f@redhat.com> (raw)
In-Reply-To: <CAOi1vP9J8JWFRpVEoojgH_LOdJm+dvvQO-EzyhPAW55kQ0k_vw@mail.gmail.com>


On 11/7/23 18:14, Ilya Dryomov wrote:
> On Tue, Nov 7, 2023 at 2:47 AM <xiubli@redhat.com> wrote:
>> From: Xiubo Li <xiubli@redhat.com>
>>
>> There is no any limit for the extent array size and it's possible
>> that when reading with a large size contents the total number of
>> extents will exceed 4096. Then the messager will fail by reseting
>> the connection and keeps resending the inflight IOs infinitely.
>>
>> URL: https://tracker.ceph.com/issues/62081
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> ---
>>
>> V3:
>> - Remove the max extents check and add one debug log.
>>
>> V2:
>> - Increase the MAX_EXTENTS instead of removing it.
>> - Do not return an errno when hit the limit.
>>
>>
>>
>>
>>   net/ceph/osd_client.c | 17 ++++-------------
>>   1 file changed, 4 insertions(+), 13 deletions(-)
>>
>> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
>> index c03d48bd3aff..5f10ab76d0f3 100644
>> --- a/net/ceph/osd_client.c
>> +++ b/net/ceph/osd_client.c
>> @@ -5850,8 +5850,6 @@ static inline void convert_extent_map(struct ceph_sparse_read *sr)
>>   }
>>   #endif
>>
>> -#define MAX_EXTENTS 4096
>> -
>>   static int osd_sparse_read(struct ceph_connection *con,
>>                             struct ceph_msg_data_cursor *cursor,
>>                             char **pbuf)
>> @@ -5882,23 +5880,16 @@ static int osd_sparse_read(struct ceph_connection *con,
>>
>>                  if (count > 0) {
>>                          if (!sr->sr_extent || count > sr->sr_ext_len) {
>> -                               /*
>> -                                * Apply a hard cap to the number of extents.
>> -                                * If we have more, assume something is wrong.
>> -                                */
>> -                               if (count > MAX_EXTENTS) {
>> -                                       dout("%s: OSD returned 0x%x extents in a single reply!\n",
>> -                                            __func__, count);
>> -                                       return -EREMOTEIO;
>> -                               }
>> -
>>                                  /* no extent array provided, or too short */
>>                                  kfree(sr->sr_extent);
>>                                  sr->sr_extent = kmalloc_array(count,
>>                                                                sizeof(*sr->sr_extent),
>>                                                                GFP_NOIO);
>> -                               if (!sr->sr_extent)
>> +                               if (!sr->sr_extent) {
>> +                                       pr_err("%s: failed to allocate %u sparse read extents\n",
>> +                                              __func__, count);
> Hi Xiubo,
>
> No need to include the function name: a) this is an error message as
> opposed to a debug message and b) such allocation is done only in one
> place anyway.

Okay, will remove it.

Thanks

- Xiubo


> Otherwise LGTM!
>
> Thanks,
>
>                  Ilya
>


      reply	other threads:[~2023-11-07 10:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-07  1:44 [PATCH v3] libceph: remove the max extents check for sparse read xiubli
2023-11-07 10:14 ` Ilya Dryomov
2023-11-07 10:42   ` Xiubo Li [this message]

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=19db51b8-841b-8433-2b42-7bc9c70e383f@redhat.com \
    --to=xiubli@redhat.com \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=mchangir@redhat.com \
    --cc=vshankar@redhat.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).