Skip to contentSkip to conversation

fix-up free space earlier in mount_ubifs()

PATCH In review Ben Gardiner 3 participants 17 messages May 30, 2011 – Jun 1, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover fix-up free space earlier in mount_ubifs()

In testing Mattew Creech's free-space-fixup flag series I found that was unable to boot a da850evm which had flashed to it's NAND a ubinized image containing a UBIFS that has the free-space-fixup flag set.

The cause of the problem was found to be the call to ubifs_write_master() from mount_ubifs() as is evidenced the backtrace produced by the assertion introduced in the first patch of this series; where the assertion introduced is that c->space_fixup is false when ubifs_write_node() is called.

UBIFS assert failed in ubifs_write_node at 766 (pid 1)

Backtrace:
[<c002dd8c>] (dump_backtrace+0x0/0x10c) from [<c02ecb8c>] (dump_stack+0x18/0x1c)
 r7:00000001 r6:c782c000 r5:c781f000 r4:c03fb468
[<c02ecb74>] (dump_stack+0x0/0x1c) from [<c015cd68>] (ubifs_write_node+0x20c/0x230)
[<c015cb5c>] (ubifs_write_node+0x0/0x230) from [<c0162930>] (ubifs_write_master+0xbc/0x228)
[<c0162874>] (ubifs_write_master+0x0/0x228) from [<c0158108>] (ubifs_fill_super+0x1d54/0x1ed8)
 r6:0001e5a0 r5:00000000 r4:00000000
[<c01563b4>] (ubifs_fill_super+0x0/0x1ed8) from [<c01584fc>] (ubifs_mount+0x270/0x3a4)
[<c015828c>] (ubifs_mount+0x0/0x3a4) from [<c00afe5c>] (mount_fs+0x1c/0xe8)
[<c00afe40>] (mount_fs+0x0/0xe8) from [<c00cc8c0>] (vfs_kern_mount+0x58/0x94)
 r6:00008000 r5:c780c780 r4:c7a6e9e0
[<c00cc868>] (vfs_kern_mount+0x0/0x94) from [<c00cc958>] (do_kern_mount+0x3c/0xd4)
 r9:c782dee8 r8:c03ebaa8 r7:c7a6ea00 r6:00000000 r5:c7a6e9e0

r4:00008000
[<c00cc91c>] (do_kern_mount+0x0/0xd4) from [<c00ccb3c>] (do_mount+0x14c/0x734)
r9:c782dee8 r8:00000020 r7:c7a6ea00 r6:c7a6e9e0 r5:00008000
r4:00000000
[<c00cc9f0>] (do_mount+0x0/0x734) from [<c00cd1c4>] (sys_mount+0xa0/0xd0) [<c00cd124>] (sys_mount+0x0/0xd0) from [<c0008dd4>] (mount_block_root+0x98/0x2c8)
r7:c0023e88 r6:c781b000 r5:00008000 r4:c781b000
[<c0008d3c>] (mount_block_root+0x0/0x2c8) from [<c00090f0>] (prepare_namespace+0x80/0x1c4) [<c0009070>] (prepare_namespace+0x0/0x1c4) from [<c0008480>] (kernel_init+0x110/0x158)
r7:00000013 r6:c0023300 r5:c0023668 r4:c0023668
[<c0008370>] (kernel_init+0x0/0x158) from [<c0043d58>] (do_exit+0x0/0x750)
r7:00000013 r6:c0043d58 r5:c0008370 r4:00000000

Moving the free-space-fixup to before the call to ubifs_write_master() requires that the LPT be initialiazed first; therefore the second patch of this series moves the ubifs_lpt_init() call to before the call to ubifs_write_master() in preparation of moving the free-space fixup.

Finally, the free-space fixup is moved to earlier in the mounting process -- in testing this has resulted in a bootable da850evm and no assertion errors.

Ben Gardiner (3):
UBIFS: assert no fixup when writing a node
UBIFS: intialize the LPT earlier
UBIFS: fix-up free space earlier

 fs/ubifs/io.c    |    2 ++
 fs/ubifs/super.c |   24 ++++++++++++------------
 2 files changed, 14 insertions(+), 12 deletions(-)
