From patchwork Tue Sep 16 08:10:13 2008 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 299 Return-Path: X-Original-To: patchwork@ozlabs.org Delivered-To: patchwork@ozlabs.org Received: from bombadil.infradead.org (bombadil.infradead.org [18.85.46.34]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EB406DDF37 for ; Tue, 16 Sep 2008 19:05:04 +1000 (EST) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1KfWUB-0000l5-Mr; Tue, 16 Sep 2008 09:04:39 +0000 Received: from bart.se.axis.com ([195.60.68.10]) by bombadil.infradead.org with esmtp (Exim 4.68 #1 (Red Hat Linux)) id 1KfVda-0004c2-3I for linux-mtd@lists.infradead.org; Tue, 16 Sep 2008 08:10:18 +0000 Received: from bart.se.axis.com (bart.se.axis.com [127.0.0.1]) by bart.se.axis.com (Postfix) with ESMTP id 8B1396407C for ; Tue, 16 Sep 2008 10:10:13 +0200 (CEST) Received: from axis.com (edgar.se.axis.com [10.93.151.1]) by bart.se.axis.com (Postfix) with ESMTP id 750AD63F20 for ; Tue, 16 Sep 2008 10:10:13 +0200 (CEST) Received: (qmail 4125 invoked by uid 400); 16 Sep 2008 08:10:13 -0000 Date: Tue, 16 Sep 2008 10:10:13 +0200 From: "Edgar E. Iglesias" To: linux-mtd@lists.infradead.org Subject: [PATCH] mtdoops at panic Message-ID: <20080916081013.GD29650@edgar.se.axis.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.16 (2007-06-09) X-Spam-Score: 0.0 (/) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.9 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+patchwork=ozlabs.org@lists.infradead.org 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. Signed-off-by: Edgar E. Iglesias diff --git a/drivers/mtd/mtdoops.c b/drivers/mtd/mtdoops.c index 5a680e1..de6d151 100644 --- a/drivers/mtd/mtdoops.c +++ b/drivers/mtd/mtdoops.c @@ -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); }