Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp737763pxk; Thu, 17 Sep 2020 15:04:49 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwVcbzIPlj69FX/yObSefxIZojImpLINHkngrDUNFJoUVd7m+NpTVwtAw4SIVEJ6rOcgqax X-Received: by 2002:a17:906:e08f:: with SMTP id gh15mr32218685ejb.443.1600380289638; Thu, 17 Sep 2020 15:04:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600380289; cv=none; d=google.com; s=arc-20160816; b=qnTyyyjDS297j4u26gd57NRepUuU3BjfajHurkDr+yhxmgPCFHHwGRi1iksPbdUw2I 8ZbU+hLByEc/OSOWtRnQFVx8De9QvuHdesWDZmXO3jIMU9hXP6vj1Iq9lfYHhyYSeyPg LzRTVXwx9/UHBAGtvl0yGXPhhcVFtq/IqUUBZXBLLs2/TO2mY4sWmJqUcfcPEVdMj+3H DZksSQBSbk3WyIIIgykRcmh8M/MF7GIBeTzHO/776bp3k4lG6aMU3MslZnHGfqkKKdoX 1bL3M8gpevzoBQ6it5v5NEYgLhyGM5wWUXlm/3fzoKTto0/pbo2wE7fiqO1h1hgD6t76 Mx4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=ubJtVk08jzU3J8YPE2lJLRaYSsnYYHZKYdrpjiW6yU4=; b=ZxdG2MASSxAfkh8DnS2krLtBJNuG3q4sUiNM9Cd4ZxMrOXJZr+BM7lP3tneyqrS7ST xN0e9CHN6eOuiWUodGRnRXYMgdok7aoODeH7+YqsyFls2zq6XuAvKTAjkj0e7O3CK6sg cNHaI1iydeeAeMpIC7B3L5Y7+4hQiEuv/5BpkS1fSbKdRHwXoIlwTlcA4kUTRsPUAivx CS2s1s/DvbomZ46sR/gOZ+MFCDhJYxVC9EN9u+OnPcRf8fNxVlIBSwIxbbFpfBCJJl7f XUQH7x6KSWk8JEKL4R5qGUAmbAYF4cSCC75fi97zAk28O2oD/rkqdXwaaDC9wPenQR+M VWfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ICDUnkL7; 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 rk18si765201ejb.599.2020.09.17.15.04.26; Thu, 17 Sep 2020 15:04:49 -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; dkim=pass header.i=@infradead.org header.s=casper.20170209 header.b=ICDUnkL7; 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 S1726262AbgIQWDL (ORCPT + 99 others); Thu, 17 Sep 2020 18:03:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44638 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725900AbgIQWDK (ORCPT ); Thu, 17 Sep 2020 18:03:10 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 331EEC06174A; Thu, 17 Sep 2020 15:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=ubJtVk08jzU3J8YPE2lJLRaYSsnYYHZKYdrpjiW6yU4=; b=ICDUnkL72CW96WATA+3jxM5vWb 6oYT1enLOn3O4Ag28G+e5sc4FqNNUy2Ikgxnpx/LhvjaiBKvrZWAbYzkaYIkc/NjzWtAUaMsW8kTk Yue6qkZhlQb9iYXfoXv9v9sKs+He0hXzIgOzvhGW01abuVdlCsLu5ep5X71lnTxbrbq9ljbXhS2jN fZS2WZ9OlwwNROzSqPlT2fhEu7ifLnDLSIWkeEha9ouk+MkogWQ6Zy5o5FAh5nDVbZ7+o9C1tZcrW sIbCrABL5nerc0GAMK3sNquTExIDELUO/f3nddMDsbHnosACnqilx6WvwEtmQbtPzdCn8oS1kPCcM eCOrz5Qw==; Received: from willy by casper.infradead.org with local (Exim 4.92.3 #3 (Red Hat Linux)) id 1kJ1zf-0003eq-8d; Thu, 17 Sep 2020 22:03:07 +0000 Date: Thu, 17 Sep 2020 23:03:07 +0100 From: Matthew Wilcox To: linux-fsdevel@vger.kernel.org Cc: linux-mm@kvack.org, v9fs-developer@lists.sourceforge.net, linux-kernel@vger.kernel.org, linux-afs@lists.infradead.org, ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org, ecryptfs@vger.kernel.org, linux-um@lists.infradead.org, linux-mtd@lists.infradead.org, Richard Weinberger Subject: Re: [PATCH 01/13] mm: Add AOP_UPDATED_PAGE return value Message-ID: <20200917220307.GX5449@casper.infradead.org> References: <20200917151050.5363-1-willy@infradead.org> <20200917151050.5363-2-willy@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200917151050.5363-2-willy@infradead.org> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 17, 2020 at 04:10:38PM +0100, Matthew Wilcox (Oracle) wrote: > +++ b/mm/filemap.c > @@ -2254,8 +2254,10 @@ ssize_t generic_file_buffered_read(struct kiocb *iocb, > * PG_error will be set again if readpage fails. > */ > ClearPageError(page); > - /* Start the actual read. The read will unlock the page. */ > + /* Start the actual read. The read may unlock the page. */ > error = mapping->a_ops->readpage(filp, page); > + if (error == AOP_UPDATED_PAGE) > + goto page_ok; > > if (unlikely(error)) { > if (error == AOP_TRUNCATED_PAGE) { If anybody wants to actually test this, this hunk is wrong. +++ b/mm/filemap.c @@ -2256,8 +2256,11 @@ ssize_t generic_file_buffered_read(struct kiocb *iocb, ClearPageError(page); /* Start the actual read. The read may unlock the page. */ error = mapping->a_ops->readpage(filp, page); - if (error == AOP_UPDATED_PAGE) + if (error == AOP_UPDATED_PAGE) { + unlock_page(page); + error = 0; goto page_ok; + } if (unlikely(error)) { if (error == AOP_TRUNCATED_PAGE) { > @@ -2619,7 +2621,7 @@ vm_fault_t filemap_fault(struct vm_fault *vmf) > */ > if (unlikely(!PageUptodate(page))) > goto page_not_uptodate; > - > +page_ok: > /* > * We've made it this far and we had to drop our mmap_lock, now is the > * time to return to the upper layer and have it re-find the vma and > @@ -2654,6 +2656,8 @@ vm_fault_t filemap_fault(struct vm_fault *vmf) > ClearPageError(page); > fpin = maybe_unlock_mmap_for_io(vmf, fpin); > error = mapping->a_ops->readpage(file, page); > + if (error == AOP_UPDATED_PAGE) > + goto page_ok; > if (!error) { > wait_on_page_locked(page); > if (!PageUptodate(page)) > @@ -2867,6 +2871,10 @@ static struct page *do_read_cache_page(struct address_space *mapping, > err = filler(data, page); > else > err = mapping->a_ops->readpage(data, page); > + if (err == AOP_UPDATED_PAGE) { > + unlock_page(page); > + goto out; > + } > > if (err < 0) { > put_page(page); > -- > 2.28.0 >