All of lore.kernel.org
 help / color / mirror / Atom feed
From: Alex Elder <elder@ieee.org>
To: Jeff Layton <jlayton@kernel.org>, ceph-devel@vger.kernel.org
Cc: idryomov@gmail.com, xiubli@redhat.com
Subject: Re: [PATCH] libceph: fix last_piece calculation in ceph_msg_data_pages_advance
Date: Wed, 2 Mar 2022 09:41:16 -0600	[thread overview]
Message-ID: <b10682fe-54a9-5103-4921-66f8c0f22382@ieee.org> (raw)
In-Reply-To: <20220302153744.43541-1-jlayton@kernel.org>

On 3/2/22 9:37 AM, Jeff Layton wrote:
> It's possible we'll have less than a page's worth of residual data, that
> is stradding the last two pages in the array. That will make it
> incorrectly set the last_piece boolean when it shouldn't.
> 
> Account for a non-zero cursor->page_offset when advancing.

It's been quite a while I looked at this code, but isn't
cursor->resid supposed to be the number of bytes remaining,
irrespective of the offset?

Have you found this to cause a failure?

					-Alex

> Signed-off-by: Jeff Layton <jlayton@kernel.org>
> ---
>   net/ceph/messenger.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
> index d3bb656308b4..3f8453773cc8 100644
> --- a/net/ceph/messenger.c
> +++ b/net/ceph/messenger.c
> @@ -894,10 +894,9 @@ static bool ceph_msg_data_pages_advance(struct ceph_msg_data_cursor *cursor,
>   		return false;   /* no more data */
>   
>   	/* Move on to the next page; offset is already at 0 */
> -
>   	BUG_ON(cursor->page_index >= cursor->page_count);
>   	cursor->page_index++;
> -	cursor->last_piece = cursor->resid <= PAGE_SIZE;
> +	cursor->last_piece = cursor->page_offset + cursor->resid <= PAGE_SIZE;
>   
>   	return true;
>   }


  reply	other threads:[~2022-03-02 15:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-02 15:37 [PATCH] libceph: fix last_piece calculation in ceph_msg_data_pages_advance Jeff Layton
2022-03-02 15:41 ` Alex Elder [this message]
2022-03-02 16:15   ` Jeff Layton
2022-03-02 17:03     ` Ilya Dryomov
2022-03-02 18:12       ` Jeff Layton

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=b10682fe-54a9-5103-4921-66f8c0f22382@ieee.org \
    --to=elder@ieee.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=jlayton@kernel.org \
    --cc=xiubli@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 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.