changeset 4590:4061c612a402 HEAD

Fix 100% CPU usage looping when a vnode change event came but it was never untriggered. Patch by Rui Lopes (rgl ruilopes com)
author Timo Sirainen <tss@iki.fi>
date Sat, 26 Aug 2006 16:55:02 +0300
parents 6e5fe029ca82
children bd1da3473e44
files src/lib/ioloop-notify-kqueue.c
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/lib/ioloop-notify-kqueue.c	Sat Aug 26 16:46:25 2006 +0300
+++ b/src/lib/ioloop-notify-kqueue.c	Sat Aug 26 16:55:02 2006 +0300
@@ -111,7 +111,10 @@
 	io->callback = callback;
 	io->context = context;
 
-	EV_SET(&ev, fd, EVFILT_VNODE, EV_ADD,
+	/* EV_CLEAR flag is needed because the EVFILT_VNODE filter reports
+	   event state transitions and not the current state.  With this flag,
+	   the same event is only returned once. */
+	EV_SET(&ev, fd, EVFILT_VNODE, EV_ADD | EV_CLEAR,
 	       NOTE_DELETE | NOTE_WRITE | NOTE_EXTEND | NOTE_REVOKE, 0, io);
 	if (kevent(ctx->kq, &ev, 1, NULL, 0, NULL) < 0) {
 		i_error("kevent(%d, %s) for notify failed: %m", fd, path);