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