Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756837Ab0LATz5 (ORCPT ); Wed, 1 Dec 2010 14:55:57 -0500 Received: from smtp1.linux-foundation.org ([140.211.169.13]:33289 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756823Ab0LATzz (ORCPT ); Wed, 1 Dec 2010 14:55:55 -0500 MIME-Version: 1.0 In-Reply-To: <1291229669.6609.24.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> From: Linus Torvalds Date: Wed, 1 Dec 2010 11:47:14 -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 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1145 Lines: 29 On Wed, Dec 1, 2010 at 10:54 AM, Trond Myklebust wrote: > > Hmm... Looking again at the problem, it appears that the same callback > needs to be added to truncate_complete_page() and > invalidate_complete_page2(). Otherwise we end up in a situation where > the page can sometimes be removed from the page cache without calling > freepage(). Yes, I think any caller of __remove_from_page_cache() should do it once it has dropped all locks. And to be consistent with that rule, even in the __remove_mapping() function I suspect the code to call ->freepage() might as well be done only in the __remove_from_page_cache() case (ie not in the PageSwapCache() case). Then, add the case to the end of "remove_page_cache()" itself, and now it's really easy to just grep for __remove_from_page_cache() and make sure they all do it. That sounds sane, no? 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/