Skip to content

Commit c35fc7a

Browse files
Christoph HellwigAl Viro
authored andcommitted
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 <[email protected]> Reviewed-by: Jan Kara <[email protected]> Signed-off-by: Al Viro <[email protected]>
1 parent 91f9943 commit c35fc7a

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

fs/block_dev.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1739,6 +1739,8 @@ static int blkdev_open(struct inode * inode, struct file * filp)
17391739
*/
17401740
filp->f_flags |= O_LARGEFILE;
17411741

1742+
filp->f_mode |= FMODE_NOWAIT;
1743+
17421744
if (filp->f_flags & O_NDELAY)
17431745
filp->f_mode |= FMODE_NDELAY;
17441746
if (filp->f_flags & O_EXCL)
@@ -1891,6 +1893,9 @@ ssize_t blkdev_write_iter(struct kiocb *iocb, struct iov_iter *from)
18911893
if (iocb->ki_pos >= size)
18921894
return -ENOSPC;
18931895

1896+
if ((iocb->ki_flags & (IOCB_NOWAIT | IOCB_DIRECT)) == IOCB_NOWAIT)
1897+
return -EOPNOTSUPP;
1898+
18941899
iov_iter_truncate(from, size - iocb->ki_pos);
18951900

18961901
blk_start_plug(&plug);

0 commit comments

Comments
 (0)