]> git-server-git.apps.pok.os.sepia.ceph.com Git - xfsprogs-dev.git/commitdiff
mkfs: enable online repair if all backrefs are enabled
authorDarrick J. Wong <djwong@kernel.org>
Sun, 22 Feb 2026 22:41:18 +0000 (14:41 -0800)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 9 Apr 2026 22:30:18 +0000 (15:30 -0700)
If all backreferences are enabled in the filesystem, then enable online
repair by default if the user didn't supply any other autofsck setting.
Users might as well get full self-repair capability if they're paying
for the extra metadata.

Note that it's up to each distro to enable the systemd services
according to their own service activation policies.  Debian policy is to
enable all systemd services at package installation but they don't
enable online fsck in their Kconfig so the services won't activate.
RHEL and SUSE policy requires sysadmins to enable them explicitly unless
the OS vendor also ships a systemd preset file enabling the services.
Distros without systemd won't get any of the systemd services,
obviously.

Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
mkfs/xfs_mkfs.c

index 527a662f3ac8582986b9bdfea87f7cf4509eacd6..f859626afdda3643c514f0037ea4cd18001c5ecb 100644 (file)
@@ -6296,6 +6296,15 @@ main(
        if (mp->m_sb.sb_agcount > 1)
                rewrite_secondary_superblocks(mp);
 
+       /*
+        * If the filesystem has full backreferences and the user didn't
+        * express an autofsck preference, enable online repair because they
+        * might as well get some useful functionality from the extra metadata.
+        */
+       if (cli.autofsck == FSPROP_AUTOFSCK_UNSET &&
+           cli.sb_feat.rmapbt && cli.sb_feat.parent_pointers)
+               cli.autofsck = FSPROP_AUTOFSCK_REPAIR;
+
        if (cli.autofsck != FSPROP_AUTOFSCK_UNSET)
                set_autofsck(mp, &cli);