Skip to contentSkip to conversation

mtdoops at panic

PATCH New Edgar E. Iglesias 1 participant 1 message Sep 16, 2008 Memory technology devices (MTD)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mtdoops at panic

Hello,

While trying out the mtdoops module I ran into trouble when logging at panic. Turns out that the mtdoops_inc_counter can sleep while preparing for the next entry.

This small patch works fine for me.

drivers/mtd/mtdoops.c +6 -1
index 5a680e1..de6d151 100644
@@ -208,7 +208,12 @@ static void mtdoops_write(struct mtdoops_context *cxt, int panic)
 		printk(KERN_ERR "mtdoops: Write failure at %d (%td of %d written), err %d.\n",
 			cxt->nextpage * OOPS_PAGE_SIZE, retlen,	OOPS_PAGE_SIZE, ret);
 
-	mtdoops_inc_counter(cxt);
+	/*
+	 * Prepare for next log-entry. If we are in panic we'll defer this
+	 * step to after reboot because mtdoops_inc_counter might sleep.
+	 */
+	if (!panic)
+		mtdoops_inc_counter(cxt);
 }