public inbox for linux-fsdevel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: Propagate errors from xfs_reflink_cancel_cow_range in xfs_dax_write_iomap_end
@ 2025-01-20 16:09 Wentao Liang
  2025-01-22  3:25 ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Wentao Liang @ 2025-01-20 16:09 UTC (permalink / raw)
  To: djwong
  Cc: chandanbabu, cem, brauner, dchinner, yi.zhang, linux-fsdevel,
	linux-kernel, 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")
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 fs/xfs/xfs_iomap.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
index 50fa3ef89f6c..d61460309a78 100644
--- a/fs/xfs/xfs_iomap.c
+++ b/fs/xfs/xfs_iomap.c
@@ -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);
 }
-- 
2.42.0.windows.2


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] xfs: Propagate errors from xfs_reflink_cancel_cow_range in xfs_dax_write_iomap_end
  2025-01-20 16:09 [PATCH] xfs: Propagate errors from xfs_reflink_cancel_cow_range in xfs_dax_write_iomap_end Wentao Liang
@ 2025-01-22  3:25 ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2025-01-22  3:25 UTC (permalink / raw)
  To: Wentao Liang
  Cc: chandanbabu, cem, brauner, dchinner, yi.zhang, linux-fsdevel,
	linux-kernel

On Tue, Jan 21, 2025 at 12:09:06AM +0800, Wentao Liang wrote:
> 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")
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
> ---
>  fs/xfs/xfs_iomap.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/fs/xfs/xfs_iomap.c b/fs/xfs/xfs_iomap.c
> index 50fa3ef89f6c..d61460309a78 100644
> --- a/fs/xfs/xfs_iomap.c
> +++ b/fs/xfs/xfs_iomap.c
> @@ -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:

Cc: <stable@vger.kernel.org> # v6.0
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>

--D

>  
>  	return xfs_reflink_end_cow(ip, pos, written);
>  }
> -- 
> 2.42.0.windows.2
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2025-01-22  3:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-20 16:09 [PATCH] xfs: Propagate errors from xfs_reflink_cancel_cow_range in xfs_dax_write_iomap_end Wentao Liang
2025-01-22  3:25 ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox