From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=BAYES_00,FAKE_REPLY_C, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2A8D7C43464 for ; Fri, 18 Sep 2020 12:30:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D9A4A2084C for ; Fri, 18 Sep 2020 12:30:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726299AbgIRMam (ORCPT ); Fri, 18 Sep 2020 08:30:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37458 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725955AbgIRMam (ORCPT ); Fri, 18 Sep 2020 08:30:42 -0400 Received: from nautica.notk.org (ipv6.notk.org [IPv6:2001:41d0:1:7a93::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40856C06174A; Fri, 18 Sep 2020 05:30:42 -0700 (PDT) Received: by nautica.notk.org (Postfix, from userid 1001) id 58A7FC01D; Fri, 18 Sep 2020 14:30:40 +0200 (CEST) Date: Fri, 18 Sep 2020 14:30:25 +0200 From: Dominique Martinet To: "Matthew Wilcox (Oracle)" Cc: linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org, Richard Weinberger , ecryptfs@vger.kernel.org, linux-um@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-mtd@lists.infradead.org, v9fs-developer@lists.sourceforge.net, ceph-devel@vger.kernel.org, linux-afs@lists.infradead.org Subject: Re: [V9fs-developer] [PATCH 02/13] 9p: Tell the VFS that readpage was synchronous Message-ID: <20200918123025.GA735@nautica> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200918111916.GA32101@casper.infradead.org> <20200917151050.5363-3-willy@infradead.org> User-Agent: Mutt/1.5.21 (2010-09-15) Precedence: bulk List-ID: X-Mailing-List: ceph-devel@vger.kernel.org Matthew Wilcox (Oracle) wrote on Thu, Sep 17, 2020: > The 9p readpage implementation was already synchronous, so use > AOP_UPDATED_PAGE to avoid cycling the page lock. > > Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Dominique Martinet (I assume it'll be merged together with the rest) > > What I'm curious about is the page used to be both unlocked and put, but > > now isn't either and the return value hasn't changed for the caller to > > make a difference on write_begin / I don't see any code change in the > > vfs to handle that. > > What did I miss? > > The page cache is kind of subtle. The grab_cache_page_write_begin() > will return a Locked page with an increased refcount. If it's Uptodate, > that's exactly what we want, and we return it. If we have to read the > page, readpage used to unlock the page before returning, and rather than > re-lock it, we would drop the reference to the page and look it up again. > It's possible that after dropping the lock on that page that the page > was replaced in the page cache and so we'd get a different page. Thanks for the explanation, I didn't realize the page already is gotten/locked at the PageUptodate goto out. > Anyway, now (unless fscache is involved), v9fs_fid_readpage will return > the page without unlocking it. So we don't need to do the dance of > dropping the lock, putting the refcount and looking the page back up > again. We can just return the page. The VFS doesn't need a special > return code because nothing has changed from the VFS's point of view -- > it asked you to get a page and you got the page. Yes, looks good to me. Cheers, -- Dominique