diff options
author | Niels de Vos <ndevos@redhat.com> | 2013-07-17 08:53:53 -0400 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2013-07-17 08:53:53 -0400 |
commit | 53ce9a3364de0723b27d861de93bfc882f7db050 (patch) | |
tree | 0e8d69c9544fd3c55d9c8bf198485abd07e26f1a /fs/fuse | |
parent | ad81f0545ef01ea651886dddac4bef6cec930092 (diff) |
fuse: readdirplus: fix dentry leak
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>
CC: stable@vger.kernel.org
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/dir.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index 0eda52738ec4..2ae5308174e2 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c | |||
@@ -1227,9 +1227,15 @@ static int fuse_direntplus_link(struct file *file, | |||
1227 | 1227 | ||
1228 | name.hash = full_name_hash(name.name, name.len); | 1228 | name.hash = full_name_hash(name.name, name.len); |
1229 | dentry = d_lookup(parent, &name); | 1229 | dentry = d_lookup(parent, &name); |
1230 | if (dentry && dentry->d_inode) { | 1230 | if (dentry) { |
1231 | inode = dentry->d_inode; | 1231 | inode = dentry->d_inode; |
1232 | if (get_node_id(inode) == o->nodeid) { | 1232 | if (!inode) { |
1233 | d_drop(dentry); | ||
1234 | } else if (get_node_id(inode) != o->nodeid) { | ||
1235 | err = d_invalidate(dentry); | ||
1236 | if (err) | ||
1237 | goto out; | ||
1238 | } else { | ||
1233 | struct fuse_inode *fi; | 1239 | struct fuse_inode *fi; |
1234 | fi = get_fuse_inode(inode); | 1240 | fi = get_fuse_inode(inode); |
1235 | spin_lock(&fc->lock); | 1241 | spin_lock(&fc->lock); |
@@ -1242,9 +1248,6 @@ static int fuse_direntplus_link(struct file *file, | |||
1242 | */ | 1248 | */ |
1243 | goto found; | 1249 | goto found; |
1244 | } | 1250 | } |
1245 | err = d_invalidate(dentry); | ||
1246 | if (err) | ||
1247 | goto out; | ||
1248 | dput(dentry); | 1251 | dput(dentry); |
1249 | dentry = NULL; | 1252 | dentry = NULL; |
1250 | } | 1253 | } |