Message ID | 166473480888.1083927.912685328486215875.stgit@magnolia (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | xfs: strengthen file mapping scrub | expand |
On Sun, Oct 02, 2022 at 11:20:08AM -0700, Darrick J. Wong wrote: > From: Darrick J. Wong <djwong@kernel.org> > > sparse complains that we can return an uninitialized error from this > function and that pag could be uninitialized. We know that there are no > zero-AG filesystems and hence we had to call xchk_bmap_check_ag_rmaps at > least once, so this is not actually possible, but I'm too worn out from > automated complaints from unsophisticated AIs so let's just fix this and > move on to more interesting problems, eh? > > Signed-off-by: Darrick J. Wong <djwong@kernel.org> > --- > fs/xfs/scrub/bmap.c | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) Looks fine. Reviewed-by: Dave Chinner <dchinner@redhat.com>
diff --git a/fs/xfs/scrub/bmap.c b/fs/xfs/scrub/bmap.c index 576c02cc8b8f..63e43fd8af5d 100644 --- a/fs/xfs/scrub/bmap.c +++ b/fs/xfs/scrub/bmap.c @@ -602,14 +602,14 @@ xchk_bmap_check_rmaps( for_each_perag(sc->mp, agno, pag) { error = xchk_bmap_check_ag_rmaps(sc, whichfork, pag); - if (error) - break; - if (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT) - break; + if (error || + (sc->sm->sm_flags & XFS_SCRUB_OFLAG_CORRUPT)) { + xfs_perag_put(pag); + return error; + } } - if (pag) - xfs_perag_put(pag); - return error; + + return 0; } /*