Wind River Support Network

HomeDefectsLIN4-13731
Fixed

LIN4-13731 : jffs_gcd_mtd hang and cause kernel panic

Created: Dec 2, 2012    Updated: May 18, 2015
Resolved Date: Jan 31, 2013
Found In Version: 4.3
Fix Version: 4.2,4.3.0.13
Severity: Severe
Applicable for: Wind River Linux 4
Component/s: Kernel

Description

When we use jffs2 fs on their target, they have lots of R/W operation on it, 
and they are facing  jffs2_gcd_mtd block system issue, 

TIPC: Resetting link <1.1.34:leth0-1.1.48:leth0>, peer not responding fsm cnt 117 timer timeout217

TIPC: Lost contact with <1.1.48>

los_int_bit_map[0]:0x1 

los_int_bit_map[0]:0x2 

INFO: task jffs2_gcd_mtd15:338 blocked for more than 120 seconds.

"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.

jffs2_gcd_mtd D 00000000     0   338      2 0x00000000

Call Trace:

[eafd1c90] [c0008044] __switch_to+0x70/0x90

[eafd1ca0] [c067e670] schedule+0x258/0x638

[eafd1d20] [c067eaac] io_schedule+0x5c/0x90

[eafd1d30] [c00bee80] sync_page+0x54/0x74

[eafd1d40] [c067f020] __wait_on_bit_lock+0x9c/0x108

[eafd1d70] [c00bedf8] __lock_page+0x88/0x98

[eafd1da0] [c00bf830] do_read_cache_page+0x188/0x1a4

[eafd1de0] [c0271534] jffs2_gc_fetch_page+0x30/0xac

[eafd1df0] [c026ead0] jffs2_garbage_collect_live+0x4c0/0xec4

[eafd1ea0] [c026fac8] jffs2_garbage_collect_pass+0x5f4/0x738

[eafd1f00] [c0271394] jffs2_garbage_collect_thread+0x188/0x1a0

[eafd1fb0] [c006821c] kthread+0x78/0x7c

[eafd1ff0] [c001075c] original_kernel_thread+0x4c/0x68

INFO: task kernel_dbg_task:404 blocked for more than 120 seconds.

"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.

kernel_dbg_ta D 00000000     0   404      2 0x00000000

Call Trace:

[eafd5b60] [c0008044] __switch_to+0x70/0x90

[eafd5b70] [c067e670] schedule+0x258/0x638

[eafd5bf0] [c067f4f4] __mutex_lock_slowpath+0x174/0x230

[eafd5c40] [c067f600] mutex_lock+0x50/0x54

[eafd5c50] [c0269838] jffs2_reserve_space+0x48/0x204

[eafd5c80] [c026c9c8] jffs2_write_inode_range+0x224/0x2d4

[eafd5cf0] [c0266a7c] jffs2_write_end+0x118/0x300

[eafd5d30] [c00be1d8] generic_file_buffered_write+0x10c/0x290

[eafd5dc0] [c00c072c] __generic_file_aio_write+0x33c/0x508

[eafd5e30] [c00c0968] generic_file_aio_write+0x70/0xf0

[eafd5e60] [c00ffd18] do_sync_write+0xac/0x120

[eafd5f00] [c01009e8] vfs_write+0xb4/0x158

[eafd5f20] [c0100c00] sys_write+0x50/0x10c

[eafd5f60] [f28753c0] kernel_runlog+0x84/0xd0 [krunlog]

[eafd5f90] [f287569c] kernel_dbg_runlog+0x70/0x214 [krunlog]

[eafd5fb0] [c006821c] kthread+0x78/0x7c

[eafd5ff0] [c001075c] original_kernel_thread+0x4c/0x68

INFO: task monitor:668 blocked for more than 120 seconds.

"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.

monitor       D 0fe7779c     0   668    661 0x00000000

Call Trace:

[eb7cbb40] [c0008044] __switch_to+0x70/0x90

[eb7cbb50] [c067e670] schedule+0x258/0x638

[eb7cbbd0] [c067f4f4] __mutex_lock_slowpath+0x174/0x230

