inotify: coalesce kernel-driven watch cleanup - #960
Merged
Conversation
daandemeyer
force-pushed
the
push-nyqkqvromxor
branch
from
July 25, 2026 12:34
ffe66cc to
6e72c42
Compare
Linux removes watch descriptors automatically when a watched inode is deleted and emits DELETE_SELF and IGNORED. The event loop previously queued the same path multiple times, so cleanup called inotify_rm_watch on an invalid descriptor and then reported WatchNotFound for the duplicate removal. Coalesce pending removals by path and record whether the kernel already removed the root descriptor. Process removals deepest-first, handle IGNORED even when remove events are filtered, and remove potentially live descendant descriptors separately. Treat expected EINVAL deletion races as trace output while warning on unexpected failures. Add regression coverage for IGNORED-only cleanup, duplicate removal coalescing, and moved-out descendant descriptor cleanup. Signed-off-by: Daan De Meyer <daan@amutable.com>
daandemeyer
force-pushed
the
push-nyqkqvromxor
branch
from
July 28, 2026 06:35
190f54b to
82475a1
Compare
Contributor
Author
|
@JohnTitor I have lots of other improvements queued up but can't submit them for testing due to the PR limit on the repo. Could you please bump that PR limit so I don't have to baby sit my PRs all the time? |
Member
|
The limit is to prevent the flood of notifications/slops for maintainers and I cannot bump it. Please understand we all are unpaid OSS maintainers and reviewing takes some time. I need firstly make enough money to live on in work, and I do not have enough financial resources to commit OSS full-time. Thank you for your patience. |
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.
Linux removes watch descriptors automatically when a watched inode is
deleted and emits DELETE_SELF and IGNORED. The event loop previously
queued the same path multiple times, so cleanup called inotify_rm_watch
on an invalid descriptor and then reported WatchNotFound for the
duplicate removal.
Coalesce pending removals by path and record whether the kernel already
removed the root descriptor. Process removals deepest-first, handle
IGNORED even when remove events are filtered, and remove potentially
live descendant descriptors separately. Treat expected EINVAL deletion
races as trace output while warning on unexpected failures.
Add regression coverage for IGNORED-only cleanup, duplicate removal
coalescing, and moved-out descendant descriptor cleanup.
Signed-off-by: Daan De Meyer daan@amutable.com