diff options
author | Pranith Kumar K <pkarampu@redhat.com> | 2014-08-21 17:30:10 +0530 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2014-09-12 01:46:06 -0700 |
commit | ab42176d73a31544accd4981d656a8cee933646c (patch) | |
tree | 0613875cdfd9fa44f00ff3093bebf32ea4bbece6 | |
parent | ab4ed074cd53f7646069ee0d8d62d3708776f96e (diff) |
cluster/afr: Perform metadata sync inside metadata locks
Backport of http://review.gluster.org/8514
BUG: 1136825
Change-Id: I480a0dc0dfff8bcff084c9b3f048c5b355683f73
Signed-off-by: Pranith Kumar K <pkarampu@redhat.com>
Reviewed-on: http://review.gluster.org/8590
Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Ravishankar N <ravishankar@redhat.com>
Reviewed-by: Vijay Bellur <vbellur@redhat.com>
-rw-r--r-- | xlators/cluster/afr/src/afr-self-heal-metadata.c | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/xlators/cluster/afr/src/afr-self-heal-metadata.c b/xlators/cluster/afr/src/afr-self-heal-metadata.c index 83628297fd1..8fa59f86880 100644 --- a/xlators/cluster/afr/src/afr-self-heal-metadata.c +++ b/xlators/cluster/afr/src/afr-self-heal-metadata.c @@ -21,9 +21,9 @@ #define AFR_HEAL_ATTR (GF_SET_ATTR_UID|GF_SET_ATTR_GID|GF_SET_ATTR_MODE) int -afr_selfheal_metadata_do (call_frame_t *frame, xlator_t *this, inode_t *inode, - int source, unsigned char *healed_sinks, - struct afr_reply *locked_replies) +__afr_selfheal_metadata_do (call_frame_t *frame, xlator_t *this, inode_t *inode, + int source, unsigned char *healed_sinks, + struct afr_reply *locked_replies) { int ret = -1; loc_t loc = {0,}; @@ -189,7 +189,6 @@ __afr_selfheal_metadata_prepare (call_frame_t *frame, xlator_t *this, inode_t *i return source; } - static int __afr_selfheal_metadata (call_frame_t *frame, xlator_t *this, inode_t *inode, unsigned char *locked_on) @@ -220,30 +219,27 @@ __afr_selfheal_metadata (call_frame_t *frame, xlator_t *this, inode_t *inode, goto unlock; } - ret = __afr_selfheal_metadata_prepare (frame, this, inode, data_lock, - sources, sinks, healed_sinks, + ret = __afr_selfheal_metadata_prepare (frame, this, inode, + data_lock, sources, + sinks, healed_sinks, locked_replies); if (ret < 0) goto unlock; source = ret; - ret = 0; + ret = __afr_selfheal_metadata_do (frame, this, inode, source, + healed_sinks, locked_replies); + if (ret) + goto unlock; + + ret = afr_selfheal_undo_pending (frame, this, inode, sources, + sinks, healed_sinks, + AFR_METADATA_TRANSACTION, + locked_replies, data_lock); } unlock: afr_selfheal_uninodelk (frame, this, inode, this->name, LLONG_MAX -1, 0, data_lock); - if (ret < 0) - goto out; - - ret = afr_selfheal_metadata_do (frame, this, inode, source, healed_sinks, - locked_replies); - if (ret) - goto out; - - ret = afr_selfheal_undo_pending (frame, this, inode, sources, sinks, - healed_sinks, AFR_METADATA_TRANSACTION, - locked_replies, data_lock); -out: return ret; } |