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