xfs: don't release log intent items when recovery fails
authorDarrick J. Wong <darrick.wong@oracle.com>
Mon, 21 Sep 2020 16:15:10 +0000 (09:15 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Wed, 23 Sep 2020 15:58:52 +0000 (08:58 -0700)
Nowadays, log recovery will call ->release on the recovered intent items
if recovery fails.  Therefore, it's redundant to release them from
inside the ->recover functions when they're about to return an error.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/xfs_bmap_item.c
fs/xfs/xfs_extfree_item.c
fs/xfs/xfs_refcount_item.c
fs/xfs/xfs_rmap_item.c

index 2b1cf3ed8172be5dedd889b41a80f3d73820606a..b04ebcd78316e82d87858f0abeb259446ad05e26 100644 (file)
@@ -444,10 +444,8 @@ xfs_bui_item_recover(
        int                             error = 0;
 
        /* Only one mapping operation per BUI... */
-       if (buip->bui_format.bui_nextents != XFS_BUI_MAX_FAST_EXTENTS) {
-               xfs_bui_release(buip);
+       if (buip->bui_format.bui_nextents != XFS_BUI_MAX_FAST_EXTENTS)
                return -EFSCORRUPTED;
-       }
 
        /*
         * First check the validity of the extent described by the
@@ -473,14 +471,8 @@ xfs_bui_item_recover(
            startblock_fsb >= mp->m_sb.sb_dblocks ||
            bmap->me_len >= mp->m_sb.sb_agblocks ||
            inode_fsb >= mp->m_sb.sb_dblocks ||
-           (bmap->me_flags & ~XFS_BMAP_EXTENT_FLAGS)) {
-               /*
-                * This will pull the BUI from the AIL and
-                * free the memory associated with it.
-                */
-               xfs_bui_release(buip);
+           (bmap->me_flags & ~XFS_BMAP_EXTENT_FLAGS))
                return -EFSCORRUPTED;
-       }
 
        error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,
                        XFS_EXTENTADD_SPACE_RES(mp, XFS_DATA_FORK), 0, 0, &tp);
index 6cb8cd11072a3b5d88058234add3012de76d0913..9093d2e7afdfd774f7a0e304b469cb9a51427c7e 100644 (file)
@@ -608,14 +608,8 @@ xfs_efi_item_recover(
                if (startblock_fsb == 0 ||
                    extp->ext_len == 0 ||
                    startblock_fsb >= mp->m_sb.sb_dblocks ||
-                   extp->ext_len >= mp->m_sb.sb_agblocks) {
-                       /*
-                        * This will pull the EFI from the AIL and
-                        * free the memory associated with it.
-                        */
-                       xfs_efi_release(efip);
+                   extp->ext_len >= mp->m_sb.sb_agblocks)
                        return -EFSCORRUPTED;
-               }
        }
 
        error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate, 0, 0, 0, &tp);
index 492d80a0b4060e6e19573a53042dbf8084fab38f..3e34b76623612c3086472aa40b7655193dba0106 100644 (file)
@@ -467,14 +467,8 @@ xfs_cui_item_recover(
                    refc->pe_len == 0 ||
                    startblock_fsb >= mp->m_sb.sb_dblocks ||
                    refc->pe_len >= mp->m_sb.sb_agblocks ||
-                   (refc->pe_flags & ~XFS_REFCOUNT_EXTENT_FLAGS)) {
-                       /*
-                        * This will pull the CUI from the AIL and
-                        * free the memory associated with it.
-                        */
-                       xfs_cui_release(cuip);
+                   (refc->pe_flags & ~XFS_REFCOUNT_EXTENT_FLAGS))
                        return -EFSCORRUPTED;
-               }
        }
 
        /*
index dc5b0753cd51917360796255cda5b9aa29eae9ba..e38ec5d736be5d8959768098913d6d1f2d45c15e 100644 (file)
@@ -511,14 +511,8 @@ xfs_rui_item_recover(
                    rmap->me_len == 0 ||
                    startblock_fsb >= mp->m_sb.sb_dblocks ||
                    rmap->me_len >= mp->m_sb.sb_agblocks ||
-                   (rmap->me_flags & ~XFS_RMAP_EXTENT_FLAGS)) {
-                       /*
-                        * This will pull the RUI from the AIL and
-                        * free the memory associated with it.
-                        */
-                       xfs_rui_release(ruip);
+                   (rmap->me_flags & ~XFS_RMAP_EXTENT_FLAGS))
                        return -EFSCORRUPTED;
-               }
        }
 
        error = xfs_trans_alloc(mp, &M_RES(mp)->tr_itruncate,