summaryrefslogtreecommitdiffstats
path: root/xlators/features/marker
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2015-12-22 16:32:49 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-01-07 00:20:27 -0800
commit33ca7a7384491bf78f1c905a9085c17415eb1d91 (patch)
tree1d3dc94cb79d5ff8e6f439f3507fcc269299d309 /xlators/features/marker
parentea42ffa13c00263a574226626d30749b6b0f3776 (diff)
quota: handle quota xattr removal when quota is enabled again
When a quota is disable and enabled again before completing the cleanup operation, this can remove the new xattrs and quota accounting can become wrong Remove removing the xattr, check if quota enabled again and the xattr is new Change-Id: Idda216f1e7346a9b843dbc112ea3e6faa9c47483 BUG: 1293601 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/13065 Reviewed-by: Raghavendra G <rgowdapp@redhat.com> Tested-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/features/marker')
-rw-r--r--xlators/features/marker/src/marker.c27
1 files changed, 23 insertions, 4 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c
index 604097d2f2e..54dc395d462 100644
--- a/xlators/features/marker/src/marker.c
+++ b/xlators/features/marker/src/marker.c
@@ -2299,10 +2299,29 @@ out:
int
remove_quota_keys (dict_t *dict, char *k, data_t *v, void *data)
{
- call_frame_t *frame = data;
- marker_local_t *local = frame->local;
- xlator_t *this = frame->this;
- int ret = -1;
+ call_frame_t *frame = data;
+ marker_local_t *local = frame->local;
+ xlator_t *this = frame->this;
+ marker_conf_t *priv = NULL;
+ char ver_str[NAME_MAX] = {0,};
+ char *dot = NULL;
+ int ret = -1;
+
+ priv = this->private;
+
+ /* If quota is enabled immediately after disable.
+ * quota healing starts creating new xattrs
+ * before completing the cleanup operation.
+ * So we should check if the xattr is the new.
+ * Do not remove xattr if its xattr
+ * version is same as current version
+ */
+ if ((priv->feature_enabled & GF_QUOTA) && priv->version > 0) {
+ snprintf (ver_str, sizeof (ver_str), ".%d", priv->version);
+ dot = strrchr (k, '.');
+ if (dot && !strcmp(dot, ver_str))
+ return 0;
+ }
ret = syncop_removexattr (FIRST_CHILD (this), &local->loc, k, 0, NULL);
if (ret) {