Commit b8bd342d authored by ruanmeisi's avatar ruanmeisi Committed by Miklos Szeredi

fuse: nlookup missing decrement in fuse_direntplus_link

During our debugging of glusterfs, we found an Assertion failed error:
inode_lookup >= nlookup, which was caused by the nlookup value in the
kernel being greater than that in the FUSE file system.

The issue was introduced by fuse_direntplus_link, where in the function,
fuse_iget increments nlookup, and if d_splice_alias returns failure,
fuse_direntplus_link returns failure without decrementing nlookup
https://github.com/gluster/glusterfs/pull/4081Signed-off-by: default avatarruanmeisi <ruan.meisi@zte.com.cn>
Fixes: 0b05b183 ("fuse: implement NFS-like readdirplus support")
Cc: <stable@vger.kernel.org> # v3.9
Signed-off-by: default avatarMiklos Szeredi <mszeredi@redhat.com>
parent 91ec6c85
...@@ -243,8 +243,16 @@ static int fuse_direntplus_link(struct file *file, ...@@ -243,8 +243,16 @@ static int fuse_direntplus_link(struct file *file,
dput(dentry); dput(dentry);
dentry = alias; dentry = alias;
} }
if (IS_ERR(dentry)) if (IS_ERR(dentry)) {
if (!IS_ERR(inode)) {
struct fuse_inode *fi = get_fuse_inode(inode);
spin_lock(&fi->lock);
fi->nlookup--;
spin_unlock(&fi->lock);
}
return PTR_ERR(dentry); return PTR_ERR(dentry);
}
} }
if (fc->readdirplus_auto) if (fc->readdirplus_auto)
set_bit(FUSE_I_INIT_RDPLUS, &get_fuse_inode(inode)->state); set_bit(FUSE_I_INIT_RDPLUS, &get_fuse_inode(inode)->state);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment