Skip to contentSkip to conversation

Subject: [PATCH] nlookup missing decrement in fuse_direntplus_link

PATCH Applied Miklos Szeredi 2 participants 3 messages Aug 10, 2023 – Aug 16, 2023 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Miklos Szeredi

author maintainer
#1 lore raw
Quoted 21 lines · On Thu, 10 Aug 2023 at 05:25, <[email protected]> wrote:

From 53aad83672123dbe01bcef9f9026becc4e93ee9f Mon Sep 17 00:00:00 2001

From: ruanmeisi <[email protected]>

Date: Tue, 25 Apr 2023 19:13:54 +0800

Subject: [PATCH] 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

Quoted 8 lines

d_splice_alias returns failure, fuse_direntplus_link returns

failure without decrementing nlookup

https://github.com/gluster/glusterfs/pull/4081

Thanks. Patch looks good.

Please resend as plain text otherwise the mailing lists will reject it and also tools will fail to handle it, so it can't be applied.

If you can't send as plain text, sending as an attachment is still better.

Thanks,
Miklos

#2 lore raw

PATCH 1/1 nlookup missing decrement in fuse_direntplus_link

From 53aad83672123dbe01bcef9f9026becc4e93ee9f Mon Sep 17 00:00:00 2001
From: ruanmeisi <[email protected]>
Date: Tue, 25 Apr 2023 19:13:54 +0800
Subject: [PATCH] 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

---
 fs/fuse/readdir.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
fs/fuse/readdir.c +9 -1
index dc603479b30e..b3d498163f97 100644
@@ -243,8 +243,16 @@ static int fuse_direntplus_link(struct file *file,
 			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);
Signature · 1 line
2.27.0
author maintainer Applied
#3 lore raw

Re: [PATCH] nlookup missing decrement in fuse_direntplus_link

Quoted 15 lines · On Fri, 11 Aug 2023 at 09:12, <[email protected]> wrote:

From 53aad83672123dbe01bcef9f9026becc4e93ee9f Mon Sep 17 00:00:00 2001
From: ruanmeisi <[email protected]>
Date: Tue, 25 Apr 2023 19:13:54 +0800
Subject: [PATCH] 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

Quoted 1 line

Applied, thanks.

Miklos