From ffbbb6a17075714865820a2f9722edcd70a4436f Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Mon, 31 Jan 2011 03:29:13 +0000 Subject: rpc/rpc-clnt: don't access rpcreq after putting the struct back into mem-pool. Signed-off-by: Raghavendra G Signed-off-by: Anand V. Avati BUG: 2335 (Segmentation fault in saved_frames_unwind) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2335 --- rpc/rpc-lib/src/rpc-clnt.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'rpc') diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c index f25a4b0ade1..d496673217a 100644 --- a/rpc/rpc-lib/src/rpc-clnt.c +++ b/rpc/rpc-lib/src/rpc-clnt.c @@ -307,11 +307,13 @@ __saved_frame_get (struct saved_frames *frames, int64_t callid) return saved_frame; } + void saved_frames_unwind (struct saved_frames *saved_frames) { struct saved_frame *trav = NULL; struct saved_frame *tmp = NULL; + struct mem_pool *saved_frames_pool = NULL; struct tm *frame_sent_tm = NULL; char timestr[256] = {0,}; @@ -329,22 +331,25 @@ saved_frames_unwind (struct saved_frames *saved_frames) continue; gf_log_callingfn ("rpc-clnt", GF_LOG_ERROR, - "forced unwinding frame type(%s) op(%s(%d)) " - "called at %s", - trav->rpcreq->prog->progname, - (trav->rpcreq->prog->procnames) ? - trav->rpcreq->prog->procnames[trav->rpcreq->procnum] - : "--", - trav->rpcreq->procnum, timestr); + "forced unwinding frame type(%s) op(%s(%d)) " + "called at %s", + trav->rpcreq->prog->progname, + (trav->rpcreq->prog->procnames) ? + trav->rpcreq->prog->procnames[trav->rpcreq->procnum] + : "--", + trav->rpcreq->procnum, timestr); saved_frames->count--; trav->rpcreq->rpc_status = -1; trav->rpcreq->cbkfn (trav->rpcreq, &iov, 1, trav->frame); + + saved_frames_pool + = trav->rpcreq->conn->rpc_clnt->saved_frames_pool; rpc_clnt_reply_deinit (trav->rpcreq, trav->rpcreq->conn->rpc_clnt->reqpool); list_del_init (&trav->list); - mem_put (trav->rpcreq->conn->rpc_clnt->saved_frames_pool, trav); + mem_put (saved_frames_pool, trav); } } -- cgit