[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1291247776.6609.79.camel@heimdal.trondhjem.org>
Date: Wed, 01 Dec 2010 18:56:16 -0500
From: Trond Myklebust <Trond.Myklebust@...app.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Hugh Dickins <hughd@...gle.com>,
Nick Piggin <npiggin@...nel.dk>,
Nick Bowler <nbowler@...iptictech.com>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
linux-nfs@...r.kernel.org, Rik van Riel <riel@...hat.com>,
Christoph Hellwig <hch@....de>,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH v2 3/3] NFS: Fix a memory leak in nfs_readdir
On Wed, 2010-12-01 at 15:46 -0800, Andrew Morton wrote:
> On Wed, 01 Dec 2010 18:21:16 -0500
> Trond Myklebust <Trond.Myklebust@...app.com> wrote:
>
> > --- a/mm/truncate.c
> > +++ b/mm/truncate.c
> > @@ -108,6 +108,10 @@ truncate_complete_page(struct address_space *mapping, struct page *page)
> > clear_page_mlock(page);
> > remove_from_page_cache(page);
> > ClearPageMappedToDisk(page);
> > +
> > + if (mapping->a_ops->freepage)
> > + mapping->a_ops->freepage(page);
> > +
> > page_cache_release(page); /* pagecache ref */
> > return 0;
> > }
>
> So here we're assuming that `mapping' was pinned by other means.
>
> Fair enough, although subtle. Even drop_pagecache_sb() got it right ;)
>
> > @@ -390,6 +394,10 @@ invalidate_complete_page2(struct address_space *mapping, struct page *page)
> > __remove_from_page_cache(page);
> > spin_unlock_irq(&mapping->tree_lock);
> > mem_cgroup_uncharge_cache_page(page);
> > +
> > + if (mapping->a_ops->freepage)
> > + mapping->a_ops->freepage(page);
> > +
> > page_cache_release(page); /* pagecache ref */
> > return 1;
> > failed:
>
> And here.
Yes. Both these functions are static, and their callers are assuming
that something is already pinning the underlying inode, so the above
should be quite safe.
--
Trond Myklebust
Linux NFS client maintainer
NetApp
Trond.Myklebust@...app.com
www.netapp.com
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists