On Thu, Oct 17, 2019 at 11:39:17AM -0700, Darrick J. Wong wrote: > On Thu, Oct 17, 2019 at 07:56:11PM +0200, Christoph Hellwig wrote: > > From: Dave Chinner <dchinner@xxxxxxxxxx> > > > > When doing a direct IO that spans the current EOF, and there are > > written blocks beyond EOF that extend beyond the current write, the > > only metadata update that needs to be done is a file size extension. > > > > However, we don't mark such iomaps as IOMAP_F_DIRTY to indicate that > > there is IO completion metadata updates required, and hence we may > > fail to correctly sync file size extensions made in IO completion > > when O_DSYNC writes are being used and the hardware supports FUA. > > > > Hence when setting IOMAP_F_DIRTY, we need to also take into account > > whether the iomap spans the current EOF. If it does, then we need to > > mark it dirty so that IO completion will call generic_write_sync() > > to flush the inode size update to stable storage correctly. > > > > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> > > Signed-off-by: Christoph Hellwig <hch@xxxxxx> > > Looks ok, but need fixes tag. Also, might it be wise to split off the > ext4 section into a separate patch so that it can be backported > separately? I 've done a bit more digging on this, and the ext4 part is not needed for DAX as IOMAP_F_DIRTY is only used in the page fault path and hence can't change the file size. As such, this only affects direct IO. Hence the ext4 hunk can be added to the ext4 iomap-dio patchset that is being developed rather than being in this patch. Fixes: 3460cac1ca76 ("iomap: Use FUA for pure data O_DSYNC DIO writes") Cheers, Dave. -- Dave Chinner david@xxxxxxxxxxxxx