diff options
author | Vikas Gorur <vikas@gluster.com> | 2009-08-06 07:37:17 +0000 |
---|---|---|
committer | Anand V. Avati <avati@dev.gluster.com> | 2009-08-07 01:37:21 -0700 |
commit | 8dfdde57b38576270dd54f610b80f1288a16f09b (patch) | |
tree | 10ee84f677b6e0186a1262a7677fa41b5eb11ac2 | |
parent | 2be295d30acd61a919796227fef71f2757f88440 (diff) |
Filter changelog xattrs in replicatev2.0.6
The AFR changelog xattrs, "trusted.afr.*" are now
filtered and prevented from being visible on the
mountpoint.
Signed-off-by: Anand V. Avati <avati@dev.gluster.com>
BUG: 9 (replicate's pending xattr's should not be visible on the mountpoint)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=9
-rw-r--r-- | xlators/cluster/afr/src/afr-inode-read.c | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/xlators/cluster/afr/src/afr-inode-read.c b/xlators/cluster/afr/src/afr-inode-read.c index c26def93c43..2f9a6cda9fd 100644 --- a/xlators/cluster/afr/src/afr-inode-read.c +++ b/xlators/cluster/afr/src/afr-inode-read.c @@ -137,7 +137,7 @@ afr_access (call_frame_t *frame, xlator_t *this, ALLOC_OR_GOTO (local, afr_local_t, out); read_child = afr_read_child (this, loc->inode); - + if (read_child >= 0) { call_child = read_child; @@ -545,6 +545,58 @@ out: /* {{{ getxattr */ +struct _xattr_key { + char *key; + struct list_head list; +}; + + +void +__gather_xattr_keys (dict_t *dict, char *key, data_t *value, + void *data) +{ + struct list_head * list = data; + struct _xattr_key * xkey = NULL; + + if (!strncmp (key, AFR_XATTR_PREFIX, + strlen (AFR_XATTR_PREFIX))) { + + xkey = CALLOC (1, sizeof (*xkey)); + if (!xkey) + return; + + xkey->key = key; + INIT_LIST_HEAD (&xkey->list); + + list_add_tail (&xkey->list, list); + } +} + + +void +__filter_xattrs (dict_t *dict) +{ + struct list_head keys; + + struct _xattr_key *key; + struct _xattr_key *tmp; + + INIT_LIST_HEAD (&keys); + + dict_foreach (dict, __gather_xattr_keys, + (void *) &keys); + + list_for_each_entry_safe (key, tmp, &keys, list) { + dict_del (dict, key->key); + + list_del_init (&key->list); + + FREE (key); + } +} + + + int32_t afr_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, @@ -590,6 +642,8 @@ afr_getxattr_cbk (call_frame_t *frame, void *cookie, out: if (unwind) { + __filter_xattrs (dict); + AFR_STACK_UNWIND (frame, op_ret, op_errno, dict); } @@ -623,6 +677,15 @@ afr_getxattr (call_frame_t *frame, xlator_t *this, ALLOC_OR_GOTO (local, afr_local_t, out); frame->local = local; + if (name) { + if (!strncmp (name, AFR_XATTR_PREFIX, + strlen (AFR_XATTR_PREFIX))) { + + op_errno = ENODATA; + goto out; + } + } + read_child = afr_read_child (this, loc->inode); if (read_child >= 0) { |