diff options
author | Junaid <junaid@gluster.com> | 2011-04-12 10:01:28 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-04-13 00:38:55 -0700 |
commit | bdb3e709e3eec1863181339bf1a5b66b702ac1bb (patch) | |
tree | 7fcd85122078c2f0f0e8a6a9ff51ca03e6df6273 | |
parent | 4b6a08fba53d895c84676d8c3ae6a5ef45fa2286 (diff) |
features/marker: Filter the quota xattr's on getxattr with NULL name argument.
Signed-off-by: Junaid <junaid@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2473 (Support for volume and directory level quota)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2473
-rw-r--r-- | xlators/features/marker/src/marker-common.c | 17 | ||||
-rw-r--r-- | xlators/features/marker/src/marker-common.h | 3 | ||||
-rw-r--r-- | xlators/features/marker/src/marker.c | 18 |
3 files changed, 36 insertions, 2 deletions
diff --git a/xlators/features/marker/src/marker-common.c b/xlators/features/marker/src/marker-common.c index a9431b628..9d27167fc 100644 --- a/xlators/features/marker/src/marker-common.c +++ b/xlators/features/marker/src/marker-common.c @@ -20,7 +20,7 @@ #define _CONFIG_H #include "config.h" #endif - +#include <fnmatch.h> #include "marker-common.h" marker_inode_ctx_t * @@ -69,3 +69,18 @@ unlock: UNLOCK (&inode->lock); return ret; } +void +marker_filter_quota_xattr (dict_t *dict, char *key, + data_t *value, void *data) +{ + int ret = -1; + + GF_VALIDATE_OR_GOTO ("marker", dict, out); + GF_VALIDATE_OR_GOTO ("marker", key, out); + + ret = fnmatch ("trusted.glusterfs.quota*", key, 0); + if (ret == 0) + dict_del (dict, key); +out: + return; +} diff --git a/xlators/features/marker/src/marker-common.h b/xlators/features/marker/src/marker-common.h index 311e4e238..2533571c1 100644 --- a/xlators/features/marker/src/marker-common.h +++ b/xlators/features/marker/src/marker-common.h @@ -30,4 +30,7 @@ int32_t marker_force_inode_ctx_get (inode_t *, xlator_t *, marker_inode_ctx_t **); + +void +marker_filter_quota_xattr (dict_t *, char *, data_t *, void *); #endif diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index 66ef66f62..6e65d090f 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -27,6 +27,7 @@ #include "marker.h" #include "marker-mem-types.h" #include "marker-quota.h" +#include "marker-common.h" void fini (xlator_t *this); @@ -263,6 +264,12 @@ int32_t marker_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, int32_t op_ret, int32_t op_errno, dict_t *dict) { + if (frame->cookie) { + gf_log (this->name, GF_LOG_DEBUG, + "Filtering the quota extended attributes"); + + dict_foreach (dict, marker_filter_quota_xattr, NULL); + } STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict); return 0; } @@ -283,9 +290,18 @@ marker_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, ret = call_from_special_client (frame, this, name); wind: - if (ret == _gf_false) + if (ret == _gf_false) { + if (name == NULL) { + /* Signifies that marker translator + * has to filter the quota's xattr's, + * this is to prevent afr from performing + * self healing on marker-quota xattrs' + */ + frame->cookie = (void *) 1; + } STACK_WIND (frame, marker_getxattr_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->getxattr, loc, name); + } return 0; } |