summaryrefslogtreecommitdiffstats
path: root/sys/geom
diff options
context:
space:
mode:
authorae <ae@FreeBSD.org>2011-05-15 20:03:54 +0000
committerae <ae@FreeBSD.org>2011-05-15 20:03:54 +0000
commit4675dfde1b670b631667c788409a96c597c853f5 (patch)
tree3812d468be092bf609f543b7c1e0584b5436e73b /sys/geom
parentcee2fc65ee973e806f775bd1a2be5e2e06a59106 (diff)
downloadFreeBSD-src-4675dfde1b670b631667c788409a96c597c853f5.zip
FreeBSD-src-4675dfde1b670b631667c788409a96c597c853f5.tar.gz
Add a sysctl kern.geom.part.check_integrity for those who has corrupt
partition tables and lost an ability to boot after r221788. Also unhide an error message from bootverbose, this would help to easier determine the problem.
Diffstat (limited to 'sys/geom')
-rw-r--r--sys/geom/part/g_part.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sys/geom/part/g_part.c b/sys/geom/part/g_part.c
index aa5444e..c9ff9c0 100644
--- a/sys/geom/part/g_part.c
+++ b/sys/geom/part/g_part.c
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
#include <sys/mutex.h>
#include <sys/queue.h>
#include <sys/sbuf.h>
+#include <sys/sysctl.h>
#include <sys/systm.h>
#include <sys/uuid.h>
#include <geom/geom.h>
@@ -104,6 +105,13 @@ struct g_part_alias_list {
{ "netbsd-swap", G_PART_ALIAS_NETBSD_SWAP },
};
+SYSCTL_DECL(_kern_geom);
+SYSCTL_NODE(_kern_geom, OID_AUTO, part, CTLFLAG_RW, 0, "GEOM_PART stuff");
+static u_int check_integrity = 1;
+TUNABLE_INT("kern.geom.part.check_integrity", &check_integrity);
+SYSCTL_UINT(_kern_geom_part, OID_AUTO, check_integrity, CTLFLAG_RW,
+ &check_integrity, 1, "Enable integrity checking");
+
/*
* The GEOM partitioning class.
*/
@@ -267,9 +275,12 @@ g_part_check_integrity(struct g_part_table *table, struct g_consumer *cp)
}
return (0);
fail:
- if (bootverbose)
- printf("GEOM_PART: integrity check failed (%s, %s)\n",
- pp->name, table->gpt_scheme->name);
+ printf("GEOM_PART: integrity check failed (%s, %s)\n", pp->name,
+ table->gpt_scheme->name);
+ if (check_integrity == 0) {
+ table->gpt_corrupt = 1;
+ return (0);
+ }
return (EINVAL);
}
OpenPOWER on IntegriCloud