From patchwork Thu May 28 15:43:59 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joakim Tjernlund X-Patchwork-Id: 27797 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.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 bilbo.ozlabs.org (Postfix) with ESMTPS id EFAC8B7084 for ; Fri, 29 May 2009 01:46:24 +1000 (EST) Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.69 #1 (Red Hat Linux)) id 1M9hm9-0005pd-8m; Thu, 28 May 2009 15:44:13 +0000 Received: from gw1.transmode.se ([213.115.205.20]) by bombadil.infradead.org with esmtps (Exim 4.69 #1 (Red Hat Linux)) id 1M9hlz-0005i5-FV for linux-mtd@lists.infradead.org; Thu, 28 May 2009 15:44:10 +0000 Received: from tmnt04.transmode.se (tmnt04.transmode.se [192.168.46.15]) by gw1.transmode.se (Postfix) with ESMTP id 4C86A65000B for ; Thu, 28 May 2009 17:43:59 +0200 (CEST) Received: from gentoo-jocke.transmode.se ([192.168.1.15]) by tmnt04.transmode.se over TLS secured channel with Microsoft SMTPSVC(5.0.2195.6713); Thu, 28 May 2009 17:44:00 +0200 Received: from gentoo-jocke.transmode.se (localhost.localdomain [127.0.0.1]) by gentoo-jocke.transmode.se (8.14.0/8.14.0) with ESMTP id n4SFi0q2032544; Thu, 28 May 2009 17:44:00 +0200 Received: (from jocke@localhost) by gentoo-jocke.transmode.se (8.14.0/8.14.0/Submit) id n4SFi0B5032543; Thu, 28 May 2009 17:44:00 +0200 From: Joakim Tjernlund To: linux-mtd@lists.infradead.org Subject: [PATCH] [JFFS2] Fix corruption when flash erase/write failure Date: Thu, 28 May 2009 17:43:59 +0200 Message-Id: <1243525439-32485-1-git-send-email-Joakim.Tjernlund@transmode.se> X-Mailer: git-send-email 1.6.2.3 X-OriginalArrivalTime: 28 May 2009 15:44:00.0257 (UTC) FILETIME=[1E99D710:01C9DFAB] X-Spam-Score: 0.0 (/) Cc: Joakim Tjernlund X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-mtd-bounces@lists.infradead.org Errors-To: linux-mtd-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Erase errors such as: "Newly-erased block contained word 0xa4ef223e at offset 0x0296a014" and failure to write the clean marker, moves the offending erase block to erasing list before calling jffs2_erase_failed(). This is bad as jffs2_erase_failed() will also move the block to the bad_list, but is now moving the wrong block, causing FS corruption. Signed-off-by: Joakim Tjernlund --- fs/jffs2/erase.c | 7 ------- 1 files changed, 0 insertions(+), 7 deletions(-) diff --git a/fs/jffs2/erase.c b/fs/jffs2/erase.c index 51024ac..b082655 100644 --- a/fs/jffs2/erase.c +++ b/fs/jffs2/erase.c @@ -488,13 +488,6 @@ static void jffs2_mark_erased_block(struct jffs2_sb_info *c, struct jffs2_eraseb return; filebad: - mutex_lock(&c->erase_free_sem); - spin_lock(&c->erase_completion_lock); - /* Stick it on a list (any list) so erase_failed can take it - right off again. Silly, but shouldn't happen often. */ - list_move(&jeb->list, &c->erasing_list); - spin_unlock(&c->erase_completion_lock); - mutex_unlock(&c->erase_free_sem); jffs2_erase_failed(c, jeb, bad_offset); return;