• Benjamin Block's avatar
    scsi: zfcp: add handling for FCP_RESID_OVER to the fcp ingress path · a099b7b1
    Benjamin Block authored
    Up until now zfcp would just ignore the FCP_RESID_OVER flag in the FCP
    response IU. When this flag is set, it is possible, in regards to the
    FCP standard, that the storage-server processes the command normally, up
    to the point where data is missing and simply ignores those.
    
    In this case no CHECK CONDITION would be set, and because we ignored the
    FCP_RESID_OVER flag we resulted in at least a data loss or even
    -corruption as a follow-up error, depending on how the
    applications/layers on top behave. To prevent this, we now set the
    host-byte of the corresponding scsi_cmnd to DID_ERROR.
    
    Other storage-behaviors, where the same condition results in a CHECK
    CONDITION set in the answer, don't need to be changed as they are
    handled in the mid-layer already.
    
    Following is an example trace record decoded with zfcpdbf from the
    s390-tools package. We forcefully injected a fc_dl which is one byte too
    small:
    
    Timestamp      : ...
    Area           : SCSI
    Subarea        : 00
    Level          : 3
    Exception      : -
    CPU ID         : ..
    Caller         : 0x...
    Record ID      : 1
    Tag            : rsl_err
    Request ID     : 0x...
    SCSI ID        : 0x...
    SCSI LUN       : 0x...
    SCSI result    : 0x00070000
                         ^^DID_ERROR
    SCSI retries   : 0x..
    SCSI allowed   : 0x..
    SCSI scribble  : 0x...
    SCSI opcode    : 2a000000 00000000 08000000 00000000
    FCP rsp inf cod: 0x00
    FCP rsp IU     : 00000000 00000000 00000400 00000001
                                           ^^fr_flags==FCP_RESID_OVER
                                             ^^fr_status==SAM_STAT_GOOD
                                                ^^^^^^^^fr_resid
                     00000000 00000000
    
    As of now, we don't actively handle to possibility that a response IU
    has both flags - FCP_RESID_OVER and FCP_RESID_UNDER - set at once.
    Reported-by: default avatarLuke M. Hopkins <lmhopkin@us.ibm.com>
    Reviewed-by: default avatarSteffen Maier <maier@linux.vnet.ibm.com>
    Fixes: 553448f6 ("[SCSI] zfcp: Message cleanup")
    Fixes: ea127f97 ("[PATCH] s390 (7/7): zfcp host adapter.") (tglx/history.git)
    Cc: <stable@vger.kernel.org> #2.6.33+
    Signed-off-by: default avatarBenjamin Block <bblock@linux.vnet.ibm.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    a099b7b1
zfcp_fc.h 7.73 KB