Patchwork UBIFS fails to mount on second boot

login
register
mail settings
Submitter Artem Bityutskiy
Date July 14, 2012, 4:39 a.m.
Message ID <1342240778.3209.12.camel@brekeke>
Download mbox | patch
Permalink /patch/170987/
State New
Headers show

Comments

Artem Bityutskiy - July 14, 2012, 4:39 a.m.
On Tue, 2012-07-03 at 11:16 +1000, Iwo Mergler wrote:
> Thanks for the hint, I have. Turns out it's fairly simple, just pass
> ddebug_query="module ubifs +p" on the command line. Unfortunately,
> the way ddebug parses the line, you can only have one rule there.

Iwo, if you send more logs, please, include function names because
otherwise the logs are very difficult to follow. I think it wold be +pf.
> 
> I think there may be a change in newer kernels that allows to use
> a semicolon as a separator between rules, but my kernel doesn't
> allow that.
> 
> So I had to make two debug runs, one each for ubi and ubifs debugging
> enabled.
> 
> The attached archive contains 4 log files:
> 
> konsole_ubi_1.txt   = first (successful) boot with UBI debug enabled
> konsole_ubi_2.txt   = second (failed) boot with UBI debug enabled
> konsole_ubifs_1.txt = first (successful) boot with UBIFS debug enabled
> konsole_ubifs_2.txt = second (failed) boot with UBIFS debug enabled 

I suspect this is a bug in the free space fixup code - my level of
confidence on this is 80%. Could you please verify this by removing the
-F mkfs.ubifs parameter or using the patch below. Thanks!
Iwo Mergler - July 18, 2012, 7:05 a.m.
Artem Bityutskiy <dedekind1@gmail.com> wrote:
> I suspect this is a bug in the free space fixup code - my level of
> confidence on this is 80%. Could you please verify this by removing
> the -F mkfs.ubifs parameter or using the patch below. Thanks!

You're right, the problem doesn't happen without fixup.

I thought I was not flashing empty pages in U-Boot, but that turned
out not to be quite true. Without fixup, the boot died in a hailstorm
of asserts. I fixed that, but now the flashing takes noticeably longer.

In other words, I quite like the fixup feature and would prefer if it doesn't
go away permanently. Otherwise:

Tested-by: Iwo Mergler <Iwo.Mergler@netcommwireless.com>

> 
> diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
> index 5862dd9..3398114 100644
> --- a/fs/ubifs/super.c
> +++ b/fs/ubifs/super.c
> @@ -1295,11 +1295,13 @@ static int mount_ubifs(struct ubifs_info *c)
>  	if (err)
>  		goto out_master;
>  
> +#if 0
>  	if (!c->ro_mount && c->space_fixup) {
>  		err = ubifs_fixup_free_space(c);
>  		if (err)
>  			goto out_lpt;
>  	}
> +#endif
>  
>  	if (!c->ro_mount) {
>  		/*
> 

Best regards,

Iwo
Artem Bityutskiy - July 18, 2012, 7:21 a.m.
On Wed, 2012-07-18 at 17:05 +1000, Iwo Mergler wrote:
> In other words, I quite like the fixup feature and would prefer if it doesn't
> go away permanently. Otherwise:
> 
> Tested-by: Iwo Mergler <Iwo.Mergler@netcommwireless.com>

You should have the fix in your mailbox, and for that fix I'd be
greatful to have your "Tested-by:". BTW, I've updated the UBI/UBIFS
documentation WRT debugging - if you could review it - would also be
great!

http://linux-mtd.infradead.org/faq/ubifs.html#L_how_debug
Iwo Mergler - July 19, 2012, 1:06 a.m.
On Wed, 18 Jul 2012 17:21:10 +1000
Artem Bityutskiy <dedekind1@gmail.com> wrote:
> You should have the fix in your mailbox, and for that fix I'd be
> greatful to have your "Tested-by:". 

Thanks, got it. Applied and tested - the bug seems to be
gone.

> From 5978233c1e065c3d01bd88f4bf3598cc293ea611 Mon Sep 17 00:00:00 2001
> From: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
> Date: Sat, 14 Jul 2012 14:33:09 +0300
> Subject: [PATCH] UBIFS: fix a bug in empty space fix-up
...
> 
> -	/* Fixup the current log head */
> -	err = fixup_leb(c, c->lhead_lnum, c->lhead_offs);
> +	/* Fixup the log head contains the only a CS node at the beginning */
> +	err = fixup_leb(c, c->lhead_lnum,
> +			ALIGN(UBIFS_CS_NODE_SZ, c->min_io_size));
>  	if (err)

Tested-by: Iwo Mergler <Iwo.Mergler@netcommwireless.com>

Thanks again for your efforts.

Best regards,

Iwo

Patch

diff --git a/fs/ubifs/super.c b/fs/ubifs/super.c
index 5862dd9..3398114 100644
--- a/fs/ubifs/super.c
+++ b/fs/ubifs/super.c
@@ -1295,11 +1295,13 @@  static int mount_ubifs(struct ubifs_info *c)
 	if (err)
 		goto out_master;
 
+#if 0
 	if (!c->ro_mount && c->space_fixup) {
 		err = ubifs_fixup_free_space(c);
 		if (err)
 			goto out_lpt;
 	}
+#endif
 
 	if (!c->ro_mount) {
 		/*