Signature · 1 line
1.7.4.1
#1 lore raw

PATCH 1/3 UBIFS: assert no fixup when writing a node

The current free space fixup can result in some writing to the UBI volume when the space_fixup flag is set.

To catch instances where UBIFS is writing to the NAND while the space_fixup flag is set, add an assert to ubifs_write_node().

---
 fs/ubifs/io.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/ubifs/io.c +2 -0
index 166951e..db298de 100644
@@ -763,6 +763,8 @@ int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum,
 	if (c->ro_error)
 		return -EROFS;
 
+	ubifs_assert(!c->space_fixup);
+
 	ubifs_prepare_node(c, buf, len, 1);
 	err = ubi_leb_write(c->ubi, lnum, buf, offs, buf_len, dtype);
 	if (err) {
Signature · 1 line
1.7.4.1
#2 lore raw

Re: [PATCH 1/3] UBIFS: assert no fixup when writing a node

Quoted 17 lines · Ben Gardiner

The current free space fixup can result in some writing to the UBI volume when the space_fixup flag is set.

To catch instances where UBIFS is writing to the NAND while the space_fixup flag is set, add an assert to ubifs_write_node().

---
 fs/ubifs/io.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
fs/ubifs/io.c +0 -0
index 166951e..db298de 100644

fs/ubifs/io.c int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum, · line 767

Quoted 5 lines
fs/ubifs/io.c +2 -0
@@ -763,6 +763,8 @@ int ubifs_write_node(struct ubifs_info *c, void *buf, int len, int lnum,
 	if (c->ro_error)
 		return -EROFS;
 
+	ubifs_assert(!c->space_fixup);
+

I've moved this assert upper to where all other assertions are placed.

I've also added this assertion to 'ubifs_wbuf_write_nolock()' because it is the other often used write path.

And pushed to the UBIFS tree, thanks.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
#3 lore raw

PATCH 2/3 UBIFS: intialize the LPT earlier

In reply to Ben Gardiner

The current mount_ubifs() implementation does not initialize the LPT until the check for recovery is completed and the dirty flag is written.

Move the LPT initializtion to before the check for recovery and dirty flag in preparation for the next patch which will move the free-space-fixup check to directly after this allocation.

---
 fs/ubifs/super.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
fs/ubifs/super.c +6 -6
index 6db0bdaa..89c8d33 100644
@@ -1281,13 +1281,17 @@ static int mount_ubifs(struct ubifs_info *c)
 
 	init_constants_master(c);
 
+	err = ubifs_lpt_init(c, 1, !c->ro_mount);
+	if (err)
+		goto out_lpt;
+
 	if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) {
 		ubifs_msg("recovery needed");
 		c->need_recovery = 1;
 		if (!c->ro_mount) {
 			err = ubifs_recover_inl_heads(c, c->sbuf);
 			if (err)
-				goto out_master;
+				goto out_lpt;
 		}
 	} else if (!c->ro_mount) {
 		/*
@@ -1297,13 +1301,9 @@ static int mount_ubifs(struct ubifs_info *c)
 		c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY);
 		err = ubifs_write_master(c);
 		if (err)
-			goto out_master;
+			goto out_lpt;
 	}
 
-	err = ubifs_lpt_init(c, 1, !c->ro_mount);
-	if (err)
-		goto out_lpt;
-
 	err = dbg_check_idx_size(c, c->bi.old_idx_sz);
 	if (err)
 		goto out_lpt;
Signature · 1 line
1.7.4.1
#4 lore raw

Re: [PATCH 2/3] UBIFS: intialize the LPT earlier

Hi,

thanks for the patch, however

Review

Quoted 3 lines · Ben Gardiner
(quoted diff) +3 -0
+	err = ubifs_lpt_init(c, 1, !c->ro_mount);
+	if (err)
+		goto out_lpt;

You cannot call ubifs_lpt_init()

Review

Quoted 6 lines
(quoted diff) +1 -0
+
 	if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) {
 		ubifs_msg("recovery needed");
 		c->need_recovery = 1;
 		if (!c->ro_mount) {
 			err = ubifs_recover_inl_heads(c, c->sbuf);

Before ubifs_recover_inl_heads() is called in case of dirty FS.

I've massaged your patch and pushed the following analogous patch to the ubifs tree, please check/test:

Quoted 1 line

From 678ef9ad3daa453723f04f84f9db6a22994e7343 Mon Sep 17 00:00:00 2001

From: Ben Gardiner <[email protected]>
Date: Mon, 30 May 2011 14:56:15 -0400
Subject: [PATCH] UBIFS: intialize LPT earlier

The current 'mount_ubifs()' implementation does not initialize the LPT until the the master node is marked dirty. Move the LPT initialization to before marking the master node dirty. This is a preparation for the next patch which will move the free-space-fixup check to before marking the master node dirty, because we have to fix-up the free space before doing any writes.

Artem: massaged the patch and commit message.

---
 fs/ubifs/super.c |   29 ++++++++++++++++-------------
 1 files changed, 16 insertions(+), 13 deletions(-)
fs/ubifs/super.c +16 -13
index 1e40db7..6d357fd 100644
@@ -1282,17 +1282,24 @@ static int mount_ubifs(struct ubifs_info *c)
 	if (err)
 		goto out_master;
 
-	init_constants_master(c);
-
 	if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) {
 		ubifs_msg("recovery needed");
 		c->need_recovery = 1;
-		if (!c->ro_mount) {
-			err = ubifs_recover_inl_heads(c, c->sbuf);
-			if (err)
-				goto out_master;
-		}
-	} else if (!c->ro_mount) {
+	}
+
+	init_constants_master(c);
+
+	if (c->need_recovery && !c->ro_mount) {
+		err = ubifs_recover_inl_heads(c, c->sbuf);
+		if (err)
+			goto out_master;
+	}
+
+	err = ubifs_lpt_init(c, 1, !c->ro_mount);
+	if (err)
+		goto out_master;
+
+	if (!c->ro_mount) {
 		/*
 		 * Set the "dirty" flag so that if we reboot uncleanly we
 		 * will notice this immediately on the next mount.
@@ -1300,13 +1307,9 @@ static int mount_ubifs(struct ubifs_info *c)
 		c->mst_node->flags |= cpu_to_le32(UBIFS_MST_DIRTY);
 		err = ubifs_write_master(c);
 		if (err)
-			goto out_master;
+			goto out_lpt;
 	}
 
-	err = ubifs_lpt_init(c, 1, !c->ro_mount);
-	if (err)
-		goto out_lpt;
-
 	err = dbg_check_idx_size(c, c->bi.old_idx_sz);
 	if (err)
 		goto out_lpt;
Signature · 7 lines
1.7.2.3



-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
#5 lore raw

PATCH 3/3 UBIFS: fix-up free space earlier

In reply to Ben Gardiner

The free space fixup is currently initiated during mount after the call to ubifs_write_master() which results in a write to PEBs; this has been observed with the patch 'assert no fixup when writing a node' applied:

Move the free space fixup on mount to before the calls to ubifs_recover_inl_heads() and ubifs_write_master(). This results in no assertions with the previously mentioned patch applied.

---
 fs/ubifs/super.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
fs/ubifs/super.c +6 -6
index 89c8d33..531b9b7 100644
@@ -1285,6 +1285,12 @@ static int mount_ubifs(struct ubifs_info *c)
 	if (err)
 		goto out_lpt;
 
+	if (!c->ro_mount && c->space_fixup) {
+		err = ubifs_fixup_free_space(c);
+		if (err)
+			goto out_infos;
+	}
+
 	if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) {
 		ubifs_msg("recovery needed");
 		c->need_recovery = 1;
@@ -1396,12 +1402,6 @@ static int mount_ubifs(struct ubifs_info *c)
 	} else
 		ubifs_assert(c->lst.taken_empty_lebs > 0);
 
-	if (!c->ro_mount && c->space_fixup) {
-		err = ubifs_fixup_free_space(c);
-		if (err)
-			goto out_infos;
-	}
-
 	err = dbg_check_filesystem(c);
 	if (err)
 		goto out_infos;
Signature · 1 line
1.7.4.1
#6 lore raw

Re: [PATCH 3/3] UBIFS: fix-up free space earlier

Quoted 20 lines · Ben Gardiner

The free space fixup is currently initiated during mount after the call to ubifs_write_master() which results in a write to PEBs; this has been observed with the patch 'assert no fixup when writing a node' applied:

Move the free space fixup on mount to before the calls to ubifs_recover_inl_heads() and ubifs_write_master(). This results in no assertions with the previously mentioned patch applied.

---
 fs/ubifs/super.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
fs/ubifs/super.c +0 -0
index 89c8d33..531b9b7 100644

fs/ubifs/super.c static int mount_ubifs(struct ubifs_info *c) · line 1292

Quoted 8 lines
fs/ubifs/super.c +5 -0
@@ -1285,6 +1285,12 @@ static int mount_ubifs(struct ubifs_info *c)
 	if (err)
 		goto out_lpt;
 
+	if (!c->ro_mount && c->space_fixup) {
+		err = ubifs_fixup_free_space(c);
+		if (err)
+			goto out_infos;
+	}

Tweaked the patch a bit to make sure 'init_constants_master()' is called before we start fixing-up - this does not matter now but it is less error prone. And pushed to the UBIFS git tree, thank you.

But please, do review my tweaks and test them. When you confirm it works, I'll send a pull request to Linus.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
#7 lore raw

PATCH 1/1 UBIFS: fixup merged 'UBIFS: fix-up free space earlier'

When the patch 'UBIFS: intialize LPT earlier' was massaged before being applied the context of the next patch 'UBIFS: fix-up free space earlier' was muddled sufficiently for the order of allocate-lpt then free-space-fixup was reversed -- I think.

Put the free-space-fixup after allocate-lpt.

---
With this fixup applied on-top-of the ubifs-2.6 master I am able to mount a ubinized image containing a UBIFS volume which has the free-space-fixup flag set. No assertions are displayed.

---
 fs/ubifs/super.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
fs/ubifs/super.c +6 -6
index 4722f31..70e8c92 100644
@@ -1284,12 +1284,6 @@ static int mount_ubifs(struct ubifs_info *c)
 
 	init_constants_master(c);
 
-	if (!c->ro_mount && c->space_fixup) {
-		err = ubifs_fixup_free_space(c);
-		if (err)
-			goto out_infos;
-	}
-
 	if ((c->mst_node->flags & cpu_to_le32(UBIFS_MST_DIRTY)) != 0) {
 		ubifs_msg("recovery needed");
 		c->need_recovery = 1;
@@ -1305,6 +1299,12 @@ static int mount_ubifs(struct ubifs_info *c)
 	if (err)
 		goto out_master;
 
+	if (!c->ro_mount && c->space_fixup) {
+		err = ubifs_fixup_free_space(c);
+		if (err)
+			goto out_master;
+	}
+
 	if (!c->ro_mount) {
 		/*
 		 * Set the "dirty" flag so that if we reboot uncleanly we
Signature · 1 line
1.7.4.1
#8 lore raw

Re: [PATCH] UBIFS: fixup merged 'UBIFS: fix-up free space earlier'

Quoted 8 lines · Ben Gardiner

When the patch 'UBIFS: intialize LPT earlier' was massaged before being applied the context of the next patch 'UBIFS: fix-up free space earlier' was muddled sufficiently for the order of allocate-lpt then free-space-fixup was reversed -- I think.

Put the free-space-fixup after allocate-lpt.

I'll take a look at this and fold this change in a bit later, thanks.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
#9 lore raw

Re: [PATCH] UBIFS: fixup merged 'UBIFS: fix-up free space earlier'

In reply to Ben Gardiner
Quoted 5 lines · Ben Gardiner

When the patch 'UBIFS: intialize LPT earlier' was massaged before being applied the context of the next patch 'UBIFS: fix-up free space earlier' was muddled sufficiently for the order of allocate-lpt then free-space-fixup was reversed -- I think.

Quoted 8 lines

Put the free-space-fixup after allocate-lpt.

---
With this fixup applied on-top-of the ubifs-2.6 master I am able to mount a ubinized image containing a UBIFS volume which has the free-space-fixup flag set. No assertions are displayed.

Thanks. Merged this patch to the 3rd one and pushed out.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)
#10 lore raw

Re: [PATCH] UBIFS: fixup merged 'UBIFS: fix-up free space earlier'

Hi Artem,

Quoted 8 lines · Artem Bityutskiy
Quoted 7 lines · Ben Gardiner

When the patch 'UBIFS: intialize LPT earlier' was massaged before being applied the context of the next patch 'UBIFS: fix-up free space earlier' was muddled sufficiently for the order of allocate-lpt then free-space-fixup was reversed -- I think.

Put the free-space-fixup after allocate-lpt.

Quoted 8 lines
Quoted 6 lines

---
With this fixup applied on-top-of the ubifs-2.6 master I am able to mount a ubinized image containing a UBIFS volume which has the free-space-fixup flag set. No assertions are displayed.

Thanks. Merged this patch to the 3rd one and pushed out.

You're most welcome.

Both branches master and linux-next are working as expected.

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca

#11 lore raw
In reply to Ben Gardiner
Quoted 9 lines · Ben Gardiner

In testing Mattew Creech's free-space-fixup flag series I found that was unable to boot a da850evm which had flashed to it's NAND a ubinized image containing a UBIFS that has the free-space-fixup flag set.

The cause of the problem was found to be the call to ubifs_write_master() from mount_ubifs() as is evidenced the backtrace produced by the assertion introduced in the first patch of this series; where the assertion introduced is that c->space_fixup is false when ubifs_write_node() is called.

Interesting - so the problem is that if ubifs_read_master() resizes the master node, a subsequent attempt to read the first (c->mst_offs + c->mst_node_alsz) bytes from the master LEB fails?

I wonder why this is the case when free-space fixup is enabled, and not otherwise? The -EBADMSG seems to imply that this is the original problem that the fix-up is intended to solve - i.e. the master node has empty pages with non-empty OOB values, and writing to them results in a bogus ECC.

Do you happen to know if the same thing occurs when you uncleanly reboot (so that recovery is needed on the next boot)? It looks like ubifs_recover_master_node() reads the same data that fixup_leb_free_space() does, so I'd expect it to fail similarly if that's what's happening, regardless of whether fix-up is performed or not.

Just trying to fully understand the error. :) That aside, this patch set makes sense to me. Thanks!

Signature · 1 line
Matthew L. Creech
#12 lore raw

Hi Matthew,

Quoted 16 lines · Matthew L. Creech
Quoted 9 lines · Ben Gardiner

In testing Mattew Creech's free-space-fixup flag series I found that was unable to boot a da850evm which had flashed to it's NAND a ubinized image containing a UBIFS that has the free-space-fixup flag set.

The cause of the problem was found to be the call to ubifs_write_master() from mount_ubifs() as is evidenced the backtrace produced by the assertion introduced in the first patch of this series; where the assertion introduced is that c->space_fixup is false when ubifs_write_node() is called.

Interesting - so the problem is that if ubifs_read_master() resizes the master node, a subsequent attempt to read the first (c->mst_offs + c->mst_node_alsz) bytes from the master LEB fails?

Quoted 5 lines

I wonder why this is the case when free-space fixup is enabled, and not otherwise?  The -EBADMSG seems to imply that this is the original problem that the fix-up is intended to solve - i.e. the master node has empty pages with non-empty OOB values, and writing to them results in a bogus ECC.

Right. I should have mentioned that it is also true that without free-space-fixup the initial flash of a UBInized image containing a UBIFS volume results in a bootable system which can mount the rootfs _the first time only_ subsequent attemps at mounting result in a failure to mount due to -74 errors.

Quoted 2 lines

Just trying to fully understand the error.  :)  That aside, this patch set makes sense to me.  Thanks!

Thank you for your endorsement. Can we take that as a Reviewed-by ?

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca

#15 lore raw
In reply to Matthew L. Creech

Hi Matthew,

To answer your other question:

Quoted 8 lines · Matthew L. Creech

[...]

Do you happen to know if the same thing occurs when you uncleanly reboot (so that recovery is needed on the next boot)?  It looks like ubifs_recover_master_node() reads the same data that fixup_leb_free_space() does, so I'd expect it to fail similarly if that's what's happening, regardless of whether fix-up is performed or not.

To test unclean w/o free-space-fixup flag set I did a powercut during 'yes > /test-file';

The first time I hsaw a dump from ubifs_check_node:

UBIFS: recovery needed
UBIFS error (pid 1): ubifs_check_node: bad CRC: calculated 0x4763322d, read 0x4c8c2537
UBIFS error (pid 1): ubifs_check_node: bad node at LEB 501:81608

Backtrace:
[<c002dd8c>] (dump_backtrace+0x0/0x10c) from [<c02ecbac>] (dump_stack+0x18/0x1c)
 r7:00013ec8 r6:c781f000 r5:c89f0ec8 r4:ffffff8b
[<c02ecb94>] (dump_stack+0x0/0x1c) from [<c015ba88>]
(ubifs_check_node+0x1b8/0x2ec)
[<c015b8d0>] (ubifs_check_node+0x0/0x2ec) from [<c0163ee4>]
(ubifs_scan_a_node+0x180/0x398)
[<c0163d64>] (ubifs_scan_a_node+0x0/0x398) from [<c017b498>]
(ubifs_recover_leb+0xd4/0xa94)
[<c017b3c4>] (ubifs_recover_leb+0x0/0xa94) from [<c0164e90>]
(ubifs_replay_journal+0x6ac/0x1c30)
[<c01647e4>] (ubifs_replay_journal+0x0/0x1c30) from [<c01571a8>]
(ubifs_fill_super+0xdf4/0x1ee4)
[<c01563b4>] (ubifs_fill_super+0x0/0x1ee4) from [<c0158508>]
(ubifs_mount+0x270/0x3a4)
[<c0158298>] (ubifs_mount+0x0/0x3a4) from [<c00afe5c>] (mount_fs+0x1c/0xe8)
[<c00afe40>] (mount_fs+0x0/0xe8) from [<c00cc8c0>] (vfs_kern_mount+0x58/0x94)
 r6:00008000 r5:c780c780 r4:c7a78b80
[<c00cc868>] (vfs_kern_mount+0x0/0x94) from [<c00cc958>]
(do_kern_mount+0x3c/0xd4)
 r9:c782dee8 r8:c03ebaa8 r7:c7a78b60 r6:00000000 r5:c7a78b80

r4:00008000
[<c00cc91c>] (do_kern_mount+0x0/0xd4) from [<c00ccb3c>] (do_mount+0x14c/0x734)
r9:c782dee8 r8:00000020 r7:c7a78b60 r6:c7a78b80 r5:00008000
r4:00000000
[<c00cc9f0>] (do_mount+0x0/0x734) from [<c00cd1c4>] (sys_mount+0xa0/0xd0) [<c00cd124>] (sys_mount+0x0/0xd0) from [<c0008dd4>] (mount_block_root+0x98/0x2c8)
r7:c0023e88 r6:c781b000 r5:00008000 r4:c781b000
[<c0008d3c>] (mount_block_root+0x0/0x2c8) from [<c00090f0>] (prepare_namespace+0x80/0x1c4)
[<c0009070>] (prepare_namespace+0x0/0x1c4) from [<c0008480>] (kernel_init+0x110/0x158)
r7:00000013 r6:c0023300 r5:c0023668 r4:c0023668
[<c0008370>] (kernel_init+0x0/0x158) from [<c0043d58>] (do_exit+0x0/0x750)
r7:00000013 r6:c0043d58 r5:c0008370 r4:00000000
UBIFS: recovery completed

every time after that there is nothing printed during recovery:

UBIFS: recovery needed
UBIFS: recovery completed
UBIFS: mounted UBI device 0, volume 1, name "rootfs"

To test unclean with free-space-flag set, I did powercut during 'nand write' in u-boot.

When attempting to mount the rootfs I got dumps from ubifs_read_node:

UBIFS error (pid 1): ubifs_read_node: bad node type (255 but expected 9) UBIFS error (pid 1): ubifs_read_node: bad node at LEB 496:101088, LEB mapping status 0

Backtrace:
[<c002dd8c>] (dump_backtrace+0x0/0x10c) from [<c02ecbac>] (dump_stack+0x18/0x1c)
 r7:c782c000 r6:c781f000 r5:c7859780 r4:ffffffea
[<c02ecb94>] (dump_stack+0x0/0x1c) from [<c015bdf4>]
(ubifs_read_node+0x238/0x2ec)
[<c015bbbc>] (ubifs_read_node+0x0/0x2ec) from [<c0168080>]
(dbg_old_index_check_init+0x70/0xe0)
[<c0168010>] (dbg_old_index_check_init+0x0/0xe0) from [<c0163864>]
(ubifs_read_master+0xdbc/0xe20)
[<c0162aa8>] (ubifs_read_master+0x0/0xe20) from [<c0156ffc>]
(ubifs_fill_super+0xc48/0x1ee4)
[<c01563b4>] (ubifs_fill_super+0x0/0x1ee4) from [<c0158508>]
(ubifs_mount+0x270/0x3a4)
[<c0158298>] (ubifs_mount+0x0/0x3a4) from [<c00afe5c>] (mount_fs+0x1c/0xe8)
[<c00afe40>] (mount_fs+0x0/0xe8) from [<c00cc8c0>] (vfs_kern_mount+0x58/0x94)
 r6:00008000 r5:c780c780 r4:c7a848e0
[<c00cc868>] (vfs_kern_mount+0x0/0x94) from [<c00cc958>]
(do_kern_mount+0x3c/0xd4)
 r9:c782dee8 r8:c03ebaa8 r7:c7a848c0 r6:00000000 r5:c7a848e0

r4:00008000
[<c00cc91c>] (do_kern_mount+0x0/0xd4) from [<c00ccb3c>] (do_mount+0x14c/0x734)
r9:c782dee8 r8:00000020 r7:c7a848c0 r6:c7a848e0 r5:00008000
r4:00000000
[<c00cc9f0>] (do_mount+0x0/0x734) from [<c00cd1c4>] (sys_mount+0xa0/0xd0) [<c00cd124>] (sys_mount+0x0/0xd0) from [<c0008dd4>] (mount_block_root+0x98/0x2c8)
r7:c0023e88 r6:c781b000 r5:00008000 r4:c781b000
[<c0008d3c>] (mount_block_root+0x0/0x2c8) from [<c00090f0>] (prepare_namespace+0x80/0x1c4)
[<c0009070>] (prepare_namespace+0x0/0x1c4) from [<c0008480>] (kernel_init+0x110/0x158)
r7:00000013 r6:c0023300 r5:c0023668 r4:c0023668
[<c0008370>] (kernel_init+0x0/0x158) from [<c0043d58>] (do_exit+0x0/0x750)
r7:00000013 r6:c0043d58 r5:c0008370 r4:00000000

I didn't ever see the -74 errors or the assertion I placed in ubifs_write_node().

Best Regards,
Ben Gardiner

---
Nanometrics Inc.
http://www.nanometrics.ca

#16 lore raw
In reply to Ben Gardiner
Quoted 8 lines · Ben Gardiner

In testing Mattew Creech's free-space-fixup flag series I found that was unable to boot a da850evm which had flashed to it's NAND a ubinized image containing a UBIFS that has the free-space-fixup flag set.

The cause of the problem was found to be the call to ubifs_write_master() from mount_ubifs() as is evidenced the backtrace produced by the assertion introduced in the first patch of this series; where the assertion introduced is that c->space_fixup is false when ubifs_write_node() is called.

So the fixes are now in the ubifs tree. You can see them in the linux-next banch's tip or in the master branch under a pile of other changes. The point is that linux-next currently contains what I want to merge to linux-3.0 and master branch contains the same plus a pile of things for linux-3.1.

Signature · 2 lines
Best Regards,
Artem Bityutskiy (Артём Битюцкий)