From 906d15fbd23c1267addab361063c1c8119992215 Mon Sep 17 00:00:00 2001 From: Christoph Hellwig Date: Sat, 11 Oct 2014 16:25:31 +0200 Subject: 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 Signed-off-by: Christoph Hellwig Reviewed-by: Martin K. Petersen Reviewed-by: Hannes Reinecke --- drivers/scsi/sd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/scsi/sd.c') diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 242f9b177285..ddf763ad3b83 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -1334,9 +1334,9 @@ static int sd_ioctl(struct block_device *bdev, fmode_t mode, * may try and take the device offline, in which case all further * access to the device is prohibited. */ - error = scsi_nonblockable_ioctl(sdp, cmd, p, - (mode & FMODE_NDELAY) != 0); - if (!scsi_block_when_processing_errors(sdp) || !error) + error = scsi_ioctl_block_when_processing_errors(sdp, cmd, + (mode & FMODE_NDELAY) != 0); + if (error) goto out; /* -- cgit v1.2.1