linux-man.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/1] inotify.7: Bug 77111 - watch descriptor reuse
@ 2014-05-29 17:39 Heinrich Schuchardt
       [not found] ` <1401385143-19306-1-git-send-email-xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
  0 siblings, 1 reply; 10+ messages in thread
From: Heinrich Schuchardt @ 2014-05-29 17:39 UTC (permalink / raw)
  To: Michael Kerrisk
  Cc: Jeff Smith, linux-man-u79uwXL29TY76Z2rM5mHXA, Heinrich Schuchardt

Watch descriptor IDs are returned by inotify_add_watch.
When calling inotify_rm_watch an IN_IGNORE is placed on the inotify queue
pointing to the ID of the removed watch.

inotify_add_watch should not return a watch descriptor ID for which events are
still on the queue but should return an unused ID.

Unfortunately the existing Kernel code does not provide such a guarantee.

Actually in rare cases watch descriptor IDs are returned by inotify_add_watch
for which events are still on the inotify queue.

cf. https://bugzilla.kernel.org/show_bug.cgi?id=77111

Signed-off-by: Heinrich Schuchardt <xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
---
 man7/inotify.7 | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/man7/inotify.7 b/man7/inotify.7
index 1fc83f8..b1c2f6f 100644
--- a/man7/inotify.7
+++ b/man7/inotify.7
@@ -728,6 +728,18 @@ and the accompanying
 event might be fetched only on the next
 .BR read (2).
 .SH BUGS
+As of Linux 3.14,
+the following bug exists:
+.IP * 3
+.\" FIXME https://bugzilla.kernel.org/show_bug.cgi?id=77111
+.BR inotify_add_watch (2)
+may return a watch descriptor ID released by a prior call to
+.BR inotify_rm_watch (2)
+even if events for this watch descriptor still exist on the inotify queue.
+As a workaround the inotify file descriptor can be read until the queue is
+empty before calling
+.BR inotify_add_watch (2).
+.PP
 .\" FIXME kernel commit 611da04f7a31b2208e838be55a42c7a1310ae321
 .\" implies that unmount events were buggy 2.6.11 to 2.6.36
 .\"
@@ -745,7 +757,7 @@ However, as an unintended effect of other changes,
 since Linux 2.6.36, an
 .B IN_IGNORED
 event is generated in this case.

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

end of thread, other threads:[~2014-06-23 10:04 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-29 17:39 [PATCH 1/1] inotify.7: Bug 77111 - watch descriptor reuse Heinrich Schuchardt
     [not found] ` <1401385143-19306-1-git-send-email-xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
2014-05-30 13:12   ` Michael Kerrisk (man-pages)
     [not found]     ` <538883D9.5090709-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-05-31 21:25       ` Heinrich Schuchardt
     [not found]         ` <538A48D0.8020402-Mmb7MZpHnFY@public.gmane.org>
2014-06-01  8:39           ` Michael Kerrisk (man-pages)
     [not found]             ` <538AE6C9.2060202-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-01 11:29               ` Heinrich Schuchardt
     [not found]                 ` <538B0EA3.5040205-Mmb7MZpHnFY@public.gmane.org>
2014-06-23  7:36                   ` Michael Kerrisk (man-pages)
2014-06-22 14:45       ` [PATCH 1/1 v2] " Heinrich Schuchardt
     [not found]         ` <1403448323-13459-1-git-send-email-xypron.glpk-Mmb7MZpHnFY@public.gmane.org>
2014-06-23  8:21           ` Michael Kerrisk (man-pages)
     [not found]             ` <53A7E39C.7050505-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2014-06-23  9:45               ` Heinrich Schuchardt
2014-06-23 10:04                 ` 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;
as well as URLs for NNTP newsgroup(s).