summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr-lk-common.c
diff options
context:
space:
mode:
authorPranith Kumar K <pranithk@gluster.com>2011-12-28 12:09:08 +0530
committerVijay Bellur <vijay@gluster.com>2011-12-28 22:07:16 -0800
commite9659b4103680eb82e7004b411d2db18c5fbb9bd (patch)
tree9b5b170bc30e900fe0dfac8558ddb07e5796a203 /xlators/cluster/afr/src/afr-lk-common.c
parente1f6ebc1a41d1759c2c4ec1d81a9b8a777b7a25d (diff)
cluster/afr: Handle error cases in local init
- Fop should unwind with appropriate errno - Local is de-allocated on errors Signed-off-by: Pranith Kumar K <pranithk@gluster.com> Change-Id: I4db40342ae184fe1cc29e51072e8fea72ef2cb15 BUG: 770513 Reviewed-on: http://review.gluster.com/2539 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Vijay Bellur <vijay@gluster.com>
Diffstat (limited to 'xlators/cluster/afr/src/afr-lk-common.c')
-rw-r--r--xlators/cluster/afr/src/afr-lk-common.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/xlators/cluster/afr/src/afr-lk-common.c b/xlators/cluster/afr/src/afr-lk-common.c
index 0680f59c2..41fa8a30b 100644
--- a/xlators/cluster/afr/src/afr-lk-common.c
+++ b/xlators/cluster/afr/src/afr-lk-common.c
@@ -2165,13 +2165,14 @@ out:
int
afr_attempt_lock_recovery (xlator_t *this, int32_t child_index)
{
- call_frame_t *frame = NULL;
- afr_private_t *priv = NULL;
- afr_local_t *local = NULL;
- afr_locked_fd_t *locked_fd = NULL;
+ call_frame_t *frame = NULL;
+ afr_private_t *priv = NULL;
+ afr_local_t *local = NULL;
+ afr_locked_fd_t *locked_fd = NULL;
afr_locked_fd_t *tmp = NULL;
- int ret = 0;
+ int ret = -1;
struct list_head locks_list = {0,};
+ int32_t op_errno = 0;
priv = this->private;
@@ -2185,15 +2186,10 @@ afr_attempt_lock_recovery (xlator_t *this, int32_t child_index)
goto out;
}
- local = GF_CALLOC (1, sizeof (*local),
- gf_afr_mt_afr_local_t);
- if (!local) {
- ret = -1;
- goto out;
- }
-
- AFR_LOCAL_INIT (local, priv);
- if (!local) {
+ ALLOC_OR_GOTO (frame->local, afr_local_t, out);
+ local = frame->local;
+ ret = afr_local_init (local, priv, &op_errno);
+ if (ret < 0) {
ret = -1;
goto out;
}
@@ -2231,6 +2227,8 @@ afr_attempt_lock_recovery (xlator_t *this, int32_t child_index)
}
out:
+ if ((ret < 0) && frame)
+ AFR_STACK_DESTROY (frame);
return ret;
}