aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-03-02 08:15:49 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2008-10-21 07:47:28 -0400
commit83ff6fe8580a7c834dba4389d742332fff9b9929 (patch)
tree7708b57bdf42961749320adbbce526e551dbe6c7
parent633a08b81206122469365b4c72eaeb71f04f2cb4 (diff)
[PATCH] don't mess with file in scsi_nonblockable_ioctl()
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--drivers/scsi/scsi_ioctl.c4
-rw-r--r--drivers/scsi/sd.c3
-rw-r--r--drivers/scsi/sr.c3
-rw-r--r--drivers/scsi/st.c3
-rw-r--r--include/scsi/scsi_ioctl.h2
5 files changed, 9 insertions, 6 deletions
diff --git a/drivers/scsi/scsi_ioctl.c b/drivers/scsi/scsi_ioctl.c
index 1f08f5a2f8fd..dc1cfb2fd76b 100644
--- a/drivers/scsi/scsi_ioctl.c
+++ b/drivers/scsi/scsi_ioctl.c
@@ -277,14 +277,14 @@ EXPORT_SYMBOL(scsi_ioctl);
277 * @filp: either NULL or a &struct file which must have the O_NONBLOCK flag. 277 * @filp: either NULL or a &struct file which must have the O_NONBLOCK flag.
278 */ 278 */
279int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd, 279int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd,
280 void __user *arg, struct file *filp) 280 void __user *arg, int ndelay)
281{ 281{
282 int val, result; 282 int val, result;
283 283
284 /* The first set of iocts may be executed even if we're doing 284 /* The first set of iocts may be executed even if we're doing
285 * error processing, as long as the device was opened 285 * error processing, as long as the device was opened
286 * non-blocking */ 286 * non-blocking */
287 if (filp && (filp->f_flags & O_NONBLOCK)) { 287 if (ndelay) {
288 if (scsi_host_in_recovery(sdev->host)) 288 if (scsi_host_in_recovery(sdev->host))
289 return -ENODEV; 289 return -ENODEV;
290 } else if (!scsi_block_when_processing_errors(sdev)) 290 } else if (!scsi_block_when_processing_errors(sdev))
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index 5d74413f591a..5a18528a69d0 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,
761 * may try and take the device offline, in which case all further 761 * may try and take the device offline, in which case all further
762 * access to the device is prohibited. 762 * access to the device is prohibited.
763 */ 763 */
764 error = scsi_nonblockable_ioctl(sdp, cmd, p, filp); 764 error = scsi_nonblockable_ioctl(sdp, cmd, p,
765 filp ? filp->f_flags & O_NDELAY : 0);
765 if (!scsi_block_when_processing_errors(sdp) || !error) 766 if (!scsi_block_when_processing_errors(sdp) || !error)
766 return error; 767 return error;
767 768
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index b92e2dac9aa9..2fb8d4d2d6f6 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,
524 * case fall through to scsi_ioctl, which will return ENDOEV again 524 * case fall through to scsi_ioctl, which will return ENDOEV again
525 * if it doesn't recognise the ioctl 525 * if it doesn't recognise the ioctl
526 */ 526 */
527 ret = scsi_nonblockable_ioctl(sdev, cmd, argp, NULL); 527 ret = scsi_nonblockable_ioctl(sdev, cmd, argp,
528 file ? file->f_flags & O_NDELAY : 0);
528 if (ret != -ENODEV) 529 if (ret != -ENODEV)
529 return ret; 530 return ret;
530 return scsi_ioctl(sdev, cmd, argp); 531 return scsi_ioctl(sdev, cmd, argp);
diff --git a/drivers/scsi/st.c b/drivers/scsi/st.c
index 8dffac9f3419..c959bdc55f4f 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)
3263 * may try and take the device offline, in which case all further 3263 * may try and take the device offline, in which case all further
3264 * access to the device is prohibited. 3264 * access to the device is prohibited.
3265 */ 3265 */
3266 retval = scsi_nonblockable_ioctl(STp->device, cmd_in, p, file); 3266 retval = scsi_nonblockable_ioctl(STp->device, cmd_in, p,
3267 file->f_flags & O_NDELAY);
3267 if (!scsi_block_when_processing_errors(STp->device) || retval != -ENODEV) 3268 if (!scsi_block_when_processing_errors(STp->device) || retval != -ENODEV)
3268 goto out; 3269 goto out;
3269 retval = 0; 3270 retval = 0;
diff --git a/include/scsi/scsi_ioctl.h b/include/scsi/scsi_ioctl.h
index edb9525386da..b9006848b813 100644
--- a/include/scsi/scsi_ioctl.h
+++ b/include/scsi/scsi_ioctl.h
@@ -42,7 +42,7 @@ typedef struct scsi_fctargaddress {
42 42
43extern int scsi_ioctl(struct scsi_device *, int, void __user *); 43extern int scsi_ioctl(struct scsi_device *, int, void __user *);
44extern int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd, 44extern int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd,
45 void __user *arg, struct file *filp); 45 void __user *arg, int ndelay);
46 46
47#endif /* __KERNEL__ */ 47#endif /* __KERNEL__ */
48#endif /* _SCSI_IOCTL_H */ 48#endif /* _SCSI_IOCTL_H */