Skip to contentSkip to conversation

xfs: Propagate errors from xfs_reflink_cancel_cow_range in xfs_dax_write_iomap_end

PATCH Superseded Wentao Liang 2 participants 2 messages Jan 20, 2025 – Jan 22, 2025

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: Propagate errors from xfs_reflink_cancel_cow_range in xfs_dax_write_iomap_end

In xfs_dax_write_iomap_end(), directly return the result of xfs_reflink_cancel_cow_range() when !written, ensuring proper error propagation and improving code robustness.

Fixes ea6c49b784f0 ("xfs: support CoW in fsdax mode")
---
 fs/xfs/xfs_iomap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/xfs/xfs_iomap.c +2 -4
index 50fa3ef89f6c..d61460309a78 100644
@@ -976,10 +976,8 @@ xfs_dax_write_iomap_end(
 	if (!xfs_is_cow_inode(ip))
 		return 0;
 
-	if (!written) {
-		xfs_reflink_cancel_cow_range(ip, pos, length, true);
-		return 0;
-	}
+	if (!written)
+		return xfs_reflink_cancel_cow_range(ip, pos, length, true);
 
 	return xfs_reflink_end_cow(ip, pos, written);
 }
Signature · 1 line
2.42.0.windows.2
Reviewed-by on v1 1/1
#1 lore raw
Quoted 15 lines · Wentao Liang

In xfs_dax_write_iomap_end(), directly return the result of xfs_reflink_cancel_cow_range() when !written, ensuring proper error propagation and improving code robustness.

Fixes ea6c49b784f0 ("xfs: support CoW in fsdax mode")
---
 fs/xfs/xfs_iomap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
fs/xfs/xfs_iomap.c +0 -0
index 50fa3ef89f6c..d61460309a78 100644

fs/xfs/xfs_iomap.c xfs_dax_write_iomap_end( · line 980

Quoted 9 lines
fs/xfs/xfs_iomap.c +2 -4
@@ -976,10 +976,8 @@ xfs_dax_write_iomap_end(
 	if (!xfs_is_cow_inode(ip))
 		return 0;
 
-	if (!written) {
-		xfs_reflink_cancel_cow_range(ip, pos, length, true);
-		return 0;
-	}
+	if (!written)
+		return xfs_reflink_cancel_cow_range(ip, pos, length, true);

Ouch. Yeah, that's clearly wrong. Please add my tags:

--D

Quoted 6 lines
fs/xfs/xfs_iomap.c +0 -0
 	return xfs_reflink_end_cow(ip, pos, written);
 }
Signature · 1 line
2.42.0.windows.2