[Yaffs] yaffs2 crashes kernel during 'cp'

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Matthias Fuchs
Date:  
To: yaffs
Subject: [Yaffs] yaffs2 crashes kernel during 'cp'
Hi,

I got yaffs2 crashing my kernel on a PPC440EPx board with a
very recent kernel (2.6.21-rc6), the ndfc NAND flash driver for the
on-chip NAND controller and the yaffs code from todays CVS.
The board uses a 256MiB NAND flash. This is what I am doing after booting:

# This is how my mtd devices look like:
du440:~# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00200000 00010000 "kernel"
mtd1: 001a0000 00010000 "initrd"
mtd2: 00060000 00010000 "u-boot"
mtd3: 10000000 00020000 "NAND 256MiB 3,3V 8-bit"
mtd4: 10000000 00020000 "content0"


# First I erase the complete NAND flash:
du440:~# flash_eraseall /dev/mtd4
Erasing 128 Kibyte @ 8140000 -- 50 % complete.
Skipping bad block at 0x08160000
Erasing 128 Kibyte @ f720000 -- 96 % complete.
Skipping bad block at 0x0f740000
Erasing 128 Kibyte @ ffe0000 -- 99 % complete.

# Then I mount it an get a lot of messages because of the checkpointing (BTW:
cool stuff ... and the reason why not using JFFS2):
du440:~# mount /nand0
....
find next checkpt block: search: block 2046 oid 0 seq 0 eccr 0
find next checkpt block: search: block 2047 oid 0 seq 0 eccr 0
find next checkpt block: search: block 2048 oid 0 seq 0 eccr 0
found no more checkpt blocks
checkpoint byte count 0
restore exit: isCheckpointed 0
block 1036 is bad
block 1979 is bad

# Here we are:
du440:~# df
Filesystem           1K-blocks      Used Available Use% Mounted on
...
/dev/mtdblock4          262144      2304    259840   1% /nand0


# Writing small files seems to be fine:
du440:~# dd if=/dev/zero of=/nand0/test1 bs=2k count=1
1+0 records in
1+0 records out
2048 bytes (2.0 kB) copied, 0.002135 seconds, 959 kB/s
du440:~# dd if=/dev/zero of=/nand0/test2 bs=2k count=2
2+0 records in
2+0 records out
4096 bytes (4.1 kB) copied, 0.003045 seconds, 1.3 MB/s

# But writing a bigger file crashes the system:
du440:~# cp /bin/bash /nand0/
------------[ cut here ]------------
Kernel BUG at c013bca8 [verbose debug info unavailable]
Oops: Exception in kernel mode, sig: 5 [#1]
NIP: C013BCA8 LR: C013BC34 CTR: 00000000
REGS: ef893a00 TRAP: 0700 Not tainted (2.6.21-rc6-g77c69916-dirty)
MSR: 00029000 <EE,ME> CR: 22424422 XER: 00000000
TASK = c0cd3bf0[2548] 'cp' THREAD: ef892000
GPR00: C013BC34 EF893AB0 C0CD3BF0 EF893AC8 00000005 EF893AC8 C029E50C 00000005
GPR08: 000000CC 00000000 FFFFFFF0 00000010 EF893BC0 10027788 28004422 00001000
GPR16: C0334458 EF893C3C EF893C38 00000000 00000000 00000000 00000000 00000001
GPR24: EF893BC0 00000000 00000000 C0FB2CE0 00000000 00004000 EF893BC0 C0352000
NIP [C013BCA8] nandmtd2_WriteChunkWithTagsToNAND+0xd0/0xd8
LR [C013BC34] nandmtd2_WriteChunkWithTagsToNAND+0x5c/0xd8
Call Trace:
[EF893AB0] [C013BC34] nandmtd2_WriteChunkWithTagsToNAND+0x5c/0xd8 (unreliable)
[EF893B10] [C013A22C] yaffs_WriteChunkWithTagsToNAND+0x7c/0x138
[EF893B30] [C0134558] yaffs_WriteNewChunkWithTagsToNAND+0x3c8/0x54c
[EF893B70] [C0135E70] yaffs_WriteChunkDataToObject+0x94/0xe8
[EF893C30] [C013657C] yaffs_WriteDataToFile+0x1fc/0x2c8
[EF893C90] [C012F600] yaffs_commit_write+0xd8/0x2c8
[EF893CD0] [C003D2EC] generic_file_buffered_write+0x210/0x9c8
[EF893D90] [C003ED30] __generic_file_aio_write_nolock+0x2dc/0x578
[EF893E00] [C003F034] generic_file_aio_write+0x68/0x10c
[EF893E30] [C00615E0] do_sync_write+0xc0/0x134
[EF893EF0] [C0061B8C] vfs_write+0xcc/0x16c
[EF893F10] [C0062628] sys_write+0x4c/0x90
[EF893F40] [C0001C64] ret_from_syscall+0x0/0x3c
Instruction dump:
7f6903a6 38e10024 4e800421 20030000 7c601914 80010064 bb410048 7c0803a6
38210060 4e800020 0fe00000 48000000 <0fe00000> 48000000 7c0802a6 7d800026

Message from syslogd@du440 at Mon Apr 16 18:30:44 2007 ...
du440 kernel: ------------[ cut here ]------------

I will start debugging tomorrow to see if one of the BUG()-calls in
nandmtd2_WriteChunkWithTagsToNAND() causes this crash.

Am I doing anytinhg completely wrong?

Matthias