aboutsummaryrefslogtreecommitdiffstats
path: root/fs/xfs/xfs_rename.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/xfs/xfs_rename.c')
-rw-r--r--fs/xfs/xfs_rename.c26
1 files changed, 7 insertions, 19 deletions
diff --git a/fs/xfs/xfs_rename.c b/fs/xfs/xfs_rename.c
index 8edb1074847a..778c87a8ebfc 100644
--- a/fs/xfs/xfs_rename.c
+++ b/fs/xfs/xfs_rename.c
@@ -169,26 +169,14 @@ xfs_rename(
169 /* 169 /*
170 * Join all the inodes to the transaction. From this point on, 170 * Join all the inodes to the transaction. From this point on,
171 * we can rely on either trans_commit or trans_cancel to unlock 171 * we can rely on either trans_commit or trans_cancel to unlock
172 * them. Note that we need to add a vnode reference to the 172 * them.
173 * directories since trans_commit & trans_cancel will decrement
174 * them when they unlock the inodes. Also, we need to be careful
175 * not to add an inode to the transaction more than once.
176 */ 173 */
177 IHOLD(src_dp); 174 xfs_trans_ijoin_ref(tp, src_dp, XFS_ILOCK_EXCL);
178 xfs_trans_ijoin(tp, src_dp, XFS_ILOCK_EXCL); 175 if (new_parent)
179 176 xfs_trans_ijoin_ref(tp, target_dp, XFS_ILOCK_EXCL);
180 if (new_parent) { 177 xfs_trans_ijoin_ref(tp, src_ip, XFS_ILOCK_EXCL);
181 IHOLD(target_dp); 178 if (target_ip)
182 xfs_trans_ijoin(tp, target_dp, XFS_ILOCK_EXCL); 179 xfs_trans_ijoin_ref(tp, target_ip, XFS_ILOCK_EXCL);
183 }
184
185 IHOLD(src_ip);
186 xfs_trans_ijoin(tp, src_ip, XFS_ILOCK_EXCL);
187
188 if (target_ip) {
189 IHOLD(target_ip);
190 xfs_trans_ijoin(tp, target_ip, XFS_ILOCK_EXCL);
191 }
192 180
193 /* 181 /*
194 * If we are using project inheritance, we only allow renames 182 * If we are using project inheritance, we only allow renames