mirror of
https://github.com/libfuse/libfuse.git
synced 2026-07-07 14:47:41 +08:00
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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user