public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* inotify_rm_watch() user-space safety requirements?
@ 2014-05-27 17:25 Jeff Smith
  2014-05-27 19:32 ` Heinrich Schuchardt
  0 siblings, 1 reply; 4+ messages in thread
From: Jeff Smith @ 2014-05-27 17:25 UTC (permalink / raw)
  To: linux-kernel

inotify's behavior concerning events from removed watches (they do
happen) and watch descriptor reuse (beyond my knowledge) is currently
undocumented.

Although it mimics a standard multiplexing interface in most regards,
writing a robust user-space handler is comparatively more complex due
to the atypical delivery of "stale" wd events preceding an IN_IGNORE
event and a lack of guarantees about how quickly a wd can be reused
via inotify_add_watch(). Not being familiar with inotify/fsnotify
internals, it's not trivially obvious to me how the fsnotify_group
management is being done. Up to the present, I've maintained queues of
"dead" wd wrappers (or at least a counter) to filter stale events, but
I am clueless whether or not this is overkill.

If removed descriptors are reserved until the IN_IGNORE event is
drained from the read queue, could that be formally guaranteed? If
it's not, is it functionality that could ever reasonably be expected
to be added, short of some other form of new (optional?)
queue-filter-on-rm functionality? It's my experience that the
asynchronous handling of watch removals is a cost that seldom serves
much user benefit.

Regards,
Jeff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-05-31  5:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-27 17:25 inotify_rm_watch() user-space safety requirements? Jeff Smith
2014-05-27 19:32 ` Heinrich Schuchardt
2014-05-27 20:04   ` Jeff Smith
2014-05-31  5:26   ` Michael Kerrisk (man-pages)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox