summaryrefslogtreecommitdiffstats
path: root/libglusterfs
diff options
context:
space:
mode:
authorMilind Changire <mchangir@redhat.com>2018-05-26 12:36:04 +0530
committerRaghavendra G <rgowdapp@redhat.com>2018-05-29 04:13:58 +0000
commit3780f6c2515c34f8705eb0fe25291bb97e73f354 (patch)
treed3aa41382705fdf111fde5224aa1bfcecb968cdc /libglusterfs
parent493f5aff9d66a83deb7cf3b3527d0d836fbd12ec (diff)
rpc: conditionally cleanup event slot
Problem: socket_server_event_handler() may call rpc_transport_unref() for a socket which may fail registration with the event sub-system. This causes an assert to fail in event_unregister_epoll_common() Solution: Conditionally cleanup event slot only if slot index >= 0 Change-Id: I6ca7c133712e894adc335c7763879691b7e4b213 fixes: bz#1582704 BUG: 1582704 Signed-off-by: Milind Changire <mchangir@redhat.com>
Diffstat (limited to 'libglusterfs')
-rw-r--r--libglusterfs/src/event-epoll.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/libglusterfs/src/event-epoll.c b/libglusterfs/src/event-epoll.c
index 45f724ab055..c861fa721e5 100644
--- a/libglusterfs/src/event-epoll.c
+++ b/libglusterfs/src/event-epoll.c
@@ -404,6 +404,14 @@ event_unregister_epoll_common (struct event_pool *event_pool, int fd,
GF_VALIDATE_OR_GOTO ("event", event_pool, out);
+ /* During shutdown, it may happen that a socket registration with
+ * the event sub-system may fail and an rpc_transport_unref() may
+ * be called for such an unregistered socket with idx == -1. This
+ * may cause the following assert(slot->fd == fd) to fail.
+ */
+ if (idx < 0)
+ goto out;
+
slot = event_slot_get (event_pool, idx);
assert (slot->fd == fd);