From 0d1199ecf08cb513db7bcd26db672811207fe5cf Mon Sep 17 00:00:00 2001 From: Vijay Bellur Date: Thu, 2 Sep 2010 03:08:55 +0000 Subject: cluster/dht: check for op_ret in dht_selfheal_dir_mkdir_cbk () Signed-off-by: Vijay Bellur Signed-off-by: Vijay Bellur BUG: 1503 (segfault in distribute during failover testing) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1503 --- xlators/cluster/dht/src/dht-selfheal.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/xlators/cluster/dht/src/dht-selfheal.c b/xlators/cluster/dht/src/dht-selfheal.c index 00424f27dc9..f3504935ded 100644 --- a/xlators/cluster/dht/src/dht-selfheal.c +++ b/xlators/cluster/dht/src/dht-selfheal.c @@ -211,14 +211,7 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, prev = cookie; subvol = prev->this; - dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); - if (prev->this == local->hashed_subvol) - local->ia_ino = local->stbuf.ia_ino; - - dht_iatt_merge (this, &local->preparent, preparent, prev->this); - dht_iatt_merge (this, &local->postparent, postparent, prev->this); - - if ((op_ret == 0) || (op_errno == EEXIST)) { + if ((op_ret == 0) || ((op_ret == -1) && (op_errno == EEXIST))) { for (i = 0; i < layout->cnt; i++) { if (layout->list[i].xlator == subvol) { layout->list[i].err = -1; @@ -227,6 +220,18 @@ dht_selfheal_dir_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, } } + if (op_ret) + goto out; + + + dht_iatt_merge (this, &local->stbuf, stbuf, prev->this); + if (prev->this == local->hashed_subvol) + local->ia_ino = local->stbuf.ia_ino; + + dht_iatt_merge (this, &local->preparent, preparent, prev->this); + dht_iatt_merge (this, &local->postparent, postparent, prev->this); + +out: this_call_cnt = dht_frame_return (frame); if (is_last_call (this_call_cnt)) { -- cgit