netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: Ilya Dryomov <idryomov@gmail.com>
Cc: LKML <linux-kernel@vger.kernel.org>,
	stable@vger.kernel.org,
	Ceph Development <ceph-devel@vger.kernel.org>,
	netdev <netdev@vger.kernel.org>
Subject: Re: [PATCH AUTOSEL 5.0 61/98] libceph: fix breakage caused by multipage bvecs
Date: Thu, 2 May 2019 08:51:45 -0400	[thread overview]
Message-ID: <20190502125145.GC11584@sasha-vm> (raw)
In-Reply-To: <CAOi1vP8Q=bH9uXVi=35PKpE0T=MNpRViaBJWPMYfD6_pfC8xRw@mail.gmail.com>

On Tue, Apr 23, 2019 at 10:28:56AM +0200, Ilya Dryomov wrote:
>On Mon, Apr 22, 2019 at 9:44 PM Sasha Levin <sashal@kernel.org> wrote:
>>
>> From: Ilya Dryomov <idryomov@gmail.com>
>>
>> [ Upstream commit 187df76325af5d9e12ae9daec1510307797e54f0 ]
>>
>> A bvec can now consist of multiple physically contiguous pages.
>> This means that bvec_iter_advance() can move to a different page while
>> staying in the same bvec (i.e. ->bi_bvec_done != 0).
>>
>> The messenger works in terms of segments which can now be defined as
>> the smaller of a bvec and a page.  The "more bytes to process in this
>> segment" condition holds only if bvec_iter_advance() leaves us in the
>> same bvec _and_ in the same page.  On next bvec (possibly in the same
>> page) and on next page (possibly in the same bvec) we may need to set
>> ->last_piece.
>>
>> Signed-off-by: Ilya Dryomov <idryomov@gmail.com>
>> Signed-off-by: Sasha Levin (Microsoft) <sashal@kernel.org>
>> ---
>>  net/ceph/messenger.c | 8 ++++++--
>>  1 file changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/net/ceph/messenger.c b/net/ceph/messenger.c
>> index 7e71b0df1fbc..3083988ce729 100644
>> --- a/net/ceph/messenger.c
>> +++ b/net/ceph/messenger.c
>> @@ -840,6 +840,7 @@ static bool ceph_msg_data_bio_advance(struct ceph_msg_data_cursor *cursor,
>>                                         size_t bytes)
>>  {
>>         struct ceph_bio_iter *it = &cursor->bio_iter;
>> +       struct page *page = bio_iter_page(it->bio, it->iter);
>>
>>         BUG_ON(bytes > cursor->resid);
>>         BUG_ON(bytes > bio_iter_len(it->bio, it->iter));
>> @@ -851,7 +852,8 @@ static bool ceph_msg_data_bio_advance(struct ceph_msg_data_cursor *cursor,
>>                 return false;   /* no more data */
>>         }
>>
>> -       if (!bytes || (it->iter.bi_size && it->iter.bi_bvec_done))
>> +       if (!bytes || (it->iter.bi_size && it->iter.bi_bvec_done &&
>> +                      page == bio_iter_page(it->bio, it->iter)))
>>                 return false;   /* more bytes to process in this segment */
>>
>>         if (!it->iter.bi_size) {
>> @@ -899,6 +901,7 @@ static bool ceph_msg_data_bvecs_advance(struct ceph_msg_data_cursor *cursor,
>>                                         size_t bytes)
>>  {
>>         struct bio_vec *bvecs = cursor->data->bvec_pos.bvecs;
>> +       struct page *page = bvec_iter_page(bvecs, cursor->bvec_iter);
>>
>>         BUG_ON(bytes > cursor->resid);
>>         BUG_ON(bytes > bvec_iter_len(bvecs, cursor->bvec_iter));
>> @@ -910,7 +913,8 @@ static bool ceph_msg_data_bvecs_advance(struct ceph_msg_data_cursor *cursor,
>>                 return false;   /* no more data */
>>         }
>>
>> -       if (!bytes || cursor->bvec_iter.bi_bvec_done)
>> +       if (!bytes || (cursor->bvec_iter.bi_bvec_done &&
>> +                      page == bvec_iter_page(bvecs, cursor->bvec_iter)))
>>                 return false;   /* more bytes to process in this segment */
>>
>>         BUG_ON(cursor->last_piece);
>
>Same here, shouldn't be needed.

Dropped, thanks!

--
Thanks,
Sasha

  reply	other threads:[~2019-05-02 12:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20190422194205.10404-1-sashal@kernel.org>
2019-04-22 19:40 ` [PATCH AUTOSEL 5.0 16/98] netfilter: nft_set_rbtree: check for inactive element after flag mismatch Sasha Levin
2019-04-22 19:40 ` [PATCH AUTOSEL 5.0 17/98] netfilter: bridge: set skb transport_header before entering NF_INET_PRE_ROUTING Sasha Levin
2019-04-22 19:40 ` [PATCH AUTOSEL 5.0 18/98] netfilter: fix NETFILTER_XT_TARGET_TEE dependencies Sasha Levin
2019-04-22 19:40 ` [PATCH AUTOSEL 5.0 19/98] netfilter: ip6t_srh: fix NULL pointer dereferences Sasha Levin
2019-04-22 19:40 ` [PATCH AUTOSEL 5.0 20/98] netfilter: nf_tables: bogus EBUSY in helper removal from transaction Sasha Levin
2019-04-22 19:41 ` [PATCH AUTOSEL 5.0 37/98] net: ks8851: Dequeue RX packets explicitly Sasha Levin
2019-04-22 19:41 ` [PATCH AUTOSEL 5.0 38/98] net: ks8851: Reassert reset pin if chip ID check fails Sasha Levin
2019-04-22 19:41 ` [PATCH AUTOSEL 5.0 39/98] net: ks8851: Delay requesting IRQ until opened Sasha Levin
2019-04-22 19:41 ` [PATCH AUTOSEL 5.0 40/98] net: ks8851: Set initial carrier state to down Sasha Levin
2019-04-22 19:41 ` [PATCH AUTOSEL 5.0 45/98] net: phy: Add DP83825I to the DP83822 driver Sasha Levin
2019-04-22 19:41 ` [PATCH AUTOSEL 5.0 46/98] net: macb: Add null check for PCLK and HCLK Sasha Levin
2019-04-22 19:41 ` [PATCH AUTOSEL 5.0 47/98] net/sched: don't dereference a->goto_chain to read the chain index Sasha Levin
2019-04-22 19:41 ` [PATCH AUTOSEL 5.0 51/98] net: xilinx: fix possible object reference leak Sasha Levin
2019-04-22 19:41 ` [PATCH AUTOSEL 5.0 52/98] net: ibm: " Sasha Levin
2019-04-22 19:41 ` [PATCH AUTOSEL 5.0 53/98] net: ethernet: ti: " Sasha Levin
2019-04-22 19:41 ` [PATCH AUTOSEL 5.0 61/98] libceph: fix breakage caused by multipage bvecs Sasha Levin
2019-04-23  8:28   ` Ilya Dryomov
2019-05-02 12:51     ` Sasha Levin [this message]
2019-04-22 19:41 ` [PATCH AUTOSEL 5.0 67/98] SUNRPC: fix uninitialized variable warning Sasha Levin

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=20190502125145.GC11584@sasha-vm \
    --to=sashal@kernel.org \
    --cc=ceph-devel@vger.kernel.org \
    --cc=idryomov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /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 NNTP newsgroup(s).