diff options
| author | Krishnan Parthasarathi <kparthas@redhat.com> | 2013-12-17 01:12:05 +0530 | 
|---|---|---|
| committer | Vijay Bellur <vbellur@redhat.com> | 2013-12-20 00:55:41 -0800 | 
| commit | 79d5a31279825bdc61ad036b30fbe7e41b76fe5e (patch) | |
| tree | 2f4c9ebc7889ab435954d3783f984246ec0e149d | |
| parent | 3991b0d0e934214882c064a0b720375af5c1575a (diff) | |
glusterd: rebalance to ref volinfo before starting
Change-Id: Ib316897dcbd0748bfb3bfcda186b9fe30c07f80f
BUG: 1038051
Signed-off-by: Krishnan Parthasarathi <kparthas@redhat.com>
Reviewed-on: http://review.gluster.org/6522
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Kaushal M <kaushal@redhat.com>
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-rebalance.c | 4 | ||||
| -rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-utils.c | 12 | 
2 files changed, 11 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c index 1ac9d64ce20..daa8ddd1def 100644 --- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c +++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c @@ -164,6 +164,9 @@ __glusterd_defrag_notify (struct rpc_clnt *rpc, void *mydata,                          rpc->conn.trans->name);                  break;          } +        case RPC_CLNT_DESTROY: +                glusterd_volinfo_unref (volinfo); +                break;          default:                  gf_log ("", GF_LOG_TRACE,                          "got some other RPC event %d", event); @@ -329,6 +332,7 @@ glusterd_rebalance_rpc_create (glusterd_volinfo_t *volinfo)                  goto out;          } +        glusterd_volinfo_ref (volinfo);          synclock_unlock (&priv->big_lock);          ret = glusterd_rpc_create (&defrag->rpc, options,                                     glusterd_defrag_notify, volinfo); diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c index 6614f98dbcc..26a67184f5d 100644 --- a/xlators/mgmt/glusterd/src/glusterd-utils.c +++ b/xlators/mgmt/glusterd/src/glusterd-utils.c @@ -1148,7 +1148,7 @@ glusterd_service_stop (const char *service, char *pidfile, int sig,                          gf_log (this->name, GF_LOG_DEBUG, "%s is already stopped",                                  service);                          ret = 0; -                        break; +                        goto out;                  default:                          gf_log (this->name, GF_LOG_ERROR, "Failed to kill %s: %s",                                  service, strerror (errno)); @@ -3425,9 +3425,11 @@ gd_check_and_update_rebalance_info (glusterd_volinfo_t *old_volinfo,          old = &(old_volinfo->rebal);          new = &(new_volinfo->rebal); -        /* If the old task-id is not null and the task-id's don't match, the old -         * volinfo task is stale and should be cleaned up -         */ +        //Disconnect from rebalance process +        if (old->defrag && old->defrag->rpc) { +                rpc_transport_disconnect (old->defrag->rpc->conn.trans); +        } +          if (!uuid_is_null (old->rebalance_id) &&              uuid_compare (old->rebalance_id, new->rebalance_id)) {                  (void)gd_stop_rebalance_process (old_volinfo); @@ -3444,11 +3446,11 @@ gd_check_and_update_rebalance_info (glusterd_volinfo_t *old_volinfo,          new->skipped_files      = old->skipped_files;          new->rebalance_failures = old->rebalance_failures;          new->rebalance_time     = old->rebalance_time; -        new->defrag             = old->defrag;          new->dict               = (old->dict ? dict_ref (old->dict) : NULL);          /* glusterd_rebalance_t.{op, id, defrag_cmd} are copied during volume           * import +         * a new defrag object should come to life with rebalance being restarted           */  out:          return ret;  | 
