[PATCH] xfs: fix IOMAP_F_DIRTY flag overwrite in zoned DIO

Andrey Albershteyn <[email protected]>
Newsgroups org.kernel.vger.linux-xfs
Message-ID <[email protected]>
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(-)

diff --git a/fs/xfs/xfs_aops.c b/fs/xfs/xfs_aops.c
index 51293b6f331f..01a981bf126e 100644
--- a/fs/xfs/xfs_aops.c
+++ b/fs/xfs/xfs_aops.c
@@ -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);
diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 225c3de88d03..45eef1b815b3 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -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;
 }
 
-- 
2.54.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.