前言
JFFS2的全名为JournallingFlashFileSystemVersion2(闪存日志型文件系统第2版),其功能就是管理在MTD设备上实现的日志型文件系统。与其他的存储设备存储方案相比,JFFS2并不准备提供让传统文件系统也可以使用此类设备的转换层。它只会直接在MTD设备上实现日志结构的文件系统。JFFS2会在安装的时候,扫描MTD设备的日志内容,并在RAM中重新建立文件系统结构本身。
除了提供具有断电可靠性的日志结构文件系统,JFFS2还会在它管理的MTD设备上实现“损耗平衡”和“数据压缩”等特性。
很强大很好用但是最近调试还是遇见了一些错误,先记录2个,以后遇见了再补充:
错误类型一:使用一段时间后崩溃无法启动
这是个遇见了很奇怪的现象,文件系统在使用了一段时间后崩溃需要擦除后再次重新烧写,而且使用时间似乎和使用次数无关,感觉不太符合常理:
下面是一次关于jffs2部分无法加载的错误日志:
GKHY___________________________________________________TEST NET: Registered protocol family 29 can: raw protocol (rev 20170425) can: broadcast manager protocol (rev 20170425 t) can: netlink gateway (rev 20170425) max_hops=1 Registering SWP/SWPB emulation handler hctosys: unable to open rtc device (rtc0) of_cfs_init of_cfs_init: OK ALSA device list: ▒random: crng init done jffs2: error: (1) jffs2_link_node_ref: Adding new ref ef185ba8 at (0x00700000-0x007002d0) not immediately after previous (0x00700000-0x00700000) Internal error: Oops - BUG: 0 [#1] PREEMPT SMP ARM Modules linked in: CPU: 1 PID: 1 Comm: swapper/0 Not tainted 4.14.0-xilinx #1 Hardware name: Xilinx Zynq Platform task: ef058000 task.stack: ef04e000 PC is at jffs2_link_node_ref+0x20/0x180 LR is at jffs2_link_node_ref+0x158/0x180 pc : [<c02b089c>] lr : [<c02b09d4>] psr: 60000113 sp : ef04fcc8 ip : 00000000 fp : ef029ff8 r10: c0a52f84 r9 : 0000e002 r8 : 00000000 r7 : ef248000 r6 : ef02d5b0 r5 : 000002d0 r4 : ef185ba8 r3 : 00000000 r2 : 00000000 r1 : 2ee98000 r0 : 00000090 Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none Control: 18c5387d Table: 0000404a DAC: 00000051 Process swapper/0 (pid: 1, stack limit = 0xef04e210) Stack: (0xef04fcc8 to 0xef050000) fcc0: 00700000 007002d0 00700000 00700000 ef286000 ef02d5b0 fce0: ef248032 c02bcc38 ef2b04e0 c03f3350 00004f7c 00000000 00004f84 00000000 fd00: 00004f84 00040000 00000008 20061985 00004f84 00000000 ef029ff8 ef286000 fd20: ef02d5b0 00004f84 00000008 ef248000 ef029000 00000000 ef029ff8 c02b50ec fd40: c0a52f84 ef04fd84 ef04fd80 00000000 c0a3c7c8 00001000 006ff160 ee9cf900 fd60: 000005b0 ef02d000 00000000 00700000 00000000 00000000 0000001c 006c0000 fd80: ef029000 00000000 00001000 e0021985 0000024b c02ba0dc ef286000 ef286000 fda0: 00000000 ee97bc00 00a00000 c02ba0dc ee9cfc04 00000020 00008000 c02b7af0 fdc0: c02ba0fc 00000000 00000594 00000020 00008000 00000000 ef001b40 ef286000 fde0: 00040000 ee97bc00 00a00000 c02ba0dc ee9cfc04 00000020 00008000 c02b9c14 fe00: ee97bc00 ee9c1000 00008000 00000000 c02ba0dc c03f4438 ee9c1000 00008000 fe20: 00000000 ee9cfc00 00008000 c0a115d0 00000000 c03f451c c02ba0dc ee9d1c00 fe40: c0a03e48 c0a501a8 ee9cfc00 c02b9dac 00008000 ee9cfc00 c0a115d0 00000000 fe60: 00000000 c02b9dbc c02ba0dc 00008000 ee9cfc00 c01da218 ee9d1c00 c01f28dc fe80: c0a115d0 00008000 00000020 ee9cfc00 ee9cfe40 c01f5450 00000000 ee9cfc00 fea0: c093486c 00000051 ef015110 eec08198 00000007 00000000 00000007 c01abd74 fec0: 00000007 c07e3618 ee9cfe40 ee9cfc00 00000000 00008000 00008000 c093486c fee0: c07e3618 c01f58c0 00000000 c07e3618 ee9e2000 ee9e2000 efdcac40 c093485c ff00: efffcbbc c0901104 00000000 00000000 ef7cf300 c015e578 ee9cce00 c093485c ff20: c093485c c0a3d240 c0934838 000000e6 c0a3d240 c03bdf9c 00000000 c093485c ff40: c093486c c0934838 000000e6 c0a3d240 c093e2a8 c093483c 00000000 c09014d4 ff60: fffffffe 00002710 00000009 c0a3d240 c0934838 c0900d84 00000007 00000007 ff80: 00000000 c090059c 00000000 c0650654 00000000 00000000 00000000 00000000 ffa0: 00000000 c065065c 00000000 c01070f0 00000000 00000000 00000000 00000000 ffc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 ffe0: 00000000 00000000 00000000 00000000 00000013 00000000 80026000 10100041 [<c02b089c>] (jffs2_link_node_ref) from [<c02bcc38>] (jffs2_sum_scan_sumnode+0x28c/0x4cc) [<c02bcc38>] (jffs2_sum_scan_sumnode) from [<c02b50ec>] (jffs2_scan_medium+0x400/0x1070) [<c02b50ec>] (jffs2_scan_medium) from [<c02b7af0>] (jffs2_do_mount_fs+0x170/0x608) [<c02b7af0>] (jffs2_do_mount_fs) from [<c02b9c14>] (jffs2_do_fill_super+0x164/0x20c) [<c02b9c14>] (jffs2_do_fill_super) from [<c03f4438>] (mount_mtd_aux.constprop.0+0x4c/0xac) [<c03f4438>] (mount_mtd_aux.constprop.0) from [<c03f451c>] (mount_mtd+0x84/0x138) [<c03f451c>] (mount_mtd) from [<c02b9dbc>] (jffs2_mount+0x10/0x1c) [<c02b9dbc>] (jffs2_mount) from [<c01da218>] (mount_fs+0xc/0x44) [<c01da218>] (mount_fs) from [<c01f28dc>] (vfs_kern_mount+0x4c/0xe8) [<c01f28dc>] (vfs_kern_mount) from [<c01f5450>] (do_mount+0x814/0xa44) [<c01f5450>] (do_mount) from [<c01f58c0>] (SyS_mount+0x70/0x98) [<c01f58c0>] (SyS_mount) from [<c0901104>] (mount_block_root+0x110/0x25c) [<c0901104>] (mount_block_root) from [<c09014d4>] (prepare_namespace+0x84/0x1b4) [<c09014d4>] (prepare_namespace) from [<c0900d84>] (kernel_init_freeable+0x168/0x1c8) [<c0900d84>] (kernel_init_freeable) from [<c065065c>] (kernel_init+0x8/0x108) [<c065065c>] (kernel_init) from [<c01070f0>] (ret_from_fork+0x14/0x24) Code: 124cc001 1581c024 1591402c 1a000003 (e7f001f2) ---[ end trace f7fa44ebf9c6f0ca ]--- Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b CPU0: stopping CPU: 0 PID: 0 Comm: swapper/0 Tainted: G D 4.14.0-xilinx #1 Hardware name: Xilinx Zynq Platform [<c010e894>] (unwind_backtrace) from [<c010aad0>] (show_stack+0x10/0x14) [<c010aad0>] (show_stack) from [<c063fb48>] (dump_stack+0x80/0xa0) [<c063fb48>] (dump_stack) from [<c010cff8>] (ipi_cpu_stop+0x3c/0x70) [<c010cff8>] (ipi_cpu_stop) from [<c010d818>] (handle_IPI+0x64/0x84) [<c010d818>] (handle_IPI) from [<c0101420>] (gic_handle_irq+0x84/0x90) [<c0101420>] (gic_handle_irq) from [<c010b50c>] (__irq_svc+0x6c/0xa8) Exception stack(0xc0a01f20 to 0xc0a01f68) 1f20: 00000000 00000000 2ee88000 ef7ced00 a219b87f 00000000 ef7ce1c0 00000000 1f40: 8b5cfccd 00000000 00000000 00000000 00000015 c0a01f70 c04e13e4 c04e1408 1f60: 60000013 ffffffff [<c010b50c>] (__irq_svc) from [<c04e1408>] (cpuidle_enter_state+0xe4/0x1b4) [<c04e1408>] (cpuidle_enter_state) from [<c01494a8>] (do_idle+0x148/0x1a8) [<c01494a8>] (do_idle) from [<c0149640>] (cpu_startup_entry+0x18/0x1c) [<c0149640>] (cpu_startup_entry) from [<c0900bbc>] (start_kernel+0x304/0x364) [<c0900bbc>] (start_kernel) from [<0000807c>] (0x807c) ---[ end Kernel panic - not syncing: Attempted to kill init! exitcode=0x0000000b
解决办法:
参考了https://bugzilla.redhat.com/show_bug.cgi?id=717635#c12中大佬们之间的交流,如果没有理解错误的话可能是因为summery support的问题
IfI disable jffs2 summery support in the kernel after which the kernel stopped dumping when mounting the rootfs. FYI: Although my kernel has summery support enabled I did not run sumtool on the rootfs.iffs2 before I fla shed it. Nikolai Zhubr2011-08-09 19:53:18 UTC Comment 9 Aha,I did not run sumtool too. I'll try with summary support disabled as soon as I get the board bac k. Thanks for the information. I've also just noticed that summary support is marked as "EXPERIMENTAL"(though usually enabled) in kernel configuration, whi ich probably confirms that it might cause some problems. Hx--1024
于是我也将这个选项取消了,但是需要很长时间才会检测出异常,短时间内也不知道这样的改法是否
有效。(目前已稳定运行一个月)
具体修改位置如下:
iconfig - Linux/arm 4.14.0 Kernel Configuration> File systems → Miscellaneous filesystems - Miscellaneous filesystems Arrow keys navigate the menu. <Enter> selects submenus ---> (or empty submenus ----). Highlighted letters are hotkeys. Pressing <Y> includes,<N> excludes, <M> modularizes features. Press <Esc><Esc> to exit,<?> for Help, </> for Search. Legend: [*] built-in [ ] ↑(-) <> BFS file system support <> EFs file system support (read only) <*> Journalling Flash File System v2 (JFFS2)support (0) JFFS2 debugging verbosity (0 = quiet, 2 = noisy) [*] JFFS2 write-buffering support Verify JFFS2 write-buffer reads [*] JFFS2 summary support JFFS2 XATTR support [ ] Advanced compression options for JFFS2 <> Compressed ROM file system support (cramfs) (OBSOLETE) ↓( +) Select> < Exit > < Help > Save > Load > Hx--1024
错误类型2:内核直接打印错误
在启动日志中直接可以清晰地看到jffs2 error,具体内容如下:
JFFS2 error: (1) jffs2_build_inode_pass1: child dir " dnf" (ino #1120) of dir ino #1074 appears to be a hard link JFFS2 error: (1) jffs2_build_inode_pass1: child dir "l" (ino #1170) of dir ino #1075 appears to be a hard link
原因及解决办法
: flash没有erase彻底. 在重新擦除后再次烧写文件系统就没有这样的问题了