On Mon, Jun 19, 2017 at 11:33:43AM -0500, Goldwyn Rodrigues wrote: > From: Goldwyn Rodrigues <rgoldwyn@xxxxxxxx> > > Find out if the I/O will trigger a wait due to writeback. If yes, > return -EAGAIN. > > Return -EINVAL for buffered AIO: there are multiple causes of > delay such as page locks, dirty throttling logic, page loading > from disk etc. which cannot be taken care of. > I don't believe that generic_file_read_iter() is sufficient. Consider ext4_file_read_iter() -> ext4_dax_read_iter(): static ssize_t ext4_dax_read_iter(struct kiocb *iocb, struct iov_iter *to) { struct inode *inode = file_inode(iocb->ki_filp); ssize_t ret; inode_lock_shared(inode); IOW, your ext4 patch is missing a chunk. I hadn't checked xfs one...