summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src
diff options
context:
space:
mode:
authorshishir gowda <shishirng@gluster.com>2010-08-05 04:44:20 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-08-06 03:37:05 -0700
commitd1d06c102cfb6ea04a5e6f7db414a00c1a8351e2 (patch)
treea90a12d5a612fed5ce074e70330dbe9cbb027096 /xlators/mgmt/glusterd/src
parentdc10948a186931f22df2b1d3b4053c0c6bcac1de (diff)
Fix cli volume defrag command hang
gluster volume defrag <volname> hang is being fixed. Also, if a invalid volname was specified, it used to create mount point and call gluster client mount on it. This is also being fixed Signed-off-by: shishir gowda <shishirng@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1247 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1247
Diffstat (limited to 'xlators/mgmt/glusterd/src')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-handler.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
index 80ca1f325..9aa4801e9 100644
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
@@ -603,6 +603,7 @@ glusterd_handle_defrag_volume (rpcsvc_request_t *req)
gf1_cli_defrag_vol_req cli_req = {0,};
glusterd_conf_t *priv = NULL;
char cmd_str[4096] = {0,};
+ glusterd_volinfo_t *tmp_volinfo = NULL;
GF_ASSERT (req);
@@ -616,6 +617,12 @@ glusterd_handle_defrag_volume (rpcsvc_request_t *req)
gf_log ("glusterd", GF_LOG_NORMAL, "Received defrag volume on %s",
cli_req.volname);
+ if (glusterd_volinfo_find(cli_req.volname, &tmp_volinfo)) {
+ gf_log ("glusterd", GF_LOG_NORMAL, "Received defrag on invalid"
+ " volname %s", cli_req.volname);
+ goto out;
+ }
+
glusterd_op_set_op (GD_OP_DEFRAG_VOLUME);
glusterd_op_set_ctx (GD_OP_DEFRAG_VOLUME, cli_req.volname);
@@ -626,6 +633,11 @@ glusterd_handle_defrag_volume (rpcsvc_request_t *req)
priv->workdir, cli_req.volname);
ret = system (cmd_str);
+ if (ret) {
+ gf_log("glusterd", GF_LOG_DEBUG, "command: %s failed", cmd_str);
+ goto out;
+ }
+
snprintf (cmd_str, 4096, "glusterfs -f %s/vols/%s/%s-tcp.vol "
"--xlator-option dht0.unhashed-sticky-bit=yes "
"--xlator-option dht0.lookup-unhashed=on %s/mount/%s",
@@ -633,11 +645,17 @@ glusterd_handle_defrag_volume (rpcsvc_request_t *req)
priv->workdir, cli_req.volname);
ret = system (cmd_str);
+ if (ret) {
+ gf_log("glusterd", GF_LOG_DEBUG, "command: %s failed", cmd_str);
+ goto out;
+ }
+
snprintf (cmd_str, 4096, "glusterfs-defrag %s/mount/%s",
priv->workdir, cli_req.volname);
ret = system (cmd_str);
- ret = 0;
+ if (ret)
+ gf_log("glusterd", GF_LOG_DEBUG, "command: %s failed",cmd_str);
out:
return ret;
}