From 4756e27bbcd8ccc11180843ad23b833e8a5cf22c Mon Sep 17 00:00:00 2001 From: Kinglong Mee Date: Tue, 18 Sep 2018 07:58:58 -0400 Subject: rpc: failed requests immediately if rpc connection is down In the case glfs_fini is ongoing, some cache xlators like readdir-ahead, continues to submit requests. Current rpc submit code ignores connection status and queues these internally generated requests. These requests then got cleaned up after inode table has been destroyed, causing crash. Change-Id: Ife6b17d8592a054f7a7f310c79d07af005087017 updates: bz#1626313 Signed-off-by: Zhang Huan --- rpc/rpc-lib/src/rpc-clnt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'rpc/rpc-lib/src') diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index c5236251549..0a1bcd35d53 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -1674,7 +1674,9 @@ rpc_clnt_submit(struct rpc_clnt *rpc, rpc_clnt_prog_t *prog, int procnum, pthread_mutex_lock(&conn->lock); { - if (conn->connected == 0 && !rpc->disabled) { + if (conn->connected == 0) { + if (rpc->disabled) + goto nosubmit; ret = rpc_transport_connect(conn->trans, conn->config.remote_port); if (ret < 0) { gf_log(conn->name, GF_LOG_WARNING, @@ -1685,6 +1687,7 @@ rpc_clnt_submit(struct rpc_clnt *rpc, rpc_clnt_prog_t *prog, int procnum, } ret = rpc_transport_submit_request(conn->trans, &req); + nosubmit: if (ret == -1) { gf_log(conn->name, GF_LOG_WARNING, "failed to submit rpc-request " -- cgit