diff options
| author | Sanju Rakonde <srakonde@redhat.com> | 2018-03-29 10:48:32 +0000 | 
|---|---|---|
| committer | Atin Mukherjee <amukherj@redhat.com> | 2018-03-29 14:58:27 +0000 | 
| commit | 3f9851db49ca6ac7a969817964a6ad216b10fd6f (patch) | |
| tree | 3cb12c5ad1a0501d3b2133c2d37dde5065b1c43e /xlators | |
| parent | c87bd439ef12adc70dc580e75304121c3cd38e9a (diff) | |
Revert "glusterd: handling brick termination in brick-mux"
This reverts commit a60fc2ddc03134fb23c5ed5c0bcb195e1649416b.
This commit was causing multiple tests to time out when brick 
multiplexing is enabled. With further debugging, it's found that even 
though the volume stop transaction is converted into mgmt_v3 to allow
the remote nodes to follow the synctask framework to process the command,
there are other callers of glusterd_brick_stop () which are not synctask
based.
Change-Id: I7aee687abc6bfeaa70c7447031f55ed4ccd64693
updates: bz#1545048
Diffstat (limited to 'xlators')
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-pmap.c | 4 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-syncop.c | 17 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 56 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.h | 3 | 
4 files changed, 25 insertions, 55 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-pmap.c b/xlators/mgmt/glusterd/src/glusterd-pmap.c index 8ef285bf48d..98b1aaa63af 100644 --- a/xlators/mgmt/glusterd/src/glusterd-pmap.c +++ b/xlators/mgmt/glusterd/src/glusterd-pmap.c @@ -557,7 +557,6 @@ __gluster_pmap_signout (rpcsvc_request_t *req)          glusterd_brickinfo_t *brickinfo            = NULL;          char                  pidfile[PATH_MAX]    = {0};          char                  brick_path[PATH_MAX] = {0,}; -        int                   kill_pid             = -1;          this = THIS;          GF_VALIDATE_OR_GOTO ("glusterd", this, fail); @@ -607,8 +606,7 @@ __gluster_pmap_signout (rpcsvc_request_t *req)                           * removed in the brick op phase. This situation would                           * arise when the brick is killed explicitly from the                           * backend */ -                        ret = glusterd_brick_process_remove_brick (brickinfo, -                                                                   &kill_pid); +                        ret = glusterd_brick_process_remove_brick (brickinfo);                          if (ret) {                                  gf_msg_debug (this->name, 0, "Couldn't remove "                                                "brick %s:%s from brick process", diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c index e5d4421deb4..31b08d76adc 100644 --- a/xlators/mgmt/glusterd/src/glusterd-syncop.c +++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c @@ -958,6 +958,7 @@ gd_syncop_mgmt_brick_op (struct rpc_clnt *rpc, glusterd_pending_node_t *pnode,          gd1_mgmt_brick_op_req  *req  = NULL;          int                    ret  = 0;          xlator_t               *this = NULL; +        glusterd_brickinfo_t   *brickinfo = NULL;          this = THIS;          args.op_ret = -1; @@ -986,6 +987,22 @@ gd_syncop_mgmt_brick_op (struct rpc_clnt *rpc, glusterd_pending_node_t *pnode,                  else                          GF_FREE (args.errstr);          } +        if (op == GD_OP_STOP_VOLUME || op == GD_OP_REMOVE_BRICK) { +                if (args.op_ret == 0) { +                        brickinfo = pnode->node; +                        ret = glusterd_brick_process_remove_brick (brickinfo); +                        if (ret) { +                                gf_msg ("glusterd", GF_LOG_ERROR, 0, +                                        GD_MSG_BRICKPROC_REM_BRICK_FAILED, +                                        "Removing brick %s:%s from brick" +                                        " process failed", +                                        brickinfo->hostname, +                                        brickinfo->path); +                                args.op_ret = ret; +                                goto out; +                        } +                } +        }          if (GD_OP_STATUS_VOLUME == op) {                  ret = dict_set_int32 (args.dict, "index", pnode->index); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 8e71756b927..af30756c947 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -69,7 +69,6 @@  #include <sys/types.h>  #include <sys/ioctl.h>  #include <sys/socket.h> -#include <sys/wait.h>  #include <rpc/pmap_clnt.h>  #include <unistd.h>  #include <fnmatch.h> @@ -2314,8 +2313,7 @@ glusterd_brickprocess_delete (glusterd_brick_proc_t *brick_proc)  }  int -glusterd_brick_process_remove_brick (glusterd_brickinfo_t *brickinfo, -                                     int *kill_pid) +glusterd_brick_process_remove_brick (glusterd_brickinfo_t *brickinfo)  {          int                      ret = -1;          xlator_t                *this = NULL; @@ -2354,7 +2352,6 @@ 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) { -                        *kill_pid = 1;                          ret = glusterd_brickprocess_delete (brick_proc);                          if (ret)                                  goto out; @@ -2457,11 +2454,7 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,          glusterd_conf_t *conf                   = NULL;          int             ret                     = -1;          char            *op_errstr              = NULL; -        char            pidfile_path[PATH_MAX]  = {0,}; -        int             kill_pid                = -1; -        FILE            *pidfile                = NULL; -        pid_t           pid                     = -1; -        int             status                  = -1; +        char            pidfile[PATH_MAX]       = {0,};          GF_ASSERT (volinfo);          GF_ASSERT (brickinfo); @@ -2474,7 +2467,7 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,          ret = 0; -        ret = glusterd_brick_process_remove_brick (brickinfo, &kill_pid); +        ret = glusterd_brick_process_remove_brick (brickinfo);          if (ret) {                  gf_msg_debug (this->name, 0, "Couldn't remove brick from"                                " brick process"); @@ -2517,47 +2510,10 @@ glusterd_volume_stop_glusterfs (glusterd_volinfo_t *volinfo,                  ret = 0;          } -        GLUSTERD_GET_BRICK_PIDFILE (pidfile_path, volinfo, brickinfo, conf); -        if (kill_pid == 1 && is_brick_mx_enabled ()) { -                pidfile = fopen (pidfile_path, "r"); -                if (!pidfile) { -                        gf_msg (this->name, GF_LOG_ERROR, errno, -                                GD_MSG_FILE_OP_FAILED, -                                "Unable to open pidfile: %s", pidfile_path); -                        ret = -1; -                        goto out; -                } - -                ret = fscanf (pidfile, "%d", &pid); -                if (ret <= 0) { -                        gf_msg (this->name, GF_LOG_ERROR, errno, -                                GD_MSG_FILE_OP_FAILED, -                                "Unable to get pid of brick process"); -                        ret = -1; -                        goto out; -                } - -                if (conf->op_version >= GD_OP_VERSION_4_1_0) { -                        while (conf->blockers) { -                                synclock_unlock (&conf->big_lock); -                                sleep (1); -                                synclock_lock (&conf->big_lock); -                        } -                } -                gf_log (this->name, GF_LOG_INFO, -                        "terminating the brick process " -                        "%d after loss of last brick %s of the volume %s", -                        pid, brickinfo->path, volinfo->volname); -                kill (pid, SIGTERM); -                waitpid (pid, &status, 0); -                pmap_registry_remove (this, brickinfo->port, brickinfo->path, -                                      GF_PMAP_PORT_BRICKSERVER, NULL, -                                      _gf_true); -                ret = 0; -        } +        GLUSTERD_GET_BRICK_PIDFILE (pidfile, volinfo, brickinfo, conf); -        gf_msg_debug (this->name,  0, "Unlinking pidfile %s", pidfile_path); -        (void) sys_unlink (pidfile_path); +        gf_msg_debug (this->name,  0, "Unlinking pidfile %s", pidfile); +        (void) sys_unlink (pidfile);          brickinfo->status = GF_BRICK_STOPPED;          brickinfo->start_triggered = _gf_false; diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.h b/xlators/mgmt/glusterd/src/glusterd-utils.h index 8118c994974..0e9e54a0687 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.h +++ b/xlators/mgmt/glusterd/src/glusterd-utils.h @@ -182,8 +182,7 @@ glusterd_brick_process_add_brick (glusterd_brickinfo_t *brickinfo,                                    glusterd_volinfo_t *volinfo);  int -glusterd_brick_process_remove_brick (glusterd_brickinfo_t *brickinfo, -                                     int *kill_pid); +glusterd_brick_process_remove_brick (glusterd_brickinfo_t *brickinfo);  int  glusterd_brick_proc_for_port (int port, glusterd_brick_proc_t **brickprocess);  | 
