diff options
author | Milind Changire <mchangir@redhat.com> | 2018-05-26 12:36:04 +0530 |
---|---|---|
committer | Shyamsundar Ranganathan <srangana@redhat.com> | 2018-05-29 14:56:05 +0000 |
commit | 37773839e4eee8a753598fb01dbd06220b98dc72 (patch) | |
tree | 7630992a98e4574fe66a87c9f86890c16a553918 /libglusterfs | |
parent | 040619ef9946fb6cd151a07239613b6d88417935 (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#1583734
Signed-off-by: Milind Changire <mchangir@redhat.com>
(cherry picked from commit 3780f6c2515c34f8705eb0fe25291bb97e73f354)
Diffstat (limited to 'libglusterfs')
-rw-r--r-- | libglusterfs/src/event-epoll.c | 8 |
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); |