Commit 82dab941 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Lachlan McIlroy

[XFS] kill parent == child checks in xfs_remove and xfs_rmdir

VFS guaranteed these can't happen.

SGI-PV: 976035
SGI-Modid: xfs-linux-melb:xfs-kern:30911a
Signed-off-by: default avatarChristoph Hellwig <hch@infradead.org>
Signed-off-by: default avatarLachlan McIlroy <lachlan@sgi.com>
parent 1ac74e01
...@@ -2180,7 +2180,7 @@ xfs_remove( ...@@ -2180,7 +2180,7 @@ xfs_remove(
xfs_itrace_ref(ip); xfs_itrace_ref(ip);
error = XFS_QM_DQATTACH(mp, dp, 0); error = XFS_QM_DQATTACH(mp, dp, 0);
if (!error && dp != ip) if (!error)
error = XFS_QM_DQATTACH(mp, ip, 0); error = XFS_QM_DQATTACH(mp, ip, 0);
if (error) { if (error) {
REMOVE_DEBUG_TRACE(__LINE__); REMOVE_DEBUG_TRACE(__LINE__);
...@@ -2228,15 +2228,9 @@ xfs_remove( ...@@ -2228,15 +2228,9 @@ xfs_remove(
* inodes locked. * inodes locked.
*/ */
xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
if (dp != ip) {
/* IHOLD(dp);
* Increment vnode ref count only in this case since xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
* there's an extra vnode reference in the case where
* dp == ip.
*/
IHOLD(dp);
xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
}
/* /*
* Entry must exist since we did a lookup in xfs_lock_dir_and_entry. * Entry must exist since we did a lookup in xfs_lock_dir_and_entry.
...@@ -2747,7 +2741,7 @@ xfs_rmdir( ...@@ -2747,7 +2741,7 @@ xfs_rmdir(
* Get the dquots for the inodes. * Get the dquots for the inodes.
*/ */
error = XFS_QM_DQATTACH(mp, dp, 0); error = XFS_QM_DQATTACH(mp, dp, 0);
if (!error && dp != cdp) if (!error)
error = XFS_QM_DQATTACH(mp, cdp, 0); error = XFS_QM_DQATTACH(mp, cdp, 0);
if (error) { if (error) {
IRELE(cdp); IRELE(cdp);
...@@ -2796,14 +2790,7 @@ xfs_rmdir( ...@@ -2796,14 +2790,7 @@ xfs_rmdir(
} }
xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
if (dp != cdp) { VN_HOLD(dir_vp);
/*
* Only increment the parent directory vnode count if
* we didn't bump it in looking up cdp. The only time
* we don't bump it is when we're looking up ".".
*/
VN_HOLD(dir_vp);
}
xfs_itrace_ref(cdp); xfs_itrace_ref(cdp);
xfs_trans_ijoin(tp, cdp, XFS_ILOCK_EXCL); xfs_trans_ijoin(tp, cdp, XFS_ILOCK_EXCL);
......
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