Skip to content

Commit 83ff6fe

Browse files
author
Al Viro
committed
[PATCH] don't mess with file in scsi_nonblockable_ioctl()
Signed-off-by: Al Viro <[email protected]>
1 parent 633a08b commit 83ff6fe

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

drivers/scsi/scsi_ioctl.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,14 @@ EXPORT_SYMBOL(scsi_ioctl);
277277
* @filp: either NULL or a &struct file which must have the O_NONBLOCK flag.
278278
*/
279279
int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd,
280-
void __user *arg, struct file *filp)
280+
void __user *arg, int ndelay)
281281
{
282282
int val, result;
283283

284284
/* The first set of iocts may be executed even if we're doing
285285
* error processing, as long as the device was opened
286286
* non-blocking */
287-
if (filp && (filp->f_flags & O_NONBLOCK)) {
287+
if (ndelay) {
288288
if (scsi_host_in_recovery(sdev->host))
289289
return -ENODEV;
290290
} else if (!scsi_block_when_processing_errors(sdev))

drivers/scsi/sd.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,8 @@ static int sd_ioctl(struct inode * inode, struct file * filp,
761761
* may try and take the device offline, in which case all further
762762
* access to the device is prohibited.
763763
*/
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);
765766
if (!scsi_block_when_processing_errors(sdp) || !error)
766767
return error;
767768

drivers/scsi/sr.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,8 @@ static int sr_block_ioctl(struct inode *inode, struct file *file, unsigned cmd,
524524
* case fall through to scsi_ioctl, which will return ENDOEV again
525525
* if it doesn't recognise the ioctl
526526
*/
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);
528529
if (ret != -ENODEV)
529530
return ret;
530531
return scsi_ioctl(sdev, cmd, argp);

drivers/scsi/st.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3263,7 +3263,8 @@ static long st_ioctl(struct file *file, unsigned int cmd_in, unsigned long arg)
32633263
* may try and take the device offline, in which case all further
32643264
* access to the device is prohibited.
32653265
*/
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);
32673268
if (!scsi_block_when_processing_errors(STp->device) || retval != -ENODEV)
32683269
goto out;
32693270
retval = 0;

include/scsi/scsi_ioctl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ typedef struct scsi_fctargaddress {
4242

4343
extern int scsi_ioctl(struct scsi_device *, int, void __user *);
4444
extern int scsi_nonblockable_ioctl(struct scsi_device *sdev, int cmd,
45-
void __user *arg, struct file *filp);
45+
void __user *arg, int ndelay);
4646

4747
#endif /* __KERNEL__ */
4848
#endif /* _SCSI_IOCTL_H */

0 commit comments

Comments
 (0)