]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/suse-2.6.27.31/patches.fixes/libiscsi-don-t-let-io-sit-in-queue-when-session-has-failed
Merge branch 'master' of git://git.ipfire.org/ipfire-2.x
[people/teissler/ipfire-2.x.git] / src / patches / suse-2.6.27.31 / patches.fixes / libiscsi-don-t-let-io-sit-in-queue-when-session-has-failed
1 From: Mike Christie <michaelc@cs.wisc.edu>
2 Date: Wed, 13 May 2009 17:57:47 -0500
3 X-Git: 301e0f7e4d78e956c58b66888e134dbdb44ea28e
4 Subject: libiscsi: don't let io sit in queue when session has failed
5
6 If the session is failed, but we have not yet fully transitioned
7 to the recovery stage we were still queueuing IO. The idea is
8 that for some failures we can recvover at the command level
9 and still continue to execute other IO. Well, we never have
10 added the recovery within a command code, so queueing up IO here
11 just creates the possibility that it might time time out so
12 this just has us requeue the IO the scsi layer for now.
13
14 Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
15 Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
16 Signed-off-by: Hannes Reinecke <hare@suse.de>
17
18 ---
19 drivers/scsi/libiscsi.c | 15 ++++++---------
20 1 file changed, 6 insertions(+), 9 deletions(-)
21
22 --- a/drivers/scsi/libiscsi.c
23 +++ b/drivers/scsi/libiscsi.c
24 @@ -1242,13 +1242,7 @@ int iscsi_queuecommand(struct scsi_cmnd
25 goto fault;
26 }
27
28 - /*
29 - * ISCSI_STATE_FAILED is a temp. state. The recovery
30 - * code will decide what is best to do with command queued
31 - * during this time
32 - */
33 - if (session->state != ISCSI_STATE_LOGGED_IN &&
34 - session->state != ISCSI_STATE_FAILED) {
35 + if (session->state != ISCSI_STATE_LOGGED_IN) {
36 /*
37 * to handle the race between when we set the recovery state
38 * and block the session we requeue here (commands could
39 @@ -1256,12 +1250,15 @@ int iscsi_queuecommand(struct scsi_cmnd
40 * up because the block code is not locked)
41 */
42 switch (session->state) {
43 + case ISCSI_STATE_FAILED:
44 case ISCSI_STATE_IN_RECOVERY:
45 reason = FAILURE_SESSION_IN_RECOVERY;
46 - goto reject;
47 + sc->result = DID_IMM_RETRY << 16;
48 + break;
49 case ISCSI_STATE_LOGGING_OUT:
50 reason = FAILURE_SESSION_LOGGING_OUT;
51 - goto reject;
52 + sc->result = DID_IMM_RETRY << 16;
53 + break;
54 case ISCSI_STATE_RECOVERY_FAILED:
55 reason = FAILURE_SESSION_RECOVERY_TIMEOUT;
56 sc->result = DID_TRANSPORT_FAILFAST << 16;