Skip to content

Commit 437d889

Browse files
ruanmeisigregkh
authored andcommitted
fuse: nlookup missing decrement in fuse_direntplus_link
commit b8bd342 upstream. 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 <[email protected]> Fixes: 0b05b18 ("fuse: implement NFS-like readdirplus support") Cc: <[email protected]> # v3.9 Signed-off-by: Miklos Szeredi <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 74f6bca commit 437d889

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

fs/fuse/dir.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1314,8 +1314,16 @@ static int fuse_direntplus_link(struct file *file,
13141314
dput(dentry);
13151315
dentry = alias;
13161316
}
1317-
if (IS_ERR(dentry))
1317+
if (IS_ERR(dentry)) {
1318+
if (!IS_ERR(inode)) {
1319+
struct fuse_inode *fi = get_fuse_inode(inode);
1320+
1321+
spin_lock(&fc->lock);
1322+
fi->nlookup--;
1323+
spin_unlock(&fc->lock);
1324+
}
13181325
return PTR_ERR(dentry);
1326+
}
13191327
}
13201328
if (fc->readdirplus_auto)
13211329
set_bit(FUSE_I_INIT_RDPLUS, &get_fuse_inode(inode)->state);

0 commit comments

Comments
 (0)