direct-io: Handle O_(D)SYNC AIO

Call generic_write_sync() from the deferred I/O completion handler if
O_DSYNC is set for a write request.  Also make sure various callers
don't call generic_write_sync if the direct I/O code returns
-EIOCBQUEUED.

Based on an earlier patch from Jan Kara <[email protected]> with updates from
Jeff Moyer <[email protected]> and Darrick J. Wong <[email protected]>.

Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Jan Kara <[email protected]>
Signed-off-by: Al Viro <[email protected]>
This commit is contained in:
Christoph Hellwig 2013-09-04 15:04:40 +02:00 • committed by Al Viro
commit 02afc27fae
6 changed files with 41 additions and 14 deletions

View file

@ -149,7 +149,7 @@ ext4_file_dio_write(struct kiocb *iocb, const struct iovec *iov,
ret = __generic_file_aio_write(iocb, iov, nr_segs, &iocb->ki_pos);
mutex_unlock(&inode->i_mutex);
if (ret > 0 || ret == -EIOCBQUEUED) {
if (ret > 0) {
ssize_t err;
err = generic_write_sync(file, pos, ret);