diff options
author | Christoph Hellwig <hch@lst.de> | 2014-10-11 10:25:31 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2014-11-12 05:16:11 -0500 |
commit | 906d15fbd23c1267addab361063c1c8119992215 (patch) | |
tree | 419ba148925c3651fe9337af24a932097e2c3d8a /drivers/scsi/st.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/st.c')
-rw-r--r-- | drivers/scsi/st.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 63c35ed3c88d..7d2e036c75c1 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c | |||
@@ -3376,11 +3376,10 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) | |||
3376 | * may try and take the device offline, in which case all further | 3376 | * may try and take the device offline, in which case all further |
3377 | * access to the device is prohibited. | 3377 | * access to the device is prohibited. |
3378 | */ | 3378 | */ |
3379 | retval = scsi_nonblockable_ioctl(STp->device, cmd_in, p, | 3379 | retval = scsi_ioctl_block_when_processing_errors(STp->device, cmd_in, |
3380 | file->f_flags & O_NDELAY); | 3380 | file->f_flags & O_NDELAY); |
3381 | if (!scsi_block_when_processing_errors(STp->device) || retval != -ENODEV) | 3381 | if (retval) |
3382 | goto out; | 3382 | goto out; |
3383 | retval = 0; | ||
3384 | 3383 | ||
3385 | cmd_type = _IOC_TYPE(cmd_in); | 3384 | cmd_type = _IOC_TYPE(cmd_in); |
3386 | cmd_nr = _IOC_NR(cmd_in); | 3385 | cmd_nr = _IOC_NR(cmd_in); |