diff options
author | Raghavendra G <raghavendra@gluster.com> | 2011-04-18 08:30:35 +0000 |
---|---|---|
committer | Anand Avati <avati@gluster.com> | 2011-04-18 07:42:18 -0700 |
commit | bb4c33f65f3e7eaeb03f3ac249d6eedd123c5ba6 (patch) | |
tree | b3376938b25ec7e5fd2a94ba2e8d41edd80a8c0b /xlators | |
parent | c034f263c0ced77b6b8f806b4533a612631a9c77 (diff) |
features/marker-quota: remove contribution xattrs from oldloc in rename.
- Though we are setting in memory contribution to zero, during updation
process contribution is actually fetched from backend. If they are not
deleted and if newpath did not exist before doing rename, contributions
from oldloc->inode will be retained even for newloc->inode, there by
preventing addition of file-size to parents in newpath.
Signed-off-by: Raghavendra G <raghavendra@gluster.com>
Signed-off-by: Anand Avati <avati@gluster.com>
BUG: 2689 (Quota: xattrs getting corrupted)
URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2689
Diffstat (limited to 'xlators')
-rw-r--r-- | xlators/features/marker/src/marker.c | 49 |
1 files changed, 43 insertions, 6 deletions
diff --git a/xlators/features/marker/src/marker.c b/xlators/features/marker/src/marker.c index 7622642e7..e7021647c 100644 --- a/xlators/features/marker/src/marker.c +++ b/xlators/features/marker/src/marker.c @@ -900,20 +900,56 @@ out: return 0; } + +int32_t +marker_quota_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, + int32_t op_ret, int32_t op_errno) +{ + marker_local_t *local = NULL, *oplocal = NULL; + + if ((op_ret < 0) && (op_errno != ENOATTR)) { + goto unwind; + } + + local = frame->local; + oplocal = local->oplocal; + + STACK_WIND (frame, marker_rename_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->rename, &oplocal->loc, + &local->loc); + return 0; + +unwind: + STACK_UNWIND_STRICT (rename, frame, -1, ENOMEM, NULL, + NULL, NULL, NULL, NULL); + local->oplocal = NULL; + marker_local_unref (local); + marker_local_unref (oplocal); + GF_FREE (local); + GF_FREE (oplocal); + return 0; +} + + int32_t marker_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc) { - int32_t ret = 0; - marker_local_t *local = NULL; - marker_local_t *oplocal = NULL; - marker_conf_t *priv = NULL; + int32_t ret = 0; + marker_local_t *local = NULL; + marker_local_t *oplocal = NULL; + marker_conf_t *priv = NULL; + char contri_key[512] = {0,}; priv = this->private; if (priv->feature_enabled == 0) goto wind; + GET_CONTRI_KEY (contri_key, oldloc->parent->gfid, ret); + if (ret < 0) + goto err; + ALLOCATE_OR_GOTO (local, marker_local_t, err); MARKER_INIT_LOCAL (frame, local); @@ -934,8 +970,9 @@ marker_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, if (ret == -1) goto err; wind: - STACK_WIND (frame, marker_rename_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->rename, oldloc, newloc); + + STACK_WIND (frame, marker_quota_removexattr_cbk, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->removexattr, oldloc, contri_key); return 0; err: STACK_UNWIND_STRICT (rename, frame, -1, ENOMEM, NULL, |