• Douglas Gilbert's avatar
    scsi: scsi_debug: every_nth triggered error injection · 3a90a63d
    Douglas Gilbert authored
    This patch simplifies, or at least makes more consistent, the way setting
    the every_nth parameter injects errors. Here is a list of 'opts' flags and
    in which cases they inject errors when abs(every_nth)%command_count == 0 is
    reached:
    
      - OPT_RECOVERED_ERR: issued on READ(*)s, WRITE(*)s and
                           WRITE_SCATTEREDs
      - OPT_DIF_ERR:       issued on READ(*)s, WRITE(*)s and
                           WRITE_SCATTEREDs
      - OPT_DIX_ERR:       issued on READ(*)s, WRITE(*)s and
                           WRITE_SCATTEREDs
      - OPT_SHORT_TRANSFER: issued on READ(*)s
      - OPT_TRANSPORT_ERR: issued on all commands
      - OPT_CMD_ABORT:     issued on all commands
    
    The other uses of every_nth were not modified.
    
    Previously if, for example, OPT_SHORT_TRANSFER was armed then if
    (abs(every_nth) % command_count == 0) occurred during a command that was
    _not_ a READ, then no error injection occurred. This behaviour puzzled
    several testers. Now a global "inject_pending" flag is set and the _next_
    READ will get hit and that flag is cleared. OPT_RECOVERED_ERR, OPT_DIF_ERR
    and OPT_DIX_ERR have similar behaviour. A downside of this is that there
    might be a hang-over pending injection that gets triggered by a following
    test.
    
    Also expand the every_nth runtime parameter so that it can take hex value
    (i.e. with a leading '0x') as well as a decimal value. Now both the 'opts'
    and the 'every_nth' runtime parameters can take hexadecimal values.
    
    Link: https://lore.kernel.org/r/20200712182927.72044-2-dgilbert@interlog.comSigned-off-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
    Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
    3a90a63d
scsi_debug.c 213 KB