summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorRobert Yang <liezhi.yang@windriver.com>2013-07-18 17:33:56 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-08-26 11:47:19 +0100
commit2cece576b351228cb24bf24a53845646a51f7f6b (patch)
tree1d8568a8cffe30bfcd7e0c605b025535a7e5d023 /meta
parenta758b9302145d0a5b8f6b0e7d276b521ccd49061 (diff)
downloadpoky-2cece576b351228cb24bf24a53845646a51f7f6b.tar.gz
e2fsprogs: only update the icache for ext2_inode
We only read the cache when: bufsize == sizeof(struct ext2_inode) then we should only update the cache in the same condition, otherwise there would be errors, for example: cache[0]: cached ino 14 when bufsize = 128 by ext2fs_write_inode_full() cache[1]: cached ino 14 when bufsize = 156 by ext2fs_read_inode_full() Then update the cache: cache[0]: cached ino 15 when bufsize = 156 by ext2fs_read_inode_full() Then the ino 14 would hit the cache[1] when bufsize = 128 (but it was cached by bufsize = 156), so there would be errors. [YOCTO #3848] (From OE-Core rev: ad8452196c5b1a54c14fd00bbf421f68aea65186) Signed-off-by: Robert Yang <liezhi.yang@windriver.com> Signed-off-by: Saul Wold <sgw@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/fix-icache.patch69
-rw-r--r--meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.8.bb1
2 files changed, 70 insertions, 0 deletions
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/fix-icache.patch b/meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/fix-icache.patch
new file mode 100644
index 0000000000..ad4e3439f4
--- /dev/null
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs-1.42.8/fix-icache.patch
@@ -0,0 +1,69 @@
1inode.c: only update the icache for ext2_inode
2
3We only read the cache when:
4
5bufsize == sizeof(struct ext2_inode)
6
7then we should only update the cache in the same condition, otherwise
8there would be errors, for example:
9
10cache[0]: cached ino 14 when bufsize = 128 by ext2fs_write_inode_full()
11cache[1]: cached ino 14 when bufsize = 156 by ext2fs_read_inode_full()
12
13Then update the cache:
14cache[0]: cached ino 15 when bufsize = 156 by ext2fs_read_inode_full()
15
16Then the ino 14 would hit the cache[1] when bufsize = 128 (but it was
17cached by bufsize = 156), so there would be errors.
18
19Note: the upstream has changed the icache lot, so this patch is
20inappropriate for the upstream, we can drop this patch when we update
21the package.
22
23Upstream-Status: [Inappropriate]
24
25Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
26---
27 lib/ext2fs/inode.c | 20 ++++++++++++--------
28 1 file changed, 12 insertions(+), 8 deletions(-)
29
30diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
31--- a/lib/ext2fs/inode.c
32+++ b/lib/ext2fs/inode.c
33@@ -612,10 +612,12 @@ errcode_t ext2fs_read_inode_full(ext2_filsys fs, ext2_ino_t ino,
34 #endif
35
36 /* Update the inode cache */
37- fs->icache->cache_last = (fs->icache->cache_last + 1) %
38- fs->icache->cache_size;
39- fs->icache->cache[fs->icache->cache_last].ino = ino;
40- fs->icache->cache[fs->icache->cache_last].inode = *inode;
41+ if (bufsize == sizeof(struct ext2_inode)) {
42+ fs->icache->cache_last = (fs->icache->cache_last + 1) %
43+ fs->icache->cache_size;
44+ fs->icache->cache[fs->icache->cache_last].ino = ino;
45+ fs->icache->cache[fs->icache->cache_last].inode = *inode;
46+ }
47
48 return 0;
49 }
50@@ -648,10 +650,12 @@ errcode_t ext2fs_write_inode_full(ext2_filsys fs, ext2_ino_t ino,
51
52 /* Check to see if the inode cache needs to be updated */
53 if (fs->icache) {
54- for (i=0; i < fs->icache->cache_size; i++) {
55- if (fs->icache->cache[i].ino == ino) {
56- fs->icache->cache[i].inode = *inode;
57- break;
58+ if (bufsize == sizeof(struct ext2_inode)) {
59+ for (i=0; i < fs->icache->cache_size; i++) {
60+ if (fs->icache->cache[i].ino == ino) {
61+ fs->icache->cache[i].inode = *inode;
62+ break;
63+ }
64 }
65 }
66 } else {
67--
681.8.1.2
69
diff --git a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.8.bb b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.8.bb
index 22618e63fb..2681f98f00 100644
--- a/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.8.bb
+++ b/meta/recipes-devtools/e2fsprogs/e2fsprogs_1.42.8.bb
@@ -5,6 +5,7 @@ SRC_URI += "file://acinclude.m4 \
5 file://remove.ldconfig.call.patch \ 5 file://remove.ldconfig.call.patch \
6 file://debugfs-too-short.patch \ 6 file://debugfs-too-short.patch \
7 file://debugfs-sparse-copy.patch \ 7 file://debugfs-sparse-copy.patch \
8 file://fix-icache.patch \
8" 9"
9 10
10SRC_URI[md5sum] = "8ef664b6eb698aa6b733df59b17b9ed4" 11SRC_URI[md5sum] = "8ef664b6eb698aa6b733df59b17b9ed4"