summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--api/src/glfs.c16
-rw-r--r--glusterfsd/src/glusterfsd.c10
-rw-r--r--glusterfsd/src/glusterfsd.h1
-rw-r--r--libglusterfs/src/client_t.c1
-rw-r--r--libglusterfs/src/client_t.h1
-rw-r--r--libglusterfs/src/glusterfs.h2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-quotad-svc.c2
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-rebalance.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-shd-svc.c9
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-snapd-svc.c4
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-tierd-svc.c1
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c1
-rwxr-xr-xxlators/mount/fuse/utils/mount.glusterfs.in9
-rwxr-xr-xxlators/mount/fuse/utils/mount_glusterfs.in9
-rw-r--r--xlators/protocol/client/src/client-handshake.c6
-rw-r--r--xlators/protocol/server/src/server-handshake.c7
16 files changed, 78 insertions, 2 deletions
diff --git a/api/src/glfs.c b/api/src/glfs.c
index 8369546667b..3313fab0372 100644
--- a/api/src/glfs.c
+++ b/api/src/glfs.c
@@ -31,6 +31,9 @@
#include <sys/types.h>
#include <unistd.h>
#include <limits.h>
+#ifdef GF_LINUX_HOST_OS
+#include <sys/prctl.h>
+#endif
#include "glusterfs.h"
#include "logging.h"
@@ -739,6 +742,8 @@ pub_glfs_new (const char *volname)
int ret = -1;
glusterfs_ctx_t *ctx = NULL;
xlator_t *old_THIS = NULL;
+ char pname[16] = "";
+ char msg[32] = "";
if (!volname) {
errno = EINVAL;
@@ -789,6 +794,16 @@ pub_glfs_new (const char *volname)
goto out;
}
+ ret = -1;
+#ifdef GF_LINUX_HOST_OS
+ ret = prctl (PR_GET_NAME, (unsigned long) pname, 0, 0, 0);
+#endif
+ if (ret)
+ fs->ctx->cmd_args.process_name = gf_strdup ("gfapi");
+ else {
+ snprintf (msg, sizeof(msg), "gfapi.%s", pname);
+ fs->ctx->cmd_args.process_name = gf_strdup (msg);
+ }
ret = 0;
out:
@@ -1115,6 +1130,7 @@ glusterfs_ctx_destroy (glusterfs_ctx_t *ctx)
GF_FREE (ctx->process_uuid);
GF_FREE (ctx->cmd_args.volfile_id);
+ GF_FREE (ctx->cmd_args.process_name);
LOCK_DESTROY (&ctx->lock);
pthread_mutex_destroy (&ctx->notify_lock);
diff --git a/glusterfsd/src/glusterfsd.c b/glusterfsd/src/glusterfsd.c
index 78b06bf4701..31a9bf71688 100644
--- a/glusterfsd/src/glusterfsd.c
+++ b/glusterfsd/src/glusterfsd.c
@@ -244,6 +244,8 @@ static struct argp_option gf_options[] = {
"Override default for secure (SSL) management connections"},
{"localtime-logging", ARGP_LOCALTIME_LOGGING_KEY, 0, 0,
"Enable localtime logging"},
+ {"process-name", ARGP_PROCESS_NAME_KEY, "PROCESS-NAME", OPTION_HIDDEN,
+ "option to specify the process type" },
{0, 0, 0, 0, "Miscellaneous Options:"},
{0, }
};
@@ -300,7 +302,7 @@ set_fuse_mount_options (glusterfs_ctx_t *ctx, dict_t *options)
cmd_args->fuse_attribute_timeout);
if (ret < 0) {
- gf_msg ("glusterfsd", GF_LOG_ERROR, errno,
+ gf_msg ("glusterfsd", GF_LOG_ERROR, errno,
glusterfsd_msg_4, ZR_ATTR_TIMEOUT_OPT);
goto err;
}
@@ -1278,6 +1280,9 @@ no_oom_api:
case ARGP_LOCALTIME_LOGGING_KEY:
cmd_args->localtime_logging = 1;
+
+ case ARGP_PROCESS_NAME_KEY:
+ cmd_args->process_name = gf_strdup (arg);
break;
case ARGP_SUBDIR_MOUNT_KEY:
if (arg[0] != '/') {
@@ -1928,6 +1933,9 @@ parse_cmdline (int argc, char *argv[], glusterfs_ctx_t *ctx)
process_mode = gf_get_process_mode (argv[0]);
ctx->process_mode = process_mode;
+ if (cmd_args->process_name) {
+ ctx->cmd_args.process_name = cmd_args->process_name;
+ }
/* Make sure after the parsing cli, if '--volfile-server' option is
given, then '--volfile-id' is mandatory */
if (cmd_args->volfile_server && !cmd_args->volfile_id) {
diff --git a/glusterfsd/src/glusterfsd.h b/glusterfsd/src/glusterfsd.h
index 871bcf61e58..99d9ec4e258 100644
--- a/glusterfsd/src/glusterfsd.h
+++ b/glusterfsd/src/glusterfsd.h
@@ -98,6 +98,7 @@ enum argp_option_keys {
#endif
ARGP_LOCALTIME_LOGGING_KEY = 177,
ARGP_SUBDIR_MOUNT_KEY = 178,
+ ARGP_PROCESS_NAME_KEY = 179,
};
struct _gfd_vol_top_priv {
diff --git a/libglusterfs/src/client_t.c b/libglusterfs/src/client_t.c
index eda1c465827..a51fb7a88c0 100644
--- a/libglusterfs/src/client_t.c
+++ b/libglusterfs/src/client_t.c
@@ -386,6 +386,7 @@ client_destroy (client_t *client)
GF_FREE (client->scratch_ctx.ctx);
GF_FREE (client->client_uid);
GF_FREE (client->subdir_mount);
+ GF_FREE (client->client_name);
GF_FREE (client);
out:
return;
diff --git a/libglusterfs/src/client_t.h b/libglusterfs/src/client_t.h
index 530c0a331ea..dff812b0602 100644
--- a/libglusterfs/src/client_t.h
+++ b/libglusterfs/src/client_t.h
@@ -33,6 +33,7 @@ typedef struct _client {
xlator_t *this;
int tbl_index;
char *client_uid;
+ char *client_name;
struct {
int flavour;
size_t len;
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
index 8dcc4a367d0..8a55d724c6e 100644
--- a/libglusterfs/src/glusterfs.h
+++ b/libglusterfs/src/glusterfs.h
@@ -421,6 +421,8 @@ struct _cmd_args {
/* For the subdir mount */
char *subdir_mount;
+
+ char *process_name;
};
typedef struct _cmd_args cmd_args_t;
diff --git a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c
index e0eb38f494a..ac8694fc440 100644
--- a/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-quotad-svc.c
@@ -122,6 +122,8 @@ glusterd_quotadsvc_start (glusterd_svc_t *svc, int flags)
dict_t *cmdline = NULL;
char key[16] = {0};
char *options[] = {
+ svc->name,
+ "--process-name",
"*replicate*.entry-self-heal=off",
"--xlator-option",
"*replicate*.metadata-self-heal=off",
diff --git a/xlators/mgmt/glusterd/src/glusterd-rebalance.c b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
index 4c24b99d0b8..70b391e4188 100644
--- a/xlators/mgmt/glusterd/src/glusterd-rebalance.c
+++ b/xlators/mgmt/glusterd/src/glusterd-rebalance.c
@@ -289,6 +289,7 @@ glusterd_handle_defrag_start (glusterd_volinfo_t *volinfo, char *op_errstr,
"*replicate*.metadata-self-heal=off",
"--xlator-option", "*replicate*.entry-self-heal=off",
"--xlator-option", "*dht.readdir-optimize=on",
+ "--process-name", "rebalance",
NULL);
if (volinfo->type == GF_CLUSTER_TYPE_TIER) {
diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
index e0135ea2be3..8716a0bd10b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
@@ -17,6 +17,7 @@
#include "glusterd-shd-svc.h"
#include "glusterd-svc-helper.h"
+#define GD_SHD_PROCESS_NAME "--process-name"
char *shd_svc_name = "glustershd";
void
@@ -162,6 +163,14 @@ glusterd_shdsvc_start (glusterd_svc_t *svc, int flags)
/* Pass cmdline arguments as key-value pair. The key is merely
* a carrier and is not used. Since dictionary follows LIFO the value
* should be put in reverse order*/
+ ret = dict_set_str (cmdline, "arg4", svc->name);
+ if (ret)
+ goto out;
+
+ ret = dict_set_str (cmdline, "arg3", GD_SHD_PROCESS_NAME);
+ if (ret)
+ goto out;
+
ret = dict_set_str (cmdline, "arg2", glusterd_uuid_option);
if (ret)
goto out;
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
index 59d8fbdfa6a..ea56d8012aa 100644
--- a/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-snapd-svc.c
@@ -297,7 +297,9 @@ glusterd_snapdsvc_start (glusterd_svc_t *svc, int flags)
"-p", svc->proc.pidfile,
"-l", svc->proc.logfile,
"--brick-name", snapd_id,
- "-S", svc->conn.sockpath, NULL);
+ "-S", svc->conn.sockpath,
+ "--process-name", svc->name,
+ NULL);
snapd_port = pmap_assign_port (THIS, volinfo->snapd.port, snapd_id);
volinfo->snapd.port = snapd_port;
diff --git a/xlators/mgmt/glusterd/src/glusterd-tierd-svc.c b/xlators/mgmt/glusterd/src/glusterd-tierd-svc.c
index c75b378140c..bb2cbff6e93 100644
--- a/xlators/mgmt/glusterd/src/glusterd-tierd-svc.c
+++ b/xlators/mgmt/glusterd/src/glusterd-tierd-svc.c
@@ -330,6 +330,7 @@ glusterd_tierdsvc_start (glusterd_svc_t *svc, int flags)
"--xlator-option", "*dht.readdir-optimize=on",
"--xlator-option",
"*tier-dht.xattr-name=trusted.tier.tier-dht",
+ "--process-name", svc->name,
NULL);
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index ee3498f3e86..9e98225e73e 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -2060,6 +2060,7 @@ retry:
"--brick-name", brickinfo->path,
"-l", brickinfo->logfile,
"--xlator-option", glusterd_uuid,
+ "--process-name", "brick",
NULL);
if (dict_get_str (priv->opts, GLUSTERD_LOCALTIME_LOGGING_KEY,
diff --git a/xlators/mount/fuse/utils/mount.glusterfs.in b/xlators/mount/fuse/utils/mount.glusterfs.in
index 826991ba402..216d03c4182 100755
--- a/xlators/mount/fuse/utils/mount.glusterfs.in
+++ b/xlators/mount/fuse/utils/mount.glusterfs.in
@@ -257,6 +257,12 @@ start_glusterfs ()
cmd_line=$(echo "$cmd_line --xlator-option=$xlator_option");
fi
+ if [ -n "$process_name" ]; then
+ cmd_line=$(echo "$cmd_line --process-name fuse.$process_name");
+ else
+ cmd_line=$(echo "$cmd_line --process-name fuse");
+ fi
+
# if trasnport type is specified, we have to append it to
# volume name, so that it fetches the right client vol file
@@ -510,6 +516,9 @@ with_options()
"halo-min-replicas")
halo_min_replicas=$value
;;
+ "process-name")
+ process_name=$value
+ ;;
x-*)
# comments or userspace application-specific options, drop them
;;
diff --git a/xlators/mount/fuse/utils/mount_glusterfs.in b/xlators/mount/fuse/utils/mount_glusterfs.in
index eca84557e87..d3571dea706 100755
--- a/xlators/mount/fuse/utils/mount_glusterfs.in
+++ b/xlators/mount/fuse/utils/mount_glusterfs.in
@@ -234,6 +234,12 @@ start_glusterfs ()
cmd_line=$(echo "$cmd_line --xlator-option=$xlator_option");
fi
+ if [ -n "$process_name" ]; then
+ cmd_line=$(echo "$cmd_line --process-name fuse.$process_name");
+ else
+ cmd_line=$(echo "$cmd_line --process-name fuse");
+ fi
+
# for rdma volume, we have to fetch volfile with '.rdma' added
# to volume name, so that it fetches the right client vol file
volume_id_rdma="";
@@ -398,6 +404,9 @@ with_options()
[ $value = "false" ] ; then
no_root_squash=1;
fi ;;
+ "process-name")
+ process_name=$value
+ ;;
*)
warn "Invalid option: $key"
exit 1
diff --git a/xlators/protocol/client/src/client-handshake.c b/xlators/protocol/client/src/client-handshake.c
index b6dc0797dd9..cd71c2c34a2 100644
--- a/xlators/protocol/client/src/client-handshake.c
+++ b/xlators/protocol/client/src/client-handshake.c
@@ -1360,6 +1360,12 @@ client_setvolume (xlator_t *this, struct rpc_clnt *rpc)
goto fail;
}
+ ret = dict_set_str (options, "process-name", this->ctx->cmd_args.process_name);
+ if (ret < 0) {
+ gf_msg (this->name, GF_LOG_INFO, 0, PC_MSG_DICT_SET_FAILED,
+ "failed to set process-name in handshake msg");
+ }
+
ret = dict_set_str (options, "client-version", PACKAGE_VERSION);
if (ret < 0) {
gf_msg (this->name, GF_LOG_WARNING, 0, PC_MSG_DICT_SET_FAILED,
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.