Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1160217pxk; Fri, 18 Sep 2020 05:32:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx5DVUD7R4VxSqX9SQJ1Yzk9BVo0T0cw1+bd8EnRoA5syjGZmdg6IUjpfLia+c/yOvIiAZt X-Received: by 2002:a17:906:f8d1:: with SMTP id lh17mr34677557ejb.409.1600432338360; Fri, 18 Sep 2020 05:32:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600432338; cv=none; d=google.com; s=arc-20160816; b=dmFSj48g1QBc8hTiStowrBIJ+uhxf2ql2CkiYCKqMz7M/dQCtUfUtIVNFOPKKGlWcZ ke4/tkUwKysCOekixCx4ZteQArFD9H/WO1wHpnzqVQEJOsDhF9i9nxEGy1jyHZJU1qkQ Dy9DbU2b/hAYpsIVEHRr63/w1niHIfBNH+5NFZXfnKRvQ9tFcytSpa7rTqOxcPqyua0g 4+P1nc4u6JVYSuF/FHfE71Djkjhng2P4nnFhsFj6ujjptwWQfdrv6+2hzCT38kSaTBAd BJL5X07NFJ8vsw/lSpjWmRD6LiWOB3aod6eybVCJiqP8rHsbIu9CWvyrI8A8YmlB7vXA J0ag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:message-id:subject:cc:to:from:date; bh=qb9VDDN9yIp9DqoN/+RfqCQGHFSolbayGqEaYturCqM=; b=BogFpliDT/lL2hIyFz4rk5KNzpb8eWpmr3Hc6e4l/BU3GzdcRCA5jgjOM568dqbbOH HJ6aErxXU8IhojXrYrRS/iCtmtiy0OFIJAbIHXjDBFvSlxHdu9Rwds4tZosJ4HXBzOGK iIAVX3FKiII4OQUgpt3ItMkh7Xe6Cr4Zgmr9dG7xZmt1JUWwYpCC766PYqfdtkK7Xmqn 4yPk+7axTsCwnUFIAwTh8gQWM023bEto2UQZZ4qLE78KlHo9mZIINL9X/uH7TMyQh2BR V/pIQWnUy0r98A1PzqGgMO1FzThu/epeHJAOOzmaKEvIFmA9F/k9S6cBJebpFENamR7x ZEUw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r1si1924714eja.274.2020.09.18.05.31.54; Fri, 18 Sep 2020 05:32:18 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726397AbgIRMan (ORCPT + 99 others); Fri, 18 Sep 2020 08:30:43 -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: linux-kernel@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