|
|
f338ef |
From 308fe0d81dbef9f84bb1ad8e7309e3ffc28d6394 Mon Sep 17 00:00:00 2001
|
|
|
f338ef |
From: Mohammed Rafi KC <rkavunga@redhat.com>
|
|
|
f338ef |
Date: Thu, 11 Jul 2019 12:37:29 +0530
|
|
|
f338ef |
Subject: [PATCH 230/255] Revert "glusterd/svc: update pid of mux volumes from
|
|
|
f338ef |
the shd process"
|
|
|
f338ef |
|
|
|
f338ef |
This reverts commit b0815b8a84a07d17a1215c55afc38888ee9fc37c.
|
|
|
f338ef |
Label : DOWNSTREAM ONLY
|
|
|
f338ef |
|
|
|
f338ef |
BUG: 1471742
|
|
|
f338ef |
Change-Id: Iab11c686565e9a9c852f2b7c2d236fa1a348f96a
|
|
|
f338ef |
Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com>
|
|
|
f338ef |
Reviewed-on: https://code.engineering.redhat.com/gerrit/175940
|
|
|
f338ef |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
f338ef |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
f338ef |
---
|
|
|
f338ef |
glusterfsd/src/gf_attach.c | 2 -
|
|
|
f338ef |
glusterfsd/src/glusterfsd-mgmt.c | 66 ++-------
|
|
|
f338ef |
libglusterfs/src/glusterfs/glusterfs.h | 2 +-
|
|
|
f338ef |
libglusterfs/src/glusterfs/libglusterfs-messages.h | 3 +-
|
|
|
f338ef |
libglusterfs/src/graph.c | 154 +--------------------
|
|
|
f338ef |
rpc/xdr/src/glusterd1-xdr.x | 1 -
|
|
|
f338ef |
xlators/mgmt/glusterd/src/glusterd-handler.c | 2 -
|
|
|
f338ef |
xlators/mgmt/glusterd/src/glusterd-handshake.c | 42 +-----
|
|
|
f338ef |
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 4 -
|
|
|
f338ef |
.../mgmt/glusterd/src/glusterd-shd-svc-helper.c | 25 ----
|
|
|
f338ef |
.../mgmt/glusterd/src/glusterd-shd-svc-helper.h | 3 -
|
|
|
f338ef |
xlators/mgmt/glusterd/src/glusterd-shd-svc.c | 8 +-
|
|
|
f338ef |
xlators/mgmt/glusterd/src/glusterd-svc-helper.c | 57 ++++----
|
|
|
f338ef |
xlators/mgmt/glusterd/src/glusterd-syncop.c | 2 -
|
|
|
f338ef |
xlators/mgmt/glusterd/src/glusterd-utils.c | 6 +-
|
|
|
f338ef |
15 files changed, 52 insertions(+), 325 deletions(-)
|
|
|
f338ef |
|
|
|
f338ef |
diff --git a/glusterfsd/src/gf_attach.c b/glusterfsd/src/gf_attach.c
|
|
|
f338ef |
index 1bff854..6293b9b 100644
|
|
|
f338ef |
--- a/glusterfsd/src/gf_attach.c
|
|
|
f338ef |
+++ b/glusterfsd/src/gf_attach.c
|
|
|
f338ef |
@@ -65,8 +65,6 @@ send_brick_req(xlator_t *this, struct rpc_clnt *rpc, char *path, int op)
|
|
|
f338ef |
brick_req.name = path;
|
|
|
f338ef |
brick_req.input.input_val = NULL;
|
|
|
f338ef |
brick_req.input.input_len = 0;
|
|
|
f338ef |
- brick_req.dict.dict_val = NULL;
|
|
|
f338ef |
- brick_req.dict.dict_len = 0;
|
|
|
f338ef |
|
|
|
f338ef |
req_size = xdr_sizeof((xdrproc_t)xdr_gd1_mgmt_brick_op_req, req);
|
|
|
f338ef |
iobuf = iobuf_get2(rpc->ctx->iobuf_pool, req_size);
|
|
|
f338ef |
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
|
|
|
f338ef |
index f930e0a..1d2cd1a 100644
|
|
|
f338ef |
--- a/glusterfsd/src/glusterfsd-mgmt.c
|
|
|
f338ef |
+++ b/glusterfsd/src/glusterfsd-mgmt.c
|
|
|
f338ef |
@@ -50,16 +50,13 @@ int
|
|
|
f338ef |
emancipate(glusterfs_ctx_t *ctx, int ret);
|
|
|
f338ef |
int
|
|
|
f338ef |
glusterfs_process_svc_attach_volfp(glusterfs_ctx_t *ctx, FILE *fp,
|
|
|
f338ef |
- char *volfile_id, char *checksum,
|
|
|
f338ef |
- dict_t *dict);
|
|
|
f338ef |
+ char *volfile_id, char *checksum);
|
|
|
f338ef |
int
|
|
|
f338ef |
glusterfs_mux_volfile_reconfigure(FILE *newvolfile_fp, glusterfs_ctx_t *ctx,
|
|
|
f338ef |
- gf_volfile_t *volfile_obj, char *checksum,
|
|
|
f338ef |
- dict_t *dict);
|
|
|
f338ef |
+ gf_volfile_t *volfile_obj, char *checksum);
|
|
|
f338ef |
int
|
|
|
f338ef |
glusterfs_process_svc_attach_volfp(glusterfs_ctx_t *ctx, FILE *fp,
|
|
|
f338ef |
- char *volfile_id, char *checksum,
|
|
|
f338ef |
- dict_t *dict);
|
|
|
f338ef |
+ char *volfile_id, char *checksum);
|
|
|
f338ef |
int
|
|
|
f338ef |
glusterfs_process_svc_detach(glusterfs_ctx_t *ctx, gf_volfile_t *volfile_obj);
|
|
|
f338ef |
|
|
|
f338ef |
@@ -78,8 +75,7 @@ mgmt_cbk_spec(struct rpc_clnt *rpc, void *mydata, void *data)
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
int
|
|
|
f338ef |
-mgmt_process_volfile(const char *volfile, ssize_t size, char *volfile_id,
|
|
|
f338ef |
- dict_t *dict)
|
|
|
f338ef |
+mgmt_process_volfile(const char *volfile, ssize_t size, char *volfile_id)
|
|
|
f338ef |
{
|
|
|
f338ef |
glusterfs_ctx_t *ctx = NULL;
|
|
|
f338ef |
int ret = 0;
|
|
|
f338ef |
@@ -149,11 +145,11 @@ mgmt_process_volfile(const char *volfile, ssize_t size, char *volfile_id,
|
|
|
f338ef |
* the volfile
|
|
|
f338ef |
*/
|
|
|
f338ef |
ret = glusterfs_process_svc_attach_volfp(ctx, tmpfp, volfile_id,
|
|
|
f338ef |
- sha256_hash, dict);
|
|
|
f338ef |
+ sha256_hash);
|
|
|
f338ef |
goto unlock;
|
|
|
f338ef |
}
|
|
|
f338ef |
ret = glusterfs_mux_volfile_reconfigure(tmpfp, ctx, volfile_obj,
|
|
|
f338ef |
- sha256_hash, dict);
|
|
|
f338ef |
+ sha256_hash);
|
|
|
f338ef |
if (ret < 0) {
|
|
|
f338ef |
gf_msg_debug("glusterfsd-mgmt", EINVAL, "Reconfigure failed !!");
|
|
|
f338ef |
}
|
|
|
f338ef |
@@ -391,8 +387,6 @@ err:
|
|
|
f338ef |
UNLOCK(&ctx->volfile_lock);
|
|
|
f338ef |
if (xlator_req.input.input_val)
|
|
|
f338ef |
free(xlator_req.input.input_val);
|
|
|
f338ef |
- if (xlator_req.dict.dict_val)
|
|
|
f338ef |
- free(xlator_req.dict.dict_val);
|
|
|
f338ef |
free(xlator_req.name);
|
|
|
f338ef |
xlator_req.name = NULL;
|
|
|
f338ef |
return 0;
|
|
|
f338ef |
@@ -567,8 +561,6 @@ out:
|
|
|
f338ef |
|
|
|
f338ef |
free(xlator_req.name);
|
|
|
f338ef |
free(xlator_req.input.input_val);
|
|
|
f338ef |
- if (xlator_req.dict.dict_val)
|
|
|
f338ef |
- free(xlator_req.dict.dict_val);
|
|
|
f338ef |
if (output)
|
|
|
f338ef |
dict_unref(output);
|
|
|
f338ef |
if (dict)
|
|
|
f338ef |
@@ -990,8 +982,6 @@ out:
|
|
|
f338ef |
if (input)
|
|
|
f338ef |
dict_unref(input);
|
|
|
f338ef |
free(xlator_req.input.input_val); /*malloced by xdr*/
|
|
|
f338ef |
- if (xlator_req.dict.dict_val)
|
|
|
f338ef |
- free(xlator_req.dict.dict_val);
|
|
|
f338ef |
if (output)
|
|
|
f338ef |
dict_unref(output);
|
|
|
f338ef |
free(xlator_req.name);
|
|
|
f338ef |
@@ -1072,8 +1062,6 @@ glusterfs_handle_attach(rpcsvc_request_t *req)
|
|
|
f338ef |
out:
|
|
|
f338ef |
UNLOCK(&ctx->volfile_lock);
|
|
|
f338ef |
}
|
|
|
f338ef |
- if (xlator_req.dict.dict_val)
|
|
|
f338ef |
- free(xlator_req.dict.dict_val);
|
|
|
f338ef |
free(xlator_req.input.input_val);
|
|
|
f338ef |
free(xlator_req.name);
|
|
|
f338ef |
|
|
|
f338ef |
@@ -1089,7 +1077,6 @@ glusterfs_handle_svc_attach(rpcsvc_request_t *req)
|
|
|
f338ef |
};
|
|
|
f338ef |
xlator_t *this = NULL;
|
|
|
f338ef |
glusterfs_ctx_t *ctx = NULL;
|
|
|
f338ef |
- dict_t *dict = NULL;
|
|
|
f338ef |
|
|
|
f338ef |
GF_ASSERT(req);
|
|
|
f338ef |
this = THIS;
|
|
|
f338ef |
@@ -1104,41 +1091,20 @@ glusterfs_handle_svc_attach(rpcsvc_request_t *req)
|
|
|
f338ef |
req->rpc_err = GARBAGE_ARGS;
|
|
|
f338ef |
goto out;
|
|
|
f338ef |
}
|
|
|
f338ef |
-
|
|
|
f338ef |
gf_msg(THIS->name, GF_LOG_INFO, 0, glusterfsd_msg_41,
|
|
|
f338ef |
"received attach "
|
|
|
f338ef |
"request for volfile-id=%s",
|
|
|
f338ef |
xlator_req.name);
|
|
|
f338ef |
-
|
|
|
f338ef |
- dict = dict_new();
|
|
|
f338ef |
- if (!dict) {
|
|
|
f338ef |
- ret = -1;
|
|
|
f338ef |
- errno = ENOMEM;
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
-
|
|
|
f338ef |
- ret = dict_unserialize(xlator_req.dict.dict_val, xlator_req.dict.dict_len,
|
|
|
f338ef |
- &dict);
|
|
|
f338ef |
- if (ret) {
|
|
|
f338ef |
- gf_msg(this->name, GF_LOG_WARNING, EINVAL, glusterfsd_msg_42,
|
|
|
f338ef |
- "failed to unserialize xdata to dictionary");
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
- dict->extra_stdfree = xlator_req.dict.dict_val;
|
|
|
f338ef |
-
|
|
|
f338ef |
ret = 0;
|
|
|
f338ef |
|
|
|
f338ef |
if (ctx->active) {
|
|
|
f338ef |
ret = mgmt_process_volfile(xlator_req.input.input_val,
|
|
|
f338ef |
- xlator_req.input.input_len, xlator_req.name,
|
|
|
f338ef |
- dict);
|
|
|
f338ef |
+ xlator_req.input.input_len, xlator_req.name);
|
|
|
f338ef |
} else {
|
|
|
f338ef |
gf_msg(this->name, GF_LOG_WARNING, EINVAL, glusterfsd_msg_42,
|
|
|
f338ef |
"got attach for %s but no active graph", xlator_req.name);
|
|
|
f338ef |
}
|
|
|
f338ef |
out:
|
|
|
f338ef |
- if (dict)
|
|
|
f338ef |
- dict_unref(dict);
|
|
|
f338ef |
if (xlator_req.input.input_val)
|
|
|
f338ef |
free(xlator_req.input.input_val);
|
|
|
f338ef |
if (xlator_req.name)
|
|
|
f338ef |
@@ -1275,8 +1241,6 @@ out:
|
|
|
f338ef |
GF_FREE(filepath);
|
|
|
f338ef |
if (xlator_req.input.input_val)
|
|
|
f338ef |
free(xlator_req.input.input_val);
|
|
|
f338ef |
- if (xlator_req.dict.dict_val)
|
|
|
f338ef |
- free(xlator_req.dict.dict_val);
|
|
|
f338ef |
|
|
|
f338ef |
return ret;
|
|
|
f338ef |
}
|
|
|
f338ef |
@@ -1349,8 +1313,6 @@ out:
|
|
|
f338ef |
if (dict)
|
|
|
f338ef |
dict_unref(dict);
|
|
|
f338ef |
free(xlator_req.input.input_val); // malloced by xdr
|
|
|
f338ef |
- if (xlator_req.dict.dict_val)
|
|
|
f338ef |
- free(xlator_req.dict.dict_val);
|
|
|
f338ef |
if (output)
|
|
|
f338ef |
dict_unref(output);
|
|
|
f338ef |
free(xlator_req.name); // malloced by xdr
|
|
|
f338ef |
@@ -1499,8 +1461,6 @@ out:
|
|
|
f338ef |
if (output)
|
|
|
f338ef |
dict_unref(output);
|
|
|
f338ef |
free(brick_req.input.input_val);
|
|
|
f338ef |
- if (brick_req.dict.dict_val)
|
|
|
f338ef |
- free(brick_req.dict.dict_val);
|
|
|
f338ef |
free(brick_req.name);
|
|
|
f338ef |
GF_FREE(xname);
|
|
|
f338ef |
GF_FREE(msg);
|
|
|
f338ef |
@@ -1694,8 +1654,6 @@ out:
|
|
|
f338ef |
if (dict)
|
|
|
f338ef |
dict_unref(dict);
|
|
|
f338ef |
free(node_req.input.input_val);
|
|
|
f338ef |
- if (node_req.dict.dict_val)
|
|
|
f338ef |
- free(node_req.dict.dict_val);
|
|
|
f338ef |
GF_FREE(msg);
|
|
|
f338ef |
GF_FREE(rsp.output.output_val);
|
|
|
f338ef |
GF_FREE(node_name);
|
|
|
f338ef |
@@ -1799,8 +1757,6 @@ glusterfs_handle_nfs_profile(rpcsvc_request_t *req)
|
|
|
f338ef |
|
|
|
f338ef |
out:
|
|
|
f338ef |
free(nfs_req.input.input_val);
|
|
|
f338ef |
- if (nfs_req.dict.dict_val)
|
|
|
f338ef |
- free(nfs_req.dict.dict_val);
|
|
|
f338ef |
if (dict)
|
|
|
f338ef |
dict_unref(dict);
|
|
|
f338ef |
if (output)
|
|
|
f338ef |
@@ -1879,8 +1835,6 @@ out:
|
|
|
f338ef |
if (dict)
|
|
|
f338ef |
dict_unref(dict);
|
|
|
f338ef |
free(xlator_req.input.input_val); // malloced by xdr
|
|
|
f338ef |
- if (xlator_req.dict.dict_val)
|
|
|
f338ef |
- free(xlator_req.dict.dict_val);
|
|
|
f338ef |
if (output)
|
|
|
f338ef |
dict_unref(output);
|
|
|
f338ef |
free(xlator_req.name); // malloced by xdr
|
|
|
f338ef |
@@ -2009,8 +1963,7 @@ out:
|
|
|
f338ef |
if (dict)
|
|
|
f338ef |
dict_unref(dict);
|
|
|
f338ef |
free(brick_req.input.input_val);
|
|
|
f338ef |
- if (brick_req.dict.dict_val)
|
|
|
f338ef |
- free(brick_req.dict.dict_val);
|
|
|
f338ef |
+
|
|
|
f338ef |
gf_log(THIS->name, GF_LOG_DEBUG, "Returning %d", ret);
|
|
|
f338ef |
return ret;
|
|
|
f338ef |
}
|
|
|
f338ef |
@@ -2260,8 +2213,7 @@ volfile:
|
|
|
f338ef |
size = rsp.op_ret;
|
|
|
f338ef |
volfile_id = frame->local;
|
|
|
f338ef |
if (mgmt_is_multiplexed_daemon(ctx->cmd_args.process_name)) {
|
|
|
f338ef |
- ret = mgmt_process_volfile((const char *)rsp.spec, size, volfile_id,
|
|
|
f338ef |
- dict);
|
|
|
f338ef |
+ ret = mgmt_process_volfile((const char *)rsp.spec, size, volfile_id);
|
|
|
f338ef |
goto post_graph_mgmt;
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
diff --git a/libglusterfs/src/glusterfs/glusterfs.h b/libglusterfs/src/glusterfs/glusterfs.h
|
|
|
f338ef |
index b6327b8..9ec2365 100644
|
|
|
f338ef |
--- a/libglusterfs/src/glusterfs/glusterfs.h
|
|
|
f338ef |
+++ b/libglusterfs/src/glusterfs/glusterfs.h
|
|
|
f338ef |
@@ -744,7 +744,7 @@ typedef struct {
|
|
|
f338ef |
char vol_id[NAME_MAX + 1];
|
|
|
f338ef |
struct list_head volfile_list;
|
|
|
f338ef |
glusterfs_graph_t *graph;
|
|
|
f338ef |
- FILE *pidfp;
|
|
|
f338ef |
+
|
|
|
f338ef |
} gf_volfile_t;
|
|
|
f338ef |
|
|
|
f338ef |
glusterfs_ctx_t *
|
|
|
f338ef |
diff --git a/libglusterfs/src/glusterfs/libglusterfs-messages.h b/libglusterfs/src/glusterfs/libglusterfs-messages.h
|
|
|
f338ef |
index 7e0eebb..ea2aa60 100644
|
|
|
f338ef |
--- a/libglusterfs/src/glusterfs/libglusterfs-messages.h
|
|
|
f338ef |
+++ b/libglusterfs/src/glusterfs/libglusterfs-messages.h
|
|
|
f338ef |
@@ -111,7 +111,6 @@ GLFS_MSGID(
|
|
|
f338ef |
LG_MSG_PTHREAD_NAMING_FAILED, LG_MSG_SYSCALL_RETURNS_WRONG,
|
|
|
f338ef |
LG_MSG_XXH64_TO_GFID_FAILED, LG_MSG_ASYNC_WARNING, LG_MSG_ASYNC_FAILURE,
|
|
|
f338ef |
LG_MSG_GRAPH_CLEANUP_FAILED, LG_MSG_GRAPH_SETUP_FAILED,
|
|
|
f338ef |
- LG_MSG_GRAPH_DETACH_STARTED, LG_MSG_GRAPH_ATTACH_FAILED,
|
|
|
f338ef |
- LG_MSG_GRAPH_ATTACH_PID_FILE_UPDATED);
|
|
|
f338ef |
+ LG_MSG_GRAPH_DETACH_STARTED, LG_MSG_GRAPH_ATTACH_FAILED);
|
|
|
f338ef |
|
|
|
f338ef |
#endif /* !_LG_MESSAGES_H_ */
|
|
|
f338ef |
diff --git a/libglusterfs/src/graph.c b/libglusterfs/src/graph.c
|
|
|
f338ef |
index 05f76bf..172dc61 100644
|
|
|
f338ef |
--- a/libglusterfs/src/graph.c
|
|
|
f338ef |
+++ b/libglusterfs/src/graph.c
|
|
|
f338ef |
@@ -1467,21 +1467,6 @@ out:
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
int
|
|
|
f338ef |
-glusterfs_svc_mux_pidfile_cleanup(gf_volfile_t *volfile_obj)
|
|
|
f338ef |
-{
|
|
|
f338ef |
- if (!volfile_obj || !volfile_obj->pidfp)
|
|
|
f338ef |
- return 0;
|
|
|
f338ef |
-
|
|
|
f338ef |
- gf_msg_trace("glusterfsd", 0, "pidfile %s cleanup", volfile_obj->vol_id);
|
|
|
f338ef |
-
|
|
|
f338ef |
- lockf(fileno(volfile_obj->pidfp), F_ULOCK, 0);
|
|
|
f338ef |
- fclose(volfile_obj->pidfp);
|
|
|
f338ef |
- volfile_obj->pidfp = NULL;
|
|
|
f338ef |
-
|
|
|
f338ef |
- return 0;
|
|
|
f338ef |
-}
|
|
|
f338ef |
-
|
|
|
f338ef |
-int
|
|
|
f338ef |
glusterfs_process_svc_detach(glusterfs_ctx_t *ctx, gf_volfile_t *volfile_obj)
|
|
|
f338ef |
{
|
|
|
f338ef |
xlator_t *last_xl = NULL;
|
|
|
f338ef |
@@ -1517,7 +1502,6 @@ glusterfs_process_svc_detach(glusterfs_ctx_t *ctx, gf_volfile_t *volfile_obj)
|
|
|
f338ef |
|
|
|
f338ef |
list_del_init(&volfile_obj->volfile_list);
|
|
|
f338ef |
glusterfs_mux_xlator_unlink(parent_graph->top, xl);
|
|
|
f338ef |
- glusterfs_svc_mux_pidfile_cleanup(volfile_obj);
|
|
|
f338ef |
parent_graph->last_xl = glusterfs_get_last_xlator(parent_graph);
|
|
|
f338ef |
parent_graph->xl_count -= graph->xl_count;
|
|
|
f338ef |
parent_graph->leaf_count -= graph->leaf_count;
|
|
|
f338ef |
@@ -1547,126 +1531,8 @@ out:
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
int
|
|
|
f338ef |
-glusterfs_svc_mux_pidfile_setup(gf_volfile_t *volfile_obj, const char *pid_file)
|
|
|
f338ef |
-{
|
|
|
f338ef |
- int ret = -1;
|
|
|
f338ef |
- FILE *pidfp = NULL;
|
|
|
f338ef |
-
|
|
|
f338ef |
- if (!pid_file || !volfile_obj)
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
-
|
|
|
f338ef |
- if (volfile_obj->pidfp) {
|
|
|
f338ef |
- ret = 0;
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
- pidfp = fopen(pid_file, "a+");
|
|
|
f338ef |
- if (!pidfp) {
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
- volfile_obj->pidfp = pidfp;
|
|
|
f338ef |
-
|
|
|
f338ef |
- ret = lockf(fileno(pidfp), F_TLOCK, 0);
|
|
|
f338ef |
- if (ret) {
|
|
|
f338ef |
- ret = 0;
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
-out:
|
|
|
f338ef |
- return ret;
|
|
|
f338ef |
-}
|
|
|
f338ef |
-
|
|
|
f338ef |
-int
|
|
|
f338ef |
-glusterfs_svc_mux_pidfile_update(gf_volfile_t *volfile_obj,
|
|
|
f338ef |
- const char *pid_file, pid_t pid)
|
|
|
f338ef |
-{
|
|
|
f338ef |
- int ret = 0;
|
|
|
f338ef |
- FILE *pidfp = NULL;
|
|
|
f338ef |
- int old_pid;
|
|
|
f338ef |
-
|
|
|
f338ef |
- if (!volfile_obj->pidfp) {
|
|
|
f338ef |
- ret = glusterfs_svc_mux_pidfile_setup(volfile_obj, pid_file);
|
|
|
f338ef |
- if (ret == -1)
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
- pidfp = volfile_obj->pidfp;
|
|
|
f338ef |
- ret = fscanf(pidfp, "%d", &old_pid);
|
|
|
f338ef |
- if (ret <= 0) {
|
|
|
f338ef |
- goto update;
|
|
|
f338ef |
- }
|
|
|
f338ef |
- if (old_pid == pid) {
|
|
|
f338ef |
- ret = 0;
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- } else {
|
|
|
f338ef |
- gf_msg("mgmt", GF_LOG_INFO, 0, LG_MSG_GRAPH_ATTACH_PID_FILE_UPDATED,
|
|
|
f338ef |
- "Old pid=%d found in pidfile %s. Cleaning the old pid and "
|
|
|
f338ef |
- "Updating new pid=%d",
|
|
|
f338ef |
- old_pid, pid_file, pid);
|
|
|
f338ef |
- }
|
|
|
f338ef |
-update:
|
|
|
f338ef |
- ret = sys_ftruncate(fileno(pidfp), 0);
|
|
|
f338ef |
- if (ret) {
|
|
|
f338ef |
- gf_msg("glusterfsd", GF_LOG_ERROR, errno,
|
|
|
f338ef |
- LG_MSG_GRAPH_ATTACH_PID_FILE_UPDATED,
|
|
|
f338ef |
- "pidfile %s truncation failed", pid_file);
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
-
|
|
|
f338ef |
- ret = fprintf(pidfp, "%d\n", pid);
|
|
|
f338ef |
- if (ret <= 0) {
|
|
|
f338ef |
- gf_msg("glusterfsd", GF_LOG_ERROR, errno,
|
|
|
f338ef |
- LG_MSG_GRAPH_ATTACH_PID_FILE_UPDATED, "pidfile %s write failed",
|
|
|
f338ef |
- pid_file);
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
-
|
|
|
f338ef |
- ret = fflush(pidfp);
|
|
|
f338ef |
- if (ret) {
|
|
|
f338ef |
- gf_msg("glusterfsd", GF_LOG_ERROR, errno,
|
|
|
f338ef |
- LG_MSG_GRAPH_ATTACH_PID_FILE_UPDATED, "pidfile %s write failed",
|
|
|
f338ef |
- pid_file);
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
-out:
|
|
|
f338ef |
- return ret;
|
|
|
f338ef |
-}
|
|
|
f338ef |
-
|
|
|
f338ef |
-int
|
|
|
f338ef |
-glusterfs_update_mux_pid(dict_t *dict, gf_volfile_t *volfile_obj)
|
|
|
f338ef |
-{
|
|
|
f338ef |
- char *file = NULL;
|
|
|
f338ef |
- int ret = -1;
|
|
|
f338ef |
-
|
|
|
f338ef |
- GF_VALIDATE_OR_GOTO("graph", dict, out);
|
|
|
f338ef |
- GF_VALIDATE_OR_GOTO("graph", volfile_obj, out);
|
|
|
f338ef |
-
|
|
|
f338ef |
- ret = dict_get_str(dict, "pidfile", &file;;
|
|
|
f338ef |
- if (ret < 0) {
|
|
|
f338ef |
- gf_msg("mgmt", GF_LOG_ERROR, EINVAL, LG_MSG_GRAPH_SETUP_FAILED,
|
|
|
f338ef |
- "Failed to get pidfile from dict for volfile_id=%s",
|
|
|
f338ef |
- volfile_obj->vol_id);
|
|
|
f338ef |
- }
|
|
|
f338ef |
-
|
|
|
f338ef |
- ret = glusterfs_svc_mux_pidfile_update(volfile_obj, file, getpid());
|
|
|
f338ef |
- if (ret < 0) {
|
|
|
f338ef |
- ret = -1;
|
|
|
f338ef |
- gf_msg("mgmt", GF_LOG_ERROR, EINVAL, LG_MSG_GRAPH_SETUP_FAILED,
|
|
|
f338ef |
- "Failed to update "
|
|
|
f338ef |
- "the pidfile for volfile_id=%s",
|
|
|
f338ef |
- volfile_obj->vol_id);
|
|
|
f338ef |
-
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
-
|
|
|
f338ef |
- if (ret == 1)
|
|
|
f338ef |
- gf_msg("mgmt", GF_LOG_INFO, 0, LG_MSG_GRAPH_ATTACH_PID_FILE_UPDATED,
|
|
|
f338ef |
- "PID %d updated in pidfile=%s", getpid(), file);
|
|
|
f338ef |
- ret = 0;
|
|
|
f338ef |
-out:
|
|
|
f338ef |
- return ret;
|
|
|
f338ef |
-}
|
|
|
f338ef |
-int
|
|
|
f338ef |
glusterfs_process_svc_attach_volfp(glusterfs_ctx_t *ctx, FILE *fp,
|
|
|
f338ef |
- char *volfile_id, char *checksum,
|
|
|
f338ef |
- dict_t *dict)
|
|
|
f338ef |
+ char *volfile_id, char *checksum)
|
|
|
f338ef |
{
|
|
|
f338ef |
glusterfs_graph_t *graph = NULL;
|
|
|
f338ef |
glusterfs_graph_t *parent_graph = NULL;
|
|
|
f338ef |
@@ -1749,25 +1615,18 @@ glusterfs_process_svc_attach_volfp(glusterfs_ctx_t *ctx, FILE *fp,
|
|
|
f338ef |
ret = -1;
|
|
|
f338ef |
goto out;
|
|
|
f338ef |
}
|
|
|
f338ef |
- volfile_obj->pidfp = NULL;
|
|
|
f338ef |
- snprintf(volfile_obj->vol_id, sizeof(volfile_obj->vol_id), "%s",
|
|
|
f338ef |
- volfile_id);
|
|
|
f338ef |
-
|
|
|
f338ef |
- if (strcmp(ctx->cmd_args.process_name, "glustershd") == 0) {
|
|
|
f338ef |
- ret = glusterfs_update_mux_pid(dict, volfile_obj);
|
|
|
f338ef |
- if (ret == -1) {
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
- }
|
|
|
f338ef |
|
|
|
f338ef |
graph->used = 1;
|
|
|
f338ef |
parent_graph->id++;
|
|
|
f338ef |
list_add(&graph->list, &ctx->graphs);
|
|
|
f338ef |
INIT_LIST_HEAD(&volfile_obj->volfile_list);
|
|
|
f338ef |
volfile_obj->graph = graph;
|
|
|
f338ef |
+ snprintf(volfile_obj->vol_id, sizeof(volfile_obj->vol_id), "%s",
|
|
|
f338ef |
+ volfile_id);
|
|
|
f338ef |
memcpy(volfile_obj->volfile_checksum, checksum,
|
|
|
f338ef |
sizeof(volfile_obj->volfile_checksum));
|
|
|
f338ef |
list_add_tail(&volfile_obj->volfile_list, &ctx->volfile_list);
|
|
|
f338ef |
+
|
|
|
f338ef |
gf_log_dump_graph(fp, graph);
|
|
|
f338ef |
graph = NULL;
|
|
|
f338ef |
|
|
|
f338ef |
@@ -1795,8 +1654,7 @@ out:
|
|
|
f338ef |
|
|
|
f338ef |
int
|
|
|
f338ef |
glusterfs_mux_volfile_reconfigure(FILE *newvolfile_fp, glusterfs_ctx_t *ctx,
|
|
|
f338ef |
- gf_volfile_t *volfile_obj, char *checksum,
|
|
|
f338ef |
- dict_t *dict)
|
|
|
f338ef |
+ gf_volfile_t *volfile_obj, char *checksum)
|
|
|
f338ef |
{
|
|
|
f338ef |
glusterfs_graph_t *oldvolfile_graph = NULL;
|
|
|
f338ef |
glusterfs_graph_t *newvolfile_graph = NULL;
|
|
|
f338ef |
@@ -1845,7 +1703,7 @@ glusterfs_mux_volfile_reconfigure(FILE *newvolfile_fp, glusterfs_ctx_t *ctx,
|
|
|
f338ef |
}
|
|
|
f338ef |
volfile_obj = NULL;
|
|
|
f338ef |
ret = glusterfs_process_svc_attach_volfp(ctx, newvolfile_fp, vol_id,
|
|
|
f338ef |
- checksum, dict);
|
|
|
f338ef |
+ checksum);
|
|
|
f338ef |
goto out;
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
diff --git a/rpc/xdr/src/glusterd1-xdr.x b/rpc/xdr/src/glusterd1-xdr.x
|
|
|
f338ef |
index 02ebec2..9b36d34 100644
|
|
|
f338ef |
--- a/rpc/xdr/src/glusterd1-xdr.x
|
|
|
f338ef |
+++ b/rpc/xdr/src/glusterd1-xdr.x
|
|
|
f338ef |
@@ -132,7 +132,6 @@ struct gd1_mgmt_brick_op_req {
|
|
|
f338ef |
string name<>;
|
|
|
f338ef |
int op;
|
|
|
f338ef |
opaque input<>;
|
|
|
f338ef |
- opaque dict<>;
|
|
|
f338ef |
} ;
|
|
|
f338ef |
|
|
|
f338ef |
struct gd1_mgmt_brick_op_rsp {
|
|
|
f338ef |
diff --git a/xlators/mgmt/glusterd/src/glusterd-handler.c b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
f338ef |
index 94e1be5..ac788a0 100644
|
|
|
f338ef |
--- a/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
f338ef |
+++ b/xlators/mgmt/glusterd/src/glusterd-handler.c
|
|
|
f338ef |
@@ -5423,8 +5423,6 @@ glusterd_print_client_details(FILE *fp, dict_t *dict,
|
|
|
f338ef |
|
|
|
f338ef |
brick_req->op = GLUSTERD_BRICK_STATUS;
|
|
|
f338ef |
brick_req->name = "";
|
|
|
f338ef |
- brick_req->dict.dict_val = NULL;
|
|
|
f338ef |
- brick_req->dict.dict_len = 0;
|
|
|
f338ef |
|
|
|
f338ef |
ret = dict_set_strn(dict, "brick-name", SLEN("brick-name"),
|
|
|
f338ef |
brickinfo->path);
|
|
|
f338ef |
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
|
|
|
f338ef |
index 86dec82..1ba58c3 100644
|
|
|
f338ef |
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
|
|
|
f338ef |
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
|
|
|
f338ef |
@@ -203,7 +203,7 @@ out:
|
|
|
f338ef |
|
|
|
f338ef |
size_t
|
|
|
f338ef |
build_volfile_path(char *volume_id, char *path, size_t path_len,
|
|
|
f338ef |
- char *trusted_str, dict_t *dict)
|
|
|
f338ef |
+ char *trusted_str)
|
|
|
f338ef |
{
|
|
|
f338ef |
struct stat stbuf = {
|
|
|
f338ef |
0,
|
|
|
f338ef |
@@ -340,19 +340,11 @@ build_volfile_path(char *volume_id, char *path, size_t path_len,
|
|
|
f338ef |
|
|
|
f338ef |
ret = glusterd_volinfo_find(volid_ptr, &volinfo);
|
|
|
f338ef |
if (ret == -1) {
|
|
|
f338ef |
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_GET_FAIL,
|
|
|
f338ef |
- "Couldn't find volinfo for volid=%s", volid_ptr);
|
|
|
f338ef |
+ gf_log(this->name, GF_LOG_ERROR, "Couldn't find volinfo");
|
|
|
f338ef |
goto out;
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
glusterd_svc_build_shd_volfile_path(volinfo, path, path_len);
|
|
|
f338ef |
-
|
|
|
f338ef |
- ret = glusterd_svc_set_shd_pidfile(volinfo, dict);
|
|
|
f338ef |
- if (ret == -1) {
|
|
|
f338ef |
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
|
|
|
f338ef |
- "Couldn't set pidfile in dict for volid=%s", volid_ptr);
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
ret = 0;
|
|
|
f338ef |
goto out;
|
|
|
f338ef |
}
|
|
|
f338ef |
@@ -927,7 +919,6 @@ __server_getspec(rpcsvc_request_t *req)
|
|
|
f338ef |
char addrstr[RPCSVC_PEER_STRLEN] = {0};
|
|
|
f338ef |
peer_info_t *peerinfo = NULL;
|
|
|
f338ef |
xlator_t *this = NULL;
|
|
|
f338ef |
- dict_t *dict = NULL;
|
|
|
f338ef |
|
|
|
f338ef |
this = THIS;
|
|
|
f338ef |
GF_ASSERT(this);
|
|
|
f338ef |
@@ -980,12 +971,6 @@ __server_getspec(rpcsvc_request_t *req)
|
|
|
f338ef |
goto fail;
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
- dict = dict_new();
|
|
|
f338ef |
- if (!dict) {
|
|
|
f338ef |
- ret = -ENOMEM;
|
|
|
f338ef |
- goto fail;
|
|
|
f338ef |
- }
|
|
|
f338ef |
-
|
|
|
f338ef |
trans = req->trans;
|
|
|
f338ef |
/* addrstr will be empty for cli socket connections */
|
|
|
f338ef |
ret = rpcsvc_transport_peername(trans, (char *)&addrstr, sizeof(addrstr));
|
|
|
f338ef |
@@ -1004,26 +989,12 @@ __server_getspec(rpcsvc_request_t *req)
|
|
|
f338ef |
*/
|
|
|
f338ef |
if (strlen(addrstr) == 0 || gf_is_local_addr(addrstr)) {
|
|
|
f338ef |
ret = build_volfile_path(volume, filename, sizeof(filename),
|
|
|
f338ef |
- TRUSTED_PREFIX, dict);
|
|
|
f338ef |
+ TRUSTED_PREFIX);
|
|
|
f338ef |
} else {
|
|
|
f338ef |
- ret = build_volfile_path(volume, filename, sizeof(filename), NULL,
|
|
|
f338ef |
- dict);
|
|
|
f338ef |
+ ret = build_volfile_path(volume, filename, sizeof(filename), NULL);
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
if (ret == 0) {
|
|
|
f338ef |
- if (dict->count > 0) {
|
|
|
f338ef |
- ret = dict_allocate_and_serialize(dict, &rsp.xdata.xdata_val,
|
|
|
f338ef |
- &rsp.xdata.xdata_len);
|
|
|
f338ef |
- if (ret) {
|
|
|
f338ef |
- gf_msg(this->name, GF_LOG_ERROR, 0,
|
|
|
f338ef |
- GD_MSG_DICT_SERL_LENGTH_GET_FAIL,
|
|
|
f338ef |
- "Failed to serialize dict "
|
|
|
f338ef |
- "to request buffer");
|
|
|
f338ef |
- goto fail;
|
|
|
f338ef |
- }
|
|
|
f338ef |
- dict->extra_free = rsp.xdata.xdata_val;
|
|
|
f338ef |
- }
|
|
|
f338ef |
-
|
|
|
f338ef |
/* to allocate the proper buffer to hold the file data */
|
|
|
f338ef |
ret = sys_stat(filename, &stbuf);
|
|
|
f338ef |
if (ret < 0) {
|
|
|
f338ef |
@@ -1065,6 +1036,7 @@ __server_getspec(rpcsvc_request_t *req)
|
|
|
f338ef |
goto fail;
|
|
|
f338ef |
}
|
|
|
f338ef |
}
|
|
|
f338ef |
+
|
|
|
f338ef |
/* convert to XDR */
|
|
|
f338ef |
fail:
|
|
|
f338ef |
if (spec_fd >= 0)
|
|
|
f338ef |
@@ -1084,10 +1056,6 @@ fail:
|
|
|
f338ef |
(xdrproc_t)xdr_gf_getspec_rsp);
|
|
|
f338ef |
free(args.key); // malloced by xdr
|
|
|
f338ef |
free(rsp.spec);
|
|
|
f338ef |
-
|
|
|
f338ef |
- if (dict)
|
|
|
f338ef |
- dict_unref(dict);
|
|
|
f338ef |
-
|
|
|
f338ef |
if (args.xdata.xdata_val)
|
|
|
f338ef |
free(args.xdata.xdata_val);
|
|
|
f338ef |
|
|
|
f338ef |
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
f338ef |
index 454877b..9ea695e 100644
|
|
|
f338ef |
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
f338ef |
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
f338ef |
@@ -655,8 +655,6 @@ glusterd_brick_op_build_payload(glusterd_op_t op,
|
|
|
f338ef |
break;
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
- brick_req->dict.dict_len = 0;
|
|
|
f338ef |
- brick_req->dict.dict_val = NULL;
|
|
|
f338ef |
ret = dict_allocate_and_serialize(dict, &brick_req->input.input_val,
|
|
|
f338ef |
&brick_req->input.input_len);
|
|
|
f338ef |
if (ret)
|
|
|
f338ef |
@@ -725,8 +723,6 @@ glusterd_node_op_build_payload(glusterd_op_t op, gd1_mgmt_brick_op_req **req,
|
|
|
f338ef |
goto out;
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
- brick_req->dict.dict_len = 0;
|
|
|
f338ef |
- brick_req->dict.dict_val = NULL;
|
|
|
f338ef |
ret = dict_allocate_and_serialize(dict, &brick_req->input.input_val,
|
|
|
f338ef |
&brick_req->input.input_len);
|
|
|
f338ef |
|
|
|
f338ef |
diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc-helper.c
|
|
|
f338ef |
index 5661e39..57ceda9 100644
|
|
|
f338ef |
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc-helper.c
|
|
|
f338ef |
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc-helper.c
|
|
|
f338ef |
@@ -126,28 +126,3 @@ glusterd_shd_svcproc_cleanup(glusterd_shdsvc_t *shd)
|
|
|
f338ef |
out:
|
|
|
f338ef |
return;
|
|
|
f338ef |
}
|
|
|
f338ef |
-
|
|
|
f338ef |
-int
|
|
|
f338ef |
-glusterd_svc_set_shd_pidfile(glusterd_volinfo_t *volinfo, dict_t *dict)
|
|
|
f338ef |
-{
|
|
|
f338ef |
- int ret = -1;
|
|
|
f338ef |
- glusterd_svc_t *svc = NULL;
|
|
|
f338ef |
- xlator_t *this = NULL;
|
|
|
f338ef |
-
|
|
|
f338ef |
- this = THIS;
|
|
|
f338ef |
- GF_VALIDATE_OR_GOTO("glusterd", this, out);
|
|
|
f338ef |
- GF_VALIDATE_OR_GOTO(this->name, volinfo, out);
|
|
|
f338ef |
- GF_VALIDATE_OR_GOTO(this->name, dict, out);
|
|
|
f338ef |
-
|
|
|
f338ef |
- svc = &(volinfo->shd.svc);
|
|
|
f338ef |
-
|
|
|
f338ef |
- ret = dict_set_dynstr_with_alloc(dict, "pidfile", svc->proc.pidfile);
|
|
|
f338ef |
- if (ret) {
|
|
|
f338ef |
- gf_msg(this->name, GF_LOG_ERROR, 0, GD_MSG_DICT_SET_FAILED,
|
|
|
f338ef |
- "Failed to set pidfile %s in dict", svc->proc.pidfile);
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
- ret = 0;
|
|
|
f338ef |
-out:
|
|
|
f338ef |
- return ret;
|
|
|
f338ef |
-}
|
|
|
f338ef |
diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc-helper.h b/xlators/mgmt/glusterd/src/glusterd-shd-svc-helper.h
|
|
|
f338ef |
index 1f0984b..59466ec 100644
|
|
|
f338ef |
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc-helper.h
|
|
|
f338ef |
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc-helper.h
|
|
|
f338ef |
@@ -36,7 +36,4 @@ glusterd_recover_shd_attach_failure(glusterd_volinfo_t *volinfo,
|
|
|
f338ef |
int
|
|
|
f338ef |
glusterd_shdsvc_create_volfile(glusterd_volinfo_t *volinfo);
|
|
|
f338ef |
|
|
|
f338ef |
-int
|
|
|
f338ef |
-glusterd_svc_set_shd_pidfile(glusterd_volinfo_t *volinfo, dict_t *dict);
|
|
|
f338ef |
-
|
|
|
f338ef |
#endif
|
|
|
f338ef |
diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
|
|
|
f338ef |
index 590169f..8ad90a9 100644
|
|
|
f338ef |
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
|
|
|
f338ef |
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
|
|
|
f338ef |
@@ -258,20 +258,14 @@ glusterd_shdsvc_manager(glusterd_svc_t *svc, void *data, int flags)
|
|
|
f338ef |
gf_boolean_t shd_restart = _gf_false;
|
|
|
f338ef |
|
|
|
f338ef |
conf = THIS->private;
|
|
|
f338ef |
+ volinfo = data;
|
|
|
f338ef |
GF_VALIDATE_OR_GOTO("glusterd", conf, out);
|
|
|
f338ef |
GF_VALIDATE_OR_GOTO("glusterd", svc, out);
|
|
|
f338ef |
- volinfo = data;
|
|
|
f338ef |
GF_VALIDATE_OR_GOTO("glusterd", volinfo, out);
|
|
|
f338ef |
|
|
|
f338ef |
if (volinfo)
|
|
|
f338ef |
glusterd_volinfo_ref(volinfo);
|
|
|
f338ef |
|
|
|
f338ef |
- if (volinfo->is_snap_volume) {
|
|
|
f338ef |
- /* healing of a snap volume is not supported yet*/
|
|
|
f338ef |
- ret = 0;
|
|
|
f338ef |
- goto out;
|
|
|
f338ef |
- }
|
|
|
f338ef |
-
|
|
|
f338ef |
while (conf->restart_shd) {
|
|
|
f338ef |
synclock_unlock(&conf->big_lock);
|
|
|
f338ef |
sleep(2);
|
|
|
f338ef |
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
|
|
|
f338ef |
index e106111..400826f 100644
|
|
|
f338ef |
--- a/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
|
|
|
f338ef |
+++ b/xlators/mgmt/glusterd/src/glusterd-svc-helper.c
|
|
|
f338ef |
@@ -519,7 +519,7 @@ glusterd_shd_svc_mux_init(glusterd_volinfo_t *volinfo, glusterd_svc_t *svc)
|
|
|
f338ef |
/* Take first entry from the process */
|
|
|
f338ef |
parent_svc = cds_list_entry(mux_proc->svcs.next, glusterd_svc_t,
|
|
|
f338ef |
mux_svc);
|
|
|
f338ef |
- glusterd_copy_file(parent_svc->proc.pidfile, svc->proc.pidfile);
|
|
|
f338ef |
+ sys_link(parent_svc->proc.pidfile, svc->proc.pidfile);
|
|
|
f338ef |
mux_conn = &parent_svc->conn;
|
|
|
f338ef |
if (volinfo)
|
|
|
f338ef |
volinfo->shd.attached = _gf_true;
|
|
|
f338ef |
@@ -623,9 +623,12 @@ glusterd_svc_attach_cbk(struct rpc_req *req, struct iovec *iov, int count,
|
|
|
f338ef |
glusterd_volinfo_t *volinfo = NULL;
|
|
|
f338ef |
glusterd_shdsvc_t *shd = NULL;
|
|
|
f338ef |
glusterd_svc_t *svc = frame->cookie;
|
|
|
f338ef |
+ glusterd_svc_t *parent_svc = NULL;
|
|
|
f338ef |
+ glusterd_svc_proc_t *mux_proc = NULL;
|
|
|
f338ef |
glusterd_conf_t *conf = NULL;
|
|
|
f338ef |
int *flag = (int *)frame->local;
|
|
|
f338ef |
xlator_t *this = THIS;
|
|
|
f338ef |
+ int pid = -1;
|
|
|
f338ef |
int ret = -1;
|
|
|
f338ef |
gf_getspec_rsp rsp = {
|
|
|
f338ef |
0,
|
|
|
f338ef |
@@ -676,7 +679,27 @@ glusterd_svc_attach_cbk(struct rpc_req *req, struct iovec *iov, int count,
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
if (rsp.op_ret == 0) {
|
|
|
f338ef |
- svc->online = _gf_true;
|
|
|
f338ef |
+ pthread_mutex_lock(&conf->attach_lock);
|
|
|
f338ef |
+ {
|
|
|
f338ef |
+ if (!strcmp(svc->name, "glustershd")) {
|
|
|
f338ef |
+ mux_proc = svc->svc_proc;
|
|
|
f338ef |
+ if (mux_proc &&
|
|
|
f338ef |
+ !gf_is_service_running(svc->proc.pidfile, &pid)) {
|
|
|
f338ef |
+ /*
|
|
|
f338ef |
+ * When svc's are restarting, there is a chance that the
|
|
|
f338ef |
+ * attached svc might not have updated it's pid. Because
|
|
|
f338ef |
+ * it was at connection stage. So in that case, we need
|
|
|
f338ef |
+ * to retry the pid file copy.
|
|
|
f338ef |
+ */
|
|
|
f338ef |
+ parent_svc = cds_list_entry(mux_proc->svcs.next,
|
|
|
f338ef |
+ glusterd_svc_t, mux_svc);
|
|
|
f338ef |
+ if (parent_svc)
|
|
|
f338ef |
+ sys_link(parent_svc->proc.pidfile, svc->proc.pidfile);
|
|
|
f338ef |
+ }
|
|
|
f338ef |
+ }
|
|
|
f338ef |
+ svc->online = _gf_true;
|
|
|
f338ef |
+ }
|
|
|
f338ef |
+ pthread_mutex_unlock(&conf->attach_lock);
|
|
|
f338ef |
gf_msg(this->name, GF_LOG_INFO, 0, GD_MSG_SVC_ATTACH_FAIL,
|
|
|
f338ef |
"svc %s of volume %s attached successfully to pid %d", svc->name,
|
|
|
f338ef |
volinfo->volname, glusterd_proc_get_pid(&svc->proc));
|
|
|
f338ef |
@@ -703,7 +726,7 @@ out:
|
|
|
f338ef |
|
|
|
f338ef |
extern size_t
|
|
|
f338ef |
build_volfile_path(char *volume_id, char *path, size_t path_len,
|
|
|
f338ef |
- char *trusted_str, dict_t *dict);
|
|
|
f338ef |
+ char *trusted_str);
|
|
|
f338ef |
|
|
|
f338ef |
int
|
|
|
f338ef |
__glusterd_send_svc_configure_req(glusterd_svc_t *svc, int flags,
|
|
|
f338ef |
@@ -728,7 +751,6 @@ __glusterd_send_svc_configure_req(glusterd_svc_t *svc, int flags,
|
|
|
f338ef |
ssize_t req_size = 0;
|
|
|
f338ef |
call_frame_t *frame = NULL;
|
|
|
f338ef |
gd1_mgmt_brick_op_req brick_req;
|
|
|
f338ef |
- dict_t *dict = NULL;
|
|
|
f338ef |
void *req = &brick_req;
|
|
|
f338ef |
void *errlbl = &&err;
|
|
|
f338ef |
struct rpc_clnt_connection *conn;
|
|
|
f338ef |
@@ -754,8 +776,6 @@ __glusterd_send_svc_configure_req(glusterd_svc_t *svc, int flags,
|
|
|
f338ef |
brick_req.name = volfile_id;
|
|
|
f338ef |
brick_req.input.input_val = NULL;
|
|
|
f338ef |
brick_req.input.input_len = 0;
|
|
|
f338ef |
- brick_req.dict.dict_val = NULL;
|
|
|
f338ef |
- brick_req.dict.dict_len = 0;
|
|
|
f338ef |
|
|
|
f338ef |
frame = create_frame(this, this->ctx->pool);
|
|
|
f338ef |
if (!frame) {
|
|
|
f338ef |
@@ -763,13 +783,7 @@ __glusterd_send_svc_configure_req(glusterd_svc_t *svc, int flags,
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
if (op == GLUSTERD_SVC_ATTACH) {
|
|
|
f338ef |
- dict = dict_new();
|
|
|
f338ef |
- if (!dict) {
|
|
|
f338ef |
- ret = -ENOMEM;
|
|
|
f338ef |
- goto *errlbl;
|
|
|
f338ef |
- }
|
|
|
f338ef |
-
|
|
|
f338ef |
- (void)build_volfile_path(volfile_id, path, sizeof(path), NULL, dict);
|
|
|
f338ef |
+ (void)build_volfile_path(volfile_id, path, sizeof(path), NULL);
|
|
|
f338ef |
|
|
|
f338ef |
ret = sys_stat(path, &stbuf);
|
|
|
f338ef |
if (ret < 0) {
|
|
|
f338ef |
@@ -804,18 +818,6 @@ __glusterd_send_svc_configure_req(glusterd_svc_t *svc, int flags,
|
|
|
f338ef |
ret = -EIO;
|
|
|
f338ef |
goto *errlbl;
|
|
|
f338ef |
}
|
|
|
f338ef |
- if (dict->count > 0) {
|
|
|
f338ef |
- ret = dict_allocate_and_serialize(dict, &brick_req.dict.dict_val,
|
|
|
f338ef |
- &brick_req.dict.dict_len);
|
|
|
f338ef |
- if (ret) {
|
|
|
f338ef |
- gf_msg(this->name, GF_LOG_ERROR, 0,
|
|
|
f338ef |
- GD_MSG_DICT_SERL_LENGTH_GET_FAIL,
|
|
|
f338ef |
- "Failed to serialize dict "
|
|
|
f338ef |
- "to request buffer");
|
|
|
f338ef |
- goto *errlbl;
|
|
|
f338ef |
- }
|
|
|
f338ef |
- dict->extra_free = brick_req.dict.dict_val;
|
|
|
f338ef |
- }
|
|
|
f338ef |
|
|
|
f338ef |
frame->cookie = svc;
|
|
|
f338ef |
frame->local = GF_CALLOC(1, sizeof(int), gf_gld_mt_int);
|
|
|
f338ef |
@@ -860,8 +862,6 @@ __glusterd_send_svc_configure_req(glusterd_svc_t *svc, int flags,
|
|
|
f338ef |
GF_ATOMIC_INC(conf->blockers);
|
|
|
f338ef |
ret = rpc_clnt_submit(rpc, &gd_brick_prog, op, cbkfn, &iov, 1, NULL, 0,
|
|
|
f338ef |
iobref, frame, NULL, 0, NULL, 0, NULL);
|
|
|
f338ef |
- if (dict)
|
|
|
f338ef |
- dict_unref(dict);
|
|
|
f338ef |
GF_FREE(volfile_content);
|
|
|
f338ef |
if (spec_fd >= 0)
|
|
|
f338ef |
sys_close(spec_fd);
|
|
|
f338ef |
@@ -874,9 +874,6 @@ maybe_free_iobuf:
|
|
|
f338ef |
iobuf_unref(iobuf);
|
|
|
f338ef |
}
|
|
|
f338ef |
err:
|
|
|
f338ef |
- if (dict)
|
|
|
f338ef |
- dict_unref(dict);
|
|
|
f338ef |
-
|
|
|
f338ef |
GF_FREE(volfile_content);
|
|
|
f338ef |
if (spec_fd >= 0)
|
|
|
f338ef |
sys_close(spec_fd);
|
|
|
f338ef |
diff --git a/xlators/mgmt/glusterd/src/glusterd-syncop.c b/xlators/mgmt/glusterd/src/glusterd-syncop.c
|
|
|
f338ef |
index a8098df..618d8bc 100644
|
|
|
f338ef |
--- a/xlators/mgmt/glusterd/src/glusterd-syncop.c
|
|
|
f338ef |
+++ b/xlators/mgmt/glusterd/src/glusterd-syncop.c
|
|
|
f338ef |
@@ -143,8 +143,6 @@ gd_brick_op_req_free(gd1_mgmt_brick_op_req *req)
|
|
|
f338ef |
if (!req)
|
|
|
f338ef |
return;
|
|
|
f338ef |
|
|
|
f338ef |
- if (req->dict.dict_val)
|
|
|
f338ef |
- GF_FREE(req->dict.dict_val);
|
|
|
f338ef |
GF_FREE(req->input.input_val);
|
|
|
f338ef |
GF_FREE(req);
|
|
|
f338ef |
}
|
|
|
f338ef |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
f338ef |
index 3bdfd49..4525ec7 100644
|
|
|
f338ef |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
f338ef |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
f338ef |
@@ -5914,8 +5914,6 @@ send_attach_req(xlator_t *this, struct rpc_clnt *rpc, char *path,
|
|
|
f338ef |
brick_req.name = path;
|
|
|
f338ef |
brick_req.input.input_val = NULL;
|
|
|
f338ef |
brick_req.input.input_len = 0;
|
|
|
f338ef |
- brick_req.dict.dict_val = NULL;
|
|
|
f338ef |
- brick_req.dict.dict_len = 0;
|
|
|
f338ef |
|
|
|
f338ef |
req_size = xdr_sizeof((xdrproc_t)xdr_gd1_mgmt_brick_op_req, req);
|
|
|
f338ef |
iobuf = iobuf_get2(rpc->ctx->iobuf_pool, req_size);
|
|
|
f338ef |
@@ -5979,7 +5977,7 @@ err:
|
|
|
f338ef |
|
|
|
f338ef |
extern size_t
|
|
|
f338ef |
build_volfile_path(char *volume_id, char *path, size_t path_len,
|
|
|
f338ef |
- char *trusted_str, dict_t *dict);
|
|
|
f338ef |
+ char *trusted_str);
|
|
|
f338ef |
|
|
|
f338ef |
static int
|
|
|
f338ef |
attach_brick(xlator_t *this, glusterd_brickinfo_t *brickinfo,
|
|
|
f338ef |
@@ -6024,7 +6022,7 @@ attach_brick(xlator_t *this, glusterd_brickinfo_t *brickinfo,
|
|
|
f338ef |
goto out;
|
|
|
f338ef |
}
|
|
|
f338ef |
|
|
|
f338ef |
- (void)build_volfile_path(full_id, path, sizeof(path), NULL, NULL);
|
|
|
f338ef |
+ (void)build_volfile_path(full_id, path, sizeof(path), NULL);
|
|
|
f338ef |
|
|
|
f338ef |
for (tries = 15; tries > 0; --tries) {
|
|
|
f338ef |
rpc = rpc_clnt_ref(other_brick->rpc);
|
|
|
f338ef |
--
|
|
|
f338ef |
1.8.3.1
|
|
|
f338ef |
|