From: Christoph Hellwig <hch@lst.de>
To: Andrey Albershteyn <aalbersh@kernel.org>
Cc: "Darrick J . Wong" <djwong@kernel.org>,
Carlos Maiolino <cmaiolino@redhat.com>,
linux-xfs@vger.kernel.org
Subject: [PATCH 4/4] repair: enhance process_dinode_metafile
Date: Mon, 8 Dec 2025 08:11:07 +0100 [thread overview]
Message-ID: <20251208071128.3137486-5-hch@lst.de> (raw)
In-Reply-To: <20251208071128.3137486-1-hch@lst.de>
Explicitly list the destiny of each metafile inode type, and warn about
unexpected types instead of just silently zapping them.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
---
repair/dinode.c | 36 +++++++++++++++++++++++-------------
1 file changed, 23 insertions(+), 13 deletions(-)
diff --git a/repair/dinode.c b/repair/dinode.c
index 61ccbbc25ca9..af4233eb7c38 100644
--- a/repair/dinode.c
+++ b/repair/dinode.c
@@ -2965,7 +2965,8 @@ process_dinode_metafile(
xfs_agnumber_t agno,
xfs_agino_t agino,
xfs_ino_t lino,
- enum xr_ino_type type)
+ enum xr_ino_type type,
+ bool *zap_metadata)
{
struct ino_tree_node *irec = find_inode_rec(mp, agno, agino);
int off = get_inode_offset(mp, lino, irec);
@@ -2973,16 +2974,6 @@ process_dinode_metafile(
set_inode_is_meta(irec, off);
switch (type) {
- case XR_INO_RTBITMAP:
- case XR_INO_RTSUM:
- /*
- * RT bitmap and summary files are always recreated when
- * rtgroups are enabled. For older filesystems, they exist at
- * fixed locations and cannot be zapped.
- */
- if (xfs_has_rtgroups(mp))
- return true;
- return false;
case XR_INO_UQUOTA:
case XR_INO_GQUOTA:
case XR_INO_PQUOTA:
@@ -2991,7 +2982,25 @@ process_dinode_metafile(
* preserve quota inodes and their contents for later.
*/
return false;
+ case XR_INO_DIR:
+ case XR_INO_RTBITMAP:
+ case XR_INO_RTSUM:
+ case XR_INO_RTRMAP:
+ case XR_INO_RTREFC:
+ /*
+ * These are always recreated. Note that for pre-metadir file
+ * systems, the RT bitmap and summary inodes need to be
+ * preserved, but we'll never end up here for them.
+ */
+ *zap_metadata = true;
+ return false;
default:
+ do_warn(_("unexpected %s inode %" PRIu64 " with metadata flag"),
+ xr_ino_type_name[type], lino);
+ if (!no_modify)
+ do_warn(_(" will zap\n"));
+ else
+ do_warn(_(" would zap\n"));
return true;
}
}
@@ -3612,8 +3621,9 @@ _("bad (negative) size %" PRId64 " on inode %" PRIu64 "\n"),
if (dino->di_version >= 3 &&
(dino->di_flags2 & cpu_to_be64(XFS_DIFLAG2_METADATA))) {
is_meta = true;
- if (process_dinode_metafile(mp, agno, ino, lino, type))
- zap_metadata = true;
+ if (process_dinode_metafile(mp, agno, ino, lino, type,
+ &zap_metadata))
+ goto bad_out;
}
/*
--
2.47.3
next prev parent reply other threads:[~2025-12-08 7:11 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-08 7:11 repair tidyups for metadir handling v2 Christoph Hellwig
2025-12-08 7:11 ` [PATCH 1/4] repair: add a enum for the XR_INO_* values Christoph Hellwig
2025-12-08 7:11 ` [PATCH 2/4] repair: add canonical names for the XR_INO_ constants Christoph Hellwig
2025-12-08 17:36 ` Darrick J. Wong
2025-12-09 6:57 ` Christoph Hellwig
2025-12-09 15:59 ` Darrick J. Wong
2025-12-09 16:20 ` Christoph Hellwig
2025-12-09 16:26 ` Darrick J. Wong
2025-12-08 7:11 ` [PATCH 3/4] repair: factor out a process_dinode_metafile helper Christoph Hellwig
2025-12-08 7:11 ` Christoph Hellwig [this message]
-- strict thread matches above, loose matches on Subject: below --
2025-12-10 5:54 repair tidyups for metadir handling v3 Christoph Hellwig
2025-12-10 5:54 ` [PATCH 4/4] repair: enhance process_dinode_metafile Christoph Hellwig
2025-11-28 6:36 repair tidyups for metadir handling Christoph Hellwig
2025-11-28 6:37 ` [PATCH 4/4] repair: enhance process_dinode_metafile Christoph Hellwig
2025-11-28 8:15 ` Carlos Maiolino
2025-12-01 6:23 ` Christoph Hellwig
2025-12-01 9:01 ` Carlos Maiolino
2025-12-01 22:48 ` Darrick J. Wong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251208071128.3137486-5-hch@lst.de \
--to=hch@lst.de \
--cc=aalbersh@kernel.org \
--cc=cmaiolino@redhat.com \
--cc=djwong@kernel.org \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox