xfs: fix IOMAP_F_DIRTY flag overwrite in zoned DIO
PATCH 1/1 xfs: fix IOMAP_F_DIRTY flag overwrite in zoned DIO
Missing IOMAP_F_DIRTY prevents completion handlers from updating i_size on the direct IO path, the flag is set but was overwritten by IOMAP_F_ANON_WRITE latter. The writeback path for buffered IO doesn't seem to require IOMAP_F_DIRTY and looks like an error.
Fixes 2e2383405824 ("xfs: implement direct writes to zoned RT devices")
Signed-off-by Andrey Albershteyn <[email protected]>
--- fs/xfs/xfs_aops.c | 1 - fs/xfs/xfs_iomap.c | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-)
fs/xfs/xfs_aops.c +0 -1
@@ -632,7 +632,6 @@ xfs_zoned_map_blocks(xfs_iunlock (ip,XFS_ILOCK_EXCL ); wpc->iomap.type =IOMAP_MAPPED ; - wpc->iomap.flags =IOMAP_F_DIRTY ; wpc->iomap.bdev = mp->m_rtdev_targp->bt_bdev; wpc->iomap.offset = offset; wpc->iomap.length =XFS_FSB_TO_B (mp, count_fsb);
fs/xfs/xfs_iomap.c +1 -2
@@ -1081,11 +1081,10 @@ xfs_zoned_direct_write_iomap_begin( } iomap->type =IOMAP_MAPPED ; - iomap->flags =IOMAP_F_DIRTY ; iomap->bdev = ip->i_mount->m_rtdev_targp->bt_bdev; iomap->offset = offset; iomap->length = length; - iomap->flags =IOMAP_F_ANON_WRITE ; + iomap->flags =IOMAP_F_DIRTY |IOMAP_F_ANON_WRITE ;return 0 ; }
Signature · 1 line
2.54.0
Quoted 7 lines · Andrey Albershteyn
Missing
IOMAP_F_DIRTYprevents completion handlers from updatingi_sizeon the direct IO path, the flag is set but was overwritten byIOMAP_F_ANON_WRITElatter. The writeback path for buffered IO doesn't seem to requireIOMAP_F_DIRTYand looks like an error.Fixes 2e2383405824 ("xfs: implement direct writes to zoned RT devices")Signed-off-by Andrey Albershteyn <[email protected]>
I actually have exactly the same fix in a series I'm about to send out, and a cleanup to move this into common code.
I guess we both saw the same Sashiko comment :)