nfs/localio: Ensure DIO WRITE's IO on stable storage upon completion
LOCALIO's misaligned DIO WRITE support requires synchronous IO for any
misaligned head and/or tail that are issued using buffered IO. In
addition, it is important that the O_DIRECT middle be on stable
storage upon its completion via AIO.
Otherwise, a misaligned DIO WRITE could mix buffered IO for the
head/tail and direct IO for the DIO-aligned middle -- which could lead
to problems associated with deferred writes to stable storage (such as
out of order partial completions causing incorrect advancement of the
file's offset, etc).
Fixes: c817248fc8 ("nfs/localio: add proper O_DIRECT support for READ and WRITE")
Signed-off-by: Mike Snitzer <snitzer@kernel.org>
Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com>
pull/1354/merge
parent
d0497dd274
commit
d32ddfeb55
|
|
@ -485,8 +485,12 @@ nfs_local_iters_init(struct nfs_local_kiocb *iocb, int rw)
|
|||
struct nfs_local_dio local_dio;
|
||||
|
||||
if (nfs_is_local_dio_possible(iocb, rw, len, &local_dio) &&
|
||||
nfs_local_iters_setup_dio(iocb, rw, v, len, &local_dio) != 0)
|
||||
nfs_local_iters_setup_dio(iocb, rw, v, len, &local_dio) != 0) {
|
||||
/* Ensure DIO WRITE's IO on stable storage upon completion */
|
||||
if (rw == ITER_SOURCE)
|
||||
iocb->kiocb.ki_flags |= IOCB_DSYNC|IOCB_SYNC;
|
||||
return; /* is DIO-aligned */
|
||||
}
|
||||
}
|
||||
|
||||
/* Use buffered IO */
|
||||
|
|
|
|||
Loading…
Reference in New Issue