diff options
author | Sanju Rakonde <srakonde@redhat.com> | 2018-04-06 01:53:45 +0530 |
---|---|---|
committer | Amar Tumballi <amarts@redhat.com> | 2018-05-07 15:31:59 +0000 |
commit | 4da244caccd38a77de5428b6954f565219ef0719 (patch) | |
tree | 43311ffe448d78206aa4f68b1be07d2c38ac4bc3 /xlators/mgmt/glusterd/src/glusterd-utils.c | |
parent | 23c1385b5f6f6103e820d15ecfe1df31940fdb45 (diff) |
glusterd: handling brick termination in brick-mux
Problem: There's a race between the glusterfs_handle_terminate()
response sent to glusterd from last brick of the process and the
socket disconnect event that encounters after the brick process
got killed.
Solution: When it is a last brick for the brick process, instead of
sending GLUSTERD_BRICK_TERMINATE to brick process, glusterd will
kill the process (same as we do it in case of non brick multiplecing).
The test case is added for https://bugzilla.redhat.com/show_bug.cgi?id=1549996
Change-Id: If94958cd7649ea48d09d6af7803a0f9437a85503
fixes: bz#1545048
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 42a4411d92e..88aea178028 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -2313,7 +2313,8 @@ glusterd_brickprocess_delete (glusterd_brick_proc_t *brick_proc) } int -glusterd_brick_process_remove_brick (glusterd_brickinfo_t *brickinfo) +glusterd_brick_process_remove_brick (glusterd_brickinfo_t *brickinfo, + int *last_brick) { int ret = -1; xlator_t *this = NULL; @@ -2352,6 +2353,8 @@ glusterd_brick_process_remove_brick (glusterd_brickinfo_t *brickinfo) /* If all bricks have been removed, delete the brick process */ if (brick_proc->brick_count == 0) { + if (last_brick != NULL) + *last_brick = 1; ret = glusterd_brickprocess_delete (brick_proc); if (ret) goto out; @@ -2455,6 +2458,7 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo, int ret = -1; char *op_errstr = NULL; char pidfile[PATH_MAX] = {0,}; + int last_brick = -1; GF_ASSERT (volinfo); GF_ASSERT (brickinfo); @@ -2467,7 +2471,7 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo, ret = 0; - ret = glusterd_brick_process_remove_brick (brickinfo); + ret = glusterd_brick_process_remove_brick (brickinfo, &last_brick); if (ret) { gf_msg_debug (this->name, 0, "Couldn't remove brick from" " brick process"); @@ -2487,7 +2491,7 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo, * attaching and detaching bricks). Therefore, we have to send * an actual signal instead. */ - if (is_brick_mx_enabled ()) { + if (is_brick_mx_enabled () && last_brick != 1) { gf_msg_debug (this->name, 0, "About to send detach " "request for brick %s:%s", brickinfo->hostname, brickinfo->path); @@ -2511,7 +2515,6 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo, } GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo, conf); - gf_msg_debug (this->name, 0, "Unlinking pidfile %s", pidfile); (void) sys_unlink (pidfile); |