]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
xfs: Propagate errors from xfs_reflink_cancel_cow_range in xfs_dax_write_iomap_end
authorWentao Liang <vulab@iscas.ac.cn>
Fri, 24 Jan 2025 03:22:28 +0000 (11:22 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 17 Feb 2025 09:05:30 +0000 (10:05 +0100)
commit fb95897b8c60653805aa09daec575ca30983f768 upstream.

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")
Cc: stable@vger.kernel.org # v6.0
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/xfs/xfs_iomap.c

index 86da16f54be9d78e7d752b7a14514d8d9e8d6335..6335b122486feeb7f80013a654bf1d86d9e8a48d 100644 (file)
@@ -942,10 +942,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);
 }