UBI: PATCH: -EINTR do not causes ubi to switch to read-only mode.
Artem Bityutskiy
dedekind at infradead.org
Tue Jul 17 08:18:53 EDT 2007
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 at 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 (Битюцкий Артём)
More information about the linux-mtd
mailing list