From: Artem Bityutskiy <dedekind1@gmail.com>
To: Matthieu CASTET <matthieu.castet@parrot.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>
Subject: Re: ubifs : corruption after power cut test
Date: Sun, 22 Aug 2010 10:44:46 +0300 [thread overview]
Message-ID: <1282463086.16502.38.camel@brekeke> (raw)
In-Reply-To: <4C4FDEF5.2040405@parrot.com>
On Wed, 2010-07-28 at 09:40 +0200, Matthieu CASTET wrote:
> I manage to reproduce it with the backtrace [1].
Matthieu, your work-around patch or something very close should
certainly be applied to the UBIFS tree, but I still would like to find
out what exactly happened in your setup.
I see 2 possibilities:
1. An error happened and 'ubifs_garbage_collect()' returned while
c->gc_lnum was -1. But in this case we should have switched to R/O mode,
and the master node would not be written. But may be for some reasons we
did not switch to R/O mode, dunno.
2. More likely scenario: in 'ubifs_rcvry_gc_commit()' we call
'ubifs_garbage_collect_leb()' directly, which can return while
c->gc_lnum is -1. And we do not handle this.
Would you please be patient enough to reproduce the issue once again with
the following patch, which was created against the latest ubifs-2.6.git, but
you should be easily able to apply it to your tree.
Artem.
diff --git a/fs/ubifs/budget.c b/fs/ubifs/budget.c
index c8ff0d1..aa433cd 100644
--- a/fs/ubifs/budget.c
+++ b/fs/ubifs/budget.c
@@ -83,6 +83,10 @@ static int run_gc(struct ubifs_info *c)
down_read(&c->commit_sem);
lnum = ubifs_garbage_collect(c, 1);
up_read(&c->commit_sem);
+ if (c->gc_lnum == -1) {
+ ubifs_err("gc_lnum is -1! ubifs_garbage_collect() returned %d", lnum);
+ dump_stack();
+ }
if (lnum < 0)
return lnum;
diff --git a/fs/ubifs/gc.c b/fs/ubifs/gc.c
index 396f24a..0e78832 100644
--- a/fs/ubifs/gc.c
+++ b/fs/ubifs/gc.c
@@ -807,12 +807,20 @@ int ubifs_garbage_collect(struct ubifs_info *c, int anyway)
goto out;
}
out_unlock:
+ if (c->gc_lnum == -1) {
+ ubifs_err("gc_lnum is -1! ubifs_garbage_collect() is returning %d", ret);
+ dump_stack();
+ }
mutex_unlock(&wbuf->io_mutex);
return ret;
out:
ubifs_assert(ret < 0);
ubifs_assert(ret != -ENOSPC && ret != -EAGAIN);
+ if (c->gc_lnum == -1) {
+ ubifs_err("gc_lnum is -1! ubifs_garbage_collect() is returning %d", ret);
+ dump_stack();
+ }
ubifs_wbuf_sync_nolock(wbuf);
ubifs_ro_mode(c, ret);
mutex_unlock(&wbuf->io_mutex);
diff --git a/fs/ubifs/journal.c b/fs/ubifs/journal.c
index d321bae..44df514 100644
--- a/fs/ubifs/journal.c
+++ b/fs/ubifs/journal.c
@@ -162,6 +162,10 @@ again:
mutex_unlock(&wbuf->io_mutex);
lnum = ubifs_garbage_collect(c, 0);
+ if (c->gc_lnum == -1) {
+ ubifs_err("gc_lnum is -1! ubifs_garbage_collect() returned %d", lnum);
+ dump_stack();
+ }
if (lnum < 0) {
err = lnum;
if (err != -ENOSPC)
diff --git a/fs/ubifs/recovery.c b/fs/ubifs/recovery.c
index daae9e1..3058256 100644
--- a/fs/ubifs/recovery.c
+++ b/fs/ubifs/recovery.c
@@ -1126,6 +1126,10 @@ int ubifs_rcvry_gc_commit(struct ubifs_info *c)
dbg_rcvry("GC'ing LEB %d", lnum);
mutex_lock_nested(&wbuf->io_mutex, wbuf->jhead);
err = ubifs_garbage_collect_leb(c, &lp);
+ if (c->gc_lnum == -1) {
+ ubifs_err("gc_lnum is -1! ubifs_garbage_collect_leb() returned %d", err);
+ dump_stack();
+ }
if (err >= 0) {
int err2 = ubifs_wbuf_sync_nolock(wbuf);
next prev parent reply other threads:[~2010-08-22 7:44 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-07-07 12:04 ubifs : corruption after power cut test Matthieu CASTET
2010-07-13 7:27 ` Matthieu CASTET
2010-07-13 8:43 ` Matthieu CASTET
2010-07-13 9:24 ` Matthieu CASTET
2010-07-13 14:24 ` Artem Bityutskiy
2010-07-13 15:10 ` Matthieu CASTET
2010-07-28 7:40 ` Matthieu CASTET
2010-08-02 9:32 ` Matthieu CASTET
2010-08-04 16:14 ` Artem Bityutskiy
2010-08-22 7:44 ` Artem Bityutskiy [this message]
2010-09-06 8:55 ` Artem Bityutskiy
2010-09-09 9:22 ` Matthieu CASTET
2010-09-09 9:51 ` Artem Bityutskiy
2010-09-24 15:31 ` Matthieu CASTET
2010-09-24 16:50 ` Artem Bityutskiy
2010-07-13 11:07 ` Artem Bityutskiy
2010-07-13 12:06 ` Matthieu CASTET
2010-07-13 14:13 ` Artem Bityutskiy
2010-07-13 14:33 ` 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=1282463086.16502.38.camel@brekeke \
--to=dedekind1@gmail.com \
--cc=linux-mtd@lists.infradead.org \
--cc=matthieu.castet@parrot.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;
as well as URLs for NNTP newsgroup(s).