Skip to content

fsimpl: Fix Linux rmdir inotify event ordering#13014

Open
copybara-service[bot] wants to merge 1 commit intomasterfrom
test/cl905392574
Open

fsimpl: Fix Linux rmdir inotify event ordering#13014
copybara-service[bot] wants to merge 1 commit intomasterfrom
test/cl905392574

Conversation

@copybara-service
Copy link
Copy Markdown

fsimpl: Fix Linux rmdir inotify event ordering

Gradle File System Watching relies on the child watch receiving IN_DELETE_SELF/IN_IGNORED before the parent's IN_DELETE|IN_ISDIR to invalidate its VFS snapshot when a watched directory is removed.

Linux does not emit rmdir inotify events with a single unconditional ordering.

If the removed directory has no extra references, the child receives IN_DELETE_SELF/IN_IGNORED before the parent's IN_DELETE|IN_ISDIR.

If an extra reference remains, such as an open directory FD, Linux still emits the parent's IN_DELETE|IN_ISDIR at rmdir() time and defers the child's IN_DELETE_SELF/IN_IGNORED until the final reference is dropped.

Match that behavior across overlay, tmpfs, gofer, and kernfs by eagerly sending child deletion notifications only in the no-extra-ref case, and keeping the parent delete notification on the rmdir path.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#12948 from tanyifeng:overlay-rmdir-inotify-order f130e14

Gradle File System Watching relies on the child watch receiving IN_DELETE_SELF/IN_IGNORED before the parent's IN_DELETE|IN_ISDIR to invalidate its VFS snapshot when a watched directory is removed.

Linux does not emit rmdir inotify events with a single unconditional ordering.

If the removed directory has no extra references, the child receives IN_DELETE_SELF/IN_IGNORED before the parent's IN_DELETE|IN_ISDIR.

If an extra reference remains, such as an open directory FD, Linux still emits the parent's IN_DELETE|IN_ISDIR at rmdir() time and defers the child's IN_DELETE_SELF/IN_IGNORED until the final reference is dropped.

Match that behavior across overlay, tmpfs, gofer, and kernfs by eagerly sending child deletion notifications only in the no-extra-ref case, and keeping the parent delete notification on the rmdir path.

FUTURE_COPYBARA_INTEGRATE_REVIEW=#12948 from tanyifeng:overlay-rmdir-inotify-order f130e14
PiperOrigin-RevId: 905392574
@copybara-service copybara-service Bot added the exported Issue was exported automatically label Apr 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

exported Issue was exported automatically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant