Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754864Ab1EDSsO (ORCPT ); Wed, 4 May 2011 14:48:14 -0400 Received: from bombadil.infradead.org ([18.85.46.34]:38043 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754345Ab1EDSsM (ORCPT ); Wed, 4 May 2011 14:48:12 -0400 Date: Wed, 4 May 2011 14:48:03 -0400 From: Christoph Hellwig To: "Darrick J. Wong" Cc: "Theodore Ts'o" , Christoph Hellwig , Chris Mason , Jeff Layton , Jan Kara , Dave Chinner , Joel Becker , "Martin K. Petersen" , Jens Axboe , linux-kernel , linux-fsdevel , Mingming Cao , linux-scsi , Dave Hansen , linux-mm@kvack.org, linux-ext4 Subject: Re: [PATCH v3 3/3] mm: Wait for writeback when grabbing pages to begin a write Message-ID: <20110504184803.GB23246@infradead.org> References: <20110406232938.GF1110@tux1.beaverton.ibm.com> <20110407165700.GB7363@quack.suse.cz> <20110408203135.GH1110@tux1.beaverton.ibm.com> <20110411124229.47bc28f6@corrin.poochiereds.net> <1302543595-sup-4352@think> <1302569212.2580.13.camel@mingming-laptop> <20110412005719.GA23077@infradead.org> <1302742128.2586.274.camel@mingming-laptop> <20110422000226.GA22189@tux1.beaverton.ibm.com> <20110504174227.GH20579@tux1.beaverton.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110504174227.GH20579@tux1.beaverton.ibm.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1315 Lines: 45 On Wed, May 04, 2011 at 10:42:27AM -0700, Darrick J. Wong wrote: > When grabbing a page for a buffered IO write, the mm should wait for writeback > on the page to complete so that the page does not become writable during the IO > operation. > > Signed-off-by: Darrick J. Wong > --- > > mm/filemap.c | 5 ++++- > 1 files changed, 4 insertions(+), 1 deletions(-) > > diff --git a/mm/filemap.c b/mm/filemap.c > index c641edf..c22675f 100644 > --- a/mm/filemap.c > +++ b/mm/filemap.c > @@ -2287,8 +2287,10 @@ struct page *grab_cache_page_write_begin(struct address_space *mapping, > gfp_notmask = __GFP_FS; > repeat: > page = find_lock_page(mapping, index); > - if (page) > + if (page) { > + wait_on_page_writeback(page); > return page; > + } goto found; > > page = __page_cache_alloc(mapping_gfp_mask(mapping) & ~gfp_notmask); > if (!page) > @@ -2301,6 +2303,7 @@ repeat: > goto repeat; > return NULL; > } found: > + wait_on_page_writeback(page); > return page; > } > EXPORT_SYMBOL(grab_cache_page_write_begin); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/