Hi,
   I'm using 4GB NAND Flash on my AT91RM9200 board, I can't mount yaffs2 partions recently:
   ("bad block" report is not pasted here)
 
[ARM ~]# cat /proc/yaffs
YAFFS built:Oct 21 2007 15:10:30
$Id: yaffs_fs.c,v 1.62 2007-08-16 20:42:11 imcd Exp $
$Id: yaffs_guts.c,v 1.51 2007-07-23 05:14:08 charles Exp $
[ARM ~]#
 
[ARM mnt]# mount /dev/mtdblock6 /mnt/data/ -t yaffs

yaffs: dev is 32505862 name is "mtdblock6"
yaffs: passed flags ""
yaffs: Attempting MTD mount on 31.6, "mtdblock6"
yaffs: auto selecting yaffs2
Unable to handle kernel NULL pointer dereference at virtual address 00000000
pgd = c3a4c000
[00000000] *pgd=23d67031, *pte=00000000, *ppte=00000000
Internal error: Oops: 817 [#1]
Modules linked in:
CPU: 0
PC is at memcpy+0x30/0x29c
LR is at __init_begin+0x3fff8000/0x30
pc : [<c00fb310>]    lr : [<00000000>]    Not tainted
sp : c3a4bb68  ip : 00000000  fp : c3a4bbac
r10: c3fec974  r9 : 00000000  r8 : 00000000
r7 : 00000000  r6 : 00000000  r5 : 00000000  r4 : 00000000
r3 : 00000000  r2 : ffffffec  r1 : c3fec994  r0 : 00000000
Flags: Nzcv  IRQs on  FIQs on  Mode SVC_32  Segment user
Control: C000317F
Table: 23A4C000  DAC: 00000015
Process mount (pid: 227, stack limit = 0xc3a4a250)
Stack: (0xc3a4bb68 to 0xc3a4c000)
bb60:                   00000000 00000000 c3a44448 c3c04000 00000000 00000000
bb80: c00e1498 c3fec974 00000001 c3c04000 00000001 c3c04000 c3a4bbc0 c3a44448
bba0: c3a4bc30 c3a4bbb0 c00e70d0 c00e1360 00000000 00000000 c0071c20 000041b6
bbc0: 00000000 0000001c 00000364 00000003 00003706 c3035f39 00000001 0000021e
bbe0: 00000028 00003dca 000000f7 00000036 000f8573 00000342 000004b4 00000000
bc00: 303030f7 00000000 c001a2fc c3c04000 0000000a c3fc5000 00000046 00000002
bc20: c0267c28 c3a4bcd8 c3a4bc34 c00e77bc c00e6cf8 c3a4a000 00000000 c3a4bcb8
bc40: c3a4bc4c c003359c c01d2a58 00000000 00000020 00000000 00000000 00000000
bc60: c020b5f6 c3c24dcc c3a4bd08 c3c24dc0 00000000 00000000 00000001 c3f65000
bc80: c3a4bc9c c3a4bc90 c0101f08 c010194c c0267c28 c3f90000 c3c24ec0 c001aa00
bca0: 00000000 00000001 c3f65000 c3a4bcc8 00020000 c3c04000 c3c24ec0 c001aa00
bcc0: 00000000 00000002 c3c24ec8 c3a4bd54 c3a4bcdc c00df718 c00e7298 00000000
bce0: 00000000 00000000 00000020 c020b5f6 c3c24dcc c3a4bd68 00000000 00000000
bd00: 00000000 00000000 6264746d 6b636f6c c3a40036 c0101f08 c010194c c3a4bd54
bd20: c3a4bd34 c00afc68 c0101f00 c032a078 c001aa00 c032a060 00008000 c3f90000
bd40: c3a4befc c3f65000 c3a4bd64 c3a4bd58 c00df918 c00df0ac c3a4bda8 c3a4bd68
bd60: c0077d84 c00df904 6264746d 6b636f6c c3870036 c3a4befc c3f65000 c3a4bd9c
bd80: c3a4bd8c c0324f70 c0324f20 fffffff4 c3f90000 c0267c68 00000000 c3a4bdc0
bda0: c3a4bdac c00df94c c0077ca4 c00df8f4 c0324f20 c3a4bde4 c3a4bdc4 c0077fe4
bdc0: c00df938 c0324f20 ffffffed c0267c68 c3f90000 00000000 c3a4be00 c3a4bde8
bde0: c0078058 c0077f9c 00008000 c3870000 c3d74000 c3a4bf74 c3a4be04 c008ea44
be00: c0078030 c3a4be10 c0023304 c00231f4 ffffffec c0376d60 c3d6317c c0019860
be20: c3a4be64 c3a4be30 c0023634 c00232f0 4012c000 c3a4bf48 00000017 ffffffff
be40: c0242808 00000017 c3a4bf10 00081000 20000013 00000000 c3a4bf0c c3a4be68
be60: c0023734 c0023440 c3a4be74 c00ff41c c00ff12c c3a4becc c3a4be84 0000012b
be80: 00000000 c3d63470 c3a4a000 c3d63470 000000e4 00000000 c3a4beb4 c3a4bea8
bea0: c3a4a000 c02456c8 00000000 00080078 c3a4bf04 c3a4bec0 c005bdb4 c005bca4
bec0: 00000044 00000000 00000000 c0245938 00000044 00000000 000200d0 c0245938
bee0: 00080078 000000d0 c0245934 ffffffff c3a4bf44 c3f90000 c3a4bf7c c3f82a0c
bf00: c0324320 c3a4bf10 c001d9a0 c0023708 00000001 00000001 00000000 00000000
bf20: 00001000 00000078 c3f90000 c3a4bf7c c001df84 c3a4a000 00000000 c3a4bf74
bf40: 00000000 c3a4bf58 c02456a4 00000000 00000000 c3d74000 00008000 c001df84
bf60: c3a4a000 00000000 c3a4bfa4 c3a4bf78 c008edf4 c008e448 c3f90000 c3f90000
bf80: c3870000 c3f65000 00080078 bec76cac ffffffff 00000015 00000000 c3a4bfa8
bfa0: c001dde0 c008ed68 00080078 bec76cac bec76e45 bec76e54 bec76e62 00008000
bfc0: 00080078 bec76cac ffffffff 00008000 00000000 00000000 00000000 00000000
bfe0: 4013a150 bec76878 0005835c 4013a15c 60000010 bec76e45 00000000 00000000
Backtrace:
[<c00e1350>] (yaffs_AddOrFindLevel0Tnode+0x0/0x160) from [<c00e70d0>] (yaffs_CheckpointRestore+0x3e8/0x5a0)
[<c00e6ce8>] (yaffs_CheckpointRestore+0x0/0x5a0) from [<c00e77bc>] (yaffs_GutsInitialise+0x534/0x1364)
[<c00e7288>] (yaffs_GutsInitialise+0x0/0x1364) from [<c00df718>] (yaffs_internal_read_super+0x67c/0x858)
[<c00df09c>] (yaffs_internal_read_super+0x0/0x858) from [<c00df918>] (yaffs_internal_read_super_mtd+0x24/0x34)
[<c00df8f4>] (yaffs_internal_read_super_mtd+0x0/0x34) from [<c0077d84>] (get_sb_bdev+0xf0/0x154)
[<c0077c94>] (get_sb_bdev+0x0/0x154) from [<c00df94c>] (yaffs_read_super+0x24/0x30)
 r8 = 00000000  r7 = C0267C68  r6 = C3F90000  r5 = FFFFFFF4
 r4 = C0324F20
[<c00df928>] (yaffs_read_super+0x0/0x30) from [<c0077fe4>] (vfs_kern_mount+0x58/0x94)
[<c0077f8c>] (vfs_kern_mount+0x0/0x94) from [<c0078058>] (do_kern_mount+0x38/0x4c)
 r7 = 00000000  r6 = C3F90000  r5 = C0267C68  r4 = FFFFFFED
[<c0078020>] (do_kern_mount+0x0/0x4c) from [<c008ea44>] (do_mount+0x60c/0x648)
 r6 = C3D74000  r5 = C3870000  r4 = 00008000
[<c008e438>] (do_mount+0x0/0x648) from [<c008edf4>] (sys_mount+0x9c/0xe8)
[<c008ed58>] (sys_mount+0x0/0xe8) from [<c001dde0>] (ret_fast_syscall+0x0/0x2c)
 r7 = 00000015  r6 = FFFFFFFF  r5 = BEC76CAC  r4 = 00080078
Code: e92d01e0 ba000003 e8b151f8 e2522020 (e8a051f8)
 Segmentation fault
[ARM mnt]#
 
 
Debugging into yaffs2 source code, I found the code which caused the Oops:
function yaffs_AddOrFindLevel0Tnode() In yaffs_guts.c:
 
  }
 } else {
  /* top is level 0 */
  if(passedTn) {
   memcpy(tn,passedTn,(dev->tnodeWidth * YAFFS_NTNODES_LEVEL0)/8);
   yaffs_FreeTnode(dev,passedTn);
  }
 }
 
