diff options
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-volume-ops.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-volume-ops.c | 49 |
1 files changed, 47 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c index df2562ba6..051e7d756 100644 --- a/xlators/mgmt/glusterd/src/glusterd-volume-ops.c +++ b/xlators/mgmt/glusterd/src/glusterd-volume-ops.c @@ -30,6 +30,8 @@ #define glusterd_op_start_volume_args_get(dict, volname, flags) \ glusterd_op_stop_volume_args_get (dict, volname, flags) +extern int +_get_slave_status (dict_t *this, char *key, data_t *value, void *data); int __glusterd_handle_create_volume (rpcsvc_request_t *req) @@ -921,7 +923,7 @@ glusterd_op_stage_start_volume (dict_t *dict, char **op_errstr) gf_boolean_t exists = _gf_false; glusterd_volinfo_t *volinfo = NULL; glusterd_brickinfo_t *brickinfo = NULL; - char msg[2048]; + char msg[2048] = {0,}; glusterd_conf_t *priv = NULL; xlator_t *this = NULL; uuid_t volume_id = {0,}; @@ -1059,6 +1061,7 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr) glusterd_volinfo_t *volinfo = NULL; char msg[2048] = {0}; xlator_t *this = NULL; + gsync_status_param_t param = {0,}; this = THIS; GF_ASSERT (this); @@ -1102,7 +1105,22 @@ glusterd_op_stage_stop_volume (dict_t *dict, char **op_errstr) if (ret && (is_run == _gf_false)) gf_log (this->name, GF_LOG_WARNING, "Unable to get the status" " of active "GEOREP" session"); - if (is_run) { + + param.volinfo = volinfo; + ret = dict_foreach (volinfo->gsync_slaves, _get_slave_status, ¶m); + + if (ret) { + gf_log (this->name, GF_LOG_WARNING, "_get_slave_satus failed"); + snprintf (msg, sizeof(msg), GEOREP" Unable to get the status " + "of active "GEOREP" session for the volume '%s'.\n" + "Please check the log file for more info. Use " + "'force' option to ignore and stop the volume.", + volname); + ret = -1; + goto out; + } + + if (is_run && param.is_active) { gf_log (this->name, GF_LOG_WARNING, GEOREP" sessions active" "for the volume %s ", volname); snprintf (msg, sizeof(msg), GEOREP" sessions are active " @@ -1756,6 +1774,9 @@ glusterd_op_stop_volume (dict_t *dict) glusterd_volinfo_t *volinfo = NULL; glusterd_brickinfo_t *brickinfo = NULL; xlator_t *this = NULL; + char mountdir[PATH_MAX] = {0,}; + runner_t runner = {0,}; + char pidfile[PATH_MAX] = {0,}; this = THIS; GF_ASSERT (this); @@ -1783,6 +1804,30 @@ glusterd_op_stop_volume (dict_t *dict) if (ret) goto out; + /* If quota auxiliary mount is present, unmount it */ + GLUSTERFS_GET_AUX_MOUNT_PIDFILE (pidfile, volname); + + if (!gf_is_service_running (pidfile, NULL)) { + gf_log (this->name, GF_LOG_DEBUG, "Aux mount of volume %s " + "absent", volname); + } else { + GLUSTERD_GET_QUOTA_AUX_MOUNT_PATH (mountdir, volname, "/"); + + runinit (&runner); + runner_add_args (&runner, "umount", + + #if GF_LINUX_HOST_OS + "-l", + #endif + mountdir, NULL); + ret = runner_run_reuse (&runner); + if (ret) + gf_log (this->name, GF_LOG_ERROR, "umount on %s failed, " + "reason : %s", mountdir, strerror (errno)); + + runner_end (&runner); + } + ret = glusterd_nodesvcs_handle_graph_change (volinfo); out: return ret; |