Re: [patch 6/6] mm: fix pagecache write deadlocks

Peter Zijlstra
2006-10-15T11:35:47Z

On Sat, 2006-10-14 at 06:19 +0200, Nick Piggin wrote:
> On Fri, Oct 13, 2006 at 03:14:57PM -0700, Andrew Morton wrote:
> > On Fri, 13 Oct 2006 18:44:52 +0200 (CEST)
> > Nick Piggin <npiggin@suse.de> wrote:

> > > @@ -2450,6 +2436,7 @@ int nobh_truncate_page(struct address_sp
> > > memset(kaddr + offset, 0, PAGE_CACHE_SIZE - offset);
> > > flush_dcache_page(page);
> > > kunmap_atomic(kaddr, KM_USER0);
> > > + SetPageUptodate(page);
> > > set_page_dirty(page);
> > > }
> > > unlock_page(page);
> >
> > I've already forgotten why this was added. Comment, please ;)
>
> Well, nobh_prepare_write no longer sets it uptodate, so we need to if
> we're going to set_page_dirty. OTOH, why does truncate_page need to
> zero the pagecache anyway? I wonder if we couldn't delete this whole
> function? (not in this patchset!)

It zeros the tail end of the page so we don't leak old data?