Skip to contentSkip to conversation

xfs: fix incorrect error-out in xfs_remove

PATCH In review Darrick J. Wong 2 participants 2 messages Nov 8, 2022 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: fix incorrect error-out in xfs_remove

From: Darrick J. Wong <[email protected]>

Clean up resources if resetting the dotdot entry doesn't succeed. Observed through code inspection.

Fixes 5838d0356bb3 ("xfs: reset child dir '..' entry when unlinking child")
---
 fs/xfs/xfs_inode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_inode.c +1 -1
index aa303be11576..d354ea2b74f9 100644
@@ -2479,7 +2479,7 @@ xfs_remove(
 			error = xfs_dir_replace(tp, ip, &xfs_name_dotdot,
 					tp->t_mountp->m_sb.sb_rootino, 0);
 			if (error)
-				return error;
+				goto out_trans_cancel;
 		}
 	} else {
 		/*
Reviewed-by on v1 1/1
#1 lore raw
Quoted 17 lines · Darrick J. Wong

From: Darrick J. Wong <[email protected]>

Clean up resources if resetting the dotdot entry doesn't succeed. Observed through code inspection.

Fixes 5838d0356bb3 ("xfs: reset child dir '..' entry when unlinking child")
---
 fs/xfs/xfs_inode.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_inode.c +0 -0
index aa303be11576..d354ea2b74f9 100644

fs/xfs/xfs_inode.c xfs_remove( · line 2485

Quoted 8 lines
fs/xfs/xfs_inode.c +1 -1
@@ -2479,7 +2479,7 @@ xfs_remove(
 			error = xfs_dir_replace(tp, ip, &xfs_name_dotdot,
 					tp->t_mountp->m_sb.sb_rootino, 0);
 			if (error)
-				return error;
+				goto out_trans_cancel;
 		}
 	} else {
 		/*

Looks good to me.

Signature · 1 line
- Andrey