From 4efc8ea17f8452cf5a5f3a504419c1269d332d79 Mon Sep 17 00:00:00 2001 From: vmallika Date: Sun, 12 Jul 2015 08:49:49 +0530 Subject: quota/marker: fix inode quota with rename 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 Reviewed-on: http://review.gluster.org/11578 Tested-by: Gluster Build System Tested-by: NetBSD Build System Reviewed-by: Raghavendra G --- xlators/features/marker/src/marker-quota.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'xlators/features/marker/src/marker-quota.h') diff --git a/xlators/features/marker/src/marker-quota.h b/xlators/features/marker/src/marker-quota.h index e1d5c8519fd..6bae110f014 100644 --- a/xlators/features/marker/src/marker-quota.h +++ b/xlators/features/marker/src/marker-quota.h @@ -13,6 +13,7 @@ #include "xlator.h" #include "marker-mem-types.h" #include "refcount.h" +#include "quota-common-utils.h" #define QUOTA_XATTR_PREFIX "trusted.glusterfs" #define QUOTA_DIRTY_KEY "trusted.glusterfs.quota.dirty" @@ -93,7 +94,7 @@ typedef struct quota_inode_ctx quota_inode_ctx_t; struct quota_synctask { xlator_t *this; loc_t loc; - int64_t contri; + quota_meta_t contri; gf_boolean_t is_static; }; typedef struct quota_synctask quota_synctask_t; @@ -141,7 +142,7 @@ int32_t mq_reduce_parent_size (xlator_t *, loc_t *, int64_t); int32_t -mq_reduce_parent_size_txn (xlator_t *, loc_t *, int64_t); +mq_reduce_parent_size_txn (xlator_t *, loc_t *, quota_meta_t *); int32_t mq_rename_update_newpath (xlator_t *, loc_t *); -- cgit