summaryrefslogtreecommitdiffstats
path: root/xlators/cluster
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2015-01-07 12:08:48 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2015-01-08 21:55:10 -0800
commitcf0770c61af2fa49fa435baf62cd5f28569175e4 (patch)
tree549d7cabb784dc10434e940d8772664b0f6d7d2b /xlators/cluster
parent05d3dfb9623f0939fa807cce3b9336a09fadab2a (diff)
cluster/ec: Do not modify quota, selinux xattrs in healing
Problem: EC heal tries to heal quota-size, selinux xattrs as well. quota-size is private to the brick but since quotad accesses them using the standard interface as well, they can not be filtered in the fops. Fix: Ignore QUOTA_SIZE_KEY and SELINUX xattrs during heal. Change-Id: I1572f9e2fcba7f120b4265e034953a15ff297f04 BUG: 1179640 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/9401 Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'xlators/cluster')
-rw-r--r--xlators/cluster/ec/src/ec-heal.c52
1 files changed, 38 insertions, 14 deletions
diff --git a/xlators/cluster/ec/src/ec-heal.c b/xlators/cluster/ec/src/ec-heal.c
index ad6417bc420..0643f250a4c 100644
--- a/xlators/cluster/ec/src/ec-heal.c
+++ b/xlators/cluster/ec/src/ec-heal.c
@@ -21,6 +21,29 @@
#include "ec-mem-types.h"
#include "ec-data.h"
+static char *ec_ignore_xattrs[] = {
+ GF_SELINUX_XATTR_KEY,
+ QUOTA_SIZE_KEY,
+ NULL
+};
+
+static gf_boolean_t
+ec_ignorable_key_match (dict_t *dict, char *key, data_t *val, void *mdata)
+{
+ int i = 0;
+
+ if (!key)
+ goto out;
+
+ for (i = 0; ec_ignore_xattrs[i]; i++) {
+ if (!strcmp (key, ec_ignore_xattrs[i]))
+ return _gf_true;
+ }
+
+out:
+ return _gf_false;
+}
+
/* FOP: heal */
void ec_heal_exclude(ec_heal_t * heal, uintptr_t mask)
@@ -864,6 +887,10 @@ void ec_heal_setxattr_others(ec_heal_t * heal)
cbk = heal->lookup->answer;
xdata = cbk->xdata;
+ if (dict_foreach_match (xdata, ec_ignorable_key_match, NULL,
+ dict_remove_foreach_fn, NULL) == -1)
+ goto out;
+
if ((cbk->iatt[0].ia_type == IA_IFREG) ||
(cbk->iatt[0].ia_type == IA_IFDIR))
{
@@ -891,24 +918,21 @@ out:
ec_fop_set_error(heal->fop, error);
}
-int32_t ec_heal_xattr_clean(dict_t * dict, char * key, data_t * data,
- void * arg)
+int32_t
+ec_heal_xattr_clean (dict_t *dict, char *key, data_t *data,
+ void *arg)
{
- dict_t * base = arg;
+ dict_t *base = arg;
- if (dict_get(base, key) == NULL)
- {
- if (dict_set_static_bin(dict, key, dict, 0) != 0)
- {
- return -1;
+ if (ec_ignorable_key_match (NULL, key, NULL, NULL)) {
+ dict_del (dict, key);
+ return 0;
}
- }
- else
- {
- dict_del(dict, key);
- }
- return 0;
+ if (dict_get (base, key) != NULL)
+ dict_del (dict, key);
+
+ return 0;
}
void ec_heal_removexattr_others(ec_heal_t * heal)