xfs: pass inode number to xfs_scrub_ino_set_{preen,warning}

There are two ways to scrub an inode -- calling xfs_iget and checking
the raw inode core, or by loading the inode cluster buffer and checking
the on-disk contents directly.  The second method is only useful if
_iget fails the verifiers; when this is the case, sc->ip is NULL and
calling the tracepoint will cause a system crash.

Therefore, pass the raw inode number directly into the _preen and
_warning functions.

Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
Darrick J. Wong
2017-11-06 11:46:15 -08:00
parent 35ce852334
commit 0a1e1567b3
4 changed files with 12 additions and 9 deletions

View File

@@ -165,10 +165,11 @@ xfs_scrub_block_set_preen(
void
xfs_scrub_ino_set_preen(
struct xfs_scrub_context *sc,
xfs_ino_t ino,
struct xfs_buf *bp)
{
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN;
trace_xfs_scrub_ino_preen(sc, sc->ip->i_ino, bp ? bp->b_bn : 0,
trace_xfs_scrub_ino_preen(sc, ino, bp ? bp->b_bn : 0,
__return_address);
}
@@ -215,10 +216,11 @@ xfs_scrub_fblock_set_corrupt(
void
xfs_scrub_ino_set_warning(
struct xfs_scrub_context *sc,
xfs_ino_t ino,
struct xfs_buf *bp)
{
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING;
trace_xfs_scrub_ino_warning(sc, sc->ip->i_ino, bp ? bp->b_bn : 0,
trace_xfs_scrub_ino_warning(sc, ino, bp ? bp->b_bn : 0,
__return_address);
}