From: Gao Xiang Date: Thu, 16 Nov 2023 02:28:27 +0000 (-0800) Subject: xfs: add missing cmap->br_state = XFS_EXT_NORM update X-Git-Tag: v5.15.140~144 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=92d38b87e8868754e06ec808ba12daa8a1d1ecd7;p=thirdparty%2Fkernel%2Fstable.git xfs: add missing cmap->br_state = XFS_EXT_NORM update [ Upstream commit 1a39ae415c1be1e46f5b3f97d438c7c4adc22b63 ] COW extents are already converted into written real extents after xfs_reflink_convert_cow_locked(), therefore cmap->br_state should reflect it. Otherwise, there is another necessary unwritten convertion triggered in xfs_dio_write_end_io() for direct I/O cases. Signed-off-by: Gao Xiang Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Leah Rumancik Acked-by: Chandan Babu R Signed-off-by: Sasha Levin --- diff --git a/fs/xfs/xfs_reflink.c b/fs/xfs/xfs_reflink.c index 36832e4bc803c..628ce65d02bb5 100644 --- a/fs/xfs/xfs_reflink.c +++ b/fs/xfs/xfs_reflink.c @@ -425,7 +425,10 @@ convert: if (!convert_now || cmap->br_state == XFS_EXT_NORM) return 0; trace_xfs_reflink_convert_cow(ip, cmap); - return xfs_reflink_convert_cow_locked(ip, offset_fsb, count_fsb); + error = xfs_reflink_convert_cow_locked(ip, offset_fsb, count_fsb); + if (!error) + cmap->br_state = XFS_EXT_NORM; + return error; out_trans_cancel: xfs_trans_cancel(tp);