Commit 1c12949e authored by Allison Henderson's avatar Allison Henderson Committed by Darrick J. Wong

xfs: Add parent pointers to xfs_cross_rename

Cross renames are handled separately from standard renames, and
need different handling to update the parent attributes correctly.
Signed-off-by: default avatarAllison Henderson <allison.henderson@oracle.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDarrick J. Wong <djwong@kernel.org>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
parent 5a8338c8
...@@ -2972,9 +2972,11 @@ xfs_cross_rename( ...@@ -2972,9 +2972,11 @@ xfs_cross_rename(
struct xfs_inode *dp1, struct xfs_inode *dp1,
struct xfs_name *name1, struct xfs_name *name1,
struct xfs_inode *ip1, struct xfs_inode *ip1,
struct xfs_parent_args *ip1_ppargs,
struct xfs_inode *dp2, struct xfs_inode *dp2,
struct xfs_name *name2, struct xfs_name *name2,
struct xfs_inode *ip2, struct xfs_inode *ip2,
struct xfs_parent_args *ip2_ppargs,
int spaceres) int spaceres)
{ {
int error = 0; int error = 0;
...@@ -3049,6 +3051,21 @@ xfs_cross_rename( ...@@ -3049,6 +3051,21 @@ xfs_cross_rename(
} }
} }
/* Schedule parent pointer replacements */
if (ip1_ppargs) {
error = xfs_parent_replacename(tp, ip1_ppargs, dp1, name1, dp2,
name2, ip1);
if (error)
goto out_trans_abort;
}
if (ip2_ppargs) {
error = xfs_parent_replacename(tp, ip2_ppargs, dp2, name2, dp1,
name1, ip2);
if (error)
goto out_trans_abort;
}
if (ip1_flags) { if (ip1_flags) {
xfs_trans_ichgtime(tp, ip1, ip1_flags); xfs_trans_ichgtime(tp, ip1, ip1_flags);
xfs_trans_log_inode(tp, ip1, XFS_ILOG_CORE); xfs_trans_log_inode(tp, ip1, XFS_ILOG_CORE);
...@@ -3265,10 +3282,10 @@ xfs_rename( ...@@ -3265,10 +3282,10 @@ xfs_rename(
/* RENAME_EXCHANGE is unique from here on. */ /* RENAME_EXCHANGE is unique from here on. */
if (flags & RENAME_EXCHANGE) { if (flags & RENAME_EXCHANGE) {
error = xfs_cross_rename(tp, src_dp, src_name, src_ip, error = xfs_cross_rename(tp, src_dp, src_name, src_ip,
target_dp, target_name, target_ip, src_ppargs, target_dp, target_name, target_ip,
spaceres); tgt_ppargs, spaceres);
xfs_iunlock_rename(inodes, num_inodes); nospace_error = 0;
return error; goto out_unlock;
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment