summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_ffs/setup.c
diff options
context:
space:
mode:
authordelphij <delphij@FreeBSD.org>2005-03-07 08:42:49 +0000
committerdelphij <delphij@FreeBSD.org>2005-03-07 08:42:49 +0000
commit50d65e6e8dfe7acfb233acf00aae3c86ad106694 (patch)
tree4a55cc21d650dd93da6eb7cdf52fd17aa3778ba7 /sbin/fsck_ffs/setup.c
parentd3c3434c1cc5d8a3a7efde19b203447a56837ea0 (diff)
downloadFreeBSD-src-50d65e6e8dfe7acfb233acf00aae3c86ad106694.zip
FreeBSD-src-50d65e6e8dfe7acfb233acf00aae3c86ad106694.tar.gz
Make background fsck based summary adjustments actually work by
initializing the sysctl mibs data before actually using them. The original patchset (which is the actual version that is running on my testboxes) have checked whether all of these sysctls and refuses to do background fsck if we don't have them. Kirk has pointed out that refusing running fsck on old kernels is pointless, as old kernels will recompute the summary at mount time, so I have removed these checks. Unfortunatelly, as the checks will initialize the mib values of those sysctl's, and which are vital for the runtime summary adjustment to work, we can not simply remove the check, which will lead to problem when running background fsck over a dirty volume. Add these checks in a different way: give a warning rather than refusing to work, and complain if the functionality is not available when adjustments are necessary. Noticed by: A power failure at my lab Pointy hat: me MFC After: 3 days
Diffstat (limited to 'sbin/fsck_ffs/setup.c')
-rw-r--r--sbin/fsck_ffs/setup.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index e95a6ad..f6b736d 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -140,6 +140,24 @@ setup(char *dev)
pfatal("kernel lacks background fsck support\n");
exit(EEXIT);
}
+ /*
+ * When kernel is lack of runtime bgfsck superblock summary
+ * adjustment functionality, it does not mean we can not
+ * continue, as old kernels will recompute the summary at
+ * mount time. However, it will be an unexpected softupdates
+ * inconsistency if it turns out that the summary is still
+ * incorrect. Set a flag so subsequent operation can know
+ * this.
+ */
+ bkgrdsumadj = 1;
+ if (sysctlnametomib("vfs.ffs.adjndir", adjndir, &size) < 0 ||
+ sysctlnametomib("vfs.ffs.adjnbfree", adjnbfree, &size) < 0 ||
+ sysctlnametomib("vfs.ffs.adjnifree", adjnifree, &size) < 0 ||
+ sysctlnametomib("vfs.ffs.adjnffree", adjnffree, &size) < 0 ||
+ sysctlnametomib("vfs.ffs.adjnumclusters", adjnumclusters, &size) < 0) {
+ bkgrdsumadj = 0;
+ pwarn("kernel lacks runtime superblock summary adjustment support");
+ }
cmd.version = FFS_CMD_VERSION;
cmd.handle = fsreadfd;
fswritefd = -1;
OpenPOWER on IntegriCloud