Author: ae
Date: Sun May 15 20:03:54 2011
New Revision: 221972
URL: http://svn.freebsd.org/changeset/base/221972

Log:
  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.

Modified:
  head/sys/geom/part/g_part.c

Modified: head/sys/geom/part/g_part.c
==============================================================================
--- head/sys/geom/part/g_part.c Sun May 15 19:04:08 2011        (r221971)
+++ head/sys/geom/part/g_part.c Sun May 15 20:03:54 2011        (r221972)
@@ -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_tab
        }
        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);
 }
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to