Skip to content

Commit b8bd342

Browse files
ruanmeisiMiklos Szeredi
authored andcommitted
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 gluster/glusterfs#4081 Signed-off-by: ruanmeisi <ruan.meisi@zte.com.cn> Fixes: 0b05b18 ("fuse: implement NFS-like readdirplus support") Cc: <stable@vger.kernel.org> # v3.9 Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
1 parent 91ec6c8 commit b8bd342

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

fs/fuse/readdir.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,8 +243,16 @@ static int fuse_direntplus_link(struct file *file,
243243
dput(dentry);
244244
dentry = alias;
245245
}
246-
if (IS_ERR(dentry))
246+
if (IS_ERR(dentry)) {
247+
if (!IS_ERR(inode)) {
248+
struct fuse_inode *fi = get_fuse_inode(inode);
249+
250+
spin_lock(&fi->lock);
251+
fi->nlookup--;
252+
spin_unlock(&fi->lock);
253+
}
247254
return PTR_ERR(dentry);
255+
}
248256
}
249257
if (fc->readdirplus_auto)
250258
set_bit(FUSE_I_INIT_RDPLUS, &get_fuse_inode(inode)->state);

0 commit comments

Comments
 (0)