Commit 82dab941a192d081dd0b7cde3ed32603372d5acc

Authored by Christoph Hellwig
Committed by Lachlan McIlroy
1 parent 1ac74e01df

[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: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Lachlan McIlroy <lachlan@sgi.com>

Showing 1 changed file with 6 additions and 19 deletions Side-by-side Diff

fs/xfs/xfs_vnodeops.c
... ... @@ -2180,7 +2180,7 @@
2180 2180 xfs_itrace_ref(ip);
2181 2181  
2182 2182 error = XFS_QM_DQATTACH(mp, dp, 0);
2183   - if (!error && dp != ip)
  2183 + if (!error)
2184 2184 error = XFS_QM_DQATTACH(mp, ip, 0);
2185 2185 if (error) {
2186 2186 REMOVE_DEBUG_TRACE(__LINE__);
2187 2187  
... ... @@ -2228,16 +2228,10 @@
2228 2228 * inodes locked.
2229 2229 */
2230 2230 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
2231   - if (dp != ip) {
2232   - /*
2233   - * Increment vnode ref count only in this case since
2234   - * there's an extra vnode reference in the case where
2235   - * dp == ip.
2236   - */
2237   - IHOLD(dp);
2238   - xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
2239   - }
2240 2231  
  2232 + IHOLD(dp);
  2233 + xfs_trans_ijoin(tp, ip, XFS_ILOCK_EXCL);
  2234 +
2241 2235 /*
2242 2236 * Entry must exist since we did a lookup in xfs_lock_dir_and_entry.
2243 2237 */
... ... @@ -2747,7 +2741,7 @@
2747 2741 * Get the dquots for the inodes.
2748 2742 */
2749 2743 error = XFS_QM_DQATTACH(mp, dp, 0);
2750   - if (!error && dp != cdp)
  2744 + if (!error)
2751 2745 error = XFS_QM_DQATTACH(mp, cdp, 0);
2752 2746 if (error) {
2753 2747 IRELE(cdp);
... ... @@ -2796,14 +2790,7 @@
2796 2790 }
2797 2791  
2798 2792 xfs_trans_ijoin(tp, dp, XFS_ILOCK_EXCL);
2799   - if (dp != cdp) {
2800   - /*
2801   - * Only increment the parent directory vnode count if
2802   - * we didn't bump it in looking up cdp. The only time
2803   - * we don't bump it is when we're looking up ".".
2804   - */
2805   - VN_HOLD(dir_vp);
2806   - }
  2793 + VN_HOLD(dir_vp);
2807 2794  
2808 2795 xfs_itrace_ref(cdp);
2809 2796 xfs_trans_ijoin(tp, cdp, XFS_ILOCK_EXCL);