Skip to content

Commit 7c69eb8

Browse files
Christoph Hellwigdamien-lemoal
authored andcommitted
zonefs: fix IOCB_NOWAIT handling
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 <[email protected]> Signed-off-by: Damien Le Moal <[email protected]>
1 parent 4c5fd3b commit 7c69eb8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

fs/zonefs/super.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -601,13 +601,13 @@ static ssize_t zonefs_file_dio_write(struct kiocb *iocb, struct iov_iter *from)
601601
ssize_t ret;
602602

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

612612
if (iocb->ki_flags & IOCB_NOWAIT) {
613613
if (!inode_trylock(inode))

0 commit comments

Comments
 (0)