[eb7cbc20] [c067f600] mutex_lock+0x50/0x54

[eb7cbc30] [c0269838] jffs2_reserve_space+0x48/0x204

[eb7cbc60] [c026c9c8] jffs2_write_inode_range+0x224/0x2d4

[eb7cbcd0] [c0266a7c] jffs2_write_end+0x118/0x300

[eb7cbd10] [c00be1d8] generic_file_buffered_write+0x10c/0x290

[eb7cbda0] [c00c072c] __generic_file_aio_write+0x33c/0x508

[eb7cbe10] [c00c0968] generic_file_aio_write+0x70/0xf0

[eb7cbe40] [c00ffd18] do_sync_write+0xac/0x120

[eb7cbee0] [c01009e8] vfs_write+0xb4/0x158

[eb7cbf00] [c0100c00] sys_write+0x50/0x10c

[eb7cbf40] [c0010a44] ret_from_syscall+0x0/0x4

--- Exception: c01 at 0xfe7779c

    LR = 0xfe77784

Steps to Reproduce

Customer has put a patch from the community, but not sure if this works 

diff -Nur linux/mm/filemap.c linux_74xx/mm/filemap.c
--- linux/mm/filemap.c      2009-09-28 13:13:06.000000000 +0900
+++ linux_74xx/mm/filemap.c        2011-12-13 17:45:21.000000000 +0900
@@ -1710,6 +1710,46 @@
}
EXPORT_SYMBOL(read_cache_page_async);
+struct page *read_cache_page_async_trylock(struct address_space *mapping,
+                                                              pgoff_t index,
+                                                              int (*filler)(void *,struct page*),
+                                                              void *data)
+{
+              struct page *page;
+              int err;
+
+retry:
+              page = __read_cache_page(mapping, index, filler, data);
+              if (IS_ERR(page))
+                              return page;
+              if (PageUptodate(page))
+                              goto out;
+
+              if (!trylock_page(page)) {
+                              page_cache_release(page);
+                              return ERR_PTR(-EBUSY);
+              }
+              if (!page->mapping) {
+                              unlock_page(page);
+                              page_cache_release(page);
+                              goto retry;
+              }
+              if (PageUptodate(page)) {
+                              unlock_page(page);
+                              goto out;
+              }
+              err = filler(data, page);
+              if (err < 0) {
+                              page_cache_release(page);
+                              return ERR_PTR(err);
+              }
+out:
+              mark_page_accessed(page);
+              return page;
+}
+EXPORT_SYMBOL(read_cache_page_async_trylock);
+
+
/**
  * read_cache_page - read into page cache, fill it if needed
  * @mapping:    the page's address_space
diff -Nur linux/fs/jffs2/fs.c linux_74xx/fs/jffs2/fs.c
--- linux/fs/jffs2/fs.c             2009-09-28 13:11:46.000000000 +0900
+++ linux_74xx/fs/jffs2/fs.c               2011-12-13 17:45:21.000000000 +0900
@@ -656,11 +656,12 @@
               struct inode *inode = OFNI_EDONI_2SFFJ(f);
               struct page *pg;
-               pg = read_cache_page_async(inode->i_mapping, offset >> PAGE_CACHE_SHIFT,
+              pg = read_cache_page_async_trylock(inode->i_mapping, offset >> PAGE_CACHE_SHIFT,
                                                    (void *)jffs2_do_readpage_unlock, inode);
               if (IS_ERR(pg))
                               return (void *)pg;
+
               *priv = (unsigned long)pg;
               return kmap(pg);
}

The error info when the fs is locked(dmesg s output) :
TIPC: Resetting link <1.1.34:leth0-1.1.48:leth0>, peer not responding fsm cnt 117 timer timeout217
TIPC: Lost contact with <1.1.48>
los_int_bit_map[0]:0x1 
los_int_bit_map[0]:0x2 
INFO: task jffs2_gcd_mtd15:338 blocked for more than 120 seconds.
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
jffs2_gcd_mtd D 00000000     0   338      2 0x00000000
Call Trace:
[eafd1c90] [c0008044] __switch_to+0x70/0x90
[eafd1ca0] [c067e670] schedule+0x258/0x638
[eafd1d20] [c067eaac] io_schedule+0x5c/0x90
[eafd1d30] [c00bee80] sync_page+0x54/0x74
[eafd1d40] [c067f020] __wait_on_bit_lock+0x9c/0x108
[eafd1d70] [c00bedf8] __lock_page+0x88/0x98
[eafd1da0] [c00bf830] do_read_cache_page+0x188/0x1a4
[eafd1de0] [c0271534] jffs2_gc_fetch_page+0x30/0xac
[eafd1df0] [c026ead0] jffs2_garbage_collect_live+0x4c0/0xec4
[eafd1ea0] [c026fac8] jffs2_garbage_collect_pass+0x5f4/0x738
[eafd1f00] [c0271394] jffs2_garbage_collect_thread+0x188/0x1a0
[eafd1fb0] [c006821c] kthread+0x78/0x7c
[eafd1ff0] [c001075c] original_kernel_thread+0x4c/0x68
INFO: task kernel_dbg_task:404 blocked for more than 120 seconds. /****/
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
kernel_dbg_ta D 00000000     0   404      2 0x00000000
Call Trace:
[eafd5b60] [c0008044] __switch_to+0x70/0x90
[eafd5b70] [c067e670] schedule+0x258/0x638
[eafd5bf0] [c067f4f4] __mutex_lock_slowpath+0x174/0x230
[eafd5c40] [c067f600] mutex_lock+0x50/0x54
[eafd5c50] [c0269838] jffs2_reserve_space+0x48/0x204
[eafd5c80] [c026c9c8] jffs2_write_inode_range+0x224/0x2d4
[eafd5cf0] [c0266a7c] jffs2_write_end+0x118/0x300
[eafd5d30] [c00be1d8] generic_file_buffered_write+0x10c/0x290
[eafd5dc0] [c00c072c] __generic_file_aio_write+0x33c/0x508
[eafd5e30] [c00c0968] generic_file_aio_write+0x70/0xf0
[eafd5e60] [c00ffd18] do_sync_write+0xac/0x120
[eafd5f00] [c01009e8] vfs_write+0xb4/0x158
[eafd5f20] [c0100c00] sys_write+0x50/0x10c
[eafd5f60] [f28753c0] kernel_runlog+0x84/0xd0 [krunlog]
[eafd5f90] [f287569c] kernel_dbg_runlog+0x70/0x214 [krunlog]
[eafd5fb0] [c006821c] kthread+0x78/0x7c
[eafd5ff0] [c001075c] original_kernel_thread+0x4c/0x68
INFO: task monitor:668 blocked for more than 120 seconds.
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
monitor       D 0fe7779c     0   668    661 0x00000000
Call Trace:
[eb7cbb40] [c0008044] __switch_to+0x70/0x90
[eb7cbb50] [c067e670] schedule+0x258/0x638
[eb7cbbd0] [c067f4f4] __mutex_lock_slowpath+0x174/0x230
[eb7cbc20] [c067f600] mutex_lock+0x50/0x54
[eb7cbc30] [c0269838] jffs2_reserve_space+0x48/0x204
[eb7cbc60] [c026c9c8] jffs2_write_inode_range+0x224/0x2d4
[eb7cbcd0] [c0266a7c] jffs2_write_end+0x118/0x300
[eb7cbd10] [c00be1d8] generic_file_buffered_write+0x10c/0x290
[eb7cbda0] [c00c072c] __generic_file_aio_write+0x33c/0x508
[eb7cbe10] [c00c0968] generic_file_aio_write+0x70/0xf0
[eb7cbe40] [c00ffd18] do_sync_write+0xac/0x120
[eb7cbee0] [c01009e8] vfs_write+0xb4/0x158
[eb7cbf00] [c0100c00] sys_write+0x50/0x10c
[eb7cbf40] [c0010a44] ret_from_syscall+0x0/0x4
--- Exception: c01 at 0xfe7779c
    LR = 0xfe77784

Other Downloads


Live chat
Online