summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2013-02-15 10:31:36 +0100
committerJeremy Allison <jra@samba.org>2013-03-01 12:00:37 -0800
commit2b3b06b9b428b72cf7f5f400c043abaca47850de (patch)
tree193f1fd59f5cf9d5578ba134e28d2cf6f6d69f7d
parent31db8a08be445b252ba27b07106ca5b2e73cc325 (diff)
downloadsamba-2b3b06b9b428b72cf7f5f400c043abaca47850de.tar.gz
samba-2b3b06b9b428b72cf7f5f400c043abaca47850de.tar.bz2
samba-2b3b06b9b428b72cf7f5f400c043abaca47850de.zip
tevent: call epoll_panic() if EPOLL_CTL_DEL failed
Only ENOENT is ignored as it is no error. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
-rw-r--r--lib/tevent/tevent_epoll.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c
index a662fee3a6..c2b31143fd 100644
--- a/lib/tevent/tevent_epoll.c
+++ b/lib/tevent/tevent_epoll.c
@@ -307,10 +307,17 @@ static void epoll_del_event(struct epoll_event_context *epoll_ev, struct tevent_
event.events = epoll_map_flags(fde->flags);
event.data.ptr = fde;
ret = epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_DEL, fde->fd, &event);
- if (ret != 0) {
- tevent_debug(epoll_ev->ev, TEVENT_DEBUG_FATAL,
- "epoll_del_event failed! probable early close bug (%s)\n",
- strerror(errno));
+ if (ret != 0 && errno == ENOENT) {
+ /*
+ * This can happen after a epoll_check_reopen
+ * within epoll_event_fd_destructor.
+ */
+ tevent_debug(epoll_ev->ev, TEVENT_DEBUG_TRACE,
+ "EPOLL_CTL_DEL ignoring ENOENT for fd[%d]\n",
+ fde->fd);
+ } else if (ret != 0) {
+ epoll_panic(epoll_ev, "EPOLL_CTL_DEL failed", false);
+ return;
}
fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT;
}