Skip to content

Commit 26b63be

Browse files
ISCAS-Vulabcmaiolino
authored andcommitted
xfs: Add error handling for xfs_reflink_cancel_cow_range
In xfs_inactive(), xfs_reflink_cancel_cow_range() is called without error handling, risking unnoticed failures and inconsistent behavior compared to other parts of the code. Fix this issue by adding an error handling for the xfs_reflink_cancel_cow_range(), improving code robustness. Fixes: 6231848 ("xfs: check for cow blocks before trying to clear them") Cc: [email protected] # v4.17 Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Wentao Liang <[email protected]> Signed-off-by: Carlos Maiolino <[email protected]>
1 parent fb95897 commit 26b63be

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

fs/xfs/xfs_inode.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,8 +1404,11 @@ xfs_inactive(
14041404
goto out;
14051405

14061406
/* Try to clean out the cow blocks if there are any. */
1407-
if (xfs_inode_has_cow_data(ip))
1408-
xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, true);
1407+
if (xfs_inode_has_cow_data(ip)) {
1408+
error = xfs_reflink_cancel_cow_range(ip, 0, NULLFILEOFF, true);
1409+
if (error)
1410+
goto out;
1411+
}
14091412

14101413
if (VFS_I(ip)->i_nlink != 0) {
14111414
/*

0 commit comments

Comments
 (0)