From 83311c5bb735508274bb25cc610e929481577f9b 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 --- 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 2899be9bf2f..d6d44d22396 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; }; @@ -361,6 +367,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; \ @@ -406,6 +420,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