From c20f501d0632d6105f0d570ac8dec251974ebe87 Mon Sep 17 00:00:00 2001 From: shishir gowda Date: Mon, 16 Apr 2012 14:39:10 +0530 Subject: cluster/dht: Handle failures in getxattr_cbk Change-Id: Ifbce2d69f0fdd0c45cba92b6fc2dffe13c60de28 BUG: 810106 Signed-off-by: shishir gowda Reviewed-on: http://review.gluster.com/3156 Tested-by: Gluster Build System Reviewed-by: Amar Tumballi Reviewed-by: Venky Shankar --- xlators/cluster/dht/src/dht-common.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'xlators/cluster/dht/src/dht-common.c') diff --git a/xlators/cluster/dht/src/dht-common.c b/xlators/cluster/dht/src/dht-common.c index 57bacb88865..c017813d63e 100644 --- a/xlators/cluster/dht/src/dht-common.c +++ b/xlators/cluster/dht/src/dht-common.c @@ -1707,10 +1707,12 @@ dht_vgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, dict_t *dict = NULL; int32_t alloc_len = 0; int32_t plen = 0; + call_frame_t *prev = NULL; local = frame->local; + prev = cookie; - if (op_ret != -1) { + if (op_ret >= 0) { ret = dict_get_str (xattr, local->xsel, &value_got); if (!ret) { alloc_len = strlen (value_got); @@ -1742,12 +1744,23 @@ dht_vgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, strcat (local->xattr_val, value_got); } + local->op_ret = 0; } + } else { + local->op_ret = -1; + local->op_errno = op_errno; + gf_log (this->name, GF_LOG_ERROR, "Subvolume %s returned -1 " + "(%s)", prev->this->name, strerror (op_errno)); } out: this_call_cnt = dht_frame_return (frame); if (is_last_call (this_call_cnt)) { + + if (local->op_ret == -1) { + goto unwind; + } + if (local->layout->cnt > 1) { /* Set it for directory */ fill_layout_info (local->layout, layout_buf); @@ -1806,8 +1819,8 @@ dht_vgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, gf_log ("this->name", GF_LOG_ERROR, "Unable to find hashed_subvol" " for path %s", local->xattr_val); - - DHT_STACK_UNWIND (getxattr, frame, -1, op_errno, dict, xdata); +unwind: + DHT_STACK_UNWIND (getxattr, frame, -1, local->op_errno, NULL, NULL); return 0; } -- cgit