summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVarun Shastry <vshastry@redhat.com>2013-08-28 17:45:55 +0530
committerGerrit Code Review <review@dev.gluster.org>2013-09-24 23:31:23 -0700
commit2a0b0aa78f1d7fdbfd2457c1303aaf0cfdcbb7ff (patch)
tree83039eca6900e3cf174b13aa9e62222931798fab
parent74be3343303ff9014aca780b4e4ed604ffde9fa3 (diff)
features/marker: don't filter quota limit xattr in getxattr
Change-Id: Ib903ec47739a80168981b3c38ef6ea36ca3ab29a BUG: 969461 Signed-off-by: Raghavendra Bhat <raghavendra@redhat.com> Signed-off-by: Varun Shastry <vshastry@redhat.com>
-rw-r--r--xlators/features/marker/src/marker-common.c5
-rw-r--r--xlators/features/marker/src/marker-common.h5
-rw-r--r--xlators/features/marker/src/marker.c32
3 files changed, 35 insertions, 7 deletions
diff --git a/xlators/features/marker/src/marker-common.c b/xlators/features/marker/src/marker-common.c
index 84a718ad..5492ec72 100644
--- a/xlators/features/marker/src/marker-common.c
+++ b/xlators/features/marker/src/marker-common.c
@@ -60,10 +60,11 @@ unlock: UNLOCK (&inode->lock);
return ret;
}
-int
+int32_t
marker_filter_quota_xattr (dict_t *dict, char *key,
data_t *value, void *data)
{
- dict_del (dict, key);
+ if (strcmp (key, QUOTA_LIMIT_KEY))
+ dict_del (dict, key);
return 0;
}
diff --git a/xlators/features/marker/src/marker-common.h b/xlators/features/marker/src/marker-common.h
index 23dd846c..1a769fb0 100644
--- a/xlators/features/marker/src/marker-common.h
+++ b/xlators/features/marker/src/marker-common.h
@@ -21,7 +21,6 @@
int32_t
marker_force_inode_ctx_get (inode_t *, xlator_t *, marker_inode_ctx_t **);
-
-int
-marker_filter_quota_xattr (dict_t *, char *, data_t *, void *);
+int32_t
+marker_filter_quota_xattr (dict_t *dict, char *key, data_t *value, void *data);
#endif
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c
index 406aff03..02fb3d6c 100644
--- a/xlators/features/marker/src/marker.c
+++ b/xlators/features/marker/src/marker.c
@@ -285,6 +285,9 @@ marker_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
loc_t loc = {0, };
inode_t *parent = NULL;
int ret = 0;
+ marker_local_t *local = NULL;
+
+ local = frame->local;
ret = dict_get_bin (dict, GET_ANCESTRY_DENTRY_KEY, (void **)&head);
@@ -313,12 +316,30 @@ marker_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this,
}
}
+ /* cookie is not set for special clients. As of now only gsync
+ is treated as a special client by marker. For any other process
+ exxept gsync, cookie is set.
+ */
if (cookie) {
gf_log (this->name, GF_LOG_DEBUG,
"Filtering the quota extended attributes");
- dict_foreach_fnmatch (dict, "trusted.glusterfs.quota*",
- marker_filter_quota_xattr, NULL);
+ /* If the getxattr is from a non special client, then do not
+ copy the quota related xattrs (except the quota limit key
+ i.e trusted.glusterfs.quota.limit-set which has been set by
+ glusterd on the directory on which quota limit is set.) for
+ directories. Let the healing of xattrs happen upon lookup.
+ NOTE: setting of trusted.glusterfs.quota.limit-set as of now
+ happens from glusterd. It should be moved to quotad. Also
+ trusted.glusterfs.quota.limit-set is set on directory which
+ is permanent till quota is removed on that directory or limit
+ is changed. So let that xattr be healed by other xlators
+ properly whenever directory healing is done.
+ */
+
+ if (IA_ISDIR (local->loc.inode->ia_type))
+ dict_foreach_fnmatch (dict, "trusted.glusterfs.quota*",
+ marker_filter_quota_xattr, NULL);
}
STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict, xdata);
@@ -332,9 +353,16 @@ marker_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc,
gf_boolean_t ret = _gf_false;
marker_conf_t *priv = NULL;
unsigned long cookie = 0;
+ marker_local_t *local = NULL;
priv = this->private;
+ local = mem_get0 (this->local_pool);
+
+ MARKER_INIT_LOCAL (frame, local);
+
+ ret = loc_copy (&local->loc, loc);
+
gf_log (this->name, GF_LOG_DEBUG, "USER:PID = %d", frame->root->pid);
if ((priv->feature_enabled & GF_QUOTA) && name