From def09c4fbb2805618715c5a125ddf482d7e53de3 Mon Sep 17 00:00:00 2001 From: hari gowtham Date: Tue, 25 Jul 2017 18:07:05 +0530 Subject: Infra to indentify process Problem: currently we can't identify which process is running and how many instances of it are available. Fix: name the process when its spawned and send it to the server and save it in the client_t The processes that abide by this change from this patch are: 1) fuse mount, 2) rebalance, 3) selfheal, 4) tier, 5) quota, 6) snapshot, 7) brick. 8) gfapi (by default. gfapi. if processname is found) Note: fuse gets a process name as native-fuse-client by default. If the user gives a name for the fuse and spawns it, it will be of this type --process-name native-fuse-client.. This can be made use by the process like aux mount done by quota, geo-rep, etc by adding another option in the aux mount " -o process-name=gsync_mount" Updates: #178 Signed-off-by: hari gowtham Change-Id: Ie4d02257216839338043737691753bab9a974d5e Reviewed-on: https://review.gluster.org/17957 Smoke: Gluster Build System Tested-by: hari gowtham Reviewed-by: Amar Tumballi CentOS-regression: Gluster Build System Reviewed-by: Atin Mukherjee Reviewed-by: Aravinda VK Reviewed-by: Niels de Vos --- xlators/protocol/server/src/server-handshake.c | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'xlators/protocol/server/src') diff --git a/xlators/protocol/server/src/server-handshake.c b/xlators/protocol/server/src/server-handshake.c index fa2f61315df..6dc9a38aa71 100644 --- a/xlators/protocol/server/src/server-handshake.c +++ b/xlators/protocol/server/src/server-handshake.c @@ -475,6 +475,7 @@ server_setvolume (rpcsvc_request_t *req) glusterfs_ctx_t *ctx = NULL; struct _child_status *tmp = NULL; char *subdir_mount = NULL; + char *client_name = NULL; params = dict_new (); reply = dict_new (); @@ -609,6 +610,10 @@ server_setvolume (rpcsvc_request_t *req) if (ret < 0) { /* Not a problem at all as the key is optional */ } + ret = dict_get_str (params, "process-name", &client_name); + if (ret < 0) { + client_name = "unknown"; + } /*lk_verion :: [1..2^31-1]*/ ret = dict_get_uint32 (params, "clnt-lk-version", &lk_version); @@ -631,6 +636,8 @@ server_setvolume (rpcsvc_request_t *req) goto fail; } + client->client_name = gf_strdup(client_name); + gf_msg_debug (this->name, 0, "Connected to %s", client->client_uid); cancelled = server_cancel_grace_timer (this, client); if (cancelled)//Do gf_client_put on behalf of grace-timer-handler. -- cgit