From 114537a2e11b3811dbf4f1ca0d4fd74d0c0b23c3 Mon Sep 17 00:00:00 2001 From: Pranith Kumar K Date: Sat, 12 Nov 2016 16:47:00 +0530 Subject: protocol/server: Print error-xlator name Problem: At the moment from which xlator the errors are stemming from is a mystery. Fix: With this patch we can find on the server side which xlator first gave the errno received by server xlator. I am not yet sure how to get this done for client side which has lot of copy_frame()s. May be another patch. >Change-Id: Ie13307b965facf2a496123e81ce0bd6756f98ac9 >BUG: 1394548 >Signed-off-by: Pranith Kumar K >Reviewed-on: http://review.gluster.org/15836 >Smoke: Gluster Build System >NetBSD-regression: NetBSD Build System >Reviewed-by: Vijay Bellur >CentOS-regression: Gluster Build System BUG: 1396780 Change-Id: I3b293d21528da391eafd0fbaa5b451a1d3ddc237 Signed-off-by: Pranith Kumar K Reviewed-on: http://review.gluster.org/15886 CentOS-regression: Gluster Build System Smoke: Gluster Build System NetBSD-regression: NetBSD Build System Reviewed-by: Raghavendra Talur --- libglusterfs/src/stack.h | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'libglusterfs') diff --git a/libglusterfs/src/stack.h b/libglusterfs/src/stack.h index 393fdac8e73..8a7a42a171d 100644 --- a/libglusterfs/src/stack.h +++ b/libglusterfs/src/stack.h @@ -36,6 +36,10 @@ typedef struct call_pool call_pool_t; #define NFS_PID 1 #define LOW_PRIO_PROC_PID -1 + +#define STACK_ERR_XL_NAME(stack) (stack->err_xl?stack->err_xl->name:"-") +#define STACK_CLIENT_NAME(stack) (stack->client?stack->client->client_uid:"-") + typedef int32_t (*ret_fn_t) (call_frame_t *frame, call_frame_t *prev_frame, xlator_t *this, @@ -110,6 +114,8 @@ struct _call_stack_t { int32_t op; int8_t type; struct timeval tv; + xlator_t *err_xl; + int32_t error; }; @@ -363,6 +369,14 @@ STACK_RESET (call_stack_t *stack) LOCK(&frame->root->stack_lock); \ { \ _parent->ref_count--; \ + if (op_ret < 0 && \ + op_errno != frame->root->error) { \ + frame->root->err_xl = frame->this; \ + frame->root->error = op_errno; \ + } else if (op_ret == 0) { \ + frame->root->err_xl = NULL; \ + frame->root->error = 0; \ + } \ } \ UNLOCK(&frame->root->stack_lock); \ old_THIS = THIS; \ @@ -408,6 +422,14 @@ STACK_RESET (call_stack_t *stack) LOCK(&frame->root->stack_lock); \ { \ _parent->ref_count--; \ + if (op_ret < 0 && \ + op_errno != frame->root->error) { \ + frame->root->err_xl = frame->this; \ + frame->root->error = op_errno; \ + } else if (op_ret == 0) { \ + frame->root->err_xl = NULL; \ + frame->root->error = 0; \ + } \ } \ UNLOCK(&frame->root->stack_lock); \ old_THIS = THIS; \ -- cgit