diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2013-07-17 14:53:53 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2013-07-17 14:53:53 +0200 |
commit | 2914941e3178d84a216fc4eb85292dfef3b6d628 (patch) | |
tree | 67b5af9d9dbf10d8f20c2c5a9dc1dc20c23a3cd3 /fs/fuse | |
parent | fuse: readdirplus: sanity checks (diff) | |
download | linux-2914941e3178d84a216fc4eb85292dfef3b6d628.tar.xz linux-2914941e3178d84a216fc4eb85292dfef3b6d628.zip |
fuse: readdirplus: fix instantiate
Fuse does instantiation slightly differently from NFS/CIFS which use
d_materialise_unique().
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
CC: stable@vger.kernel.org
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/dir.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c index bb6829720dd6..5dfbb5439e4e 100644 --- a/fs/fuse/dir.c +++ b/fs/fuse/dir.c @@ -1272,10 +1272,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; |