]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Only lock access to epoll_ctl when using watcher thread
authorMark Andrews <marka@isc.org>
Thu, 3 Dec 2020 00:05:17 +0000 (11:05 +1100)
committerMark Andrews <marka@isc.org>
Thu, 10 Dec 2020 02:34:36 +0000 (02:34 +0000)
lib/isc/unix/socket.c

index d8af1ffdf9e913930e84e051b91e9bb8e3f15dbc..07d17d95b372ccee9ec5f9404bf5ee137ba804a8 100644 (file)
@@ -971,13 +971,17 @@ watch_fd(isc__socketmgr_t *manager, int fd, int msg) {
        event.data.fd = fd;
 
        op = (oldevents == 0U) ? EPOLL_CTL_ADD : EPOLL_CTL_MOD;
+#ifdef USE_WATCHER_THREAD
        if (manager->fds[fd] != NULL) {
                LOCK(&manager->fds[fd]->lock);
        }
+#endif
        ret = epoll_ctl(manager->epoll_fd, op, fd, &event);
+#ifdef USE_WATCHER_THREAD
        if (manager->fds[fd] != NULL) {
                UNLOCK(&manager->fds[fd]->lock);
        }
+#endif
        UNLOCK(&manager->fdlock[lockid]);
        if (ret == -1) {
                if (errno == EEXIST)