Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754151AbdDLOjB (ORCPT ); Wed, 12 Apr 2017 10:39:01 -0400 Received: from bombadil.infradead.org ([65.50.211.133]:43173 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752286AbdDLOi6 (ORCPT ); Wed, 12 Apr 2017 10:38:58 -0400 Date: Wed, 12 Apr 2017 07:38:57 -0700 From: Matthew Wilcox To: Jeff Layton Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, tytso@mit.edu, jack@suse.cz, neilb@suse.com, viro@zeniv.linux.org.uk Subject: Re: [PATCH v2 06/17] mm: doc comment for scary spot in write_one_page Message-ID: <20170412143857.GD784@bombadil.infradead.org> References: <20170412120614.6111-1-jlayton@redhat.com> <20170412120614.6111-7-jlayton@redhat.com> <1492002094.2937.4.camel@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1492002094.2937.4.camel@redhat.com> User-Agent: Mutt/1.7.1 (2016-10-04) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1381 Lines: 34 On Wed, Apr 12, 2017 at 09:01:34AM -0400, Jeff Layton wrote: > On Wed, 2017-04-12 at 08:06 -0400, Jeff Layton wrote: > > Not sure what to do here just yet. > > > > Signed-off-by: Jeff Layton > > --- > > mm/page-writeback.c | 6 ++++++ > > 1 file changed, 6 insertions(+) > > > > diff --git a/mm/page-writeback.c b/mm/page-writeback.c > > index de0dbf12e2c1..3ac8399dc984 100644 > > --- a/mm/page-writeback.c > > +++ b/mm/page-writeback.c > > @@ -2388,6 +2388,12 @@ int write_one_page(struct page *page) > > ret = mapping->a_ops->writepage(page, &wbc); > > if (ret == 0) { > > wait_on_page_writeback(page); > > + /* > > + * FIXME: is this racy? What guarantees that PG_error > > + * will still be set once we get around to checking it? > > + * What if writeback fails, but then a read is issued > > + * before we check this, and that calls ClearPageError? > > + */ > > if (PageError(page)) > > ret = -EIO; > > } > > Ahh, we are always under the page lock here, and this is generally used > for writing out directory pages anyway. I'm fine with dropping this > patch unless someone else sees a problem here. ->writepage drops the page lock. We're still holding a refcount on this page, but that's not going to prevent read being called. But maybe the filesystem won't call read on a page that's marked as PageError?