tn is a NULL pointer when  fStruct->topLevel == 0 , fStruct->top == 0 and passedTn != NULL:
 
/* Traverse down to level 0, adding anything we need */
 l = fStruct->topLevel;
 tn = fStruct->top;
 
Then I tried to use no-checkpoint option after system reboot:
 
[ARM ~]# mount /dev/mtdblock6 /mnt/data/  -t yaffs2 -o no-checkpoint-read
yaffs: dev is 32505862 name is "mtdblock6"
yaffs: passed flags "no-checkpoint"
yaffs: Attempting MTD mount on 31.6, "mtdblock6"
restore entry: isCheckpointed 0
skipping checkpoint read
checkpoint byte count 0
restore exit: isCheckpointed 0
Partially written block 137 being set for retirement
Partially written block 137 being set for retirement
Partially written block 137 being set for retirement
Partially written block 137 being set for retirement
Partially written block 137 being set for retirement
mount: mounting /dev/mtdblock6 on /mnt/data failed
 
[ARM ~]# cat /proc/ysaffs
YAFFS built:Nov  1 2007 18:33:07
$Id: yaffs_fs.c,v 1.62 2007-08-16 20:42:11 imcd Exp $
$Id: yaffs_guts.c,v 1.51 2007-07-23 05:14:08 charles Exp $
Device 0 "NAND Data Storage"
startBlock......... 0
endBlock........... 32767
nDataBytesPerChunk. 2048
chunkGroupBits..... 0
chunkGroupSize..... 1
nErasedBlocks...... 32363
nReservedBlocks.... 5
nCheckptResBlocks.. 10
blocksInCheckpoint. 5
nTnodesCreated..... 100
nFreeTnodes........ 0
nObjectsCreated.... 200
nFreeObjects....... 0
nFreeChunks........ 2071315
nPageWrites........ 0
nPageReads......... 0
nBlockErasures..... 0
nGCCopies.......... 0
garbageCollections. 0
passiveGCs......... 0
nRetriedWrites..... 0
nShortOpCaches..... 10
nRetireBlocks...... 0
eccFixed........... 0
eccUnfixed......... 0
tagsEccFixed....... 0
tagsEccUnfixed..... 0
cacheHits.......... 0
nDeletedFiles...... 0
nUnlinkedFiles..... 0
nBackgroudDeletions 0
useNANDECC......... 1
isYaffs2........... 1
 
