• James Bottomley's avatar
    scsi: normalize fixed and descriptor sense data · 3123e8db
    James Bottomley authored
    From: Douglas Gilbert <dougg@torque.net>
    
    The patch only touches two files: scsi.h and scsi_lib.c
    It adds the proposed facility and then uses it in scsi_lib
    in roughly 4 locations. IMO there were 3 sense processing errors:
       - block SG_IO did not get passed back deferred errors
         [SG_IO is a __pass-through__ interface!!]
       - MEDIUM_ERRORs _do_ get processed for deferred sense errors
         in scsi_io_completion() which seems unintended
         [I did not fix this one.]
       - invalid command operation code handling in
         __scsi_mode_sense() was just wrong
    
    If people think this is a reasonable approach, then the rest of
    the scsi mid-level and upper level driver could be converted.
    As Kai pointed we may need some general routines to pick up the
    sense data "extras".
    
    The benefit of doing this conversion is that it may well
    highlight a lot more sense data processing errors (if the
    above is any guide).
    
    Changes:
        - add structure to receive normalized sense data from either
          fixed or descriptor format sense data
        - add scsi_normalize_sense() function to populate that structure
        - add scsi_sense_is_deferred() function so deferred errors can
          be ignored in many contexts
        - apply new mechanism to sense data processing within the
          scsi_lib.c file
    
    Patch reformatted by: Christoph Hellwig <hch@lst.de>
    Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
    3123e8db
scsi_error.c 51.6 KB