提交 21a9d4c9 编写于 作者: C Christoph Hellwig

sd: fix up ->compat_ioctl

No need to verify the passthrough ioctls, the real handler will
take care of that.  Also make sure not to block for resets on
O_NONBLOCK fds.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NMartin K. Petersen <martin.petersen@oracle.com>
Reviewed-by: NHannes Reinecke <hare@suse.de>
上级 906d15fb
...@@ -1541,31 +1541,19 @@ static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode, ...@@ -1541,31 +1541,19 @@ static int sd_compat_ioctl(struct block_device *bdev, fmode_t mode,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device; struct scsi_device *sdev = scsi_disk(bdev->bd_disk)->device;
int ret; int error;
ret = scsi_verify_blk_ioctl(bdev, cmd);
if (ret < 0)
return ret;
/* error = scsi_ioctl_block_when_processing_errors(sdev, cmd,
* If we are in the middle of error recovery, don't let anyone (mode & FMODE_NDELAY) != 0);
* else try and use this device. Also, if error recovery fails, it if (error)
* may try and take the device offline, in which case all further return error;
* access to the device is prohibited.
*/
if (!scsi_block_when_processing_errors(sdev))
return -ENODEV;
if (sdev->host->hostt->compat_ioctl) {
ret = sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg);
return ret;
}
/* /*
* Let the static ioctl translation table take care of it. * Let the static ioctl translation table take care of it.
*/ */
return -ENOIOCTLCMD; if (!sdev->host->hostt->compat_ioctl)
return -ENOIOCTLCMD;
return sdev->host->hostt->compat_ioctl(sdev, cmd, (void __user *)arg);
} }
#endif #endif
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册