linux-mtd.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Matthieu CASTET <matthieu.castet@parrot.com>
To: Matthieu CASTET <matthieu.castet@parrot.com>
Cc: "linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
	"dedekind1@gmail.com" <dedekind1@gmail.com>
Subject: Re: ubifs : corruption after power cut test
Date: Mon, 2 Aug 2010 11:32:33 +0200	[thread overview]
Message-ID: <4C5690B1.6030407@parrot.com> (raw)
In-Reply-To: <4C4FDEF5.2040405@parrot.com>

[-- Attachment #1: Type: text/plain, Size: 500 bytes --]

Matthieu CASTET a écrit :
> Hi,
> 
> Matthieu CASTET a écrit :
>> Artem Bityutskiy a écrit :
>> Ok thanks, I will run it
>>
>> When checking the code, I saw that switch_gc_head can set c->gc_lnum to -1.
>>
>> In ubifs_put_super, we set c->mst_node->gc_lnum to c->gc_lnum and write 
>> master node.
>> Can't ubifs_put_super run while switch_gc_head set gc_lnum to -1 ?
>>
> I manage to reproduce it with the backtrace [1].
> 
Waiting for a proper fix, I force recovery if gc_lnum to -1.


Matthieu

[-- Attachment #2: ubifs --]
[-- Type: text/plain, Size: 865 bytes --]

diff --git a/fs/ubifs/master.c b/fs/ubifs/master.c
index 28beaee..2b668cc 100644
--- a/fs/ubifs/master.c
+++ b/fs/ubifs/master.c
@@ -135,7 +135,7 @@ static int validate_master(const struct ubifs_info *c)
 		goto out;
 	}
 
-	if (c->gc_lnum >= c->leb_cnt || c->gc_lnum < c->main_first) {
+	if (c->gc_lnum != -1 && (c->gc_lnum >= c->leb_cnt || c->gc_lnum < c->main_first)) {
 		err = 7;
 		goto out;
 	}
diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 8cdcdc5..0207620 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1260,7 +1260,7 @@ static int mount_ubifs(struct ubifs_info *c)
 
 	init_constants_master(c);
 
-	if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) {
+	if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0 || c->gc_lnum == -1) {
 		ubifs_msg("recovery needed");
 		c->need_recovery = 1;
 		if (!mounted_read_only) {

  reply	other threads:[~2010-08-02  9:32 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 [this message]
2010-08-04 16:14               ` Artem Bityutskiy
2010-08-22  7:44             ` Artem Bityutskiy
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=4C5690B1.6030407@parrot.com \
    --to=matthieu.castet@parrot.com \
    --cc=dedekind1@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).