This is an update on my in-field experience with yaffs2 compiled under linux 2.6.34 using yaffs2 code as of commit 4e188b08c5531f99f73383a85251e03a1e667b26 .


Our filesystem is remounted read-only during the boot process. No filesystem changes are expected under normal operation; we have been periodically testing filesystem integrity with rsync. Thus far one instance of file corruption has occurred after 387 device-years of operation. There was also some evidence of 3 filesystem anomalies (see below) but these were not reproducible: rsync reported files missing during its scan, but a later scan showed no issues. I'm ignoring the anomalies until there is more evidence of a problem.


The corruption was duplication of a 2k NAND page, seemingly overwriting whatever was originally there. The file in question was a compressed kernel image file. (This file is not normally read: it is the source file for the actual kernel stored on another NAND partition.) I did not verify whether rebooting corrected the issue before overwriting the corrupt file with a clean copy.  This is possible, as yaffs stores some data structures in ram. 


Per hexdump -C output below, the corruption is not due to NAND bitflips, as the entire 2k page is a duplicate of a page appearing later in the file. I do not know how to determine whether the corruption is due to the mtd layer or due to yaffs .


I would welcome any statement from yaffs developers identifying what branch or commit is recommended for use in production devices.


Rob Calhoun


% grep -A8 '69 af 63 fe 5a 0b b3 bc' uImage.corrupt | more
0012f000  69 af 63 fe 5a 0b b3 bc  87 e7 6f d0 a3 44 cf 57  |i.c.Z.....o..D.W|
0012f010  b2 9f 9f 93 e8 09 30 9f  d1 27 37 c4 52 9c d7 c7  |......0..'7.R...|
0012f020  21 fd 96 70 ff b4 f6 96  f9 e4 cf 7b 93 1e 85 fd  |!..p.......{....|
0012f030  1a 7a 80 a7 36 ec e6 93  49 81 09 e7 13 fe e8 0a  |.z..6...I.......|
0012f040  f1 e1 19 f7 6d 03 ee 43  6f ed a6 67 54 fa 15 d1  |....m..Co..gT...|
0012f050  af 80 ea ab c9 dc 27 56  3b 43 19 ed 04 0f 5b 42  |......'V;C....[B|
0012f060  ed 2c a7 76 a2 8d f1 e7  95 a4 ea 15 e5 a3 6f 77  |.,.v..........ow|
0012f070  12 0d 2e 91 18 3b 28 3f  b3 ed 69 ec 2a 6a d3 b7  |.....;(?..i.*j..|
0012f080  33 ca dc 00 3c ac f1 b0  83 b6 9b d9 54 e6 5e 94  |3...<.......T.^.|
--
00158800  69 af 63 fe 5a 0b b3 bc  87 e7 6f d0 a3 44 cf 57  |i.c.Z.....o..D.W|
00158810  b2 9f 9f 93 e8 09 30 9f  d1 27 37 c4 52 9c d7 c7  |......0..'7.R...|
00158820  21 fd 96 70 ff b4 f6 96  f9 e4 cf 7b 93 1e 85 fd  |!..p.......{....|
00158830  1a 7a 80 a7 36 ec e6 93  49 81 09 e7 13 fe e8 0a  |.z..6...I.......|
00158840  f1 e1 19 f7 6d 03 ee 43  6f ed a6 67 54 fa 15 d1  |....m..Co..gT...|
00158850  af 80 ea ab c9 dc 27 56  3b 43 19 ed 04 0f 5b 42  |......'V;C....[B|
00158860  ed 2c a7 76 a2 8d f1 e7  95 a4 ea 15 e5 a3 6f 77  |.,.v..........ow|
00158870  12 0d 2e 91 18 3b 28 3f  b3 ed 69 ec 2a 6a d3 b7  |.....;(?..i.*j..|
00158880  33 ca dc 00 3c ac f1 b0  83 b6 9b d9 54 e6 5e 94  |3...<.......T.^.|





Sent: Tuesday, December 9, 2014 9:24 PM
To: KU Yuen; yaffs@lists.aleph1.co.uk
Subject: Re: [Yaffs] yaffs2
 
Several of list members have reported the "too few arguments to function" issue. It appears that the new cache policy proposed in 30f9...7561 was not fully implemented.

In lieu of guidance from Charles Manning on whether the new cache policy code is considered stable, I rebuilt kernel 2.6.34 using the commit before the policy was introduced. 

commit 4e188b08c5531f99f73383a85251e03a1e667b26
Author: Charles Manning <cdhmanning@gmail.com>
Date:   Wed Jun 18 14:21:03 2014 +1200

    Update to support Linux 3.14/3.15
    
    Thanks to Andre Renaud for doing some of this.

Yaffs2 compiles fine at this commit.

Because we previously experienced a corruption problem with an (ancient) version of yaffs, I have been monitoring systems built using linux 2.6.34 + yaffs2 at 4e18...7b26 fairly closely. At this time we have logged around 165 device-years of use. Overall, filesystem reliability with this combination has been good. We have seen one uncorrectable bitflip error (this is the NAND hardware/mtd layer, and not related to yaffs) and one "filesystem anomaly", a duplicate symbolic link: 

$ ls -li /usr/sbin/chroot*
    989 lrwxrwxrwx    1 root     root            19 Aug 19 17:30 /usr/sbin/chroot -> /bin/busybox.nosuid
    989 lrwxrwxrwx    1 root     root            19 Aug 19 17:30 /usr/sbin/chroot -> /bin/busybox.nosuid

This was found using rsync -n to test against a filesystem mounted read-only. I don't have an explanation for it yet. mtd reported no uncorrectable errors, and there were no invisible chars in the link names. I did not do detailed forensics on the filesystem before correcting it.

Overall the yaffs2 codebase as of 4e18...7b26 seems solid for small production runs. I'd recommend additional testing before deploying widely.

-Rob Calhoun




From: KU Yuen <kuyuen@live.com>
Date: 9 Dec 2014 12:51 AM
To: "yaffs@lists.aleph1.co.uk" <yaffs@lists.aleph1.co.uk>
Subject: [Yaffs] yaffs2

Hi

I’m using ubuntu 14.04 with kernel: 3.13 and x86_64, trying to compile yaffs2 with the following error messages

fs/yaffs2/yaffs_vfs.c: In function ‘yaffs_file_flush’: 

fs/yaffs2/yaffs_vfs.c:741:2: error: too few arguments to function ‘yaffs_flush_file’ 

  yaffs_flush_file(obj, 1, 0); 

  ^ 

In file included from fs/yaffs2/yaffs_vfs.c:173:0: 

fs/yaffs2/yaffs_guts.h:879:5: note: declared here 

 int yaffs_flush_file(struct yaffs_obj *in, 

     ^ 

fs/yaffs2/yaffs_vfs.c: In function ‘yaffs_sync_object’: 

fs/yaffs2/yaffs_vfs.c:771:2: error: too few arguments to function ‘yaffs_flush_file’ 

  yaffs_flush_file(obj, 1, datasync); 

  ^ 

In file included from fs/yaffs2/yaffs_vfs.c:173:0: 

fs/yaffs2/yaffs_guts.h:879:5: note: declared here 

 int yaffs_flush_file(struct yaffs_obj *in, 

     ^ 

fs/yaffs2/yaffs_vfs.c: In function ‘yaffs_flush_inodes’: 

fs/yaffs2/yaffs_vfs.c:2190:4: error: too few arguments to function ‘yaffs_flush_file’ 

    yaffs_flush_file(obj, 1, 0); 

    ^ 

In file included from fs/yaffs2/yaffs_vfs.c:173:0: 

fs/yaffs2/yaffs_guts.h:879:5: note: declared here 

 int yaffs_flush_file(struct yaffs_obj *in, 

     ^ 

fs/yaffs2/yaffs_vfs.c: In function ‘yaffs_flush_super’: 

fs/yaffs2/yaffs_vfs.c:2203:2: error: too few arguments to function ‘yaffs_flush_whole_cache’ 

  yaffs_flush_whole_cache(dev); 

  ^ 

In file included from fs/yaffs2/yaffs_vfs.c:173:0: 

fs/yaffs2/yaffs_guts.h:885:6: note: declared here 

 void yaffs_flush_whole_cache(struct yaffs_dev *dev, int discard); 

      ^ 

make[3]: *** [fs/yaffs2/yaffs_vfs.o] Error 1 

make[2]: *** [fs/yaffs2] Error 2 

make[1]: *** [fs] Error 2 

make[1]: Leaving directory `/home/testing/kernel/source' 

make: *** [debian/stamp/build/kernel] Error 2



what can i do and how to fix it??




Peter KU