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