From: "Vinit Agnihotri" <vinit.agnihotri@gmail.com>
To: linux-mtd@lists.infradead.org, dedekind@infradead.org
Subject: UBI: PATCH: -EINTR do not causes ubi to switch to read-only mode.
Date: Tue, 17 Jul 2007 17:22:03 +0530 [thread overview]
Message-ID: <9b52d64c0707170452v6c8b8ae0vf2dcf7304947a0c0@mail.gmail.com> (raw)
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:
Signed-off-by: Vinit Agnihotri <vinit.agnihotri@gmail.com>
================================================================
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;
+ }
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) {
+ ubi_ro_mode(ubi);
+ leb_write_unlock(ubi, vol_id, lnum);
+ ubi_free_vid_hdr(ubi, vid_hdr);
+ return err;
+ }
+ err = -EINTR;
+ }
+ 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;
+ }
+ 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;
+ }
ubi_ro_mode(ubi);
return err;
}
next reply other threads:[~2007-07-17 11:52 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-07-17 11:52 Vinit Agnihotri [this message]
2007-07-17 12:18 ` UBI: PATCH: -EINTR do not causes ubi to switch to read-only mode 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=9b52d64c0707170452v6c8b8ae0vf2dcf7304947a0c0@mail.gmail.com \
--to=vinit.agnihotri@gmail.com \
--cc=dedekind@infradead.org \
--cc=linux-mtd@lists.infradead.org \
/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