• Boaz Harrosh's avatar
    [SCSI] aha152x: Fix check_condition code-path · 45333ffa
    Boaz Harrosh authored
    check_condition code-path was similar but more
    complicated to Reset. It went like this:
    
      1. extra space was allocated at aha152x_scdata for mirroring
        scsi_cmnd members.
      2. At aha152x_internal_queue() every not check_condition
        (REQUEST_SENSE) command was copied to above members in
        case of error.
      3. At busfree_run() in the DONE_CS phase if a Status of
        SAM_STAT_CHECK_CONDITION was detected. The command was
        re-queued Internally using aha152x_internal_queue(,,check_condition,)
        The old command members are over written with the
        REQUEST_SENSE info.
      4. At busfree_run() in the DONE_CS phase again. If it is a
        check_condition command, info was restored from mirror
        made at first call to aha152x_internal_queue() (see 2)
        and the command is completed.
    
    What I did is:
    
      1. Allocate less space in aha152x_scdata only for the 16-byte
        original command. (which is actually not needed by scsi-ml
        anymore at this stage. But this is to much knowledge of scsi-ml)
      2. If Status == SAM_STAT_CHECK_CONDITION, then like before
         re-queue a REQUEST_SENSE command. But only now save original
         command members. (Less of them)
      3. In aha152x_internal_queue(), just like for Reset, use the
        check_condition hint to set differently the working members.
        execute the command.
      4. At busfree_run() in the DONE_CS phase again. restore needed
         members.
    
    While at it. This patch fixes a BUG. Old code when sending
    a REQUEST_SENSE for a failed command. Would than return with
    cmd->resid == 0 which was the status of the REQUEST_SENSE.
    The failing command resid was lost. And when would resid
    be interesting if not on a failing command?
    Signed-off-by: default avatarBoaz Harrosh <bharrosh@panasas.com>
    Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
    45333ffa
aha152x.c 99 KB