[patch] allow crash dumps to Linux swap partitions

Andrey V. Elsukov ae at FreeBSD.org
Sat Feb 18 17:50:19 UTC 2012


On 17.02.2012 22:57, Don Lewis wrote:
>> MBR scheme also allows dumping only to the same partition types.
>> But ad0s4 partition has type DOSPTYP_EXT. And you got this error message.
> 
> Is it possible to detect whether a request has been forwarded?  I think
> there is also the possibility of foot shooting in the DOSPTYP_386BSD
> case and it would be nice to fix that as well.

Hi,

I think we can check bp->bio_from field, something like that (not tested):

-- 
WBR, Andrey V. Elsukov
-------------- next part --------------
Index: head/sys/geom/part/g_part.c
===================================================================
--- head/sys/geom/part/g_part.c	(revision 231895)
+++ head/sys/geom/part/g_part.c	(working copy)
@@ -2113,9 +2193,14 @@ g_part_start(struct bio *bp)
 			/*
 			 * Check that the partition is suitable for kernel
 			 * dumps. Typically only swap partitions should be
-			 * used.
+			 * used. If request goes from the nested scheme we
+			 * allow dumping, because nested scheme allowed that.
 			 */
-			if (!G_PART_DUMPTO(table, entry)) {
+			if (table->gpt_depth == 0 &&
+			    bp->bio_from != NULL &&
+			    bp->bio_from->geom->class != &g_part_class) {
+				/* FALLTHROUGH */
+			} else if (G_PART_DUMPTO(table, entry) == 0) {
 				g_io_deliver(bp, ENODEV);
 				printf("GEOM_PART: Partition '%s' not suitable"
 				    " for kernel dumps (wrong type?)\n",


More information about the freebsd-arch mailing list