summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2017-08-29 17:13:21 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2017-09-05 02:04:23 +0300
commitc35fc7a5abae9c154dd6f8c0b288462342facd45 (patch)
tree4531ee1324e372e1382f55f09f2c710564af8838 /fs
parent91f9943e1c7b6638f27312d03fe71fcc67b23571 (diff)
downloadlinux-c35fc7a5abae9c154dd6f8c0b288462342facd45.tar.xz
block_dev: support RFW_NOWAIT on block device nodes
All support is already there in the generic code, we just need to wire it up. Signed-off-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/block_dev.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/block_dev.c b/fs/block_dev.c
index 9941dc8342df..ea21d18d8e79 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1739,6 +1739,8 @@ static int blkdev_open(struct inode * inode, struct file * filp)
*/
filp->f_flags |= O_LARGEFILE;
+ filp->f_mode |= FMODE_NOWAIT;
+
if (filp->f_flags & O_NDELAY)
filp->f_mode |= FMODE_NDELAY;
if (filp->f_flags & O_EXCL)
@@ -1891,6 +1893,9 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
if (iocb->ki_pos >= size)
return -ENOSPC;
+ if ((iocb->ki_flags & (IOCB_NOWAIT | IOCB_DIRECT)) == IOCB_NOWAIT)
+ return -EOPNOTSUPP;
+
iov_iter_truncate(from, size - iocb->ki_pos);
blk_start_plug(&plug);