summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorAnush Shetty <anush@gluster.com>2010-07-26 05:07:18 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-27 01:20:00 -0700
commit4792bb9a6caa4c74b6facebaba9379694893070e (patch)
treee0161e207aba4d39d8a1e071e450e11846ca3253 /xlators
parent470127fba6ca05671bd6b2ef9c187877711bf6cb (diff)
Set fdctx only if op_ret is not -1
Signed-off-by: Anush Shetty <anush@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1218 (Crash in client_fdctx_destroy) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1218
Diffstat (limited to 'xlators')
-rw-r--r--xlators/protocol/client/src/client3_1-fops.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/xlators/protocol/client/src/client3_1-fops.c b/xlators/protocol/client/src/client3_1-fops.c
index 8c99a16093a..06b33348493 100644
--- a/xlators/protocol/client/src/client3_1-fops.c
+++ b/xlators/protocol/client/src/client3_1-fops.c
@@ -2098,11 +2098,9 @@ client3_1_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count,
call_frame_t *frame = NULL;
frame = myframe;
-
local = frame->local;
conf = frame->this->private;
- fdctx = local->fdctx;
-
+
if (-1 == req->rpc_status) {
rsp.op_ret = -1;
rsp.op_errno = ENOTCONN;
@@ -2122,6 +2120,8 @@ client3_1_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count,
local->loc.path, rsp.op_ret, rsp.fd);
if (-1 != rsp.op_ret) {
+ fdctx = local->fdctx;
+ if(fdctx) {
pthread_mutex_lock (&conf->lock);
{
fdctx->remote_fd = rsp.fd;
@@ -2132,6 +2132,8 @@ client3_1_reopen_cbk (struct rpc_req *req, struct iovec *iov, int count,
}
}
pthread_mutex_unlock (&conf->lock);
+
+ }
}
out:
@@ -2164,8 +2166,7 @@ client3_1_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
local = frame->local;
frame->local = NULL;
conf = frame->this->private;
- fdctx = local->fdctx;
-
+
if (-1 == req->rpc_status) {
rsp.op_ret = -1;
rsp.op_errno = ENOTCONN;
@@ -2184,7 +2185,9 @@ client3_1_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
"reopendir on %s returned %d (%"PRId64")",
local->loc.path, rsp.op_ret, rsp.fd);
- if (fdctx) {
+ if (-1 != rsp.op_ret) {
+ fdctx = local->fdctx;
+ if (fdctx) {
pthread_mutex_lock (&conf->lock);
{
fdctx->remote_fd = rsp.fd;
@@ -2195,6 +2198,8 @@ client3_1_reopendir_cbk (struct rpc_req *req, struct iovec *iov, int count,
}
}
pthread_mutex_unlock (&conf->lock);
+
+ }
}
out: