diff options
author | shishir gowda <shishirng@gluster.com> | 2011-04-12 05:19:22 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-06-14 02:38:12 -0700 |
commit | 2a2060359a6991e310e6532376273bccb9cfbadc (patch) | |
tree | efd9648fe8c778bf44cecb3c12bc29a555db6a8c /xlators | |
parent | b81ab76a2b3163b9326c5c024c7dc5f51e6ae868 (diff) |
DHT: check for mis-matching user xattrs
Signed-off-by: shishir gowda <shishirng@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2717 (Detect user_xattr mismatches for dir's)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2717
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/cluster/dht/src/dht-common.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 678457a3b..e921d9c31 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -35,13 +35,13 @@ #include <sys/time.h> #include <libgen.h> - void dht_aggregate (dict_t *this, char *key, data_t *value, void *data) { dict_t *dst = NULL; int64_t *ptr = 0, *size = NULL; int32_t ret = -1; + data_pair_t *data_pair = NULL; dst = data; @@ -71,6 +71,20 @@ dht_aggregate (dict_t *this, char *key, data_t *value, void *data) } *size = hton64 (ntoh64 (*size) + ntoh64 (*ptr)); + } else { + /* compare user xattrs only */ + if (!strncmp (key, "user.", strlen ("user."))) { + ret = dict_lookup (dst, key, &data_pair); + if (!ret && data) { + ret = is_data_equal (data_pair->value, value); + if (!ret) + gf_log ("dht", GF_LOG_WARNING, + "xattr mismatch for %s", key); + } + } + ret = dict_set (dst, key, value); + if (ret) + gf_log ("dht", GF_LOG_WARNING, "xattr dict set failed"); } return; @@ -1869,7 +1883,6 @@ dht_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, * local->xattr. */ dht_aggregate_xattr (xattr, local->xattr); - local->xattr = dict_copy (xattr, local->xattr); } out: if (is_last_call (this_call_cnt)) { |