]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/suse-2.6.27.39/patches.fixes/libiscsi-don-t-increment-cmdsn-if-cmd-is-not-sent
Fix oinkmaster patch.
[ipfire-2.x.git] / src / patches / suse-2.6.27.39 / patches.fixes / libiscsi-don-t-increment-cmdsn-if-cmd-is-not-sent
1 From: Hannes Reinecke <hare@suse.de>
2 Date: Thu, 13 Aug 2009 10:55:44 +0200
3 Subject: libiscsi: don't increment cmdsn if cmd is not sent
4 X-Git: d3305f3407fa3e9452079ec6cc8379067456e4aa
5 References: bnc#472432
6
7 We increment session->cmdsn at the top of iscsi_prep_scsi_cmd_pdu, but
8 if the prep ecb or prep bidi or init_task calls fails then we leave the
9 session->cmdsn incremented. This moves the cmdsn manipulation to the end
10 of the function when we know it has succeeded.
11
12 It also adds a session->cmdsn--; in queuecommand for if a driver like
13 bnx2i tries to send a a task from that context but it fails. We do not
14 have to do this in the xmit thread context because that code will retry
15 the same task if the initial call fails.
16
17 Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
18 Signed-off-by: Hannes Reinecke <hare@suse.de>
19 ---
20 drivers/scsi/libiscsi.c | 5 +++--
21 1 files changed, 3 insertions(+), 2 deletions(-)
22
23 diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
24 index b1a1b61..b87ca12 100644
25 --- a/drivers/scsi/libiscsi.c
26 +++ b/drivers/scsi/libiscsi.c
27 @@ -224,8 +224,6 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
28 return rc;
29 } else
30 hdr->itt = build_itt(task->itt, session->age);
31 - hdr->cmdsn = cpu_to_be32(session->cmdsn);
32 - session->cmdsn++;
33 hdr->exp_statsn = cpu_to_be32(conn->exp_statsn);
34 cmd_len = sc->cmd_len;
35 if (cmd_len < ISCSI_CDB_SIZE)
36 @@ -310,6 +308,8 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_task *task)
37 return -EIO;
38
39 task->state = ISCSI_TASK_RUNNING;
40 + hdr->cmdsn = cpu_to_be32(session->cmdsn);
41 + session->cmdsn++;
42 list_move_tail(&task->running, &conn->run_list);
43
44 conn->scsicmd_pdus_cnt++;
45 @@ -1309,6 +1309,7 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
46 goto fault;
47 }
48 if (session->tt->xmit_task(task)) {
49 + session->cmdsn--;
50 sc->scsi_done = NULL;
51 iscsi_complete_command(task);
52 reason = FAILURE_SESSION_NOT_READY;
53 --
54 1.6.0.2
55