• Douglas Gilbert's avatar
    scsi: add SG_SCSI_RESET_NO_ESCALATE flag to SG_SCSI_RESET ioctl · 26cf591e
    Douglas Gilbert authored
    Further to a January 2013 thread titled: "[PATCH] SG_SCSI_RESET ioctl
    should only perform requested operation" by Jeremy Linton a patch (v3)
    is presented that expands the existing ioctl to include "no_escalate"
    versions to the existing resets. This requires no changes to SCSI low
    level drivers (LLDs); it adds several more finely tuned reset options
    to the user space. For example:
    
       /* This call remains the same, with the same escalating semantics
        * if the device (LU) reset fail. That is: on failure to try a
        * target reset and if that fails, try a bus reset, and if that fails
        * try a host (i.e. LLD) reset. */
       val = SG_SCSI_RESET_DEVICE;
       res = ioctl(<sg_or_block_fd>, SG_SCSI_RESET, &val);
    
       /* What follows is a new option introduced by this patch series. Only
        * a device reset is attempted. If that fails then an appropriate
        * error code is provided. N.B. There is no reset escalation. */
       val = SG_SCSI_RESET_DEVICE | SG_SCSI_RESET_NO_ESCALATE;
       res = ioctl(<sg_or_block_fd>, SG_SCSI_RESET, &val);
    Signed-off-by: default avatarDouglas Gilbert <dgilbert@interlog.com>
    Reviewed-by: default avatarJeremy Linton <jlinton@tributary.com>
    Reviewed-by: default avatarHannes Reinecke <hare@suse.de>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    26cf591e
scsi_ioctl.c 9.47 KB