Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756607Ab0LAXhJ (ORCPT ); Wed, 1 Dec 2010 18:37:09 -0500 Received: from smtp1.linux-foundation.org ([140.211.169.13]:59863 "EHLO smtp1.linux-foundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755655Ab0LAXhG (ORCPT ); Wed, 1 Dec 2010 18:37:06 -0500 Date: Wed, 1 Dec 2010 15:36:08 -0800 From: Andrew Morton To: Linus Torvalds Cc: Trond Myklebust , Hugh Dickins , Nick Piggin , Nick Bowler , Linux Kernel Mailing List , linux-nfs@vger.kernel.org, Rik van Riel , Christoph Hellwig , Al Viro Subject: Re: [PATCH v2 3/3] NFS: Fix a memory leak in nfs_readdir Message-Id: <20101201153608.78b331f9.akpm@linux-foundation.org> In-Reply-To: References: <1291217804-11257-1-git-send-email-Trond.Myklebust@netapp.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> <20101201123341.d12ef362.akpm@linux-foundation.org> <20101201133831.ea6ba10a.akpm@linux-foundation.org> <1291240272.6609.50.camel@heimdal.trondhjem.org> <20101201141351.8609140b.akpm@linux-foundation.org> <20101201143856.51f4f9d9.akpm@linux-foundation.org> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1391 Lines: 41 On Wed, 1 Dec 2010 15:31:11 -0800 Linus Torvalds wrote: > On Wed, Dec 1, 2010 at 2:38 PM, Andrew Morton wrote: > > > > OK, the stop_machine() plugs a lot of potential race-vs-module-unload > > things. __But Trond is referring to races against vmscan inode reclaim, > > unmount, etc. > > So? > > A filesystem module cannot be unloaded while it's still mounted. > > And unmount doesn't succeed until all inodes are gone. > > And getting rid of an inode doesn't succeed until all pages associated > with it are gone. > > And getting rid of the pages involves locking them (whether in > truncate or vmscan) and removing them from all lists. > > Ergo: vmscan has a locked page leads to the filesystem being > guaranteed to not be unmounted. And that, in turn, guarantees that > the module won't be unloaded until the machine has gone through an > idle cycle. The page isn't attached to the address_space any more: static int __remove_mapping(struct address_space *mapping, struct page *page) { ... __remove_from_page_cache(page); spin_unlock_irq(&mapping->tree_lock); ... } -- 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/