Still failed, then I tried many times with or without no-checkpoint option:
(the error reports were not same each time!)

-------------------------------------------------------------
 
Partially written block 137 being set for retirement
**>> Block 137 retired
Block 137 is in state 9 after gc, should be erased
mount: mounting /dev/mtdblock6 on /mnt/data/ failed
 
-------------------------------------------------------------
 
page 9553 in gc has no object: 603 1 1449
mount: mounting /dev/mtdblock6 on /mnt/data/ failed
 
-------------------------------------------------------------
 
Partially written block 150 being set for retirement
Partially written block 150 being set for retirement
Partially written block 150 being set for retirement
Partially written block 150 being set for retirement
Partially written block 150 being set for retirement
Partially written block 150 being set for retirement
mount: mounting /dev/mtdblock6 on /mnt/data/ failed
 
-------------------------------------------------------------
 
Partially written block 150 being set for retirement
Partially written block 150 being set for retirement
Partially written block 150 being set for retirement
Partially written block 150 being set for retirement
Partially written block 137 being set for retirement
Partially written block 137 being set for retirement
 
[ARM ~]# df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/mtdblock5            5930      5930         0 100% /
tmpfs                    31224         4     31220   0% /dev
tmpfs                    31224         0     31224   0% /tmp
tmpfs                    31224        28     31196   0% /var
/dev/mtdblock4            6781      6781         0 100% /mnt/app
/dev/mtdblock6         4194304     56544   4137760   1% /mnt/data
 
Finally, mounted OK with no-checkpoint, but some files were corrupted:
 
[ARM data]# ls -l
ls: ./MC200710312033417.cld: Value too large for defined data type
ls: ./MC2007103120335019.cld: Value too large for defined data type
ls: ./MC200710312034278.cld: Value too large for defined data type
-rw-r--r--    1 0        0         1446407 Oct 31 21:20 LB20071031211758180.cld
-rw-r--r--    1 0        0         1196419 Oct 31 21:24 LB20071031212218149.cld
 
[ARM ~]# umount /mnt/data
 
 
Remounted and failed again:

Partially written block 150 being set for retirement
Partially written block 150 being set for retirement
Partially written block 150 being set for retirement
Partially written block 7316 being set for retirement
Partially written block 7316 being set for retirement
Partially written block 7316 being set for retirement
mount: mounting /dev/mtdblock6 on /mnt/data/ failed
 
It seems that my yaffs filesystem can not work(be mounted) steadily, I don't know If it's a hardware or software problem.
 
Can somebody please help me.
 
 
Thank you very much!
 


Explore the seven wonders of the world Learn more!