Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3320735yba; Tue, 23 Apr 2019 01:30:07 -0700 (PDT) X-Google-Smtp-Source: APXvYqwl6yTkgshV6szwnUbibGrPSkvHNXNB6fYfk4gzIK2ndwNYztbNhyDBa/wslCBNGqXraWFM X-Received: by 2002:a63:d709:: with SMTP id d9mr23663138pgg.38.1556008207497; Tue, 23 Apr 2019 01:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556008207; cv=none; d=google.com; s=arc-20160816; b=qKzDemI0E4r2TWrX+cMRDaGaxYNvRfYAB5ObKALc4jHIqGahZuw0iYtve3bERql3c3 ZhhW2Kpg8Ef9zTWWh9W1vYRa0ZVg35RqbAuMDMyvYWqphk1k0a93sIU9ZOnnLWKFboNY +aPy8jZszNRCpcvn9uuaKOjgpdeOhJjuUVUi4Ggxr7UzFFH+j1OiE/sTxP0sJK7QvOiC jhiv25gTSWbbmoE33eK6Vxp8whUQfvKAo6pKd0ugULUOd1HZ+XPKUS8fgXGE7GnxR4/w E4HKKKuec9Mq3kZXD52OZQc81DvzwYS2fGeVuoXBtYbBT2tq1cAOGtdGc33x/9sMuATr MbfQ== 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=CNbIImTYyg/CNsNHBJ7fygvu/1OPcPfdcMzPNCLn1b8=; b=II0OqZniSuA/qqqK95pr6rN5cc9gR2s4eumBxGx6+ThvAZWM0UuGvbQAsrO7feE17x H+c375KU/coIGgXvBRfDRlEyEp6c69JGo7ufSHN9GMFolQHlDHR52alf8pTJYBzlaV/w 6OtJ8Ch1OYi8aVT0Bdx7n0B8fzPgpHIFekHALg+ZGNvh0DYKqsva4dtGPfKbpz+lBX+k dRf4M+Vd0l8HSk5p1yVx57Rf7jgDymANHC3nxQ9Es/166jYvGyajT1xytXLnMGuHGEeg WKwnazYAhHRmy/ZuzM4xOOcsWcvZxN3yXpTG18pW6bvMUmUZl0FMBqzGccH+dYTomCe5 v7vQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=aHSRLaM5; 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 u22si15394484plq.193.2019.04.23.01.29.52; Tue, 23 Apr 2019 01:30:07 -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=aHSRLaM5; 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 S1726617AbfDWI1j (ORCPT + 99 others); Tue, 23 Apr 2019 04:27:39 -0400 Received: from mail-io1-f68.google.com ([209.85.166.68]:33617 "EHLO mail-io1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725888AbfDWI1i (ORCPT ); Tue, 23 Apr 2019 04:27:38 -0400 Received: by mail-io1-f68.google.com with SMTP id u12so1275329iop.0; Tue, 23 Apr 2019 01:27:37 -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=CNbIImTYyg/CNsNHBJ7fygvu/1OPcPfdcMzPNCLn1b8=; b=aHSRLaM5DEAJOEjk+lTeYmJ1MqFRsHoNBqC/DtJEzZnCTEsNNopeRbQyx/37Iwi7yb qmaL6vEbMylDKAD9Ve97o5G10yp36gRHoHjgk52BZQ+S25r7QvN7cIqU0fME+z8baQfC ltkvUe3mTvUqcxEvs3zkZjSWy0PCif8ydntoL4hwAjrdUNlJHERIAHpKAuqoh4uqhPDk WrImW4ZvU3Ortqgwnd14S7Ul09/Mba1bn4dm0mS2kPYQfff6NwCnJ233MmMgZi5QjYS/ vSBGFFFqntPYc1y9Wq5EURIjNuqkQFaArvqGiMkfcuWATt/LxQNwHNdWsjRIY6o+PCep Mm3Q== 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=CNbIImTYyg/CNsNHBJ7fygvu/1OPcPfdcMzPNCLn1b8=; b=BFrm2A50EeNyHYIQeeJRBUebbB1tzpdCDGLTotuvY/ZdfUPxlj9b/vfhsr5JgmYRXm Tb8OtkklD+5GiBJU66CQrKDWpAUUck0Meoqhut2d6v6vNOwWPQD6Z4iNM2t6dNEl7OlA H78D0GLscEAvZRMlJ5ICv80uYdLSPEbl9Dup7k4+oWSSG9P7X3vTup9WL/JlYwsuguCH QXKF58g3Kn07vFAK3ic1GKK6rCFUkFHCpAa0+RMdx7+khi+MECmXjUk7qmKscMlIpKtL Vs5TqkpghZi1CdSNzoi6WSfacByvcA/hyHyKbfNMbuWGAvLD6bn46EQCzcpoTKSvmE1m Hbeg== X-Gm-Message-State: APjAAAW8vGpTUxJ2NqEGH8SolCDVki4guVA1KLN6UlNoxukUD4sigElA 2Ufr6drpnz9Jf5Bg3TBR4mnO0+e8D5r60+61A3FBkqs5rq0= X-Received: by 2002:a6b:cf0f:: with SMTP id o15mr9886010ioa.5.1556008057551; Tue, 23 Apr 2019 01:27:37 -0700 (PDT) MIME-Version: 1.0 References: <20190422194516.11634-1-sashal@kernel.org> <20190422194516.11634-48-sashal@kernel.org> In-Reply-To: <20190422194516.11634-48-sashal@kernel.org> From: Ilya Dryomov Date: Tue, 23 Apr 2019 10:27:34 +0200 Message-ID: Subject: Re: [PATCH AUTOSEL 4.19 48/68] 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:46 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 f7d7f32ac673..ef5216206bdf 100644 > --- a/net/ceph/messenger.c > +++ b/net/ceph/messenger.c > @@ -870,6 +870,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)); > @@ -881,7 +882,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) { > @@ -929,6 +931,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)); > @@ -940,7 +943,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); Hi Sasha, This shouldn't be needed. Multipage bvecs code is new in 5.1 (commit 07173c3ec276 ("block: enable multipage bvecs")), this commit just fixed the fall out. Thanks, Ilya