diff options
author | vmallika <vmallika@redhat.com> | 2015-07-12 08:49:49 +0530 |
---|---|---|
committer | Raghavendra G <rgowdapp@redhat.com> | 2015-08-20 22:45:35 -0700 |
commit | d6569f7bd93f4f7a27ce0a89281c63c0591b7871 (patch) | |
tree | 6c6c507b8341cf8815e66f3fe4f3e1ba0e162cf0 /xlators/features/marker/src/marker-quota-helper.c | |
parent | d776cfb85e00fe0a03e7c13c903f453ff201e73f (diff) |
quota/marker: fix inode quota with rename
This is a backport of http://review.gluster.org/11578
There are three problems with marker-rename which
is fixed in this patch
Problem 1)
1) mq_reduce_parent_size is not handling inode-quota contribution
2) When dest files exists and IO is happening
Now renaming will overwrite existing file
mq_reduce_parent_size called on dest file
with saved contribution, this can be
a problem is IO is still happening
contribution might have changed
Problem 2)
There is a small race between rename and in-progress write
Consider below scenario
1) rename FOP invoked on file 'x'
2) write is still in progress for file 'x'
3) rename takes a lock on old-parent
4) write-update txn blocked on old-parent to acquire lock
5) in rename_cbk, contri xattrs are removed and contribution is deleted and
lock is released
6) now write-update txn gets the lock and updates the wrong parent
as it was holding lock on old parent
so validate parent once the lock is acquired
Problem 3)
when a rename operation is performed, a lock is
held on old parent. This lock is release before
unwinding the rename operation.
This can be a problem if there are in-progress
writes happening during rename, where update txn
can take a lock and update the old parent
as inode table is not updated with new parent
> Change-Id: Ic3316097c001c33533f98592e8fcf234b1ee2aa2
> BUG: 1240991
> Signed-off-by: vmallika <vmallika@redhat.com>
> Reviewed-on: http://review.gluster.org/11578
> Tested-by: Gluster Build System <jenkins@build.gluster.com>
> Tested-by: NetBSD Build System <jenkins@build.gluster.org>
> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Change-Id: Ie8e43c711a0e3dbe8494f0d64ab10c7b7a55e0d1
BUG: 1255244
Signed-off-by: vmallika <vmallika@redhat.com>
Reviewed-on: http://review.gluster.org/11961
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Tested-by: NetBSD Build System <jenkins@build.gluster.org>
Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'xlators/features/marker/src/marker-quota-helper.c')
-rw-r--r-- | xlators/features/marker/src/marker-quota-helper.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/xlators/features/marker/src/marker-quota-helper.c b/xlators/features/marker/src/marker-quota-helper.c index a103bb945a2..df76f12cf47 100644 --- a/xlators/features/marker/src/marker-quota-helper.c +++ b/xlators/features/marker/src/marker-quota-helper.c @@ -174,6 +174,9 @@ mq_get_contribution_node (inode_t *inode, quota_inode_ctx_t *ctx) LOCK (&ctx->lock); { + if (list_empty (&ctx->contribution_head)) + goto unlock; + list_for_each_entry (temp, &ctx->contribution_head, contri_list) { if (gf_uuid_compare (temp->gfid, inode->gfid) == 0) { @@ -183,7 +186,9 @@ mq_get_contribution_node (inode_t *inode, quota_inode_ctx_t *ctx) } } } +unlock: UNLOCK (&ctx->lock); + out: return contri; } |