提交 d0387f38 编写于 作者: M Mike Christie 提交者: Zheng Zengkai

scsi: libiscsi: Fix iscsi_prep_scsi_cmd_pdu() error handling

stable inclusion
from stable-5.10.24
commit 79b4fdd8b4cfd88e0314b368bd911a732161c944
bugzilla: 51348

--------------------------------

[ Upstream commit d28d48c6 ]

If iscsi_prep_scsi_cmd_pdu() fails we try to add it back to the cmdqueue,
but we leave it partially setup. We don't have functions that can undo the
pdu and init task setup. We only have cleanup_task which can clean up both
parts. So this has us just fail the cmd and go through the standard cleanup
routine and then have the SCSI midlayer retry it like is done when it fails
in the queuecommand path.

Link: https://lore.kernel.org/r/20210207044608.27585-2-michael.christie@oracle.comReviewed-by: NLee Duncan <lduncan@suse.com>
Signed-off-by: NMike Christie <michael.christie@oracle.com>
Signed-off-by: NMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: NSasha Levin <sashal@kernel.org>
Signed-off-by: NChen Jun <chenjun102@huawei.com>
Acked-by: N  Weilong Chen <chenweilong@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 b919d326
...@@ -1532,14 +1532,9 @@ static int iscsi_data_xmit(struct iscsi_conn *conn) ...@@ -1532,14 +1532,9 @@ static int iscsi_data_xmit(struct iscsi_conn *conn)
} }
rc = iscsi_prep_scsi_cmd_pdu(conn->task); rc = iscsi_prep_scsi_cmd_pdu(conn->task);
if (rc) { if (rc) {
if (rc == -ENOMEM || rc == -EACCES) { if (rc == -ENOMEM || rc == -EACCES)
spin_lock_bh(&conn->taskqueuelock); fail_scsi_task(conn->task, DID_IMM_RETRY);
list_add_tail(&conn->task->running, else
&conn->cmdqueue);
conn->task = NULL;
spin_unlock_bh(&conn->taskqueuelock);
goto done;
} else
fail_scsi_task(conn->task, DID_ABORT); fail_scsi_task(conn->task, DID_ABORT);
spin_lock_bh(&conn->taskqueuelock); spin_lock_bh(&conn->taskqueuelock);
continue; continue;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册