git: a11c97bb79e7 - stable/13 - Rate limit kernel UFS/FFS cylinder group check-hash error messages.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sun, 20 Aug 2023 04:28:23 UTC
The branch stable/13 has been updated by mckusick: URL: https://cgit.FreeBSD.org/src/commit/?id=a11c97bb79e7e0d7a175dc69f9c49fd2d52a3d11 commit a11c97bb79e7e0d7a175dc69f9c49fd2d52a3d11 Author: Kirk McKusick <mckusick@FreeBSD.org> AuthorDate: 2023-08-09 00:10:07 +0000 Commit: Kirk McKusick <mckusick@FreeBSD.org> CommitDate: 2023-08-20 04:27:38 +0000 Rate limit kernel UFS/FFS cylinder group check-hash error messages. Sponsored-by: The FreeBSD Foundation (cherry picked from commit 6dff61a1d1878ea5e9f6e5c36521b3f39cd34b33) --- sys/ufs/ffs/ffs_alloc.c | 58 +++++++++++++++++++++++++------------------------ 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/sys/ufs/ffs/ffs_alloc.c b/sys/ufs/ffs/ffs_alloc.c index 44c07bb776b7..35c8662307c6 100644 --- a/sys/ufs/ffs/ffs_alloc.c +++ b/sys/ufs/ffs/ffs_alloc.c @@ -2991,15 +2991,6 @@ ffs_mapsearch(struct fs *fs, return (-1); } -static const struct statfs * -ffs_getmntstat(struct vnode *devvp) -{ - - if (devvp->v_type == VCHR) - return (&devvp->v_rdev->si_mountpt->mnt_stat); - return (ffs_getmntstat(VFSTOUFS(devvp->v_mount)->um_devvp)); -} - /* * Fetch and verify a cylinder group. */ @@ -3013,6 +3004,7 @@ ffs_getcg(struct fs *fs, { struct buf *bp; struct cg *cgp; + struct mount *mp; const struct statfs *sfs; daddr_t blkno; int error; @@ -3021,10 +3013,13 @@ ffs_getcg(struct fs *fs, *cgpp = NULL; if ((fs->fs_metackhash & CK_CYLGRP) != 0) flags |= GB_CKHASH; - if (devvp->v_type == VREG) - blkno = fragstoblks(fs, cgtod(fs, cg)); - else + if (devvp->v_type == VCHR) { blkno = fsbtodb(fs, cgtod(fs, cg)); + mp = devvp->v_rdev->si_mountpt; + } else { + blkno = fragstoblks(fs, cgtod(fs, cg)); + mp = devvp->v_mount; + } error = breadn_flags(devvp, blkno, blkno, (int)fs->fs_cgsize, NULL, NULL, 0, NOCRED, flags, ffs_ckhash_cg, &bp); if (error != 0) @@ -3033,28 +3028,35 @@ ffs_getcg(struct fs *fs, if ((fs->fs_metackhash & CK_CYLGRP) != 0 && (bp->b_flags & B_CKHASH) != 0 && cgp->cg_ckhash != bp->b_ckhash) { - sfs = ffs_getmntstat(devvp); - printf("UFS %s%s (%s) cylinder checksum failed: cg %ju, cgp: " - "0x%x != bp: 0x%jx\n", - devvp->v_type == VCHR ? "" : "snapshot of ", - sfs->f_mntfromname, sfs->f_mntonname, - (intmax_t)cg, cgp->cg_ckhash, (uintmax_t)bp->b_ckhash); + if (ppsratecheck(&VFSTOUFS(mp)->um_last_integritymsg, + &VFSTOUFS(mp)->um_secs_integritymsg, 1)) { + sfs = &mp->mnt_stat; + printf("UFS %s%s (%s) cylinder checkhash failed: " + "cg %ju, cgp: 0x%x != bp: 0x%jx\n", + devvp->v_type == VCHR ? "" : "snapshot of ", + sfs->f_mntfromname, sfs->f_mntonname, (intmax_t)cg, + cgp->cg_ckhash, (uintmax_t)bp->b_ckhash); + } bp->b_flags &= ~B_CKHASH; bp->b_flags |= B_INVAL | B_NOCACHE; brelse(bp); return (EIO); } if (!cg_chkmagic(cgp) || cgp->cg_cgx != cg) { - sfs = ffs_getmntstat(devvp); - printf("UFS %s%s (%s)", - devvp->v_type == VCHR ? "" : "snapshot of ", - sfs->f_mntfromname, sfs->f_mntonname); - if (!cg_chkmagic(cgp)) - printf(" cg %ju: bad magic number 0x%x should be " - "0x%x\n", (intmax_t)cg, cgp->cg_magic, CG_MAGIC); - else - printf(": wrong cylinder group cg %ju != cgx %u\n", - (intmax_t)cg, cgp->cg_cgx); + if (ppsratecheck(&VFSTOUFS(mp)->um_last_integritymsg, + &VFSTOUFS(mp)->um_secs_integritymsg, 1)) { + sfs = &mp->mnt_stat; + printf("UFS %s%s (%s)", + devvp->v_type == VCHR ? "" : "snapshot of ", + sfs->f_mntfromname, sfs->f_mntonname); + if (!cg_chkmagic(cgp)) + printf(" cg %ju: bad magic number 0x%x should " + "be 0x%x\n", (intmax_t)cg, cgp->cg_magic, + CG_MAGIC); + else + printf(": wrong cylinder group cg %ju != " + "cgx %u\n", (intmax_t)cg, cgp->cg_cgx); + } bp->b_flags &= ~B_CKHASH; bp->b_flags |= B_INVAL | B_NOCACHE; brelse(bp);