You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: let fsnotify_destroy_group handle mark cleanup to fix race
Previous attempts using flush_workqueue(system_unbound_wq) all failed
because fsnotify_mark_destroy_workfn is queued as a DELAYED work via
queue_delayed_work(). flush_workqueue() does NOT flush delayed works
that haven't expired, so the workfn always races with group freeing.
The correct fix: stop manually destroying marks (fsnotify_destroy_mark
+ fsnotify_put_mark). Instead, just drop our extra mark reference and
let fsnotify_destroy_group() handle everything internally. It calls:
1. fsnotify_clear_marks_by_group — detaches and frees all marks
2. fsnotify_wait_marks_destroyed — flush_delayed_work(&reaper_work)
3. fsnotify_put_group — safe to free group, no pending async work
This is the same pattern used by inotify, fanotify, and all other
fsnotify consumers in the kernel.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>