From 83ff6fe8580a7c834dba4389d742332fff9b9929 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Sun, 2 Mar 2008 08:15:49 -0500 Subject: [PATCH] [PATCH] don't mess with file in scsi_nonblockable_ioctl() Signed-off-by: Al Viro --- drivers/scsi/scsi_ioctl.c | 4 ++-- drivers/scsi/sd.c | 3 ++- drivers/scsi/sr.c | 3 ++- drivers/scsi/st.c | 3 ++- include/scsi/scsi_ioctl.h | 2 +- 5 files changed, 9 insertions(+), 6 deletions(-) diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c index 1f08f5a2f8f..dc1cfb2fd76 100644 --- a/drivers/scsi/scsi_ioctl.c +++ b/drivers/scsi/scsi_ioctl.c @@ -277,14 +277,14 @@ EXPORT_SYMBOL(scsi_ioctl); * @filp: either NULL or a &struct file which must have the O_NONBLOCK flag. */ int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd, - void __user *arg, struct file *filp) + void __user *arg, int ndelay) { int val, result; /* The first set of iocts may be executed even if we're doing * error processing, as long as the device was opened * non-blocking */ - if (filp && (filp->f_flags & O_NONBLOCK)) { + if (ndelay) { if (scsi_host_in_recovery(sdev->host)) return -ENODEV; } else if (!scsi_block_when_processing_errors(sdev)) diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 5d74413f591..5a18528a69d 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c @@ -761,7 +761,8 @@ static int sd_ioctl(struct inode * inode, struct file * filp, * 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, filp); + error = scsi_nonblockable_ioctl(sdp, cmd, p, + filp ? filp->f_flags & O_NDELAY : 0); if (!scsi_block_when_processing_errors(sdp) || !error) return error; diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c index b92e2dac9aa..2fb8d4d2d6f 100644 --- a/drivers/scsi/sr.c +++ b/drivers/scsi/sr.c @@ -524,7 +524,8 @@ static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd, * case fall through to scsi_ioctl, which will return ENDOEV again * if it doesn't recognise the ioctl */ - ret = scsi_nonblockable_ioctl(sdev, cmd, argp, NULL); + ret = scsi_nonblockable_ioctl(sdev, cmd, argp, + file ? file->f_flags & O_NDELAY : 0); if (ret != -ENODEV) return ret; return scsi_ioctl(sdev, cmd, argp); diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c index 8dffac9f341..c959bdc55f4 100644 --- a/drivers/scsi/st.c +++ b/drivers/scsi/st.c @@ -3263,7 +3263,8 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg) * may try and take the device offline, in which case all further * access to the device is prohibited. */ - retval = scsi_nonblockable_ioctl(STp->device, cmd_in, p, file); + retval = scsi_nonblockable_ioctl(STp->device, cmd_in, p, + file->f_flags & O_NDELAY); if (!scsi_block_when_processing_errors(STp->device) || retval != -ENODEV) goto out; retval = 0; diff --git a/include/scsi/scsi_ioctl.h b/include/scsi/scsi_ioctl.h index edb9525386d..b9006848b81 100644 --- a/include/scsi/scsi_ioctl.h +++ b/include/scsi/scsi_ioctl.h @@ -42,7 +42,7 @@ typedef struct scsi_fctargaddress { extern int scsi_ioctl(struct scsi_device *, int, void __user *); extern int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd, - void __user *arg, struct file *filp); + void __user *arg, int ndelay); #endif /* __KERNEL__ */ #endif /* _SCSI_IOCTL_H */ -- 2.41.1