summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPranith Kumar K <pkarampu@redhat.com>2014-08-21 17:30:10 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2014-08-22 02:33:09 -0700
commitbc38d564663a64072ca508da12a8b4b6d48995e9 (patch)
tree98c97c6607d828cfe5d15a168bfdb1f69e61661f
parent3b70b160a46b22b77a8ad1897440ec1346795a0f (diff)
cluster/afr: Perform metadata sync inside metadata locks
Change-Id: Ie55b3d37cacbdad74a3f63c3b0f025b0ffd0104a BUG: 1132461 Signed-off-by: Pranith Kumar K <pkarampu@redhat.com> Reviewed-on: http://review.gluster.org/8514 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Krutika Dhananjay <kdhananj@redhat.com>
-rw-r--r--xlators/cluster/afr/src/afr-self-heal-metadata.c34
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;
}