mbox series

[v3,0/2] libceph: sparse-read misc fixes

Message ID 20231106011644.248119-1-xiubli@redhat.com
Headers show
Series libceph: sparse-read misc fixes | expand

Message

Xiubo Li Nov. 6, 2023, 1:16 a.m. UTC
From: Xiubo Li <xiubli@redhat.com>

V3:
- Remove the WARN_ON_ONCE().
- Return -EREMOTEIO when the datalen and extents mismatch.

V2:
- Remove [1/3] patch from V1.

Xiubo Li (2):
  libceph: save and covert sr_datalen to host-endian
  libceph: check the data length when sparse-read finishes

 include/linux/ceph/osd_client.h |  3 ++-
 net/ceph/osd_client.c           | 15 ++++++++++++++-
 2 files changed, 16 insertions(+), 2 deletions(-)

Comments

Ilya Dryomov Nov. 6, 2023, 11:54 a.m. UTC | #1
On Mon, Nov 6, 2023 at 2:19 AM <xiubli@redhat.com> wrote:
>
> From: Xiubo Li <xiubli@redhat.com>
>
> For sparse reading the real length of the data should equal to the
> total length from the extent array.
>
> URL: https://tracker.ceph.com/issues/62081
> Signed-off-by: Xiubo Li <xiubli@redhat.com>
> Reviewed-by: Jeff Layton <jlayton@kernel.org>
> ---
>  net/ceph/osd_client.c | 8 ++++++++
>  1 file changed, 8 insertions(+)
>
> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> index 0e629dfd55ee..050dc39065fb 100644
> --- a/net/ceph/osd_client.c
> +++ b/net/ceph/osd_client.c
> @@ -5920,6 +5920,12 @@ static int osd_sparse_read(struct ceph_connection *con,
>                 fallthrough;
>         case CEPH_SPARSE_READ_DATA:
>                 if (sr->sr_index >= count) {
> +                       if (sr->sr_datalen && count) {
> +                               pr_warn_ratelimited("%s: datalen and extents mismath, %d left\n",
> +                                                   __func__, sr->sr_datalen);
> +                               return -EREMOTEIO;

By returning EREMOTEIO here you have significantly changed the
semantics (in v2 it was just a warning) but Jeff's Reviewed-by is
retained.  Has he acked the change?

Thanks,

                Ilya
Xiubo Li Nov. 6, 2023, 12:17 p.m. UTC | #2
On 11/6/23 19:54, Ilya Dryomov wrote:
> On Mon, Nov 6, 2023 at 2:19 AM <xiubli@redhat.com> wrote:
>> From: Xiubo Li <xiubli@redhat.com>
>>
>> For sparse reading the real length of the data should equal to the
>> total length from the extent array.
>>
>> URL: https://tracker.ceph.com/issues/62081
>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>> Reviewed-by: Jeff Layton <jlayton@kernel.org>
>> ---
>>   net/ceph/osd_client.c | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
>> index 0e629dfd55ee..050dc39065fb 100644
>> --- a/net/ceph/osd_client.c
>> +++ b/net/ceph/osd_client.c
>> @@ -5920,6 +5920,12 @@ static int osd_sparse_read(struct ceph_connection *con,
>>                  fallthrough;
>>          case CEPH_SPARSE_READ_DATA:
>>                  if (sr->sr_index >= count) {
>> +                       if (sr->sr_datalen && count) {
>> +                               pr_warn_ratelimited("%s: datalen and extents mismath, %d left\n",
>> +                                                   __func__, sr->sr_datalen);
>> +                               return -EREMOTEIO;
> By returning EREMOTEIO here you have significantly changed the
> semantics (in v2 it was just a warning) but Jeff's Reviewed-by is
> retained.  Has he acked the change?

Oh, sorry I forgot to remove that.

Jeff, Please take a look here again.

Thanks

- Xiubo

> Thanks,
>
>                  Ilya
>
Jeff Layton Nov. 6, 2023, 12:32 p.m. UTC | #3
On Mon, 2023-11-06 at 20:17 +0800, Xiubo Li wrote:
> On 11/6/23 19:54, Ilya Dryomov wrote:
> > On Mon, Nov 6, 2023 at 2:19 AM <xiubli@redhat.com> wrote:
> > > From: Xiubo Li <xiubli@redhat.com>
> > > 
> > > For sparse reading the real length of the data should equal to the
> > > total length from the extent array.
> > > 
> > > URL: https://tracker.ceph.com/issues/62081
> > > Signed-off-by: Xiubo Li <xiubli@redhat.com>
> > > Reviewed-by: Jeff Layton <jlayton@kernel.org>
> > > ---
> > >   net/ceph/osd_client.c | 8 ++++++++
> > >   1 file changed, 8 insertions(+)
> > > 
> > > diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
> > > index 0e629dfd55ee..050dc39065fb 100644
> > > --- a/net/ceph/osd_client.c
> > > +++ b/net/ceph/osd_client.c
> > > @@ -5920,6 +5920,12 @@ static int osd_sparse_read(struct ceph_connection *con,
> > >                  fallthrough;
> > >          case CEPH_SPARSE_READ_DATA:
> > >                  if (sr->sr_index >= count) {
> > > +                       if (sr->sr_datalen && count) {
> > > +                               pr_warn_ratelimited("%s: datalen and extents mismath, %d left\n",
> > > +                                                   __func__, sr->sr_datalen);
> > > +                               return -EREMOTEIO;
> > By returning EREMOTEIO here you have significantly changed the
> > semantics (in v2 it was just a warning) but Jeff's Reviewed-by is
> > retained.  Has he acked the change?
> 
> Oh, sorry I forgot to remove that.
> 
> Jeff, Please take a look here again.
> 
> Thanks
> 
> - Xiubo
> 
> 

Returning EREMOTEIO if the lengths don't match seems like a reasonable
thing to do. You can retain the R-b.
Xiubo Li Nov. 6, 2023, 1:01 p.m. UTC | #4
On 11/6/23 20:32, Jeff Layton wrote:
> On Mon, 2023-11-06 at 20:17 +0800, Xiubo Li wrote:
>> On 11/6/23 19:54, Ilya Dryomov wrote:
>>> On Mon, Nov 6, 2023 at 2:19 AM <xiubli@redhat.com> wrote:
>>>> From: Xiubo Li <xiubli@redhat.com>
>>>>
>>>> For sparse reading the real length of the data should equal to the
>>>> total length from the extent array.
>>>>
>>>> URL: https://tracker.ceph.com/issues/62081
>>>> Signed-off-by: Xiubo Li <xiubli@redhat.com>
>>>> Reviewed-by: Jeff Layton <jlayton@kernel.org>
>>>> ---
>>>>    net/ceph/osd_client.c | 8 ++++++++
>>>>    1 file changed, 8 insertions(+)
>>>>
>>>> diff --git a/net/ceph/osd_client.c b/net/ceph/osd_client.c
>>>> index 0e629dfd55ee..050dc39065fb 100644
>>>> --- a/net/ceph/osd_client.c
>>>> +++ b/net/ceph/osd_client.c
>>>> @@ -5920,6 +5920,12 @@ static int osd_sparse_read(struct ceph_connection *con,
>>>>                   fallthrough;
>>>>           case CEPH_SPARSE_READ_DATA:
>>>>                   if (sr->sr_index >= count) {
>>>> +                       if (sr->sr_datalen && count) {
>>>> +                               pr_warn_ratelimited("%s: datalen and extents mismath, %d left\n",
>>>> +                                                   __func__, sr->sr_datalen);
>>>> +                               return -EREMOTEIO;
>>> By returning EREMOTEIO here you have significantly changed the
>>> semantics (in v2 it was just a warning) but Jeff's Reviewed-by is
>>> retained.  Has he acked the change?
>> Oh, sorry I forgot to remove that.
>>
>> Jeff, Please take a look here again.
>>
>> Thanks
>>
>> - Xiubo
>>
>>
> Returning EREMOTEIO if the lengths don't match seems like a reasonable
> thing to do. You can retain the R-b.
>
Thanks Jeff.

- Xiubo