summaryrefslogtreecommitdiff
path: root/fs/block_dev.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-09-14 19:29:55 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2017-09-14 19:29:55 -0700
commite253d98f5babbec7e6ced810f7335b265a7f7e83 (patch)
treecd688c4ba8d43edb12bbeb523393879f7c212b65 /fs/block_dev.c
parent0f0d12728e56c94d3289c6831243b6faeae8a19d (diff)
parentc35fc7a5abae9c154dd6f8c0b288462342facd45 (diff)
Merge branch 'work.read_write' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull nowait read support from Al Viro: "Support IOCB_NOWAIT for buffered reads and block devices" * 'work.read_write' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: block_dev: support RFW_NOWAIT on block device nodes fs: support RWF_NOWAIT for buffered reads fs: support IOCB_NOWAIT in generic_file_buffered_read fs: pass iocb to do_generic_file_read
Diffstat (limited to 'fs/block_dev.c')
-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 bb715b2fcfb8..93d088ffc05c 100644
--- a/fs/block_dev.c
+++ b/fs/block_dev.c
@@ -1740,6 +1740,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)
@@ -1892,6 +1894,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);