]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
xfs_repair: update incore metadata state whenever we create new files
authorDarrick J. Wong <djwong@kernel.org>
Wed, 3 Jul 2024 21:21:54 +0000 (14:21 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 30 Jul 2024 00:13:18 +0000 (17:13 -0700)
Make sure that we update our incore metadata inode bookkeepping whenever
we create new metadata files.  There will be many more of these later.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
repair/phase6.c

index c9e816da8cab532ebc679053bee777f9b71164e8..98f3f4d3ce625bb193a38c1453e18f08eb21c0f2 100644 (file)
@@ -474,6 +474,24 @@ reset_sbroot_ino(
        libxfs_inode_init(tp, &args, ip);
 }
 
+/*
+ * Mark a newly allocated inode as metadata in the incore bitmap.  Callers
+ * must have already called mark_ino_inuse to ensure there is an incore record.
+ */
+static void
+mark_ino_metadata(
+       struct xfs_mount        *mp,
+       xfs_ino_t               ino)
+{
+       struct ino_tree_node    *irec;
+       int                     ino_offset;
+
+       irec = find_inode_rec(mp, XFS_INO_TO_AGNO(mp, ino),
+                       XFS_INO_TO_AGINO(mp, ino));
+       ino_offset = get_inode_offset(mp, ino, irec);
+       set_inode_is_meta(irec, ino_offset);
+}
+
 /* Load a realtime freespace metadata inode from disk and reset it. */
 static int
 ensure_rtino(
@@ -873,6 +891,7 @@ mk_metadir(
 
        libxfs_trans_ijoin(tp, mp->m_metadirip, 0);
        libxfs_metafile_set_iflag(tp, mp->m_metadirip);
+       mark_ino_metadata(mp, mp->m_metadirip->i_ino);
 
        error = -libxfs_trans_commit(tp);
        if (error)