summaryrefslogtreecommitdiff
path: root/fs/fuse
diff options
context:
space:
mode:
authorNiels de Vos <ndevos@redhat.com>2013-07-17 14:53:53 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-28 16:30:07 -0700
commit05ac7b3a7db7823aecde55df6a5f8d6bb45693f4 (patch)
treed141871c29e281efcca627976892f3210162b2fd /fs/fuse
parentdf18f5f93ce9ed27bd9a779196614afd7a0aa017 (diff)
downloadlinux-3.10-05ac7b3a7db7823aecde55df6a5f8d6bb45693f4.tar.gz
linux-3.10-05ac7b3a7db7823aecde55df6a5f8d6bb45693f4.tar.bz2
linux-3.10-05ac7b3a7db7823aecde55df6a5f8d6bb45693f4.zip
fuse: readdirplus: fix dentry leak
commit 53ce9a3364de0723b27d861de93bfc882f7db050 upstream. In case d_lookup() returns a dentry with d_inode == NULL, the dentry is not returned with dput(). This results in triggering a BUG() in shrink_dcache_for_umount_subtree(): BUG: Dentry ...{i=0,n=...} still in use (1) [unmount of fuse fuse] [SzM: need to d_drop() as well] Reported-by: Justin Clift <jclift@redhat.com> Signed-off-by: Niels de Vos <ndevos@redhat.com> Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Tested-by: Brian Foster <bfoster@redhat.com> Tested-by: Niels de Vos <ndevos@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/fuse')
-rw-r--r--fs/fuse/dir.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index f3f783dc4f7..5532bf416f9 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1229,9 +1229,15 @@ static int fuse_direntplus_link(struct file *file,
name.hash = full_name_hash(name.name, name.len);
dentry = d_lookup(parent, &name);
- if (dentry && dentry->d_inode) {
+ if (dentry) {
inode = dentry->d_inode;
- if (get_node_id(inode) == o->nodeid) {
+ if (!inode) {
+ d_drop(dentry);
+ } else if (get_node_id(inode) != o->nodeid) {
+ err = d_invalidate(dentry);
+ if (err)
+ goto out;
+ } else {
struct fuse_inode *fi;
fi = get_fuse_inode(inode);
spin_lock(&fc->lock);
@@ -1244,9 +1250,6 @@ static int fuse_direntplus_link(struct file *file,
*/
goto found;
}
- err = d_invalidate(dentry);
- if (err)
- goto out;
dput(dentry);
dentry = NULL;
}