Skip to content

Commit

Permalink
zonefs: fix IOCB_NOWAIT handling
Browse files Browse the repository at this point in the history
IOCB_NOWAIT can't just be ignored as it breaks applications expecting
it not to block.  Just refuse the operation as applications must handle
that (e.g. by falling back to a thread pool).

Fixes: 8dcc1a9 ("fs: New zonefs file system")
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
  • Loading branch information
Christoph Hellwig authored and damien-lemoal committed Feb 26, 2020
1 parent 4c5fd3b commit 7c69eb8
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fs/zonefs/super.c
Original file line number Diff line number Diff line change
Expand Up @@ -601,13 +601,13 @@ static ssize_t zonefs_file_dio_write(struct kiocb *iocb, struct iov_iter *from)
ssize_t ret;

/*
* For async direct IOs to sequential zone files, ignore IOCB_NOWAIT
* For async direct IOs to sequential zone files, refuse IOCB_NOWAIT
* as this can cause write reordering (e.g. the first aio gets EAGAIN
* on the inode lock but the second goes through but is now unaligned).
*/
if (zi->i_ztype == ZONEFS_ZTYPE_SEQ && !is_sync_kiocb(iocb)
&& (iocb->ki_flags & IOCB_NOWAIT))
iocb->ki_flags &= ~IOCB_NOWAIT;
if (zi->i_ztype == ZONEFS_ZTYPE_SEQ && !is_sync_kiocb(iocb) &&
(iocb->ki_flags & IOCB_NOWAIT))
return -EOPNOTSUPP;

if (iocb->ki_flags & IOCB_NOWAIT) {
if (!inode_trylock(inode))
Expand Down

0 comments on commit 7c69eb8

Please sign in to comment.