--- a/fs/iomap/direct-io.cI don't follow the logic here -- all the error codes except for EAGAIN
+++ b/fs/iomap/direct-io.c
@@ -679,7 +679,12 @@ __iomap_dio_rw(struct kiocb *iocb, struct iov_iter
*iter,
if (ret != -EAGAIN) {
trace_iomap_dio_invalidate_fail(inode, iomi.pos,
iomi.len);
- ret = -ENOTBLK;
+ if (iocb->ki_flags & IOCB_ATOMIC) {
+ if (ret == -ENOTBLK)
+ ret = -EAGAIN;
are squashed into ENOTBLK, so why would we let them through for an
atomic write?
if (ret != -EAGAIN) {
trace_iomap_dio_invalidate_fail(inode, iomi.pos,
iomi.len);
if (iocb->ki_flags & IOCB_ATOMIC) {
/*
* folio invalidation failed, maybe this is
* transient, unlock and see if the caller
* tries again
*/
return -EAGAIN;
} else {
/* fall back to buffered write */
return -ENOTBLK;
}
}