Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756909Ab0LAUTt (ORCPT ); Wed, 1 Dec 2010 15:19:49 -0500 Received: from smtp1.linux-foundation.org ([140.211.169.13]:32983 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755632Ab0LAUTs convert rfc822-to-8bit (ORCPT ); Wed, 1 Dec 2010 15:19:48 -0500 MIME-Version: 1.0 In-Reply-To: <1291234251.6609.39.camel@heimdal.trondhjem.org> References: <1291217804-11257-1-git-send-email-Trond.Myklebust@netapp.com> <1291217804-11257-2-git-send-email-Trond.Myklebust@netapp.com> <20101201150428.GA2879@elliptictech.com> <1291217804-11257-3-git-send-email-Trond.Myklebust@netapp.com> <1291217804-11257-4-git-send-email-Trond.Myklebust@netapp.com> <1291229669.6609.24.camel@heimdal.trondhjem.org> <1291234251.6609.39.camel@heimdal.trondhjem.org> From: Linus Torvalds Date: Wed, 1 Dec 2010 12:18:58 -0800 Message-ID: Subject: Re: [PATCH v2 3/3] NFS: Fix a memory leak in nfs_readdir To: Trond Myklebust Cc: Nick Bowler , Linux Kernel Mailing List , linux-nfs@vger.kernel.org, Andrew Morton , Hugh Dickins , Rik van Riel , Christoph Hellwig , Al Viro Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1151 Lines: 31 On Wed, Dec 1, 2010 at 12:10 PM, Trond Myklebust wrote: > > Something like the following then? > diff --git a/mm/truncate.c b/mm/truncate.c > index ba887bf..76ab2a8 100644 > --- 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; > ?} I'd do this in "remove_from_page_cache()" instead of in "truncate_complete_page()". Otherwise it will miss any other callers that use "remove_from_page_cache()" (not that there are many, and I doubt NFS cares about the ones that do exists, but..) Linus -- 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/