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>
This commit is contained in:
Christoph Hellwig
2014-10-11 16:25:31 +02:00
父節點 176aa9d6ee
當前提交 906d15fbd2
共有 8 個文件被更改,包括 49 次插入74 次删除

查看文件

@@ -616,6 +616,11 @@ static long ch_ioctl(struct file *file,
int retval;
void __user *argp = (void __user *)arg;
retval = scsi_ioctl_block_when_processing_errors(ch->device, cmd,
file->f_flags & O_NDELAY);
if (retval)
return retval;
switch (cmd) {
case CHIOGPARAMS:
{