мониторинг событий файловой системы (monitoring filesystem events)
Ошибки (баги) (Bugs)
Before Linux 3.19, fallocate(2) did not create any inotify
events. Since Linux 3.19, calls to fallocate(2) generate
IN_MODIFY
events.
In kernels before 2.6.16, the IN_ONESHOT
mask flag does not work.
As originally designed and implemented, the IN_ONESHOT
flag did
not cause an IN_IGNORED
event to be generated when the watch was
dropped after one event. However, as an unintended effect of
other changes, since Linux 2.6.36, an IN_IGNORED
event is
generated in this case.
Before kernel 2.6.25, the kernel code that was intended to
coalesce successive identical events (i.e., the two most recent
events could potentially be coalesced if the older had not yet
been read) instead checked if the most recent event could be
coalesced with the oldest unread event.
When a watch descriptor is removed by calling inotify_rm_watch(2)
(or because a watch file is deleted or the filesystem that
contains it is unmounted), any pending unread events for that
watch descriptor remain available to read. As watch descriptors
are subsequently allocated with inotify_add_watch(2), the kernel
cycles through the range of possible watch descriptors (0 to
INT_MAX
) incrementally. When allocating a free watch descriptor,
no check is made to see whether that watch descriptor number has
any pending unread events in the inotify queue. Thus, it can
happen that a watch descriptor is reallocated even when pending
unread events exist for a previous incarnation of that watch
descriptor number, with the result that the application might
then read those events and interpret them as belonging to the
file associated with the newly recycled watch descriptor. In
practice, the likelihood of hitting this bug may be extremely
low, since it requires that an application cycle through INT_MAX
watch descriptors, release a watch descriptor while leaving
unread events for that watch descriptor in the queue, and then
recycle that watch descriptor. For this reason, and because
there have been no reports of the bug occurring in real-world
applications, as of Linux 3.15, no kernel changes have yet been
made to eliminate this possible bug.