diff options
author | Rafi KC <rafi.kavungal@iternity.com> | 2020-10-27 12:42:03 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-27 12:42:03 +0530 |
commit | 03d9cd7284403499287643a77fb1700a97cde588 (patch) | |
tree | d28133b7adcaf9b6c1e8f6ca0537f25e9a7ae7a9 /rpc | |
parent | fc129cc2226884cbf59409256823fd9c147391be (diff) | |
download | glusterfs-03d9cd7284403499287643a77fb1700a97cde588.tar.gz glusterfs-03d9cd7284403499287643a77fb1700a97cde588.tar.xz glusterfs-03d9cd7284403499287643a77fb1700a97cde588.zip |
rpcsvc/transport: gracefully disconnect when graph is not ready (#1671)
* rpcsvc/transport: gracefully disconnect when graph is not ready.
There was a crash reported when the brick rpc get's an accept
request from a client before the server xlator is fully inited.
The fix https://review.gluster.org/22339/ solves
the crash, but it leaves the connection alive with out adding
the rpc to xprts list of server conf. This will leads to problems
with upcall, dump, and other cleanup codes.
So this patch will make the rpc to fail and disconnect if a
connection attempted before the server is fully inited.
Change-Id: I3bf1113c0da4c2614afaa2c0f4eb6abfb0d26ed0
Signed-off-by: Mohammed Rafi KC <rafi.kavungal@iternity.com>
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-lib/src/rpcsvc.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c index 39910d481b..1701fbace0 100644 --- a/rpc/rpc-lib/src/rpcsvc.c +++ b/rpc/rpc-lib/src/rpcsvc.c @@ -362,11 +362,12 @@ err: /* this procedure can only pass 4 arguments to registered notifyfn. To send more * arguments call wrapper->notify directly. */ -static void +static int rpcsvc_program_notify(rpcsvc_listener_t *listener, rpcsvc_event_t event, void *data) { rpcsvc_notify_wrapper_t *wrapper = NULL; + int ret = 0; if (!listener) { goto out; @@ -375,12 +376,15 @@ rpcsvc_program_notify(rpcsvc_listener_t *listener, rpcsvc_event_t event, list_for_each_entry(wrapper, &listener->svc->notify, list) { if (wrapper->notify) { - wrapper->notify(listener->svc, wrapper->data, event, data); + if (wrapper->notify(listener->svc, wrapper->data, event, data) < + 0 && + ret == 0) + ret = -1; } } out: - return; + return ret; } static int @@ -395,8 +399,7 @@ rpcsvc_accept(rpcsvc_t *svc, rpc_transport_t *listen_trans, goto out; } - rpcsvc_program_notify(listener, RPCSVC_EVENT_ACCEPT, new_trans); - ret = 0; + ret = rpcsvc_program_notify(listener, RPCSVC_EVENT_ACCEPT, new_trans); out: return ret; } |