From: Artem Bityutskiy <dedekind@infradead.org>
To: Vinit Agnihotri <vinit.agnihotri@gmail.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: UBI: PATCH: -EINTR do not causes ubi to switch to read-only mode.
Date: Tue, 17 Jul 2007 15:18:53 +0300 [thread overview]
Message-ID: <1184674733.3531.155.camel@sauron> (raw)
In-Reply-To: <9b52d64c0707170452v6c8b8ae0vf2dcf7304947a0c0@mail.gmail.com>
Vinit,
your patch again does not apply. Please, try to save your own mail and
apply it with git-am.
Also few notes below.
On Tue, 2007-07-17 at 17:22 +0530, Vinit Agnihotri wrote:
> With reference to previous mails, I am posting patch to handle -EINTR
> separately.
> Now ubi wont switch to read-only mode on receiving -EINTR signal while
> writing or erasing.
>
> patch is here:
It is better to include the commit message you would like to see in the
commit instead.
> Signed-off-by: Vinit Agnihotri <vinit.agnihotri@gmail.com>
> ================================================================
This line is unneeded.
> diff -ruN linux-2.6.18.3-vanila/drivers/mtd/ubi/eba.c
> linux-2.6.18.3-mod/drivers/mtd/ubi/eba.c
> --- linux-2.6.18.3-vanila/drivers/mtd/ubi/eba.c 2007-07-09
> 14:28:28.000000000 +0530
> +++ linux-2.6.18.3-mod/drivers/mtd/ubi/eba.c 2007-07-17 16:59:28.000000000 +0530
> @@ -616,6 +616,10 @@
> ubi_warn("failed to write data to PEB %d", pnum);
> if (err == -EIO && ubi->bad_allowed)
> err = recover_peb(ubi, pnum, vol_id, lnum, buf, offset, len);
> + if (err == -EINTR) {
> + leb_write_unlock(ubi, vol_id, lnum);
> + return err;
There is already return statement below. Also it would be nice to add
-ENOMEM check here as well.
> if (err)
> ubi_ro_mode(ubi);
> }
> @@ -673,7 +677,18 @@
>
> write_error:
> if (err != -EIO || !ubi->bad_allowed) {
> - ubi_ro_mode(ubi);
> + if (err == -EINTR) {
> + err = ubi_wl_put_peb(ubi, pnum, 1);
> + if (err || ++tries > UBI_IO_RETRIES) {
No need to retry if user wants to interrupt. Just put, unlock and return
-EINTR up.
> + ubi_ro_mode(ubi);
> + leb_write_unlock(ubi, vol_id, lnum);
> + ubi_free_vid_hdr(ubi, vid_hdr);
> + return err;
> + }
> + err = -EINTR;
> + }
> + else
} else
> + ubi_ro_mode(ubi);
> leb_write_unlock(ubi, vol_id, lnum);
> ubi_free_vid_hdr(ubi, vid_hdr);
> return err;
> @@ -799,7 +814,17 @@
> * something nasty and unexpected happened. Switch to read-only
> * mode just in case.
> */
> - ubi_ro_mode(ubi);
> + if (err == -EINTR) {
> + err = ubi_wl_put_peb(ubi, pnum, 1);
> + if (err || ++tries > UBI_IO_RETRIES) {
> + ubi_ro_mode(ubi);
> + leb_write_unlock(ubi, vol_id, lnum);
> + ubi_free_vid_hdr(ubi, vid_hdr);
> + return err;
> + }
Similar.
> + err = -EINTR;
> + } else
> + ubi_ro_mode(ubi);
> leb_write_unlock(ubi, vol_id, lnum);
> ubi_free_vid_hdr(ubi, vid_hdr);
> return err;
> diff -ruN linux-2.6.18.3-vanila/drivers/mtd/ubi/wl.c
> linux-2.6.18.3-mod/drivers/mtd/ubi/wl.c
> --- linux-2.6.18.3-vanila/drivers/mtd/ubi/wl.c 2007-07-09
> 14:28:28.000000000 +0530
> +++ linux-2.6.18.3-mod/drivers/mtd/ubi/wl.c 2007-07-17 16:37:44.000000000 +0530
> @@ -1103,6 +1103,10 @@
> * this physical eraseblock for erasure again would cause
> * errors again and again. Well, lets switch to RO mode.
> */
> + if (err == -EINTR) {
> + err = schedule_erase(ubi, e, 0);
> + return -EINTR;
> + }
Please, amend comments as well otherwise they do not match the code.
> ubi_ro_mode(ubi);
> return err;
> }
--
Best regards,
Artem Bityutskiy (Битюцкий Артём)
prev parent reply other threads:[~2007-07-17 12:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-17 11:52 UBI: PATCH: -EINTR do not causes ubi to switch to read-only mode Vinit Agnihotri
2007-07-17 12:18 ` Artem Bityutskiy [this message]
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=1184674733.3531.155.camel@sauron \
--to=dedekind@infradead.org \
--cc=linux-mtd@lists.infradead.org \
--cc=vinit.agnihotri@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