vfs: Attach inotify watches to their filesystem owners by ayushr2 · Pull Request #16088 · google/gvisor · GitHub
Skip to content

vfs: Attach inotify watches to their filesystem owners - #16088

Draft
ayushr2 wants to merge 1 commit into
masterfrom
codex/inotify-watch-targets
Draft

ayushr2 wants to merge 1 commit into
masterfrom
codex/inotify-watch-targets

Conversation

@ayushr2

@ayushr2 ayushr2 commented Oct 21, 2026

Copy link
Copy Markdown
Collaborator

An inotify watch retains the dentry used to add it even when its watch set
belongs to a shared inode. Allowing an unlinked gofer alias to be destroyed
while another hard link remains then leaves the watch targeting a dead
dentry that cannot be checkpointed.

Introduce WatchTarget and use the owning inode in gofer, tmpfs, EROFS, and
kernfs. Overlay and anonfs retain their dentry targets. Track inode aliases
in gofer and EROFS so removing the last watch rechecks every dentry kept out
of the eviction cache. Notify outside gofer's ancestry lock so one-shot
cleanup can safely evict other aliases.

Preserve gofer watches while another hard link represents the inode. Cover
unlinking the watched alias, checkpoint/restore, continued events through a
surviving link, and final watch deletion. Add alias cleanup tests for watch
removal, inotify close, and one-shot expiry.

Tested: affected filesystem unit tests and nogo; full inotify suites on
Linux, directfs, shared gofer, overlay, and tmpfs; focused save/restore and
lockdep tests.

Related to #16024.

Assisted-by: Codex

An inotify watch retains the dentry used to add it even when its watch set
belongs to a shared inode. Allowing an unlinked gofer alias to be destroyed
while another hard link remains then leaves the watch targeting a dead
dentry that cannot be checkpointed.

Introduce WatchTarget and use the owning inode in gofer, tmpfs, EROFS, and
kernfs. Overlay and anonfs retain their dentry targets. Track inode aliases
in gofer and EROFS so removing the last watch rechecks every dentry kept out
of the eviction cache. Notify outside gofer's ancestry lock so one-shot
cleanup can safely evict other aliases.

Preserve gofer watches while another hard link represents the inode. Cover
unlinking the watched alias, checkpoint/restore, continued events through a
surviving link, and final watch deletion. Add alias cleanup tests for watch
removal, inotify close, and one-shot expiry.

Tested: affected filesystem unit tests and nogo; full inotify suites on
Linux, directfs, shared gofer, overlay, and tmpfs; focused save/restore and
lockdep tests.

Related to #16024.

Assisted-by: Codex
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