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>
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);