From aa22f24f5db7659387704998ae01520708869873 Mon Sep 17 00:00:00 2001 From: Rajesh Joseph Date: Sat, 3 Dec 2016 01:10:51 +0530 Subject: rpc: fix for race between rpc and protocol/client It is possible that the notification thread which notifies protocol/client layer about the disconnection is put to sleep and meanwhile, a fuse thread or a timer thread initiates and completes reconnection to the brick. The notification thread is then woken up and protocol/client layer updates its flags to indicate that network is disconnected. No reconnection is initiated because reconnection is rpc-lib layer's responsibility and its flags indicate that connection is connected. Fix: Serialize connect and disconnect notify Credit: Raghavendra Talur Change-Id: I8ff5d1a3283b47f5c26848a42016a40bc34ffc1d BUG: 1386626 Signed-off-by: Rajesh Joseph Reviewed-on: http://review.gluster.org/15916 Reviewed-by: Raghavendra G Smoke: Gluster Build System Reviewed-by: Raghavendra Talur NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- rpc/rpc-lib/src/rpc-clnt.h | 1 + 1 file changed, 1 insertion(+) (limited to 'rpc/rpc-lib/src/rpc-clnt.h') diff --git a/rpc/rpc-lib/src/rpc-clnt.h b/rpc/rpc-lib/src/rpc-clnt.h index f84b4cbf806..3a5b287cd49 100644 --- a/rpc/rpc-lib/src/rpc-clnt.h +++ b/rpc/rpc-lib/src/rpc-clnt.h @@ -172,6 +172,7 @@ struct rpc_req { typedef struct rpc_clnt { pthread_mutex_t lock; + pthread_mutex_t notifylock; rpc_clnt_notify_t notifyfn; rpc_clnt_connection_t conn; void *mydata; -- cgit