|
|
21ab4e |
From 460031ffd7cded3655746ed80ed8dbfe290f2bf4 Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Sunil Kumar Acharya <sheggodu@redhat.com>
|
|
|
21ab4e |
Date: Wed, 21 Jun 2017 16:37:09 +0530
|
|
|
21ab4e |
Subject: [PATCH 537/539] cluster/ec: Node uuid xattr support update for EC
|
|
|
21ab4e |
|
|
|
21ab4e |
Problem:
|
|
|
21ab4e |
The change in EC to return list of node uuids for
|
|
|
21ab4e |
GF_XATTR_NODE_UUID_KEY was causing problems with
|
|
|
21ab4e |
geo-rep.
|
|
|
21ab4e |
|
|
|
21ab4e |
Fix:
|
|
|
21ab4e |
This patch will allow to get the single node uuid
|
|
|
21ab4e |
as it was doing before with the key
|
|
|
21ab4e |
"GF_XATTR_NODE_UUID_KEY", and will also allow to get
|
|
|
21ab4e |
the list of node uuids by using a new key
|
|
|
21ab4e |
"GF_XATTR_LIST_NODE_UUIDS_KEY". This will solve
|
|
|
21ab4e |
the problem with geo-rep and any other features which
|
|
|
21ab4e |
were depending on this.
|
|
|
21ab4e |
|
|
|
21ab4e |
>Reviewed-on: https://review.gluster.org/17594
|
|
|
21ab4e |
>Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
>Reviewed-by: Xavier Hernandez <xhernandez@datalab.es>
|
|
|
21ab4e |
>Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com>
|
|
|
21ab4e |
>CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
|
|
|
21ab4e |
BUG: 1462693
|
|
|
21ab4e |
Change-Id: I2d9214a9658d4a41a3d6de08600884d2bda5f3eb
|
|
|
21ab4e |
Signed-off-by: Sunil Kumar Acharya <sheggodu@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/110573
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
libglusterfs/src/glusterfs.h | 2 ++
|
|
|
21ab4e |
xlators/cluster/ec/src/ec-combine.c | 20 +++++++++++++++-----
|
|
|
21ab4e |
xlators/cluster/ec/src/ec-inode-read.c | 9 ++++++++-
|
|
|
21ab4e |
3 files changed, 25 insertions(+), 6 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/libglusterfs/src/glusterfs.h b/libglusterfs/src/glusterfs.h
|
|
|
21ab4e |
index 0f68ecd..2856990 100644
|
|
|
21ab4e |
--- a/libglusterfs/src/glusterfs.h
|
|
|
21ab4e |
+++ b/libglusterfs/src/glusterfs.h
|
|
|
21ab4e |
@@ -107,6 +107,8 @@
|
|
|
21ab4e |
strlen (x)) == 0))
|
|
|
21ab4e |
#define XATTR_IS_NODE_UUID(x) (strncmp (x, GF_XATTR_NODE_UUID_KEY, \
|
|
|
21ab4e |
strlen (GF_XATTR_NODE_UUID_KEY)) == 0)
|
|
|
21ab4e |
+#define XATTR_IS_NODE_UUID_LIST(x) (strncmp (x, GF_XATTR_LIST_NODE_UUIDS_KEY, \
|
|
|
21ab4e |
+ strlen (GF_XATTR_LIST_NODE_UUIDS_KEY)) == 0)
|
|
|
21ab4e |
#define XATTR_IS_LOCKINFO(x) (strncmp (x, GF_XATTR_LOCKINFO_KEY, \
|
|
|
21ab4e |
strlen (GF_XATTR_LOCKINFO_KEY)) == 0)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/xlators/cluster/ec/src/ec-combine.c b/xlators/cluster/ec/src/ec-combine.c
|
|
|
21ab4e |
index 60605be..367233a 100644
|
|
|
21ab4e |
--- a/xlators/cluster/ec/src/ec-combine.c
|
|
|
21ab4e |
+++ b/xlators/cluster/ec/src/ec-combine.c
|
|
|
21ab4e |
@@ -366,7 +366,8 @@ out:
|
|
|
21ab4e |
|
|
|
21ab4e |
static int32_t
|
|
|
21ab4e |
ec_dict_data_concat(const char *fmt, ec_cbk_data_t *cbk, int32_t which,
|
|
|
21ab4e |
- char *key, const char *def, gf_boolean_t global, ...)
|
|
|
21ab4e |
+ char *key, char *new_key, const char *def,
|
|
|
21ab4e |
+ gf_boolean_t global, ...)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
ec_t *ec = cbk->fop->xl->private;
|
|
|
21ab4e |
data_t *data[ec->nodes];
|
|
|
21ab4e |
@@ -447,6 +448,9 @@ ec_dict_data_concat(const char *fmt, ec_cbk_data_t *cbk, int32_t which,
|
|
|
21ab4e |
memcpy(str + len, post, postlen + 1);
|
|
|
21ab4e |
|
|
|
21ab4e |
dict = (which == EC_COMBINE_XDATA) ? cbk->xdata : cbk->dict;
|
|
|
21ab4e |
+ if (new_key) {
|
|
|
21ab4e |
+ key = new_key;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
err = dict_set_dynstr(dict, key, str);
|
|
|
21ab4e |
if (err != 0) {
|
|
|
21ab4e |
goto out;
|
|
|
21ab4e |
@@ -692,14 +696,14 @@ int32_t ec_dict_data_combine(dict_t * dict, char * key, data_t * value,
|
|
|
21ab4e |
(strcmp(key, GF_XATTR_USER_PATHINFO_KEY) == 0))
|
|
|
21ab4e |
{
|
|
|
21ab4e |
return ec_dict_data_concat("(<EC:%s> { })", data->cbk, data->which,
|
|
|
21ab4e |
- key, NULL, _gf_false,
|
|
|
21ab4e |
+ key, NULL, NULL, _gf_false,
|
|
|
21ab4e |
data->cbk->fop->xl->name);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
if (strncmp(key, GF_XATTR_CLRLK_CMD, strlen(GF_XATTR_CLRLK_CMD)) == 0)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
return ec_dict_data_concat("{\n}", data->cbk, data->which, key, NULL,
|
|
|
21ab4e |
- _gf_false);
|
|
|
21ab4e |
+ NULL, _gf_false);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
if (strncmp(key, GF_XATTR_LOCKINFO_KEY,
|
|
|
21ab4e |
@@ -730,8 +734,14 @@ int32_t ec_dict_data_combine(dict_t * dict, char * key, data_t * value,
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
if (XATTR_IS_NODE_UUID(key)) {
|
|
|
21ab4e |
- return ec_dict_data_concat("{ }", data->cbk, data->which, key,
|
|
|
21ab4e |
- UUID0_STR, _gf_true);
|
|
|
21ab4e |
+ if (data->cbk->fop->int32) {
|
|
|
21ab4e |
+ /* List of node uuid is requested */
|
|
|
21ab4e |
+ return ec_dict_data_concat("{ }", data->cbk, data->which, key,
|
|
|
21ab4e |
+ GF_XATTR_LIST_NODE_UUIDS_KEY,
|
|
|
21ab4e |
+ UUID0_STR, _gf_true);
|
|
|
21ab4e |
+ } else {
|
|
|
21ab4e |
+ return ec_dict_data_uuid(data->cbk, data->which, key);
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
if (fnmatch(GF_XATTR_STIME_PATTERN, key, FNM_NOESCAPE) == 0)
|
|
|
21ab4e |
diff --git a/xlators/cluster/ec/src/ec-inode-read.c b/xlators/cluster/ec/src/ec-inode-read.c
|
|
|
21ab4e |
index c3d9c87..c815910 100644
|
|
|
21ab4e |
--- a/xlators/cluster/ec/src/ec-inode-read.c
|
|
|
21ab4e |
+++ b/xlators/cluster/ec/src/ec-inode-read.c
|
|
|
21ab4e |
@@ -486,7 +486,14 @@ ec_getxattr (call_frame_t *frame, xlator_t *this, uintptr_t target,
|
|
|
21ab4e |
}
|
|
|
21ab4e |
}
|
|
|
21ab4e |
if (name != NULL) {
|
|
|
21ab4e |
- fop->str[0] = gf_strdup(name);
|
|
|
21ab4e |
+ /* In case of list-node-uuids xattr, set flag to indicate
|
|
|
21ab4e |
+ * the same and use node-uuid xattr for winding fop */
|
|
|
21ab4e |
+ if (XATTR_IS_NODE_UUID_LIST(name)) {
|
|
|
21ab4e |
+ fop->int32 = 1;
|
|
|
21ab4e |
+ fop->str[0] = gf_strdup(GF_XATTR_NODE_UUID_KEY);
|
|
|
21ab4e |
+ } else {
|
|
|
21ab4e |
+ fop->str[0] = gf_strdup(name);
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
if (fop->str[0] == NULL) {
|
|
|
21ab4e |
gf_msg (this->name, GF_LOG_ERROR, ENOMEM,
|
|
|
21ab4e |
EC_MSG_NO_MEMORY,
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|