From patchwork Mon Feb 7 16:58:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 82118 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 ozlabs.org (Postfix) with ESMTPS id 67E59B7043 for ; Tue, 8 Feb 2011 04:03:48 +1100 (EST) Received: from canuck.infradead.org ([2001:4978:20e::1]) by bombadil.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1PmUSY-0002Ec-HW; Mon, 07 Feb 2011 17:01:06 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.72 #1 (Red Hat Linux)) id 1PmUSW-0001qq-Ue; Mon, 07 Feb 2011 17:01:04 +0000 Received: from mail-ew0-f49.google.com ([209.85.215.49]) by canuck.infradead.org with esmtps (Exim 4.72 #1 (Red Hat Linux)) id 1PmUSU-0001qH-1l for linux-mtd@lists.infradead.org; Mon, 07 Feb 2011 17:01:02 +0000 Received: by ewy20 with SMTP id 20so2239487ewy.36 for ; Mon, 07 Feb 2011 09:01:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:subject:from:reply-to:to:cc:in-reply-to :references:content-type:date:message-id:mime-version:x-mailer :content-transfer-encoding; bh=BKBxapf/+bZo4cKlRB/BSc9RD5yw323rMPZ/6hQy9+Q=; b=aZSGvn8qDncPrYuKA5b65vWSs23rH+926UsE+hrA+W0zs2NucTzEsWSQ8wCYKhkzWm CuIlFOHWIpCth3jNDhQZAd33WPRp5ZKqzg6IKIXH76AXYWH76q4EN7E5MRoI44+Ltb+I y+zWTfFOBeYFTXEuSYtb5eUjh9I9Eak5y11wE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=subject:from:reply-to:to:cc:in-reply-to:references:content-type :date:message-id:mime-version:x-mailer:content-transfer-encoding; b=lNUyYdLbqLbZvH8yCg9RcCj1KSy8tA/fQffw+MhDUCO+rqMsMR7B60Q38xwqrb5gPB JZGM7EQtFmrnOAbP7ZRymLR+lzp7aJA0agx/coyiv+VHJvR4C6d/Xn/XY+xkWxW4cJc8 Ysux38VYu8L+yju3LoFtwRW9EV2B0/rfSMl0A= Received: by 10.213.35.68 with SMTP id o4mr11506221ebd.33.1297097995087; Mon, 07 Feb 2011 08:59:55 -0800 (PST) Received: from ?IPv6:::1? (shutemov.name [188.40.19.243]) by mx.google.com with ESMTPS id b52sm3268305eei.1.2011.02.07.08.59.52 (version=SSLv3 cipher=RC4-MD5); Mon, 07 Feb 2011 08:59:53 -0800 (PST) Subject: Re: [PATCH v2 0/5] UBIFS: fix recovery on CFI NOR From: Artem Bityutskiy To: Anatolij Gustschin In-Reply-To: <20110207172523.11294ec5@wker> References: <1296998270-19853-1-git-send-email-dedekind1@gmail.com> <20110207172523.11294ec5@wker> Date: Mon, 07 Feb 2011 18:58:59 +0200 Message-ID: <1297097939.5938.26.camel@localhost> Mime-Version: 1.0 X-Mailer: Evolution 2.32.1 (2.32.1-1.fc14) X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110207_120102_239567_14EDBDD2 X-CRM114-Status: GOOD ( 16.85 ) X-Spam-Score: 1.4 (+) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (1.4 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.215.49 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is freemail (dedekind1[at]gmail.com) 2.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (dedekind1[at]gmail.com) -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Holger Brunck , "linux-mtd@lists.infradead.org" , Detlev Zundel , Norbert van Bolhuis , Adrian Hunter X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: dedekind1@gmail.com 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+incoming=patchwork.ozlabs.org@lists.infradead.org On Mon, 2011-02-07 at 17:25 +0100, Anatolij Gustschin wrote: > I dropped the lines containing ffffffff in the dump above (verified > that these were all ffffffff). > > The UBIFS data node before the dumped area seems to be okay > and contains "ABC123ABC123ABC123..." data block. > > The corrupted area seems to contain data from an interrupted > write operation. It looks like I missed the no_more_nodes() function. I think this should fix the issue you have found. If you still have the flash which ubifs refuses to mount, you can apply this patch, and ubifs should mount that media. diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c index 4278ae7..65e4664 100644 --- a/fs/ubifs/recovery.c +++ b/fs/ubifs/recovery.c @@ -430,7 +430,7 @@ static int no_more_nodes(const struct ubifs_info *c, void *buf, int len, int skip, dlen = le32_to_cpu(ch->len); /* Check for empty space after the corrupt node's common header */ - skip = ALIGN(offs + UBIFS_CH_SZ, c->min_io_size) - offs; + skip = ALIGN(offs + UBIFS_CH_SZ, c->max_write_size) - offs; if (is_empty(buf + skip, len - skip)) return 1; /* @@ -442,7 +442,7 @@ static int no_more_nodes(const struct ubifs_info *c, void *buf, int len, return 0; } /* Now we know the corrupt node's length we can skip over it */ - skip = ALIGN(offs + dlen, c->min_io_size) - offs; + skip = ALIGN(offs + dlen, c->max_write_size) - offs; /* After which there should be empty space */ if (is_empty(buf + skip, len - skip)) return 1;