Skip to content

Conversation

@benhillis
Copy link
Member

link() returns a fuse_entry_out for the target inode, which creates a kernel dentry reference that will later be released via forget(). Without incrementing the lookup count, the subsequent forget would undercount and potentially free the inode prematurely.

Copilot AI review requested due to automatic review settings February 10, 2026 16:22
@benhillis benhillis requested a review from a team as a code owner February 10, 2026 16:22
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes virtio-fs inode lifetime accounting for link(). Because link() returns a fuse_entry_out for an existing inode, it implicitly creates an additional kernel lookup reference that must be balanced by a later forget(); without incrementing the inode lookup count, the inode could be removed prematurely.

Changes:

  • Increment the target inode’s lookup count in Fuse::link() before returning fuse_entry_out.
  • Add a VirtioFsInode::add_ref() helper to increment lookup count without updating the inode’s stored path.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
vm/devices/virtio/virtiofs/src/lib.rs Ensures link() properly accounts for the kernel dentry/lookup reference by incrementing the target inode’s lookup count.
vm/devices/virtio/virtiofs/src/inode.rs Introduces add_ref() as a small API to increment lookup_count without changing the stored path.

link() returns a fuse_entry_out for the target inode, which creates a
kernel dentry reference that will later be released via forget(). Without
incrementing the lookup count, the subsequent forget would undercount
and potentially free the inode prematurely.
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant