| From | David Howells <> | Subject | [PATCH 26/73] union-mount: Free union stack on removal of topmost dentry from dcache [ver #2] | Date | Tue, 21 Feb 2012 18:00:48 +0000 |
| |
From: Jan Blunck <jblunck@suse.de>
If a dentry is removed from dentry cache because its usage count drops to zero, its union stack is freed too.
Original-author: Jan Blunck <jblunck@suse.de> Signed-off-by: David Howells <dhowells@redhat.com> ---
fs/dcache.c | 10 ++++++++++ 1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/fs/dcache.c b/fs/dcache.c index 326a432..e450890 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -39,6 +39,7 @@ #include <linux/ratelimit.h> #include "internal.h" #include "mount.h" +#include "union.h" /* * Usage: @@ -316,6 +317,7 @@ static struct dentry *d_kill(struct dentry *dentry, struct dentry *parent) if (parent) spin_unlock(&parent->d_lock); dentry_iput(dentry); + d_free_unions(dentry); /* * dentry_iput drops the locks, at which point nobody (except * transient RCU lookups) can reach this dentry. @@ -907,6 +909,7 @@ static void shrink_dcache_for_umount_subtree(struct dentry *dentry) iput(inode); } + d_free_unions(dentry); d_free(dentry); /* finished when we fall off the top of the tree, @@ -2009,6 +2012,7 @@ again: } dentry->d_flags &= ~DCACHE_CANT_MOUNT; dentry_unlink_inode(dentry); + d_free_unions(dentry); fsnotify_nameremove(dentry, isdir); return; } @@ -2018,6 +2022,12 @@ again: spin_unlock(&dentry->d_lock); + /* Remove any associated unions. While someone still has this + * directory open (ref count > 0), we could not have deleted it unless + * it was empty, and therefore has no references to directories below + * it. So we don't need the unions. + */ + d_free_unions(dentry); fsnotify_nameremove(dentry, isdir); } EXPORT_SYMBOL(d_delete);
|