From 933b46b4a3538794b3a29c8f7b6472b58998be6a Mon Sep 17 00:00:00 2001 From: Atin Mukherjee Date: Mon, 15 Jul 2019 11:26:55 +0530 Subject: glusterd: stop stale bricks during handshaking in brick mux mode This patch addresses two problems: 1. During friend handshaking, if a volume is imported due to change in the version, the old bricks were not stopped which would lead to a situation where bricks will run with old volfiles. 2. As part of attaching shd service in glusterd_attach_svc, there might be a case that the volume for which we're attempting to attach a shd service might become stale and in the process of deletion and hence in every retrials (if the rpc connection isn't ready) check for the existance of the volume and then only attempt the further attach request. patch on master: https://review.gluster.org/#/c/glusterfs/+/23042/ > Bug: bz#1733425 > Change-Id: I6bac6b871f7e31cb5bf277db979289dec196a03e > Signed-off-by: Atin Mukherjee > Signed-off-by: Mohammed Rafi KC fixes: bz#1812849 Change-Id: I6bac6b871f7e31cb5bf277db979289dec196a03e Signed-off-by: Sanju Rakonde --- xlators/mgmt/glusterd/src/glusterd-svc-helper.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'xlators/mgmt/glusterd/src/glusterd-svc-helper.c') diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c index e4924f831b7..5042d8e85f5 100644 --- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c +++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c @@ -902,6 +902,22 @@ glusterd_attach_svc(glusterd_svc_t *svc, glusterd_volinfo_t *volinfo, int flags) rpc = rpc_clnt_ref(svc->conn.rpc); for (tries = 15; tries > 0; --tries) { + /* There might be a case that the volume for which we're attempting to + * attach a shd svc might become stale and in the process of deletion. + * Given that the volinfo object is being already passed here before + * that sequence of operation has happened we might be operating on a + * stale volume. At every sync task switch we should check for existance + * of the volume now + */ + if (!glusterd_volume_exists(volinfo->volname)) { + gf_msg(THIS->name, GF_LOG_INFO, 0, GD_MSG_SVC_ATTACH_FAIL, + "Volume %s " + " is marked as stale, not attempting further shd svc attach " + "attempts", + volinfo->volname); + ret = 0; + goto out; + } if (rpc) { pthread_mutex_lock(&conf->attach_lock); { -- cgit