memfs_ll: take a lookup reference in memfs_link

memfs_link replies with fuse_reply_entry, which hands the kernel a
new lookup reference on the inode, but it only bumped nlink and never
bumped nlookup.  Every other entry-replying handler (lookup, create,
mkdir) accounts for that reference. Without it, the kernel's accumulated
forget count for a hard-linked inode exceeds nlookup, and dec_lookup()
underflows and panics with "Lookup count mismatch detected" -- readily
reproduced by a concurrent stress loop that hard-links files. Increment
nlookup on the successful link reply.

Signed-off-by: Bernd Schubert <bernd@bsbernd.com>
This commit is contained in:
Bernd Schubert
2026-06-17 13:03:48 +02:00
parent 7952b4b69d
commit a22569e617
+3
View File
@@ -1024,6 +1024,9 @@ static void memfs_link(fuse_req_t req, fuse_ino_t ino, fuse_ino_t newparent,
goto out_unlock_parent;
}
// the reply below hands the kernel a new lookup reference
src_inode->inc_lookup();
memset(&e, 0, sizeof(e));
e.ino = ino;
e.attr_timeout = MEMFS_ATTR_TIMEOUT;