CRIU supports checkpointing and restoring inotify and fanotify instances. These mechanisms allow applications to monitor filesystem events (like file creation, modification, or deletion).
Restoring an fsnotify instance is inherently difficult because the kernel does not provide a direct way to retrieve the original path of a watched object (the “watchee”). Furthermore, the event queues themselves pose consistency risks.
When an application adds a watch (via inotify_add_watch), the kernel associates the watch with an inode, but it does not store the path used to create it. To restore the watch, CRIU must find a valid path to that specific inode.
open_by_handle_at(). If the filesystem supports file handles, CRIU captures the handle during the dump and uses it to re-open the inode during restoration without needing the original path.If there are pending events in the fsnotify queue at the time of the dump, CRIU cannot currently “peek” at them or safely migrate them.
The ... inotify events will be dropped. These events are lost, and the application must be prepared to handle this gap in its event stream.IN_CREATE or IN_DELETE events that the application will see upon resumption.A “ghost file” is a file that was deleted by the application but is still held open. During restoration, CRIU must recreate these files. This action itself generates notify events, potentially confusing applications that monitor the directories where these ghost files are temporarily placed.
CRIU also supports fanotify, including:
Due to the complexity of perfectly migrating event queues, CRIU’s current strategy is: