kill FMODE_NDELAY_NOW
Subsystems (3)
PATCH 1/2 kill FMODE_NDELAY_NOW
Update FMODE_NDELAY before each ioctl call so that we can kill the magic FMODE_NDELAY_NOW. It would be even better to do this directly in setfl(), but for that we'd need to have FMODE_NDELAY for all files, not just block special files.
Signed-off-by Christoph Hellwig <[email protected]>
block/compat_ioctl.c +7 -1
@@ -699,8 +699,14 @@ long compat_blkdev_ioctl(struct file *fistruct backing_dev_info *bdi;loff_t size; +/* +* O_NDELAY can be altered using fcntl(.., F_SETFL, ..), so we have +* to updated it before every ioctl. +*/ if (file->f_flags &O_NDELAY ) - mode |=FMODE_NDELAY_NOW ; + mode |=FMODE_NDELAY ; +else + mode &= ~FMODE_NDELAY ;switch (cmd) {case HDIO_GETGEO :
drivers/scsi/sd.c +1 -1
@@ -757,7 +757,7 @@ static int sd_ioctl(struct block_device* access to the device is prohibited. */ error =scsi_nonblockable_ioctl (sdp, cmd, p, - (mode &FMODE_NDELAY_NOW ) !=0 ); + (mode &FMODE_NDELAY ) !=0 );if (!scsi_block_when_processing_errors (sdp) || !error)return error;
drivers/scsi/sr.c +1 -1
@@ -521,7 +521,7 @@ static int sr_block_ioctl(struct block_d* if it doesn't recognise the ioctl */ ret =scsi_nonblockable_ioctl (sdev, cmd, argp, - (mode &FMODE_NDELAY_NOW ) !=0 ); + (mode &FMODE_NDELAY ) !=0 );if (ret != -ENODEV )return ret;return scsi_ioctl (sdev, cmd, argp);
fs/block_dev.c +9 -1
@@ -1207,8 +1207,16 @@ static long block_ioctl(struct file *fil {struct block_device *bdev =I_BDEV (file->f_mapping->host);fmode_t mode = file->f_mode; + +/* +* O_NDELAY can be altered using fcntl(.., F_SETFL, ..), so we have +* to updated it before every ioctl. +*/ if (file->f_flags &O_NDELAY ) - mode |=FMODE_NDELAY_NOW ; + mode |=FMODE_NDELAY ; +else + mode &= ~FMODE_NDELAY ; +return blkdev_ioctl (bdev, mode, cmd, arg); }
include/linux/fs.h +0 -1
@@ -79,7 +79,6 @@ extern int dir_notify_enable;#define FMODE_NDELAY ((__force fmode_t)32)#define FMODE_EXCL ((__force fmode_t)64)#define FMODE_WRITE_IOCTL ((__force fmode_t)128) -#define FMODE_NDELAY_NOW ((__force fmode_t)256)#define RW_MASK 1#define RWA_MASK 2
Al Viro
maintainerQuoted 4 lines · Christoph Hellwig
Update
FMODE_NDELAYbefore each ioctl call so that we can kill the magicFMODE_NDELAY_NOW. It would be even better to do this directly insetfl(), but for that we'd need to haveFMODE_NDELAYfor all files, not just block special files.
We _can't_ do that in setfl() - not unless you such bdev method. Note that there's a bunch of cases where O_NDELAY at open() is used to get very different semantics and we want ->release() to see the matching value.