From fc087e2be8ec19281cddded8d989b55c9e029cf9 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Tue, 14 Jul 2009 16:53:13 +0000 Subject: [PATCH] Merge of r945: Fixes wrong usage of parent request's fields in the response. Reported by Erez Zilber git-svn-id: http://svn.code.sf.net/p/scst/svn/branches/1.0.1.x@954 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/kernel/nthread.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/iscsi-scst/kernel/nthread.c b/iscsi-scst/kernel/nthread.c index e3e459f10..65ec1c6d0 100644 --- a/iscsi-scst/kernel/nthread.c +++ b/iscsi-scst/kernel/nthread.c @@ -1086,16 +1086,19 @@ static int write_data(struct iscsi_conn *conn) int saved_size, size, sendsize; int length, offset, idx; int flags, res, count, sg_size; - bool do_put = false; + bool do_put = false, ref_cmd_to_parent; TRACE_ENTRY(); iscsi_extracheck_is_wr_thread(conn); - if (write_cmnd->own_sg == 0) + if (write_cmnd->own_sg == 0) { ref_cmd = write_cmnd->parent_req; - else + ref_cmd_to_parent = true; + } else { ref_cmd = write_cmnd; + ref_cmd_to_parent = false; + } if (!ref_cmd->on_written_list) { TRACE_DBG("Adding cmd %p to conn %p written_list", ref_cmd, @@ -1350,7 +1353,8 @@ out_err: (long long unsigned int)conn->session->sid, conn->cid, conn->write_cmnd); } - if ((ref_cmd->scst_cmd != NULL) || (ref_cmd->scst_aen != NULL)) { + if (ref_cmd_to_parent && + ((ref_cmd->scst_cmd != NULL) || (ref_cmd->scst_aen != NULL))) { if (ref_cmd->scst_state == ISCSI_CMD_STATE_AEN) scst_set_aen_delivery_status(ref_cmd->scst_aen, SCST_AEN_RES_FAILED);