]> git.pld-linux.org Git - packages/kernel.git/blob - jam-07-scsi-error-tmout.patch
- obsolete
[packages/kernel.git] / jam-07-scsi-error-tmout.patch
1         Prevent endless loop in SCSI error handling.
2         Author: Borzenkov Andrey <Andrej.Borsenkow@mow.siemens.ru>
3
4 --- linux-2.4.18-18mdk/drivers/scsi/scsi_error.c.scsi-eh-timeout        Thu May 30 16:22:37 2002
5 +++ linux-2.4.18-18mdk/drivers/scsi/scsi_error.c        Sun Jun  9 19:18:11 2002
6 @@ -1103,6 +1103,8 @@
7   */
8  STATIC int scsi_eh_completed_normally(Scsi_Cmnd * SCpnt)
9  {
10 +       int rtn;
11 +
12         /*
13          * First check the host byte, to see if there is anything in there
14          * that would indicate what we need to do.
15 @@ -1116,14 +1118,18 @@
16                          * otherwise we just flag it as success.
17                          */
18                         SCpnt->flags &= ~IS_RESETTING;
19 -                       return NEEDS_RETRY;
20 +                       goto maybe_retry;
21                 }
22                 /*
23                  * Rats.  We are already in the error handler, so we now get to try
24                  * and figure out what to do next.  If the sense is valid, we have
25                  * a pretty good idea of what to do.  If not, we mark it as failed.
26                  */
27 -               return scsi_check_sense(SCpnt);
28 +               rtn = scsi_check_sense(SCpnt);
29 +               if (rtn == NEEDS_RETRY) {
30 +                       goto maybe_retry;
31 +               }
32 +               return rtn;
33         }
34         if (host_byte(SCpnt->result) != DID_OK) {
35                 return FAILED;
36 @@ -1142,7 +1148,11 @@
37         case COMMAND_TERMINATED:
38                 return SUCCESS;
39         case CHECK_CONDITION:
40 -               return scsi_check_sense(SCpnt);
41 +               rtn = scsi_check_sense(SCpnt);
42 +               if (rtn == NEEDS_RETRY) {
43 +                       goto maybe_retry;
44 +               }
45 +               return rtn;
46         case CONDITION_GOOD:
47         case INTERMEDIATE_GOOD:
48         case INTERMEDIATE_C_GOOD:
49 @@ -1157,6 +1167,17 @@
50                 return FAILED;
51         }
52         return FAILED;
53 +
54 +      maybe_retry:
55 +
56 +       if ((++SCpnt->retries) < SCpnt->allowed) {
57 +               return NEEDS_RETRY;
58 +       } else {
59 +                /*
60 +                 * No more retries - report this one back to upper level.
61 +                 */
62 +               return SUCCESS;
63 +       }
64  }
65  
66  /*
This page took 0.031378 seconds and 3 git commands to generate.