From: Darrick J. Wong Date: Thu, 21 Nov 2024 00:24:36 +0000 (-0800) Subject: xfs_repair: repair rtbitmap and rtsummary block headers X-Git-Tag: v6.13.0~57 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5ef84567a5f9377d7a53346029b3f6e5878b58a1;p=thirdparty%2Fxfsprogs-dev.git xfs_repair: repair rtbitmap and rtsummary block headers Check and repair the new block headers attached to rtbitmap and rtsummary blocks. Signed-off-by: "Darrick J. Wong" Reviewed-by: Christoph Hellwig --- diff --git a/repair/rt.c b/repair/rt.c index 102baa1d..5ba04919 100644 --- a/repair/rt.c +++ b/repair/rt.c @@ -237,6 +237,7 @@ check_rtfile_contents( while (bno < filelen) { struct xfs_bmbt_irec map; struct xfs_buf *bp; + unsigned int offset = 0; int nmap = 1; error = -libxfs_bmapi_read(ip, bno, 1, &map, &nmap, 0); @@ -262,7 +263,19 @@ check_rtfile_contents( break; } - check_rtwords(rtg, filename, bno, bp->b_addr, buf); + if (xfs_has_rtgroups(mp)) { + struct xfs_rtbuf_blkinfo *hdr = bp->b_addr; + + if (hdr->rt_owner != cpu_to_be64(ip->i_ino)) { + do_warn( + _("corrupt owner in %s at dblock 0x%llx\n"), + filename, (unsigned long long)bno); + } + + offset = sizeof(*hdr); + } + + check_rtwords(rtg, filename, bno, bp->b_addr + offset, buf); buf += mp->m_blockwsize << XFS_WORDLOG; bno++;