Commit d59f44d3 authored by Darrick J. Wong's avatar Darrick J. Wong

xfs: directory bestfree check should release buffers

When we're checking bestfree information in directory blocks, always
drop the block buffer at the end of the function.  We should always
release resources when we're done using them.
Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent afbabf56
...@@ -503,7 +503,7 @@ xchk_directory_leaf1_bestfree( ...@@ -503,7 +503,7 @@ xchk_directory_leaf1_bestfree(
/* Read the free space block. */ /* Read the free space block. */
error = xfs_dir3_leaf_read(sc->tp, sc->ip, lblk, &bp); error = xfs_dir3_leaf_read(sc->tp, sc->ip, lblk, &bp);
if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, lblk, &error)) if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, lblk, &error))
goto out; return error;
xchk_buffer_recheck(sc, bp); xchk_buffer_recheck(sc, bp);
leaf = bp->b_addr; leaf = bp->b_addr;
...@@ -568,9 +568,10 @@ xchk_directory_leaf1_bestfree( ...@@ -568,9 +568,10 @@ xchk_directory_leaf1_bestfree(
xchk_directory_check_freesp(sc, lblk, dbp, best); xchk_directory_check_freesp(sc, lblk, dbp, best);
xfs_trans_brelse(sc->tp, dbp); xfs_trans_brelse(sc->tp, dbp);
if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)
goto out; break;
} }
out: out:
xfs_trans_brelse(sc->tp, bp);
return error; return error;
} }
...@@ -592,7 +593,7 @@ xchk_directory_free_bestfree( ...@@ -592,7 +593,7 @@ xchk_directory_free_bestfree(
/* Read the free space block */ /* Read the free space block */
error = xfs_dir2_free_read(sc->tp, sc->ip, lblk, &bp); error = xfs_dir2_free_read(sc->tp, sc->ip, lblk, &bp);
if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, lblk, &error)) if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, lblk, &error))
goto out; return error;
xchk_buffer_recheck(sc, bp); xchk_buffer_recheck(sc, bp);
if (xfs_sb_version_hascrc(&sc->mp->m_sb)) { if (xfs_sb_version_hascrc(&sc->mp->m_sb)) {
...@@ -615,7 +616,7 @@ xchk_directory_free_bestfree( ...@@ -615,7 +616,7 @@ xchk_directory_free_bestfree(
0, &dbp); 0, &dbp);
if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, lblk, if (!xchk_fblock_process_error(sc, XFS_DATA_FORK, lblk,
&error)) &error))
break; goto out;
xchk_directory_check_freesp(sc, lblk, dbp, best); xchk_directory_check_freesp(sc, lblk, dbp, best);
xfs_trans_brelse(sc->tp, dbp); xfs_trans_brelse(sc->tp, dbp);
} }
...@@ -623,6 +624,7 @@ xchk_directory_free_bestfree( ...@@ -623,6 +624,7 @@ xchk_directory_free_bestfree(
if (freehdr.nused + stale != freehdr.nvalid) if (freehdr.nused + stale != freehdr.nvalid)
xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk); xchk_fblock_set_corrupt(sc, XFS_DATA_FORK, lblk);
out: out:
xfs_trans_brelse(sc->tp, bp);
return error; return error;
} }
......
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