diff options
author | ruanmeisi <ruan.meisi@zte.com.cn> | 2023-04-25 14:13:54 +0300 |
---|---|---|
committer | Miklos Szeredi <mszeredi@redhat.com> | 2023-08-16 10:40:48 +0300 |
commit | b8bd342d50cbf606666488488f9fea374aceb2d5 (patch) | |
tree | bc93138e5677b5f848aca1ae080730ffb4c1171a /fs/fuse | |
parent | 91ec6c85599b60c00caf4e9a9d6c4d6e5dd5e93c (diff) | |
download | linux-b8bd342d50cbf606666488488f9fea374aceb2d5.tar.xz |
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/4081
Signed-off-by: ruanmeisi <ruan.meisi@zte.com.cn>
Fixes: 0b05b18381ee ("fuse: implement NFS-like readdirplus support")
Cc: <stable@vger.kernel.org> # v3.9
Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Diffstat (limited to 'fs/fuse')
-rw-r--r-- | fs/fuse/readdir.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/fuse/readdir.c b/fs/fuse/readdir.c index dc603479b30e..b3d498163f97 100644 --- a/fs/fuse/readdir.c +++ b/fs/fuse/readdir.c @@ -243,8 +243,16 @@ retry: dput(dentry); 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); + } } if (fc->readdirplus_auto) set_bit(FUSE_I_INIT_RDPLUS, &get_fuse_inode(inode)->state); |