Files
Hungyu Lin 581230d2ec inotify: do not coalesce rename events
inotify compares the mask, watch descriptor and name when coalescing
adjacent unread events, but ignores their rename cookies. Distinct
IN_MOVED_FROM events can therefore be coalesced, losing the cookie needed
to match a later IN_MOVED_TO event.

For example, watch two directories with IN_MOVE. Move an entry from the
first directory into an unwatched directory, recreate it under the same
name, then move it from the first directory into the second watched
directory before reading the events. The second IN_MOVED_FROM is merged
with the first, while the IN_MOVED_TO retains the second rename's cookie.
Userspace can no longer pair the second rename's events.

The original inotify implementation compared cookies before coalescing.
The fsnotify conversion lost this comparison. Do not coalesce
IN_MOVED_FROM or IN_MOVED_TO events, which carry the identity of their
respective renames. Leave coalescing of other event types unchanged.

Fixes: 63c882a054 ("inotify: reimplement inotify using fsnotify")
Cc: [email protected]
Suggested-by: Amir Goldstein <[email protected]>
Signed-off-by: Hungyu Lin <[email protected]>
Reviewed-by: Amir Goldstein <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jan Kara <[email protected]>
2026-11-03 14:05:25 +01:00
..
2025-07-14 10:13:31 +02:00
2023-02-02 16:26:06 -08:00