Commit 83ff6fe8580a7c834dba4389d742332fff9b9929

Authored by Al Viro
1 parent 633a08b812

[PATCH] don't mess with file in scsi_nonblockable_ioctl()

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 5 changed files with 9 additions and 6 deletions Side-by-side Diff

drivers/scsi/scsi_ioctl.c
... ... @@ -277,14 +277,14 @@
277 277 * @filp: either NULL or a &struct file which must have the O_NONBLOCK flag.
278 278 */
279 279 int 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 282 int val, result;
283 283  
284 284 /* The first set of iocts may be executed even if we're doing
285 285 * error processing, as long as the device was opened
286 286 * non-blocking */
287   - if (filp && (filp->f_flags & O_NONBLOCK)) {
  287 + if (ndelay) {
288 288 if (scsi_host_in_recovery(sdev->host))
289 289 return -ENODEV;
290 290 } else if (!scsi_block_when_processing_errors(sdev))
... ... @@ -761,7 +761,8 @@
761 761 * may try and take the device offline, in which case all further
762 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 766 if (!scsi_block_when_processing_errors(sdp) || !error)
766 767 return error;
767 768  
... ... @@ -524,7 +524,8 @@
524 524 * case fall through to scsi_ioctl, which will return ENDOEV again
525 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 529 if (ret != -ENODEV)
529 530 return ret;
530 531 return scsi_ioctl(sdev, cmd, argp);
... ... @@ -3263,7 +3263,8 @@
3263 3263 * may try and take the device offline, in which case all further
3264 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 3268 if (!scsi_block_when_processing_errors(STp->device) || retval != -ENODEV)
3268 3269 goto out;
3269 3270 retval = 0;
include/scsi/scsi_ioctl.h
... ... @@ -42,7 +42,7 @@
42 42  
43 43 extern int scsi_ioctl(struct scsi_device *, int, void __user *);
44 44 extern 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 47 #endif /* __KERNEL__ */
48 48 #endif /* _SCSI_IOCTL_H */