Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3321133yba; Tue, 23 Apr 2019 01:30:36 -0700 (PDT) X-Google-Smtp-Source: APXvYqwpSbscJhDKg1Il8w/YP3nxHZ/HveARfWs76wZFZw0e6KqzBNu3LU05NMfw8r/TId/BQIYg X-Received: by 2002:a63:cc0a:: with SMTP id x10mr23944575pgf.179.1556008236873; Tue, 23 Apr 2019 01:30:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556008236; cv=none; d=google.com; s=arc-20160816; b=Uj4XHva525GRVvU1mKoCZ4bA152sMS6TJDfGWDZdpnECVGqWAY+xCvRcJuPAe9HQyv r6hztWcKn2GHry9c8g5fpLS8tphaPWhp9bbUel2z2JoMIFJuT5m7eGq1p1HJJZPZM7VS 9FKLB3/cDwhTw+Om7zdu8uTl4gIUpgjRZs/j9HKp5x8IMlj/THlHAIrSeojduwYbCmnw HpNZkRGMTqzzmVtazz35hAo6SfC7PXn6hpsFxFNSqqcjrtrPsnPmH62xihSPl/J3BudY 5RZCBzOVI/h2OOx+A36fufMaTppgS8cqebfdl/jcxidzyAwKqi3CY1ZLmwOTBQi/jlzG VVZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=gNYp5B3WW49wZuSSd+AU4UVnQVS79h4V7MG01aCk1c4=; b=fpoqYW2X7ILY3HtrvtwsLvCq8HzFP+nQ673v7v6PGPZy5Nfxl3aAfUtJ8kQy9GLSt3 NrRy9o6dZTOLsNrt7YcAiFB8EUHE7/YEDgYpkKs71LRH4Y904lvKIIRaGXYQXBbFPsvp rUc+dRkFgODncxkRQ2OpF6LHfHDi5BI5Y/FZKg2Bf/IxyfAkxSD+xhcSrG0EDwsC9GH4 dlFT3NteA14vhB6Upvcy95biVYhDR4GbUf+YrIjUQyZP8tlBqGoPCRb43VEAiArpBjxP nOHFmkRMc/WJJRg+Ki+hMF9X5OH4AbVYdp6193ruJYS7PcVPsl6jv2Pf/NhiQHWMD8E8 Y2xA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BuBIkpxD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b68si15832707plb.351.2019.04.23.01.30.21; Tue, 23 Apr 2019 01:30:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BuBIkpxD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727193AbfDWI3B (ORCPT + 99 others); Tue, 23 Apr 2019 04:29:01 -0400 Received: from mail-it1-f194.google.com ([209.85.166.194]:35671 "EHLO mail-it1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725888AbfDWI3A (ORCPT ); Tue, 23 Apr 2019 04:29:00 -0400 Received: by mail-it1-f194.google.com with SMTP id w15so22420608itc.0; Tue, 23 Apr 2019 01:29:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gNYp5B3WW49wZuSSd+AU4UVnQVS79h4V7MG01aCk1c4=; b=BuBIkpxDnqhVJQGHtHsevkVcisx8RJSEdl3bpUqmj9luxaikK6hvXmmbttnMEWmrZ/ BW2x7ne3jfVbZgtzkn1N3GIVELGJ/3XB1nWojR+h3w7D8wrVzDrkSZ1zwoT/s36CFxo+ RhIWH2MHdf2bwXXp31WRrE8fbiQ4I2HrjvSQMpxxA4RaqC4vn9/wpxRdtzekIdz/zGup UP7i09Pt/cUBlcecq3NkxTYi1qkC+M5XY89dac/u6qcm1DGgt1kbBPbCAIqElT6/BTnU HnZBAN4PHEaqKjWHh7v9PJA1N1fcAR9BHSf0OsBRtkF46+MdV3dZzxnadWZS7O1S3gXr VusA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gNYp5B3WW49wZuSSd+AU4UVnQVS79h4V7MG01aCk1c4=; b=dZNRwpb++/FTy3Kby+rnfqgRJ1MIXAaD+WCalN1opBzMrLsDS3Er7JhEvmOM9bwYic jKRNUjnLEa34vG0Qq3U0gks5/eqIuF4TfEUr5QRagmaDqWGaqb8twvOIYsXsp6ZUcR+5 M/1Bk6rAT+t8YRI1gPvinudjZ/1Ah16745Cql1hNDCZUmFyNnUjI66yT7bVIw8uITh+U 7OZmyB0///gr1W1bMZlLaKqbD/GQX1Gn97hGE58we22MoweOMzJD+faryVXgNW0yIFPt yWsq2dFBdvX/eyHEXrCm9KYQ8G2+RV8aUKS1UFfAaME0uqL0P6lT08iDx+D6PO5iU6ar OMGg== X-Gm-Message-State: APjAAAWZfTQL8FJJId+rcUSY9KBLg8YwN6YxCQnvu9IYwtp+7l9hBHti uwHSWZvPB21TGBKrVCKhflC4tfmAQwU3Kw4zFnU= X-Received: by 2002:a02:c4cf:: with SMTP id h15mr16634119jaj.96.1556008139688; Tue, 23 Apr 2019 01:28:59 -0700 (PDT) MIME-Version: 1.0 References: <20190422194205.10404-1-sashal@kernel.org> <20190422194205.10404-61-sashal@kernel.org> In-Reply-To: <20190422194205.10404-61-sashal@kernel.org> From: Ilya Dryomov Date: Tue, 23 Apr 2019 10:28:56 +0200 Message-ID: Subject: Re: [PATCH AUTOSEL 5.0 61/98] libceph: fix breakage caused by multipage bvecs To: Sasha Levin Cc: LKML , stable@vger.kernel.org, Ceph Development , netdev Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 22, 2019 at 9:44 PM Sasha Levin wrote: > > From: Ilya Dryomov > > [ 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 > Signed-off-by: Sasha Levin (Microsoft) > --- > 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. Thanks, Ilya