summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAtin Mukherjee <amukherj@redhat.com>2017-05-19 21:04:53 +0530
committerShyamsundar Ranganathan <srangana@redhat.com>2017-05-29 13:56:08 +0000
commit12c5b9d774f6e03b69efc8e276165debdf360cb6 (patch)
tree19f5c71621d13175949413c4a836fae4b7f3d0d0 /xlators
parent3efadd83dc4367268e3af71e3fad82634bcd786d (diff)
glusterfsd: process attach and detach request inside lock
With brick multiplexing, there is a high possibility that attach and detach requests might be parallely processed and to avoid a concurrent update to the same graph list, a mutex lock is required. Please note this backport defines the volfile_lock mutex which was done as part of a different patch https://review.gluster.org/15036 in mainline but is not available in release-3.11 branch. Credits : Rafi (rkavunga@redhat.com) for the RCA of this issue >Reviewed-on: https://review.gluster.org/17374 >Smoke: Gluster Build System <jenkins@build.gluster.org> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >CentOS-regression: Gluster Build System <jenkins@build.gluster.org> >Reviewed-by: Jeff Darcy <jeff@pl.atyp.us> >(cherry picked from commit 3ca5ae2f3bff2371042b607b8e8a218bf316b48c) Change-Id: Ic8e6d1708655c8a143c5a3690968dfa572a32a9c BUG: 1455907 Signed-off-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-on: https://review.gluster.org/17402 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Shyamsundar Ranganathan <srangana@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/server/src/server-handshake.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c
index 64267f2aef9..f00804a3d3a 100644
--- a/xlators/protocol/server/src/server-handshake.c
+++ b/xlators/protocol/server/src/server-handshake.c
@@ -412,7 +412,7 @@ server_setvolume (rpcsvc_request_t *req)
rpc_transport_t *xprt = NULL;
int32_t fop_version = 0;
int32_t mgmt_version = 0;
-
+ glusterfs_ctx_t *ctx = NULL;
params = dict_new ();
reply = dict_new ();
@@ -423,6 +423,7 @@ server_setvolume (rpcsvc_request_t *req)
req->rpc_err = GARBAGE_ARGS;
goto fail;
}
+ ctx = THIS->ctx;
this = req->svc->xl;
/* this is to ensure config_params is populated with the first brick
@@ -468,7 +469,11 @@ server_setvolume (rpcsvc_request_t *req)
goto fail;
}
- xl = get_xlator_by_name (this, name);
+ LOCK (&ctx->volfile_lock);
+ {
+ xl = get_xlator_by_name (this, name);
+ }
+ UNLOCK (&ctx->volfile_lock);
if (xl == NULL) {
ret = gf_asprintf (&msg, "remote-subvolume \"%s\" is not found",
name);