aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--block/compat_ioctl.c8
-rw-r--r--drivers/scsi/sd.c2
-rw-r--r--drivers/scsi/sr.c2
-rw-r--r--fs/block_dev.c10
-rw-r--r--include/linux/fs.h1
5 files changed, 18 insertions, 5 deletions
diff --git a/block/compat_ioctl.c b/block/compat_ioctl.c
index d43e6087badc..67eb93cff699 100644
--- a/block/compat_ioctl.c
+++ b/block/compat_ioctl.c
@@ -722,8 +722,14 @@ long compat_blkdev_ioctl(struct file *file, unsigned cmd, unsigned long arg)
722 struct backing_dev_info *bdi; 722 struct backing_dev_info *bdi;
723 loff_t size; 723 loff_t size;
724 724
725 /*
726 * O_NDELAY can be altered using fcntl(.., F_SETFL, ..), so we have
727 * to updated it before every ioctl.
728 */
725 if (file->f_flags & O_NDELAY) 729 if (file->f_flags & O_NDELAY)
726 mode |= FMODE_NDELAY_NOW; 730 mode |= FMODE_NDELAY;
731 else
732 mode &= ~FMODE_NDELAY;
727 733
728 switch (cmd) { 734 switch (cmd) {
729 case HDIO_GETGEO: 735 case HDIO_GETGEO:
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index c9e1242eaf25..5081b3981d3c 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -757,7 +757,7 @@ static int sd_ioctl(struct block_device *bdev, fmode_t mode,
757 * access to the device is prohibited. 757 * access to the device is prohibited.
758 */ 758 */
759 error = scsi_nonblockable_ioctl(sdp, cmd, p, 759 error = scsi_nonblockable_ioctl(sdp, cmd, p,
760 (mode & FMODE_NDELAY_NOW) != 0); 760 (mode & FMODE_NDELAY) != 0);
761 if (!scsi_block_when_processing_errors(sdp) || !error) 761 if (!scsi_block_when_processing_errors(sdp) || !error)
762 return error; 762 return error;
763 763
diff --git a/drivers/scsi/sr.c b/drivers/scsi/sr.c
index 62b6633e3a97..45b66b98a516 100644
--- a/drivers/scsi/sr.c
+++ b/drivers/scsi/sr.c
@@ -521,7 +521,7 @@ static int sr_block_ioctl(struct block_device *bdev, fmode_t mode, unsigned cmd,
521 * if it doesn't recognise the ioctl 521 * if it doesn't recognise the ioctl
522 */ 522 */
523 ret = scsi_nonblockable_ioctl(sdev, cmd, argp, 523 ret = scsi_nonblockable_ioctl(sdev, cmd, argp,
524 (mode & FMODE_NDELAY_NOW) != 0); 524 (mode & FMODE_NDELAY) != 0);
525 if (ret != -ENODEV) 525 if (ret != -ENODEV)
526 return ret; 526 return ret;
527 return scsi_ioctl(sdev, cmd, argp); 527 return scsi_ioctl(sdev, cmd, argp);
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 7c727523bc54..99e0ae1a4c78 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1206,8 +1206,16 @@ static long block_ioctl(struct file *file, unsigned cmd, unsigned long arg)
1206{ 1206{
1207 struct block_device *bdev = I_BDEV(file->f_mapping->host); 1207 struct block_device *bdev = I_BDEV(file->f_mapping->host);
1208 fmode_t mode = file->f_mode; 1208 fmode_t mode = file->f_mode;
1209
1210 /*
1211 * O_NDELAY can be altered using fcntl(.., F_SETFL, ..), so we have
1212 * to updated it before every ioctl.
1213 */
1209 if (file->f_flags & O_NDELAY) 1214 if (file->f_flags & O_NDELAY)
1210 mode |= FMODE_NDELAY_NOW; 1215 mode |= FMODE_NDELAY;
1216 else
1217 mode &= ~FMODE_NDELAY;
1218
1211 return blkdev_ioctl(bdev, mode, cmd, arg); 1219 return blkdev_ioctl(bdev, mode, cmd, arg);
1212} 1220}
1213 1221
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 0dcdd9458f4b..b3345a90e11a 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -79,7 +79,6 @@ extern int dir_notify_enable;
79#define FMODE_NDELAY ((__force fmode_t)32) 79#define FMODE_NDELAY ((__force fmode_t)32)
80#define FMODE_EXCL ((__force fmode_t)64) 80#define FMODE_EXCL ((__force fmode_t)64)
81#define FMODE_WRITE_IOCTL ((__force fmode_t)128) 81#define FMODE_WRITE_IOCTL ((__force fmode_t)128)
82#define FMODE_NDELAY_NOW ((__force fmode_t)256)
83 82
84#define RW_MASK 1 83#define RW_MASK 1
85#define RWA_MASK 2 84#define RWA_MASK 2