From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Richard Weinberger <richard@nod.at>
Cc: "David Woodhouse" <dwmw2@infradead.org>,
"Brian Norris" <computersforpeace@gmail.com>,
linux-mtd@lists.infradead.org,
"Artem Bityutskiy" <dedekind1@gmail.com>,
"Andrea Scian" <rnd4@dave-tech.it>,
"Bean Huo 霍斌斌 (beanhuo)" <beanhuo@micron.com>,
"Karl Zhang 张双锣 (karlzhang)" <karlzhang@micron.com>,
"Iwo Mergler" <Iwo.Mergler@netcommwireless.com>,
"Jeff Lauruhn (jlauruhn)" <jlauruhn@micron.com>,
"Stefan Roese" <sr@denx.de>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 3/5] UBI: switch the UBI device in read-only mode when mtd returns -EROFS
Date: Sat, 26 Sep 2015 10:40:17 +0200 [thread overview]
Message-ID: <20150926104017.7aa4b13a@bbrezillon> (raw)
In-Reply-To: <560585B2.3020904@nod.at>
Hi Richard,
On Fri, 25 Sep 2015 19:34:42 +0200
Richard Weinberger <richard@nod.at> wrote:
> Am 25.09.2015 um 17:09 schrieb Boris Brezillon:
> > The NAND layer is now able to forward power-cut emulation errors from
> > a NAND driver to the MTD user.
> > Check for this kind of errors in UBI and switch the UBI device in read-only
> > mode if such an error occurs.
> > The error will also be forwarded to the UBI user requesting the operation
> > if any, thus allowing UBIFS to act accordingly.
> >
> > Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
> > ---
> > drivers/mtd/ubi/io.c | 4 +++-
> > 1 file changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
> > index 5bbd1f0..c5ebef7 100644
> > --- a/drivers/mtd/ubi/io.c
> > +++ b/drivers/mtd/ubi/io.c
> > @@ -303,6 +303,8 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset,
> > len = ubi->peb_size - offset;
> > if (len)
> > err = ubi_self_check_all_ff(ubi, pnum, offset, len);
> > + } else if (err == -EROFS) {
> > + ubi_ro_mode(ubi);
> > }
> >
> > return err;
> > @@ -355,7 +357,7 @@ retry:
> >
> > err = mtd_erase(ubi->mtd, &ei);
> > if (err) {
> > - if (retries++ < UBI_IO_RETRIES) {
> > + if (err != -EROFS && retries++ < UBI_IO_RETRIES) {
>
> Looks good! :)
> One small nit, can you please add a comment above both lines that the EROFS checks are
> here because of emulators.
Sure, I'll add a comment.
Thanks,
Boris
--
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
next prev parent reply other threads:[~2015-09-26 8:41 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-25 15:09 [PATCH 0/5] mtd: nand/UBI: add power-cut emulation Boris Brezillon
2015-09-25 15:09 ` [PATCH 1/5] mtd: nand: add basic stuff to support " Boris Brezillon
2015-09-28 5:41 ` kbuild test robot
2015-09-25 15:09 ` [PATCH 2/5] mtd: nand: return -EROFS in case of " Boris Brezillon
2015-09-25 15:09 ` [PATCH 3/5] UBI: switch the UBI device in read-only mode when mtd returns -EROFS Boris Brezillon
2015-09-25 17:34 ` Richard Weinberger
2015-09-26 8:40 ` Boris Brezillon [this message]
2015-09-25 15:09 ` [PATCH 4/5] mtd: nand: nandsim: implement ->get_status() Boris Brezillon
2015-09-25 15:09 ` [PATCH 5/5] mtd: nand: nandsim: add support for power-cut emulation Boris Brezillon
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=20150926104017.7aa4b13a@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=Iwo.Mergler@netcommwireless.com \
--cc=beanhuo@micron.com \
--cc=computersforpeace@gmail.com \
--cc=dedekind1@gmail.com \
--cc=dwmw2@infradead.org \
--cc=jlauruhn@micron.com \
--cc=karlzhang@micron.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=richard@nod.at \
--cc=rnd4@dave-tech.it \
--cc=sr@denx.de \
/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;
as well as URLs for NNTP newsgroup(s).