Repository navigation
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Superseded by upstream PR #4819, now merged. It resolves the same rename race using directory-lock ordering. The local development branch adopted that implementation in fe4b7cd after a full build, ten focused checks, 20 queue runs pinned to one core, and the forced 32-byte read-boundary regression passed. The normal 16 KiB buffer is restored. This fork proposal is closed as superseded; its original proposal and validation follow for reference.
What
The Linux vnode watcher matches rename cookies only within one inotify read. If the matching IN_MOVED_FROM and IN_MOVED_TO land in different reads, a rename inside a watched directory incorrectly reports NOTE_WRITE | NOTE_EXTEND. The existing guest_kqueue directory-rename assertion intermittently fails for this reason.
Retain move cookies across reads with a 20 ms bounded wait. Matching opposite-direction events produce one NOTE_WRITE; unmatched entries preserve the existing cross-directory hints after expiry. Stop remains interruptible and pending hints are flushed when the host watch ends. Add deterministic tests for split/interleaved pairs, directory pairs, unmatched arrivals/departures, expiry, duplicate cookies and delayed processing; extend the native queue test with movement outside and back into the watched directory.
The mechanism follows the inotify(7) rename caveat: rename pairs may be split across reads and are not inserted atomically. The 20 ms wait is a host policy, not measured console timing; a counterpart arriving after expiry is still treated as a separate move. Windows behavior is unchanged.
Tested
An investigation-only 32-byte inotify read buffer forces the existing rename pair into separate reads. Before the fix, guest_kqueue fails with one event, flags 0x6 (WRITE | EXTEND). With the fix, the same fixture returns flags 0x2 (WRITE) and passes. The normal 16 KiB buffer is restored; no buffer override or diagnostic print is committed.
Full bundled Linux Release integration build with 32 workers; commit f17e22f on upstream 43e3a70. Normal-buffer guest_kqueue passes 40 consecutive runs. Eleven focused checks pass without skips, including the move matcher, native kqueue/equeue/socket tests, patched libraries and HTTP network regression. Both topic and integration conventions pass. Production FileEvent.cpp, matcher and test sources match the tested integration exactly. That integration includes other development fixes; an independent full topic build and Windows run have not been done. No title progression or new guest exports are claimed.
This review PR is in the JJenkx fork because the upstream author allowance is occupied by boykopovar#4474. Its base branch preserves the already-merged upstream kqueue/file-event implementation and follow-up tests with their authors; the PR diff contains only this fix. All prerequisites are already in upstream main.
Checklist