summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2013-07-17 14:53:53 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-07-28 16:30:07 -0700
commitdc2a6c2d3e9a2529b3ffc70c165cbb10c85768f5 (patch)
tree26132a7ba4d824a5d4bbbee435db9f646ee1ab7a /fs
parent05ac7b3a7db7823aecde55df6a5f8d6bb45693f4 (diff)
fuse: readdirplus: fix instantiate
commit 2914941e3178d84a216fc4eb85292dfef3b6d628 upstream. Fuse does instantiation slightly differently from NFS/CIFS which use d_materialise_unique(). Signed-off-by: Miklos Szeredi <mszeredi@suse.cz> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/fuse/dir.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 5532bf416f9b..a71df0206f6f 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1264,10 +1264,19 @@ static int fuse_direntplus_link(struct file *file,
if (!inode)
goto out;
- alias = d_materialise_unique(dentry, inode);
- err = PTR_ERR(alias);
- if (IS_ERR(alias))
- goto out;
+ if (S_ISDIR(inode->i_mode)) {
+ mutex_lock(&fc->inst_mutex);
+ alias = fuse_d_add_directory(dentry, inode);
+ mutex_unlock(&fc->inst_mutex);
+ err = PTR_ERR(alias);
+ if (IS_ERR(alias)) {
+ iput(inode);
+ goto out;
+ }
+ } else {
+ alias = d_splice_alias(inode, dentry);
+ }
+
if (alias) {
dput(dentry);
dentry = alias;