]> git.ipfire.org Git - thirdparty/samba.git/commit
smbd: Handle split MOVED_FROM/MOVED_TO inotify events
authorVolker Lendecke <vl@samba.org>
Tue, 27 May 2025 11:46:30 +0000 (13:46 +0200)
committerRalph Boehme <slow@samba.org>
Mon, 2 Jun 2025 17:08:34 +0000 (17:08 +0000)
commit245d80c6a98349a656f5a79ffd3e15e6255df243
treecac20575257ecf78f4353bc452b980a9dc958c81
parent2b317dd80002b7f87710317118bca35a20e85f4c
smbd: Handle split MOVED_FROM/MOVED_TO inotify events

inotify(7) explicitly states that MOVED_FROM and MOVED_TO are not
atomically added to the inotify queue. Save MOVED_FROM in the watch
descriptor and try to match a later MOVED_TO with that. If no
corresponding MOVED_TO comes, send out a NOTIFY_ACTION_REMOVED after
100 milliseconds.

This is all racy, as we only catch directly corresponding FROM and TO
events. According to inotify(7) anything can come in between FROM and
TO, in particular other FROM/TO pairs. The best we can do I think is
turn dislocated FROM/TO pairs as REMOVED/ADDED instead of the original
Windows rename OLD_NAME/NEW_NAME.

Bug: https://bugzilla.samba.org/show_bug.cgi?id=15864
Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Ralph Boehme <slow@samba.org>
source3/smbd/notify_inotify.c