summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0067-UBIFS-fix-a-bug-in-empty-space-fix-up.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0067-UBIFS-fix-a-bug-in-empty-space-fix-up.patch')
-rw-r--r--recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0067-UBIFS-fix-a-bug-in-empty-space-fix-up.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0067-UBIFS-fix-a-bug-in-empty-space-fix-up.patch b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0067-UBIFS-fix-a-bug-in-empty-space-fix-up.patch
new file mode 100644
index 00000000..c51b1770
--- /dev/null
+++ b/recipes-kernel/linux/linux-ti33x-psp-3.2/3.2.24/0067-UBIFS-fix-a-bug-in-empty-space-fix-up.patch
@@ -0,0 +1,67 @@
1From f6ba94c29333fa6df9b3b553415e93bafbd3c831 Mon Sep 17 00:00:00 2001
2From: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
3Date: Sat, 14 Jul 2012 14:33:09 +0300
4Subject: [PATCH 067/109] UBIFS: fix a bug in empty space fix-up
5
6commit c6727932cfdb13501108b16c38463c09d5ec7a74 upstream.
7
8UBIFS has a feature called "empty space fix-up" which is a quirk to work-around
9limitations of dumb flasher programs. Namely, of those flashers that are unable
10to skip NAND pages full of 0xFFs while flashing, resulting in empty space at
11the end of half-filled eraseblocks to be unusable for UBIFS. This feature is
12relatively new (introduced in v3.0).
13
14The fix-up routine (fixup_free_space()) is executed only once at the very first
15mount if the superblock has the 'space_fixup' flag set (can be done with -F
16option of mkfs.ubifs). It basically reads all the UBIFS data and metadata and
17writes it back to the same LEB. The routine assumes the image is pristine and
18does not have anything in the journal.
19
20There was a bug in 'fixup_free_space()' where it fixed up the log incorrectly.
21All but one LEB of the log of a pristine file-system are empty. And one
22contains just a commit start node. And 'fixup_free_space()' just unmapped this
23LEB, which resulted in wiping the commit start node. As a result, some users
24were unable to mount the file-system next time with the following symptom:
25
26UBIFS error (pid 1): replay_log_leb: first log node at LEB 3:0 is not CS node
27UBIFS error (pid 1): replay_log_leb: log error detected while replaying the log at LEB 3:0
28
29The root-cause of this bug was that 'fixup_free_space()' wrongly assumed
30that the beginning of empty space in the log head (c->lhead_offs) was known
31on mount. However, it is not the case - it was always 0. UBIFS does not store
32in it the master node and finds out by scanning the log on every mount.
33
34The fix is simple - just pass commit start node size instead of 0 to
35'fixup_leb()'.
36
37Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com>
38Reported-by: Iwo Mergler <Iwo.Mergler@netcommwireless.com>
39Tested-by: Iwo Mergler <Iwo.Mergler@netcommwireless.com>
40Reported-by: James Nute <newten82@gmail.com>
41Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
42---
43 fs/ubifs/sb.c | 8 ++++++--
44 1 files changed, 6 insertions(+), 2 deletions(-)
45
46diff --git a/fs/ubifs/sb.c b/fs/ubifs/sb.c
47index 6094c5a..b73ecd8 100644
48--- a/fs/ubifs/sb.c
49+++ b/fs/ubifs/sb.c
50@@ -715,8 +715,12 @@ static int fixup_free_space(struct ubifs_info *c)
51 lnum = ubifs_next_log_lnum(c, lnum);
52 }
53
54- /* Fixup the current log head */
55- err = fixup_leb(c, c->lhead_lnum, c->lhead_offs);
56+ /*
57+ * Fixup the log head which contains the only a CS node at the
58+ * beginning.
59+ */
60+ err = fixup_leb(c, c->lhead_lnum,
61+ ALIGN(UBIFS_CS_NODE_SZ, c->min_io_size));
62 if (err)
63 goto out;
64
65--
661.7.7.6
67