|
|
e3c68b |
From ba1460a4fee0c41c7d7f7a2043bae37f7e751259 Mon Sep 17 00:00:00 2001
|
|
|
e3c68b |
From: Ravishankar N <ravishankar@redhat.com>
|
|
|
e3c68b |
Date: Fri, 15 Mar 2019 19:31:03 +0530
|
|
|
e3c68b |
Subject: [PATCH 108/124] afr: add client-pid to all gf_event() calls
|
|
|
e3c68b |
|
|
|
e3c68b |
client-pid for glustershd is GF_CLIENT_PID_SELF_HEALD
|
|
|
e3c68b |
client-pid for glfsheal is GF_CLIENT_PID_GLFS_HEALD
|
|
|
e3c68b |
|
|
|
e3c68b |
Patch on upstream master: https://review.gluster.org/#/c/glusterfs/+/22369/
|
|
|
e3c68b |
BUG: 1676495
|
|
|
e3c68b |
Change-Id: Ib3a863af160ff48c822a5e6b0c27c575c9887470
|
|
|
e3c68b |
Signed-off-by: Ravishankar N <ravishankar@redhat.com>
|
|
|
e3c68b |
Reviewed-on: https://code.engineering.redhat.com/gerrit/166460
|
|
|
e3c68b |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e3c68b |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
e3c68b |
---
|
|
|
e3c68b |
heal/src/glfs-heal.c | 6 ++++++
|
|
|
e3c68b |
xlators/cluster/afr/src/afr-common.c | 12 ++++++++----
|
|
|
e3c68b |
xlators/cluster/afr/src/afr-self-heal-common.c | 11 +++++++----
|
|
|
e3c68b |
xlators/cluster/afr/src/afr-self-heal-data.c | 4 +++-
|
|
|
e3c68b |
xlators/cluster/afr/src/afr-self-heal-entry.c | 5 +++--
|
|
|
e3c68b |
xlators/cluster/afr/src/afr-self-heal-metadata.c | 4 +++-
|
|
|
e3c68b |
xlators/cluster/afr/src/afr-self-heal-name.c | 7 ++++---
|
|
|
e3c68b |
xlators/mgmt/glusterd/src/glusterd-shd-svc.c | 10 ++++++++++
|
|
|
e3c68b |
8 files changed, 44 insertions(+), 15 deletions(-)
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/heal/src/glfs-heal.c b/heal/src/glfs-heal.c
|
|
|
e3c68b |
index 6030de3..7e37e47 100644
|
|
|
e3c68b |
--- a/heal/src/glfs-heal.c
|
|
|
e3c68b |
+++ b/heal/src/glfs-heal.c
|
|
|
e3c68b |
@@ -1688,6 +1688,12 @@ main(int argc, char **argv)
|
|
|
e3c68b |
goto out;
|
|
|
e3c68b |
}
|
|
|
e3c68b |
|
|
|
e3c68b |
+ ret = glfs_setfspid(fs, GF_CLIENT_PID_GLFS_HEAL);
|
|
|
e3c68b |
+ if (ret) {
|
|
|
e3c68b |
+ printf("Setting client pid failed, %s\n", strerror(errno));
|
|
|
e3c68b |
+ goto out;
|
|
|
e3c68b |
+ }
|
|
|
e3c68b |
+
|
|
|
e3c68b |
ret = glfs_init(fs);
|
|
|
e3c68b |
if (ret < 0) {
|
|
|
e3c68b |
ret = -errno;
|
|
|
e3c68b |
diff --git a/xlators/cluster/afr/src/afr-common.c b/xlators/cluster/afr/src/afr-common.c
|
|
|
e3c68b |
index 47a5d3a..3690b84 100644
|
|
|
e3c68b |
--- a/xlators/cluster/afr/src/afr-common.c
|
|
|
e3c68b |
+++ b/xlators/cluster/afr/src/afr-common.c
|
|
|
e3c68b |
@@ -5233,7 +5233,8 @@ __afr_handle_child_up_event(xlator_t *this, xlator_t *child_xlator,
|
|
|
e3c68b |
"Subvolume '%s' came back up; "
|
|
|
e3c68b |
"going online.",
|
|
|
e3c68b |
child_xlator->name);
|
|
|
e3c68b |
- gf_event(EVENT_AFR_SUBVOL_UP, "subvol=%s", this->name);
|
|
|
e3c68b |
+ gf_event(EVENT_AFR_SUBVOL_UP, "client-pid=%d; subvol=%s",
|
|
|
e3c68b |
+ this->ctx->cmd_args.client_pid, this->name);
|
|
|
e3c68b |
} else {
|
|
|
e3c68b |
*event = GF_EVENT_SOME_DESCENDENT_UP;
|
|
|
e3c68b |
}
|
|
|
e3c68b |
@@ -5310,7 +5311,8 @@ __afr_handle_child_down_event(xlator_t *this, xlator_t *child_xlator, int idx,
|
|
|
e3c68b |
"All subvolumes are down. Going "
|
|
|
e3c68b |
"offline until at least one of them "
|
|
|
e3c68b |
"comes back up.");
|
|
|
e3c68b |
- gf_event(EVENT_AFR_SUBVOLS_DOWN, "subvol=%s", this->name);
|
|
|
e3c68b |
+ gf_event(EVENT_AFR_SUBVOLS_DOWN, "client-pid=%d; subvol=%s",
|
|
|
e3c68b |
+ this->ctx->cmd_args.client_pid, this->name);
|
|
|
e3c68b |
} else {
|
|
|
e3c68b |
*event = GF_EVENT_SOME_DESCENDENT_DOWN;
|
|
|
e3c68b |
}
|
|
|
e3c68b |
@@ -5585,12 +5587,14 @@ afr_notify(xlator_t *this, int32_t event, void *data, void *data2)
|
|
|
e3c68b |
if (!had_quorum && has_quorum) {
|
|
|
e3c68b |
gf_msg(this->name, GF_LOG_INFO, 0, AFR_MSG_QUORUM_MET,
|
|
|
e3c68b |
"Client-quorum is met");
|
|
|
e3c68b |
- gf_event(EVENT_AFR_QUORUM_MET, "subvol=%s", this->name);
|
|
|
e3c68b |
+ gf_event(EVENT_AFR_QUORUM_MET, "client-pid=%d; subvol=%s",
|
|
|
e3c68b |
+ this->ctx->cmd_args.client_pid, this->name);
|
|
|
e3c68b |
}
|
|
|
e3c68b |
if (had_quorum && !has_quorum) {
|
|
|
e3c68b |
gf_msg(this->name, GF_LOG_WARNING, 0, AFR_MSG_QUORUM_FAIL,
|
|
|
e3c68b |
"Client-quorum is not met");
|
|
|
e3c68b |
- gf_event(EVENT_AFR_QUORUM_FAIL, "subvol=%s", this->name);
|
|
|
e3c68b |
+ gf_event(EVENT_AFR_QUORUM_FAIL, "client-pid=%d; subvol=%s",
|
|
|
e3c68b |
+ this->ctx->cmd_args.client_pid, this->name);
|
|
|
e3c68b |
}
|
|
|
e3c68b |
}
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/xlators/cluster/afr/src/afr-self-heal-common.c b/xlators/cluster/afr/src/afr-self-heal-common.c
|
|
|
e3c68b |
index 2268761..595bed4 100644
|
|
|
e3c68b |
--- a/xlators/cluster/afr/src/afr-self-heal-common.c
|
|
|
e3c68b |
+++ b/xlators/cluster/afr/src/afr-self-heal-common.c
|
|
|
e3c68b |
@@ -383,11 +383,12 @@ out:
|
|
|
e3c68b |
uuid_utoa_r(replies[src_idx].poststat.ia_gfid, g2),
|
|
|
e3c68b |
priv->children[src_idx]->name);
|
|
|
e3c68b |
gf_event(EVENT_AFR_SPLIT_BRAIN,
|
|
|
e3c68b |
+ "client-pid=%d;"
|
|
|
e3c68b |
"subvol=%s;type=gfid;file="
|
|
|
e3c68b |
"<gfid:%s>/%s>;count=2;child-%d=%s;gfid-%d=%s;"
|
|
|
e3c68b |
"child-%d=%s;gfid-%d=%s",
|
|
|
e3c68b |
- this->name, uuid_utoa(pargfid), bname, child_idx,
|
|
|
e3c68b |
- priv->children[child_idx]->name, child_idx,
|
|
|
e3c68b |
+ this->ctx->cmd_args.client_pid, this->name, uuid_utoa(pargfid),
|
|
|
e3c68b |
+ bname, child_idx, priv->children[child_idx]->name, child_idx,
|
|
|
e3c68b |
uuid_utoa_r(replies[child_idx].poststat.ia_gfid, g1), src_idx,
|
|
|
e3c68b |
priv->children[src_idx]->name, src_idx,
|
|
|
e3c68b |
uuid_utoa_r(replies[src_idx].poststat.ia_gfid, g2));
|
|
|
e3c68b |
@@ -2296,11 +2297,13 @@ afr_selfheal_unlocked_inspect(call_frame_t *frame, xlator_t *this, uuid_t gfid,
|
|
|
e3c68b |
priv->children[i]->name,
|
|
|
e3c68b |
uuid_utoa(replies[i].poststat.ia_gfid));
|
|
|
e3c68b |
gf_event(EVENT_AFR_SPLIT_BRAIN,
|
|
|
e3c68b |
+ "client-pid=%d;"
|
|
|
e3c68b |
"subvol=%s;"
|
|
|
e3c68b |
"type=file;gfid=%s;"
|
|
|
e3c68b |
"ia_type-%d=%s;ia_type-%d=%s",
|
|
|
e3c68b |
- this->name, uuid_utoa(replies[i].poststat.ia_gfid),
|
|
|
e3c68b |
- first_idx, gf_inode_type_to_str(first.ia_type), i,
|
|
|
e3c68b |
+ this->ctx->cmd_args.client_pid, this->name,
|
|
|
e3c68b |
+ uuid_utoa(replies[i].poststat.ia_gfid), first_idx,
|
|
|
e3c68b |
+ gf_inode_type_to_str(first.ia_type), i,
|
|
|
e3c68b |
gf_inode_type_to_str(replies[i].poststat.ia_type));
|
|
|
e3c68b |
ret = -EIO;
|
|
|
e3c68b |
goto out;
|
|
|
e3c68b |
diff --git a/xlators/cluster/afr/src/afr-self-heal-data.c b/xlators/cluster/afr/src/afr-self-heal-data.c
|
|
|
e3c68b |
index d9a0ee3..18a0334 100644
|
|
|
e3c68b |
--- a/xlators/cluster/afr/src/afr-self-heal-data.c
|
|
|
e3c68b |
+++ b/xlators/cluster/afr/src/afr-self-heal-data.c
|
|
|
e3c68b |
@@ -537,9 +537,11 @@ __afr_selfheal_data_finalize_source(
|
|
|
e3c68b |
replies, AFR_DATA_TRANSACTION);
|
|
|
e3c68b |
if (source < 0) {
|
|
|
e3c68b |
gf_event(EVENT_AFR_SPLIT_BRAIN,
|
|
|
e3c68b |
+ "client-pid=%d;"
|
|
|
e3c68b |
"subvol=%s;type=data;"
|
|
|
e3c68b |
"file=%s",
|
|
|
e3c68b |
- this->name, uuid_utoa(inode->gfid));
|
|
|
e3c68b |
+ this->ctx->cmd_args.client_pid, this->name,
|
|
|
e3c68b |
+ uuid_utoa(inode->gfid));
|
|
|
e3c68b |
return -EIO;
|
|
|
e3c68b |
}
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/xlators/cluster/afr/src/afr-self-heal-entry.c b/xlators/cluster/afr/src/afr-self-heal-entry.c
|
|
|
e3c68b |
index b23ed6a..fc09b4c 100644
|
|
|
e3c68b |
--- a/xlators/cluster/afr/src/afr-self-heal-entry.c
|
|
|
e3c68b |
+++ b/xlators/cluster/afr/src/afr-self-heal-entry.c
|
|
|
e3c68b |
@@ -269,11 +269,12 @@ afr_selfheal_detect_gfid_and_type_mismatch(xlator_t *this,
|
|
|
e3c68b |
gf_inode_type_to_str(replies[src_idx].poststat.ia_type),
|
|
|
e3c68b |
priv->children[src_idx]->name);
|
|
|
e3c68b |
gf_event(EVENT_AFR_SPLIT_BRAIN,
|
|
|
e3c68b |
+ "client-pid=%d;"
|
|
|
e3c68b |
"subvol=%s;type=file;"
|
|
|
e3c68b |
"file=<gfid:%s>/%s>;count=2;child-%d=%s;type-"
|
|
|
e3c68b |
"%d=%s;child-%d=%s;type-%d=%s",
|
|
|
e3c68b |
- this->name, uuid_utoa(pargfid), bname, i,
|
|
|
e3c68b |
- priv->children[i]->name, i,
|
|
|
e3c68b |
+ this->ctx->cmd_args.client_pid, this->name,
|
|
|
e3c68b |
+ uuid_utoa(pargfid), bname, i, priv->children[i]->name, i,
|
|
|
e3c68b |
gf_inode_type_to_str(replies[i].poststat.ia_type), src_idx,
|
|
|
e3c68b |
priv->children[src_idx]->name, src_idx,
|
|
|
e3c68b |
gf_inode_type_to_str(replies[src_idx].poststat.ia_type));
|
|
|
e3c68b |
diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c
|
|
|
e3c68b |
index a661fcb..ba43341 100644
|
|
|
e3c68b |
--- a/xlators/cluster/afr/src/afr-self-heal-metadata.c
|
|
|
e3c68b |
+++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c
|
|
|
e3c68b |
@@ -242,9 +242,11 @@ __afr_selfheal_metadata_finalize_source(call_frame_t *frame, xlator_t *this,
|
|
|
e3c68b |
|
|
|
e3c68b |
if (!priv->metadata_splitbrain_forced_heal) {
|
|
|
e3c68b |
gf_event(EVENT_AFR_SPLIT_BRAIN,
|
|
|
e3c68b |
+ "client-pid=%d;"
|
|
|
e3c68b |
"subvol=%s;"
|
|
|
e3c68b |
"type=metadata;file=%s",
|
|
|
e3c68b |
- this->name, uuid_utoa(inode->gfid));
|
|
|
e3c68b |
+ this->ctx->cmd_args.client_pid, this->name,
|
|
|
e3c68b |
+ uuid_utoa(inode->gfid));
|
|
|
e3c68b |
return -EIO;
|
|
|
e3c68b |
}
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/xlators/cluster/afr/src/afr-self-heal-name.c b/xlators/cluster/afr/src/afr-self-heal-name.c
|
|
|
e3c68b |
index c4df5d4..36640b5 100644
|
|
|
e3c68b |
--- a/xlators/cluster/afr/src/afr-self-heal-name.c
|
|
|
e3c68b |
+++ b/xlators/cluster/afr/src/afr-self-heal-name.c
|
|
|
e3c68b |
@@ -222,13 +222,14 @@ afr_selfheal_name_type_mismatch_check(xlator_t *this, struct afr_reply *replies,
|
|
|
e3c68b |
gf_inode_type_to_str(inode_type),
|
|
|
e3c68b |
priv->children[type_idx]->name);
|
|
|
e3c68b |
gf_event(EVENT_AFR_SPLIT_BRAIN,
|
|
|
e3c68b |
+ "client-pid=%d;"
|
|
|
e3c68b |
"subvol=%s;type=file;"
|
|
|
e3c68b |
"file=<gfid:%s>/%s;count=2;"
|
|
|
e3c68b |
"child-%d=%s;type-%d=%s;child-%d=%s;"
|
|
|
e3c68b |
"type-%d=%s",
|
|
|
e3c68b |
- this->name, uuid_utoa(pargfid), bname, i,
|
|
|
e3c68b |
- priv->children[i]->name, i,
|
|
|
e3c68b |
- gf_inode_type_to_str(inode_type1), type_idx,
|
|
|
e3c68b |
+ this->ctx->cmd_args.client_pid, this->name,
|
|
|
e3c68b |
+ uuid_utoa(pargfid), bname, i, priv->children[i]->name,
|
|
|
e3c68b |
+ i, gf_inode_type_to_str(inode_type1), type_idx,
|
|
|
e3c68b |
priv->children[type_idx]->name, type_idx,
|
|
|
e3c68b |
gf_inode_type_to_str(inode_type));
|
|
|
e3c68b |
return -EIO;
|
|
|
e3c68b |
diff --git a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
|
|
|
e3c68b |
index 04a4b2e..19eca9f 100644
|
|
|
e3c68b |
--- a/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
|
|
|
e3c68b |
+++ b/xlators/mgmt/glusterd/src/glusterd-shd-svc.c
|
|
|
e3c68b |
@@ -324,6 +324,7 @@ glusterd_new_shd_svc_start(glusterd_svc_t *svc, int flags)
|
|
|
e3c68b |
{
|
|
|
e3c68b |
int ret = -1;
|
|
|
e3c68b |
char glusterd_uuid_option[PATH_MAX] = {0};
|
|
|
e3c68b |
+ char client_pid[32] = {0};
|
|
|
e3c68b |
dict_t *cmdline = NULL;
|
|
|
e3c68b |
|
|
|
e3c68b |
cmdline = dict_new();
|
|
|
e3c68b |
@@ -335,6 +336,15 @@ glusterd_new_shd_svc_start(glusterd_svc_t *svc, int flags)
|
|
|
e3c68b |
if (ret < 0)
|
|
|
e3c68b |
goto out;
|
|
|
e3c68b |
|
|
|
e3c68b |
+ ret = snprintf(client_pid, sizeof(client_pid), "--client-pid=%d",
|
|
|
e3c68b |
+ GF_CLIENT_PID_SELF_HEALD);
|
|
|
e3c68b |
+ if (ret < 0)
|
|
|
e3c68b |
+ goto out;
|
|
|
e3c68b |
+
|
|
|
e3c68b |
+ ret = dict_set_str(cmdline, "arg", client_pid);
|
|
|
e3c68b |
+ if (ret < 0)
|
|
|
e3c68b |
+ goto out;
|
|
|
e3c68b |
+
|
|
|
e3c68b |
/* Pass cmdline arguments as key-value pair. The key is merely
|
|
|
e3c68b |
* a carrier and is not used. Since dictionary follows LIFO the value
|
|
|
e3c68b |
* should be put in reverse order*/
|
|
|
e3c68b |
--
|
|
|
e3c68b |
1.8.3.1
|
|
|
e3c68b |
|