From patchwork Mon Jan 16 10:24:35 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Artem Bityutskiy X-Patchwork-Id: 136267 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:4978:20e::2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BFED7B6F65 for ; Mon, 16 Jan 2012 21:24:27 +1100 (EST) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1Rmjin-0006J0-IX; Mon, 16 Jan 2012 10:23:25 +0000 Received: from mail-iy0-f177.google.com ([209.85.210.177]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1RmjiG-0006CQ-RJ for linux-mtd@lists.infradead.org; Mon, 16 Jan 2012 10:22:54 +0000 Received: by iakl21 with SMTP id l21so10146322iak.36 for ; Mon, 16 Jan 2012 02:22:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=message-id:subject:from:reply-to:to:cc:date:in-reply-to:references :content-type:x-mailer:mime-version; bh=4XOMfC5aYQYMI6k3ePhXYAJ7puPds12sNzmYeag5kmQ=; b=CP+8SI7hUGpKXihwAGyTznaW33Th2uKHEIlvw4+hfuH913ZL+2YaPdseUoRoPunnG2 +c77ZqaVshuXuE931mDTFv4XMABx2wUnvj5Yx5rX964LhfU1mzJDQVFZrNnxV7Q7lZ5L 93yTikcJTBN67XT67aEwCwwnM0su80hERD8H8= Received: by 10.42.170.3 with SMTP id d3mr8332259icz.7.1326709371692; Mon, 16 Jan 2012 02:22:51 -0800 (PST) Received: from [127.0.0.1] (jfdmzpr01-ext.jf.intel.com. [134.134.139.70]) by mx.google.com with ESMTPS id xu6sm32421982igb.7.2012.01.16.02.22.48 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 16 Jan 2012 02:22:50 -0800 (PST) Message-ID: <1326709475.14299.34.camel@sauron.fi.intel.com> Subject: Re: Corrupted UBIFS, bad CRC From: Artem Bityutskiy To: Karsten Jeppesen Date: Mon, 16 Jan 2012 12:24:35 +0200 In-Reply-To: <1326701907.78896.YahooMailNeo@web121503.mail.ne1.yahoo.com> References: <1326376049.44121.YahooMailNeo@web121502.mail.ne1.yahoo.com> <1326630286.2201.3.camel@koala> <1326701907.78896.YahooMailNeo@web121503.mail.ne1.yahoo.com> X-Mailer: Evolution 3.2.2 (3.2.2-1.fc16) Mime-Version: 1.0 X-Spam-Note: CRM114 invocation failed X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.210.177 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (dedekind1[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (dedekind1[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -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: ubifs X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.14 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, 2012-01-16 at 00:18 -0800, Karsten Jeppesen wrote: > Hi Artem, > > Of course I can. Anything I can do to help. > > I put it on one of my outside servers and I put as well the /dev/mtd4 as the ubi0_0 you asked for: > > > and > Thanks. I've taken a look by using mtdram. You have a strange corruption: 144 bytes of 0xFFs, then 32 bytes of zeroes, and then all 0xFFs. This looks like some oddity of your NOR flash. My theory is that your flash has write buffer and its size is 256 or larger. Anyway, first of all - start with pulling the latest ubifs-v2.6.32 tree - I've added few changes there very recently which fix UBI/UBIFS debugging messages. Also, please, enable UIBFS debugging compilation option. From now on I assume you have done this. Also I assume that you are aware that you need to look at dmesg to see all the UBIFS messages. There is some test in the MTD web site which explains this. Next: if I hack UBIFS like this: Then I can mount your image successfully. What is 'mtd->writebufsize' in your setup? You need to find out the right size and teach your driver to report it correctly. UBI reports max_write_size when you attach the MTD device. E.g., with mtdram I have the following: [493058.328443] UBI DBG (pid 18798): io_init: min_io_size 1 [493058.328444] UBI DBG (pid 18798): io_init: max_write_size 64 With my hack it is 256, of course. The mtdram module which I use hard-codes it to 64. diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c index 6c3fb5a..58a49e7 100644 --- a/drivers/mtd/ubi/build.c +++ b/drivers/mtd/ubi/build.c @@ -691,6 +691,8 @@ static int io_init(struct ubi_device *ubi) ubi_assert(ubi->min_io_size % ubi->hdrs_min_io_size == 0); ubi->max_write_size = ubi->mtd->writebufsize; + ubi->max_write_size = 256; + /* * Maximum write size has to be greater or equivalent to min. I/O * size, and be multiple of min. I/O size.