From 1b82cb88124b5ff753a2f551956b337a66265ec7 Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Fri, 20 Jan 2017 16:09:13 +0530 Subject: [PATCH 282/285] performance/write-behind: access stub only if available during statedump >Reviewed-on: https://review.gluster.org/16440 >Reviewed-by: N Balachandran >NetBSD-regression: NetBSD Build System >CentOS-regression: Gluster Build System >Smoke: Gluster Build System Change-Id: Ia5dd718458a5e32138012f81f014d13fc6b28be2 BUG: 1414247 Signed-off-by: Raghavendra G Reviewed-on: https://code.engineering.redhat.com/gerrit/96726 Reviewed-by: Atin Mukherjee Tested-by: Atin Mukherjee --- libglusterfs/src/call-stub.c | 47 ++++++++++++++++++++++ libglusterfs/src/call-stub.h | 2 + .../performance/write-behind/src/write-behind.c | 24 +++++------ 3 files changed, 61 insertions(+), 12 deletions(-) diff --git a/libglusterfs/src/call-stub.c b/libglusterfs/src/call-stub.c index 9ed2493..c9c47b5 100644 --- a/libglusterfs/src/call-stub.c +++ b/libglusterfs/src/call-stub.c @@ -2538,3 +2538,50 @@ call_unwind_error (call_stub_t *stub, int op_ret, int op_errno) return; } + + +void +call_unwind_error_keep_stub (call_stub_t *stub, int op_ret, int op_errno) +{ + xlator_t *old_THIS = NULL; + + list_del_init (&stub->list); + + old_THIS = THIS; + THIS = stub->frame->this; + { + stub->args_cbk.op_ret = op_ret; + stub->args_cbk.op_errno = op_errno; + call_resume_unwind (stub); + } + + THIS = old_THIS; + + return; + +} + +void +call_resume_keep_stub (call_stub_t *stub) +{ + xlator_t *old_THIS = NULL; + + errno = EINVAL; + GF_VALIDATE_OR_GOTO ("call-stub", stub, out); + + list_del_init (&stub->list); + + old_THIS = THIS; + THIS = stub->frame->this; + { + if (stub->wind) + call_resume_wind (stub); + else + call_resume_unwind (stub); + } + + THIS = old_THIS; + +out: + return; +} diff --git a/libglusterfs/src/call-stub.h b/libglusterfs/src/call-stub.h index 5779ee3..300b593 100644 --- a/libglusterfs/src/call-stub.h +++ b/libglusterfs/src/call-stub.h @@ -763,8 +763,10 @@ fop_setactivelk_cbk_stub (call_frame_t *frame, fop_setactivelk_cbk_t fn, int32_t op_ret, int32_t op_errno, dict_t *xdata); void call_resume (call_stub_t *stub); +void call_resume_keep_stub (call_stub_t *stub); void call_stub_destroy (call_stub_t *stub); void call_unwind_error (call_stub_t *stub, int op_ret, int op_errno); +void call_unwind_error_keep_stub (call_stub_t *stub, int op_ret, int op_errno); /* * Sometimes we might want to call just this, perhaps repeatedly, without diff --git a/xlators/performance/write-behind/src/write-behind.c b/xlators/performance/write-behind/src/write-behind.c index 7f5719b..ea3b987 100644 --- a/xlators/performance/write-behind/src/write-behind.c +++ b/xlators/performance/write-behind/src/write-behind.c @@ -373,10 +373,10 @@ __wb_request_unref (wb_request_t *req) list_del_init (&req->winds); list_del_init (&req->unwinds); - if (req->stub && req->ordering.tempted) { + if (req->stub) { call_stub_destroy (req->stub); req->stub = NULL; - } /* else we would have call_resume()'ed */ + } if (req->iobref) iobref_unref (req->iobref); @@ -1511,21 +1511,20 @@ __wb_pick_winds (wb_inode_t *wb_inode, list_head_t *tasks, void wb_do_winds (wb_inode_t *wb_inode, list_head_t *tasks) { - wb_request_t *req = NULL; - wb_request_t *tmp = NULL; + wb_request_t *req = NULL; + wb_request_t *tmp = NULL; list_for_each_entry_safe (req, tmp, tasks, winds) { - list_del_init (&req->winds); + list_del_init (&req->winds); if (req->op_ret == -1) { - call_unwind_error (req->stub, req->op_ret, - req->op_errno); + call_unwind_error_keep_stub (req->stub, req->op_ret, + req->op_errno); } else { - call_resume (req->stub); + call_resume_keep_stub (req->stub); } - req->stub = NULL; - wb_request_unref (req); + wb_request_unref (req); } } @@ -2352,8 +2351,9 @@ __wb_dump_requests (struct list_head *head, char *prefix) gf_proc_dump_write ("size", "%"GF_PRI_SIZET, req->write_size); - gf_proc_dump_write ("offset", "%"PRId64, - req->stub->args.offset); + if (req->stub) + gf_proc_dump_write ("offset", "%"PRId64, + req->stub->args.offset); flag = req->ordering.lied; gf_proc_dump_write ("lied", "%d", flag); -- 2.9.3