-
-
Notifications
You must be signed in to change notification settings - Fork 258
Closed
Description
I'm wondering what happens if a monitored object is deleted. I'm wondering if it would remain/leak/linger in the watches map. Perhaps we can watch for the IN_DELETE_SELF event for each watched path, and if triggered, we remove the entries? Not sure if that'd work.
IN_DELETE_SELF
Watched file/directory was itself deleted. (This event
also occurs if an object is moved to another filesystem,
since mv(1) in effect copies the file to the other
filesystem and then deletes it from the original
filesystem.) In addition, an IN_IGNORED event will
subsequently be generated for the watch descriptor.
Also from TLPI:
An
IN_IGNOREDevent is generated when a watch is removed. This can occur for two reasons: the application used aninotify_rm_watch()call to explicitly remove the watch, or the watch was implicitly removed by the kernel because the monitored object was deleted or the file system where it resides was unmounted.
So I think monitoring for IN_IGNORED should be enough. When we receive it, we remove the entries from our own data structures.
Reactions are currently unavailable