summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorSusant Palai <spalai@redhat.com>2013-12-12 06:20:55 +0000
committerVijay Bellur <vbellur@redhat.com>2014-01-22 20:43:04 -0800
commit79683794c2ee9c6b5c1182e2a378598c2037a9ff (patch)
tree0d6c24c70569383d915820a011b0f8323299dd08 /xlators
parentb2dfa011a3fdcb7d22764d143517d0fbd1c2a201 (diff)
quota: filter glusterfs quota xattrs
Change-Id: I86ebe02735ee88598640240aa888e02b48ecc06c BUG: 1040423 Signed-off-by: Susant Palai <spalai@redhat.com> Reviewed-on: http://review.gluster.org/6490 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators')
-rw-r--r--xlators/cluster/dht/src/dht-common.c6
-rw-r--r--xlators/features/quota/src/quota.c56
2 files changed, 28 insertions, 34 deletions
diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c
index f59bc96670c..cf4ec258d2f 100644
--- a/xlators/cluster/dht/src/dht-common.c
+++ b/xlators/cluster/dht/src/dht-common.c
@@ -2010,6 +2010,12 @@ dht_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
if (dict_get (xattr, conf->xattr_name)) {
dict_del (xattr, conf->xattr_name);
}
+
+ if (frame->root->pid >= 0 ) {
+ GF_REMOVE_INTERNAL_XATTR("trusted.glusterfs.quota*", xattr);
+ GF_REMOVE_INTERNAL_XATTR("trusted.pgfid*", xattr);
+ }
+
local->op_ret = 0;
if (!local->xattr) {
diff --git a/xlators/features/quota/src/quota.c b/xlators/features/quota/src/quota.c
index 5cbd9f02d65..89f9958d8db 100644
--- a/xlators/features/quota/src/quota.c
+++ b/xlators/features/quota/src/quota.c
@@ -3255,10 +3255,6 @@ quota_setxattr (call_frame_t *frame, xlator_t *this,
int op_ret = -1;
int64_t hard_lim = -1, soft_lim = -1;
quota_local_t *local = NULL;
- char *src = NULL;
- char *dst = NULL;
- int len = 0;
- int ret = -1;
priv = this->private;
@@ -3268,29 +3264,11 @@ quota_setxattr (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (this, err);
VALIDATE_OR_GOTO (loc, err);
- if (0 <= frame->root->pid) {
- ret = dict_get_ptr_and_len (dict, QUOTA_LIMIT_KEY,
- (void **)&src, &len);
- if (ret) {
- gf_log (this->name, GF_LOG_DEBUG, "dict_get on %s "
- "failed", QUOTA_LIMIT_KEY);
- } else {
- dst = GF_CALLOC (len, sizeof (char), gf_common_mt_char);
- if (dst)
- memcpy (dst, src, len);
- }
-
- GF_REMOVE_INTERNAL_XATTR ("trusted.glusterfs.quota*",
- dict);
- if (!ret && IA_ISDIR (loc->inode->ia_type) && dst) {
- ret = dict_set_dynptr (dict, QUOTA_LIMIT_KEY,
- dst, len);
- if (ret)
- gf_log (this->name, GF_LOG_WARNING, "setting "
- "key %s failed", QUOTA_LIMIT_KEY);
- else
- dst = NULL;
- }
+ if (frame->root->pid >= 0) {
+ GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.quota*", dict,
+ op_errno, err);
+ GF_IF_INTERNAL_XATTR_GOTO ("trusted.pgfid*", dict, op_errno,
+ err);
}
quota_get_limits (this, dict, &hard_lim, &soft_lim);
@@ -3367,9 +3345,12 @@ quota_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd,
VALIDATE_OR_GOTO (this, err);
VALIDATE_OR_GOTO (fd, err);
- if (0 <= frame->root->pid)
- GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.quota*", dict,
+ if (0 <= frame->root->pid) {
+ GF_IF_INTERNAL_XATTR_GOTO ("trusted.glusterfs.quota*",
+ dict, op_errno, err);
+ GF_IF_INTERNAL_XATTR_GOTO ("trusted.pgfid*", dict,
op_errno, err);
+ }
quota_get_limits (this, dict, &hard_lim, &soft_lim);
@@ -3418,8 +3399,12 @@ quota_removexattr (call_frame_t *frame, xlator_t *this,
/* all quota xattrs can be cleaned up by doing setxattr on special key.
* Hence its ok that we don't allow removexattr on quota keys here.
*/
- GF_IF_NATIVE_XATTR_GOTO ("trusted.quota*",
- name, op_errno, err);
+ if (frame->root->pid >= 0) {
+ GF_IF_NATIVE_XATTR_GOTO ("trusted.glusterfs.quota*",
+ name, op_errno, err);
+ GF_IF_NATIVE_XATTR_GOTO ("trusted.pgfid*", name,
+ op_errno, err);
+ }
VALIDATE_OR_GOTO (frame, err);
VALIDATE_OR_GOTO (loc, err);
@@ -3460,9 +3445,12 @@ quota_fremovexattr (call_frame_t *frame, xlator_t *this,
VALIDATE_OR_GOTO (this, err);
VALIDATE_OR_GOTO (fd, err);
- GF_IF_NATIVE_XATTR_GOTO ("trusted.quota*",
- name, op_errno, err);
-
+ if (frame->root->pid >= 0) {
+ GF_IF_NATIVE_XATTR_GOTO ("trusted.glusterfs.quota*",
+ name, op_errno, err);
+ GF_IF_NATIVE_XATTR_GOTO ("trusted.pgfid*", name,
+ op_errno, err);
+ }
wind:
STACK_WIND (frame, priv->is_quota_on?
quota_fremovexattr_cbk: default_fremovexattr_cbk,