Skip to content

inotify: coalesce kernel-driven watch cleanup - #960

Merged
JohnTitor merged 1 commit into
notify-rs:mainfrom
daandemeyer:push-nyqkqvromxor
Aug 1, 2026
Merged

inotify: coalesce kernel-driven watch cleanup#960
JohnTitor merged 1 commit into
notify-rs:mainfrom
daandemeyer:push-nyqkqvromxor

Conversation

@daandemeyer

Copy link
Copy Markdown
Contributor

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

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

Copy link
Copy Markdown
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?

@JohnTitor

Copy link
Copy Markdown
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.

@JohnTitor JohnTitor left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM, thanks!

@JohnTitor
JohnTitor merged commit 478b867 into notify-rs:main Aug 1, 2026
18 checks passed
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.

2 participants