scsi: split scsi_nonblockable_ioctl
authorChristoph Hellwig <hch@lst.de>
Sat, 11 Oct 2014 14:25:31 +0000 (16:25 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 12 Nov 2014 10:16:11 +0000 (11:16 +0100)
commit906d15fbd23c1267addab361063c1c8119992215
tree419ba148925c3651fe9337af24a932097e2c3d8a
parent176aa9d6ee2db582e7e856dbe1983004a82869b4
scsi: split scsi_nonblockable_ioctl

The calling conventions for this function are bad as it could return
-ENODEV both for a device not currently online and a not recognized ioctl.

Add a new scsi_ioctl_block_when_processing_errors function that wraps
scsi_block_when_processing_errors with the a special case for the
SG_SCSI_RESET ioctl command, and handle the SG_SCSI_RESET case itself
in scsi_ioctl.  All callers of scsi_ioctl now must call the above helper
to check for the EH state, so that the ioctl handler itself doesn't
have to.

Reported-by: Robert Elliott <Elliott@hp.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Martin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: Hannes Reinecke <hare@suse.de>
drivers/scsi/ch.c
drivers/scsi/osst.c
drivers/scsi/scsi_ioctl.c
drivers/scsi/sd.c
drivers/scsi/sg.c
drivers/scsi/sr.c
drivers/scsi/st.c
include/scsi/scsi_ioctl.h