]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: repair realtime group superblock
authorDarrick J. Wong <djwong@kernel.org>
Mon, 4 Nov 2024 04:19:30 +0000 (20:19 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Tue, 5 Nov 2024 21:38:43 +0000 (13:38 -0800)
Repair the realtime superblock if it has become out of date with the
primary superblock.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
fs/xfs/scrub/repair.h
fs/xfs/scrub/rgsuper.c
fs/xfs/scrub/scrub.c

index 4052185743910da837cf8263b2f25961988ad455..b649da1a93eb8c07e9116f4e65c8d208b4a44d22 100644 (file)
@@ -146,9 +146,11 @@ int xrep_metapath(struct xfs_scrub *sc);
 #ifdef CONFIG_XFS_RT
 int xrep_rtbitmap(struct xfs_scrub *sc);
 int xrep_rtsummary(struct xfs_scrub *sc);
+int xrep_rgsuperblock(struct xfs_scrub *sc);
 #else
 # define xrep_rtbitmap                 xrep_notsupported
 # define xrep_rtsummary                        xrep_notsupported
+# define xrep_rgsuperblock             xrep_notsupported
 #endif /* CONFIG_XFS_RT */
 
 #ifdef CONFIG_XFS_QUOTA
@@ -253,6 +255,7 @@ static inline int xrep_setup_symlink(struct xfs_scrub *sc, unsigned int *x)
 #define xrep_symlink                   xrep_notsupported
 #define xrep_dirtree                   xrep_notsupported
 #define xrep_metapath                  xrep_notsupported
+#define xrep_rgsuperblock              xrep_notsupported
 
 #endif /* CONFIG_XFS_ONLINE_REPAIR */
 
index 00dfe043dfea7f60a72a665d98b7ec018e27fcb2..463b3573bb761b35a2a89100eb5185226080025a 100644 (file)
 #include "xfs_trans_resv.h"
 #include "xfs_mount.h"
 #include "xfs_rtgroup.h"
+#include "xfs_log_format.h"
+#include "xfs_trans.h"
+#include "xfs_sb.h"
 #include "scrub/scrub.h"
 #include "scrub/common.h"
+#include "scrub/repair.h"
 
 /* Set us up with a transaction and an empty context. */
 int
@@ -66,3 +70,15 @@ xchk_rgsuperblock(
        xchk_rgsuperblock_xref(sc);
        return 0;
 }
+
+#ifdef CONFIG_XFS_ONLINE_REPAIR
+int
+xrep_rgsuperblock(
+       struct xfs_scrub        *sc)
+{
+       ASSERT(rtg_rgno(sc->sr.rtg) == 0);
+
+       xfs_log_sb(sc->tp);
+       return 0;
+}
+#endif /* CONFIG_XFS_ONLINE_REPAIR */
index ceb22c722d8f52012149486da4f07a31f5ad7d94..950f5a58dcd967bc94023d736ecf0a6e83bc00b3 100644 (file)
@@ -456,7 +456,7 @@ static const struct xchk_meta_ops meta_scrub_ops[] = {
                .setup  = xchk_setup_rgsuperblock,
                .scrub  = xchk_rgsuperblock,
                .has    = xfs_has_rtsb,
-               .repair = xrep_notsupported,
+               .repair = xrep_rgsuperblock,
        },
 };