summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2015-01-07 12:08:48 +0530
committerRaghavendra Bhat <raghavendra@redhat.com>2015-02-04 03:54:47 -0800
commit8fd0a88eed39e1f70f0057efb2f92564fb135186 (patch)
treecef6f05c5717d8dbad2abb76d0f1055bf7fdfdd9
parent92ab560f73299a1d5faf43a1a90516baa2ba275b (diff)
cluster/ec: Do not modify quota, selinux xattrs in healing
Backport of http://review.gluster.org/9401 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. BUG: 1178590 Change-Id: Id569a49ef996e5507f4474c99b6cdc22781ad82d Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/9454 Reviewed-by: Xavier Hernandez <xhernandez@datalab.es> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra Bhat <raghavendra@redhat.com>
-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 625c31c1cc1..949170db495 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)