diff options
author | Jeremy Allison <jra@samba.org> | 2013-02-15 10:16:44 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2013-03-01 12:01:05 -0800 |
commit | 15ca40fb7ad1668013eb5ebef4479058d33df992 (patch) | |
tree | 67904a02258fa861f77d1c9684f33e02973713cd | |
parent | 809593e7f55c1d17c616f60d69ec5904e531ea2f (diff) | |
download | samba-15ca40fb7ad1668013eb5ebef4479058d33df992.tar.gz samba-15ca40fb7ad1668013eb5ebef4479058d33df992.tar.bz2 samba-15ca40fb7ad1668013eb5ebef4479058d33df992.zip |
tevent: Fix up epoll_del_event to cope with deleting a multiplexed fde event.
Signed-off-by: Jeremy Allison <jra@samba.org>
Signed-off-by: Stefan Metzmacher <metze@samba.org>
Reviewed-by: Stefan Metzmacher <metze@samba.org>
-rw-r--r-- | lib/tevent/tevent_epoll.c | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/tevent/tevent_epoll.c b/lib/tevent/tevent_epoll.c index 987748cec5..97130db0a7 100644 --- a/lib/tevent/tevent_epoll.c +++ b/lib/tevent/tevent_epoll.c @@ -430,10 +430,22 @@ static void epoll_del_event(struct epoll_event_context *epoll_ev, struct tevent_ { struct epoll_event event; int ret; + struct tevent_fd *mpx_fde = NULL; fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; + if (fde->additional_flags & EPOLL_ADDITIONAL_FD_FLAG_HAS_MPX) { + /* + * This is a multiplexed fde, we need to modify both events. + */ + mpx_fde = talloc_get_type_abort(fde->additional_data, + struct tevent_fd); + + mpx_fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_HAS_EVENT; + mpx_fde->additional_flags &= ~EPOLL_ADDITIONAL_FD_FLAG_REPORT_ERROR; + } + ZERO_STRUCT(event); ret = epoll_ctl(epoll_ev->epoll_fd, EPOLL_CTL_DEL, fde->fd, &event); if (ret != 0 && errno == ENOENT) { @@ -448,10 +460,14 @@ static void epoll_del_event(struct epoll_event_context *epoll_ev, struct tevent_ } else if (ret != 0 && errno == EBADF) { tevent_debug(epoll_ev->ev, TEVENT_DEBUG_WARNING, "EPOLL_CTL_DEL EBADF for " - "fde[%p] fd[%d] - disabling\n", - fde, fde->fd); + "fde[%p] mpx_fde[%p] fd[%d] - disabling\n", + fde, mpx_fde, fde->fd); DLIST_REMOVE(epoll_ev->ev->fd_events, fde); fde->event_ctx = NULL; + if (mpx_fde != NULL) { + DLIST_REMOVE(epoll_ev->ev->fd_events, mpx_fde); + mpx_fde->event_ctx = NULL; + } return; } else if (ret != 0) { epoll_panic(epoll_ev, "EPOLL_CTL_DEL failed", false); |