linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Michael Cyr <mikecyr@us.ibm.com>
To: nab@linux-iscsi.org, joe@perches.com
Cc: hch@infradead.org, bryantly@linux.vnet.ibm.com,
	James.Bottomley@HansenPartnership.com, tyreld@linux.vnet.ibm.com,
	brking@linux.vnet.ibm.com, akpm@linux-foundation.org,
	bart.vanassche@sandisk.com, gregkh@linuxfoundation.org,
	seroyer@linux.vnet.ibm.com, linux-scsi@vger.kernel.org,
	target-devel@vger.kernel.org, martin.petersen@oracle.com,
	Michael Cyr <mikecyr@us.ibm.com>
Subject: [PATCH v1 2/3] Properly handle if target_submit_cmd/tmr fails
Date: Tue, 11 Oct 2016 17:58:04 -0500	[thread overview]
Message-ID: <1476226685-2276-3-git-send-email-mikecyr@us.ibm.com> (raw)
In-Reply-To: <1476226685-2276-1-git-send-email-mikecyr@us.ibm.com>

Signed-off-by: Michael Cyr <mikecyr@us.ibm.com>
---
 drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
index 34f758c..5c4b979 100644
--- a/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
+++ b/drivers/scsi/ibmvscsi_tgt/ibmvscsi_tgt.c
@@ -2561,6 +2561,10 @@ static void ibmvscsis_parse_cmd(struct scsi_info *vscsi,
 			       data_len, attr, dir, 0);
 	if (rc) {
 		dev_err(&vscsi->dev, "target_submit_cmd failed, rc %d\n", rc);
+		spin_lock_bh(&vscsi->intr_lock);
+		list_del(&cmd->list);
+		ibmvscsis_free_cmd_resources(vscsi, cmd);
+		spin_unlock_bh(&vscsi->intr_lock);
 		goto fail;
 	}
 	return;
@@ -2640,6 +2644,9 @@ static void ibmvscsis_parse_task(struct scsi_info *vscsi,
 		if (rc) {
 			dev_err(&vscsi->dev, "target_submit_tmr failed, rc %d\n",
 				rc);
+			spin_lock_bh(&vscsi->intr_lock);
+			list_del(&cmd->list);
+			spin_unlock_bh(&vscsi->intr_lock);
 			cmd->se_cmd.se_tmr_req->response =
 				TMR_FUNCTION_REJECTED;
 		}
-- 
2.5.0


  parent reply	other threads:[~2016-10-11 22:58 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-11 22:58 [PATCH v1 0/3] Fixes for problems found during testing Michael Cyr
2016-10-11 22:58 ` [PATCH v1 1/3] Synchronization of cmds during termination conditions Michael Cyr
2016-10-12  6:20   ` Greg KH
2016-10-12 14:09   ` Bryant G. Ly
2016-10-11 22:58 ` Michael Cyr [this message]
2016-10-11 22:58 ` [PATCH v1 3/3] Return correct partition name/number to client Michael Cyr
2016-10-13 16:02 ` [PATCH v2 0/6] Fixes for ibmvscsis driver Michael Cyr
2016-10-13 16:02   ` [PATCH v2 1/6] ibmvscsis: Rearrange functions for future patches Michael Cyr
2016-10-13 16:02   ` [PATCH v2 2/6] ibmvscsis: Synchronize cmds at tpg_enable_store time Michael Cyr
2016-10-13 16:02   ` [PATCH v2 3/6] ibmvscsis: Synchronize cmds at remove time Michael Cyr
2016-10-13 16:02   ` [PATCH v2 4/6] ibmvscsis: Clean up properly if target_submit_cmd/tmr fails Michael Cyr
2016-10-13 16:02   ` [PATCH v2 5/6] ibmvscsis: Return correct partition name/# to client Michael Cyr
2016-10-13 16:02   ` [PATCH v2 6/6] ibmvscsis: Issues from Dan Carpenter/Smatch Michael Cyr
     [not found]   ` <8fcdcfd1eedecae72a868ab45a872e06@linux.vnet.ibm.com>
2016-10-17 16:15     ` [PATCH v2 0/6] Fixes for ibmvscsis driver Tyrel Datwyler
2016-10-19  1:21   ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476226685-2276-3-git-send-email-mikecyr@us.ibm.com \
    --to=mikecyr@us.ibm.com \
    --cc=James.Bottomley@HansenPartnership.com \
    --cc=akpm@linux-foundation.org \
    --cc=bart.vanassche@sandisk.com \
    --cc=brking@linux.vnet.ibm.com \
    --cc=bryantly@linux.vnet.ibm.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hch@infradead.org \
    --cc=joe@perches.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=martin.petersen@oracle.com \
    --cc=nab@linux-iscsi.org \
    --cc=seroyer@linux.vnet.ibm.com \
    --cc=target-devel@vger.kernel.org \
    --cc=tyreld@linux.vnet.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).