mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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:
parent
35ce852334
commit
0a1e1567b3
4 changed files with 12 additions and 9 deletions
|
@ -98,7 +98,7 @@ xfs_scrub_xattr_listent(
|
||||||
|
|
||||||
if (flags & XFS_ATTR_INCOMPLETE) {
|
if (flags & XFS_ATTR_INCOMPLETE) {
|
||||||
/* Incomplete attr key, just mark the inode for preening. */
|
/* Incomplete attr key, just mark the inode for preening. */
|
||||||
xfs_scrub_ino_set_preen(sx->sc, NULL);
|
xfs_scrub_ino_set_preen(sx->sc, context->dp->i_ino, NULL);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -165,10 +165,11 @@ xfs_scrub_block_set_preen(
|
||||||
void
|
void
|
||||||
xfs_scrub_ino_set_preen(
|
xfs_scrub_ino_set_preen(
|
||||||
struct xfs_scrub_context *sc,
|
struct xfs_scrub_context *sc,
|
||||||
|
xfs_ino_t ino,
|
||||||
struct xfs_buf *bp)
|
struct xfs_buf *bp)
|
||||||
{
|
{
|
||||||
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_PREEN;
|
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);
|
__return_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,10 +216,11 @@ xfs_scrub_fblock_set_corrupt(
|
||||||
void
|
void
|
||||||
xfs_scrub_ino_set_warning(
|
xfs_scrub_ino_set_warning(
|
||||||
struct xfs_scrub_context *sc,
|
struct xfs_scrub_context *sc,
|
||||||
|
xfs_ino_t ino,
|
||||||
struct xfs_buf *bp)
|
struct xfs_buf *bp)
|
||||||
{
|
{
|
||||||
sc->sm->sm_flags |= XFS_SCRUB_OFLAG_WARNING;
|
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);
|
__return_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,8 @@ bool xfs_scrub_fblock_process_error(struct xfs_scrub_context *sc, int whichfork,
|
||||||
|
|
||||||
void xfs_scrub_block_set_preen(struct xfs_scrub_context *sc,
|
void xfs_scrub_block_set_preen(struct xfs_scrub_context *sc,
|
||||||
struct xfs_buf *bp);
|
struct xfs_buf *bp);
|
||||||
void xfs_scrub_ino_set_preen(struct xfs_scrub_context *sc, struct xfs_buf *bp);
|
void xfs_scrub_ino_set_preen(struct xfs_scrub_context *sc, xfs_ino_t ino,
|
||||||
|
struct xfs_buf *bp);
|
||||||
|
|
||||||
void xfs_scrub_block_set_corrupt(struct xfs_scrub_context *sc,
|
void xfs_scrub_block_set_corrupt(struct xfs_scrub_context *sc,
|
||||||
struct xfs_buf *bp);
|
struct xfs_buf *bp);
|
||||||
|
@ -67,7 +68,7 @@ void xfs_scrub_ino_set_corrupt(struct xfs_scrub_context *sc, xfs_ino_t ino,
|
||||||
void xfs_scrub_fblock_set_corrupt(struct xfs_scrub_context *sc, int whichfork,
|
void xfs_scrub_fblock_set_corrupt(struct xfs_scrub_context *sc, int whichfork,
|
||||||
xfs_fileoff_t offset);
|
xfs_fileoff_t offset);
|
||||||
|
|
||||||
void xfs_scrub_ino_set_warning(struct xfs_scrub_context *sc,
|
void xfs_scrub_ino_set_warning(struct xfs_scrub_context *sc, xfs_ino_t ino,
|
||||||
struct xfs_buf *bp);
|
struct xfs_buf *bp);
|
||||||
void xfs_scrub_fblock_set_warning(struct xfs_scrub_context *sc, int whichfork,
|
void xfs_scrub_fblock_set_warning(struct xfs_scrub_context *sc, int whichfork,
|
||||||
xfs_fileoff_t offset);
|
xfs_fileoff_t offset);
|
||||||
|
|
|
@ -328,7 +328,7 @@ xfs_scrub_dinode(
|
||||||
* We autoconvert v1 inodes into v2 inodes on writeout,
|
* We autoconvert v1 inodes into v2 inodes on writeout,
|
||||||
* so just mark this inode for preening.
|
* so just mark this inode for preening.
|
||||||
*/
|
*/
|
||||||
xfs_scrub_ino_set_preen(sc, bp);
|
xfs_scrub_ino_set_preen(sc, ino, bp);
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
case 3:
|
case 3:
|
||||||
|
@ -353,7 +353,7 @@ xfs_scrub_dinode(
|
||||||
*/
|
*/
|
||||||
if (dip->di_uid == cpu_to_be32(-1U) ||
|
if (dip->di_uid == cpu_to_be32(-1U) ||
|
||||||
dip->di_gid == cpu_to_be32(-1U))
|
dip->di_gid == cpu_to_be32(-1U))
|
||||||
xfs_scrub_ino_set_warning(sc, bp);
|
xfs_scrub_ino_set_warning(sc, ino, bp);
|
||||||
|
|
||||||
/* di_format */
|
/* di_format */
|
||||||
switch (dip->di_format) {
|
switch (dip->di_format) {
|
||||||
|
@ -408,7 +408,7 @@ xfs_scrub_dinode(
|
||||||
* overly large offsets, flag the inode for admin review.
|
* overly large offsets, flag the inode for admin review.
|
||||||
*/
|
*/
|
||||||
if (isize >= mp->m_super->s_maxbytes)
|
if (isize >= mp->m_super->s_maxbytes)
|
||||||
xfs_scrub_ino_set_warning(sc, bp);
|
xfs_scrub_ino_set_warning(sc, ino, bp);
|
||||||
|
|
||||||
/* di_nblocks */
|
/* di_nblocks */
|
||||||
if (flags2 & XFS_DIFLAG2_REFLINK) {
|
if (flags2 & XFS_DIFLAG2_REFLINK) {
|
||||||
|
@ -601,7 +601,7 @@ xfs_scrub_inode(
|
||||||
XFS_INO_TO_AGBNO(mp, ino), &error))
|
XFS_INO_TO_AGBNO(mp, ino), &error))
|
||||||
goto out;
|
goto out;
|
||||||
if (!has_shared)
|
if (!has_shared)
|
||||||
xfs_scrub_ino_set_preen(sc, bp);
|
xfs_scrub_ino_set_preen(sc, ino, bp);
|
||||||
}
|
}
|
||||||
|
|
||||||
out:
|
out:
|
||||||
|
|
Loading…
Add table
Reference in a new issue