From: Artem Bityutskiy <dedekind@infradead.org>
To: Nahor <nahor.j+gmane@gmail.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: Nandwrite's behavior in case of write failure
Date: Fri, 05 Jun 2009 15:31:27 +0300 [thread overview]
Message-ID: <1244205087.5847.66.camel@localhost.localdomain> (raw)
In-Reply-To: <h09s2s$ar6$1@ger.gmane.org>
On Thu, 2009-06-04 at 18:23 -0700, Nahor wrote:
> Hi,
>
> If the call to pwrite fails, nanwrite tries first to erase the block
> then to mark it as bad. If erase fails, nandwrite aborts. If setting the
> bad block flag fails, nandwrite just ignores it and go to the next block.
I think this is a bug. It should not aborts in erase fails, but mark
the block as bad instead. But it should check the error code as well,
and mark it as bad only if the error was EIO. I.e., it should not
mark the block as bad on ENOMEM.
And yes, if mark_bad() fails, nandwrite should not ignore this.
This is what we do in ubiformat, I think. Also, ubiformat asks the user
if he wants to mark the block as bad, unless the -y option was used.
nandwrite could do something similar.
> My questions are:
> - Why erase the block?
Just in case. We should be very careful with marking blocks as bad,
because if you do this by mistake, you may loose your device. Indeed,
imagine you marked 100 blocks as bad my mistake, and you do not remember
the block numbers. How will you know which blocks you should then
unmark?
So the idea of erase is to check whether the block is really bad
or this is just a driver bug or something.
> - Probably linked to the first question, why abort if erase fails? Why
> not just ignore it and rely on the bad block flag?
I guess this is a bug in nandwrite
> - Why ignore the bad block flag error? If nandwrite can't set it and
> just goes on, the caller (app ou user) will think that everything is
> good. But when reading the partition later, the user will garbage when
> reaching that page.
And this must be a bug, IMO.
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
next prev parent reply other threads:[~2009-06-05 12:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-05 1:23 Nandwrite's behavior in case of write failure Nahor
2009-06-05 12:31 ` Artem Bityutskiy [this message]
2009-06-06 2:40 ` Nahor
2009-06-07 8:57 ` Artem Bityutskiy
2009-06-08 17:00 ` Nahor
2009-06-08 20:43 ` Jehan Bing
2009-06-09 12:59 ` Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1244205087.5847.66.camel@localhost.localdomain \
--to=dedekind@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=nahor.j+gmane@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox