diff options
author | Christoph Hellwig <hch@lst.de> | 2014-10-11 16:25:31 +0200 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-11-12 11:16:11 +0100 |
commit | 906d15fbd23c1267addab361063c1c8119992215 (patch) | |
tree | 419ba148925c3651fe9337af24a932097e2c3d8a /drivers/scsi/osst.c | |
parent | 176aa9d6ee2db582e7e856dbe1983004a82869b4 (diff) |
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>
Diffstat (limited to 'drivers/scsi/osst.c')
-rw-r--r-- | drivers/scsi/osst.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/scsi/osst.c b/drivers/scsi/osst.c index 3d0d13c4da15..b6d63d636692 100644 --- a/drivers/scsi/osst.c +++ b/drivers/scsi/osst.c @@ -4969,10 +4969,10 @@ static long osst_ioctl(struct file * file, * may try and take the device offline, in which case all further * access to the device is prohibited. */ - if( !scsi_block_when_processing_errors(STp->device) ) { - retval = (-ENXIO); + retval = scsi_ioctl_block_when_processing_errors(STp->device, cmd_in, + file->f_flags & O_NDELAY); + if (retval) goto out; - } cmd_type = _IOC_TYPE(cmd_in); cmd_nr = _IOC_NR(cmd_in); |