From b9a4b393ee346d027e8cdf4ea7c6f2daf03c0dd2 Mon Sep 17 00:00:00 2001 From: Sakshi Date: Fri, 5 Jun 2015 13:48:09 +0530 Subject: dht : Error value check before performing rebalance complete Backport of http://review.gluster.org/#/c/11097/ >Change-Id: I7a0cd288d16f27b887c7820162efdbe99a039d95 >BUG: 1188242 >Signed-off-by: Sakshi Change-Id: I7a0cd288d16f27b887c7820162efdbe99a039d95 BUG: 1233632 Signed-off-by: Sakshi Reviewed-on: http://review.gluster.org/11329 Tested-by: Gluster Build System Reviewed-by: N Balachandran Tested-by: NetBSD Build System Reviewed-by: Raghavendra G Tested-by: Raghavendra G --- xlators/cluster/dht/src/dht-inode-write.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/xlators/cluster/dht/src/dht-inode-write.c b/xlators/cluster/dht/src/dht-inode-write.c index 85102a39965..1846ece1b9d 100644 --- a/xlators/cluster/dht/src/dht-inode-write.c +++ b/xlators/cluster/dht/src/dht-inode-write.c @@ -29,21 +29,29 @@ dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, struct iatt *postbuf, dict_t *xdata) { dht_local_t *local = NULL; + call_frame_t *prev = NULL; int ret = -1; xlator_t *subvol1 = NULL; xlator_t *subvol2 = NULL; - if (op_ret == -1 && !dht_inode_missing(op_errno)) { - goto out; - } - local = frame->local; + prev = cookie; + if (!local) { op_ret = -1; op_errno = EINVAL; goto out; } + if (op_ret == -1 && !dht_inode_missing(op_errno)) { + local->op_errno = op_errno; + local->op_ret = -1; + gf_msg_debug (this->name, 0, + "subvolume %s returned -1 (%s)", + prev->this->name, strerror (op_errno)); + goto out; + } + if (local->call_cnt != 1) { /* preserve the modes of source */ if (local->stbuf.ia_blocks) { @@ -57,7 +65,7 @@ dht_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, local->op_errno = op_errno; /* Phase 2 of migration */ - if (IS_DHT_MIGRATION_PHASE2 (postbuf)) { + if ((op_ret == -1) || IS_DHT_MIGRATION_PHASE2 (postbuf)) { ret = dht_rebalance_complete_check (this, frame); if (!ret) return 0; -- cgit