From mboxrd@z Thu Jan 1 00:00:00 1970 From: jblunck@suse.de Subject: [PATCH 2/5] vfs: d_genocide() doesnt add dentries to unused list Date: Fri, 16 Jun 2006 12:43:23 +0200 Message-ID: <20060616104322.204073000@hasse.suse.de> References: <20060616104321.778718000@hasse.suse.de> Cc: linux-fsdevel@vger.kernel.org, akpm@osdl.org, viro@zeniv.linux.org.uk, dgc@sgi.com, balbir@in.ibm.com, neilb@suse.de Return-path: To: linux-kernel@vger.kernel.org Content-Disposition: inline; filename=patches.jbl/vfs-d_genocide-fix.diff Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org Calling d_genocide() is only lowering the reference count of the dentries but doesn't add them to the unused list. Signed-off-by: Jan Blunck --- fs/dcache.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) Index: work-2.6/fs/dcache.c =================================================================== --- work-2.6.orig/fs/dcache.c +++ work-2.6/fs/dcache.c @@ -1612,11 +1612,25 @@ resume: this_parent = dentry; goto repeat; } - atomic_dec(&dentry->d_count); + if (!list_empty(&dentry->d_lru)) { + dentry_stat.nr_unused--; + list_del_init(&dentry->d_lru); + } + if (atomic_dec_and_test(&dentry->d_count)) { + list_add(&dentry->d_lru, dentry_unused.prev); + dentry_stat.nr_unused++; + } } if (this_parent != root) { next = this_parent->d_u.d_child.next; - atomic_dec(&this_parent->d_count); + if (!list_empty(&this_parent->d_lru)) { + dentry_stat.nr_unused--; + list_del_init(&this_parent->d_lru); + } + if (atomic_dec_and_test(&this_parent->d_count)) { + list_add(&this_parent->d_lru, dentry_unused.prev); + dentry_stat.nr_unused++; + } this_parent = this_parent->d_parent; goto resume; }