On Wed, Apr 13, 2011 at 18:09, Mark Whitney wrote: > > > On Wed, Apr 13, 2011 at 17:55, Charles Manning wrote: > >> On Thursday 14 April 2011 05:00:54 Mark Whitney wrote: >> > I am using YAFFS2 from the 2.6.32 kernel on an integrated NAND flash >> device >> > (running android 2.2.1_r1, if that matters). >> > >> > I am seeing 2 odd things, seems like they are related: >> > >> > 1. There are duplicate entries of the same directory (/data/system, >> below) >> > when I do ls: >> > >> > bash-3.2# mount >> > rootfs on / type rootfs (rw) >> > /dev/root on / type yaffs2 (rw,relatime) >> > tmpfs on /dev type tmpfs (rw,relatime,mode=755) >> > devpts on /dev/pts type devpts (rw,relatime,mode=600) >> > proc on /proc type proc (rw,relatime) >> > sysfs on /sys type sysfs (rw,relatime) >> > tmpfs on /mnt/asec type tmpfs (rw,relatime,mode=755,gid=1000) >> > tmpfs on /mnt/tmpfs type tmpfs >> (rw,relatime,size=194144k,mode=777,gid=1000) >> > /dev/block/mtdblock7 on /data type yaffs2 (rw,nosuid,nodev,relatime) >> > /dev/block/mtdblock8 on /cache type yaffs2 (rw,nosuid,nodev,relatime) >> > bash-3.2# ls -ailp /data >> > 1 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 ./ >> > 1 drwxrwxr-x 1 0 0 2048 Apr 13 13:50 ../ >> > 511 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 app/ >> > 510 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 >> > app-private/ >> > 441 drwx------ 1 1000 1000 2048 Jan 1 2000 backup/ >> > 264 drwxrwx--x 1 1000 1000 2048 Jul 29 2009 >> > dalvik-cache/ >> > 509 drwxrwx--x 1 1000 1000 2048 Apr 13 16:47 data/ >> > 265 drwxr-x--- 1 0 1007 2048 Jan 1 2000 >> dontpanic/ >> > 497 drwxrwxrwx 1 1000 1000 2048 Apr 13 16:39 >> energyhub/ >> > 507 drwxrwx--x 1 2000 2000 2048 Jan 1 2000 local/ >> > 2 drwxrwx--- 1 0 0 2048 Jan 1 2000 >> > lost+found/ 499 drwxrwx--t 1 1000 9998 2048 Jan 1 2000 >> > misc/ 256 drwx------ 1 0 0 2048 Apr 13 16:38 >> > property/ 498 drwxrwxr-x 1 1000 1000 2048 Apr 13 16:47 >> > system/ 498 drwxrwxr-x 1 1000 1000 2048 Apr 13 16:47 >> > system/ >> > >> > >> > 2. My duplicate /data/system inode entry keeps swapping between 506 and >> 498 >> > when I reboot the device: >> > >> > bash-3.2# date; ls -ailp /data >> > Wed Apr 13 16:46:32 UTC 2011 >> > 1 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 . >> > 1 drwxrwxr-x 1 0 0 2048 Apr 13 13:50 .. >> > 511 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 app >> > 510 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 >> > app-private 441 drwx------ 1 1000 1000 2048 Jan 1 2000 >> > backup 264 drwxrwx--x 1 1000 1000 2048 Jul 29 2009 >> > dalvik-cache >> > 509 drwxrwx--x 1 1000 1000 2048 Apr 13 16:46 data >> > 265 drwxr-x--- 1 0 1007 2048 Jan 1 2000 >> dontpanic >> > 497 drwxrwxrwx 1 1000 1000 2048 Apr 13 16:39 >> energyhub >> > 507 drwxrwx--x 1 2000 2000 2048 Jan 1 2000 local >> > 2 drwxrwx--- 1 0 0 2048 Jan 1 2000 >> lost+found >> > 499 drwxrwx--t 1 1000 9998 2048 Jan 1 2000 misc >> > 256 drwx------ 1 0 0 2048 Apr 13 16:38 >> property >> > 506 drwxrwxr-x 1 1000 1000 2048 Apr 13 16:46 system >> > 506 drwxrwxr-x 1 1000 1000 2048 Apr 13 16:46 system >> > >> > ... >> > >> > >> > Linux version 2.6.32 (mark@eddie) (gcc version 4.3.3 (GCC) ) #2 Wed Mar >> 30 >> > 18:44:20 EDT 2011 >> > >> > ... >> > >> > bash-3.2# date; ls -ailp /data >> > Wed Apr 13 16:47:11 UTC 2011 >> > 1 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 . >> > 1 drwxrwxr-x 1 0 0 2048 Apr 13 13:50 .. >> > 511 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 app >> > 510 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 >> > app-private 441 drwx------ 1 1000 1000 2048 Jan 1 2000 >> > backup 264 drwxrwx--x 1 1000 1000 2048 Jul 29 2009 >> > dalvik-cache >> > 509 drwxrwx--x 1 1000 1000 2048 Apr 13 16:46 data >> > 265 drwxr-x--- 1 0 1007 2048 Jan 1 2000 >> dontpanic >> > 497 drwxrwxrwx 1 1000 1000 2048 Apr 13 16:39 >> energyhub >> > 507 drwxrwx--x 1 2000 2000 2048 Jan 1 2000 local >> > 2 drwxrwx--- 1 0 0 2048 Jan 1 2000 >> lost+found >> > 499 drwxrwx--t 1 1000 9998 2048 Jan 1 2000 misc >> > 256 drwx------ 1 0 0 2048 Apr 13 16:38 >> property >> > 498 drwxrwxr-x 1 1000 1000 2048 Apr 13 16:45 system >> > 498 drwxrwxr-x 1 1000 1000 2048 Apr 13 16:45 system >> > >> > ... >> > >> > >> > >> > ... >> > >> > bash-3.2# date; ls -ailp /data >> > Wed Apr 13 16:55:26 UTC 2011 >> > 1 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 ./ >> > 1 drwxrwxr-x 1 0 0 2048 Apr 13 13:50 ../ >> > 511 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 app/ >> > 510 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 >> > app-private/ >> > 441 drwx------ 1 1000 1000 2048 Jan 1 2000 backup/ >> > 264 drwxrwx--x 1 1000 1000 2048 Jul 29 2009 >> > dalvik-cache/ >> > 509 drwxrwx--x 1 1000 1000 2048 Apr 13 16:47 data/ >> > 265 drwxr-x--- 1 0 1007 2048 Jan 1 2000 >> dontpanic/ >> > 497 drwxrwxrwx 1 1000 1000 2048 Apr 13 16:39 >> energyhub/ >> > 507 drwxrwx--x 1 2000 2000 2048 Jan 1 2000 local/ >> > 2 drwxrwx--- 1 0 0 2048 Jan 1 2000 >> > lost+found/ 499 drwxrwx--t 1 1000 9998 2048 Jan 1 2000 >> > misc/ 256 drwx------ 1 0 0 2048 Apr 13 16:38 >> > property/ 506 drwxrwxr-x 1 1000 1000 2048 Apr 13 16:46 >> > system/ 506 drwxrwxr-x 1 1000 1000 2048 Apr 13 16:46 >> > system/ >> > >> >> There do indeed seem to be two inodes with the same name in the one >> directory. >> They are: 506 and 498. >> >> That is not what you see in ls because ls does a readdir to fetch a name >> then >> uses lstat by name to get info about it. The look up will return the same >> values each time. >> >> The randomisation is likely caused by changes in the way the directory was >> scanned and linked. >> >> I can't figure out why the directory should have got into that state in >> the >> first place. >> > > A few more things: > > I tried "mount -o remount" a few times on the /data partition and it did > not flip the inode used for /data/system, only reboot seemed to trigger the > swap. > > As you might expect, when I moved the currently accessible copy of > /data/system out of the way and rebooted, it just used the other copy from > then on: > > bash-3.2# ls -li /data/ > 511 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 app > 510 drwxrwx--x 1 1000 1000 2048 Jan 1 2000 > app-private > 441 drwx------ 1 1000 1000 2048 Jan 1 2000 backup > 264 drwxrwx--x 1 1000 1000 2048 Jul 29 2009 > dalvik-cache > 509 drwxrwx--x 1 1000 1000 2048 Apr 13 18:37 data > 265 drwxr-x--- 1 0 1007 2048 Jan 1 2000 dontpanic > 497 drwxrwxrwx 1 1000 1000 2048 Apr 13 18:48 energyhub > 507 drwxrwx--x 1 2000 2000 2048 Jan 1 2000 local > 2 drwxrwx--- 1 0 0 2048 Jan 1 2000 lost+found > 499 drwxrwx--t 1 1000 9998 2048 Jan 1 2000 misc > 256 drwx------ 1 0 0 2048 Apr 13 18:48 property > 498 drwxrwxr-x 1 1000 1000 2048 Apr 13 18:48 system > 506 drwxrwxr-x 1 1000 1000 2048 Apr 13 18:25 system.bak > > After this I reinitialized the whole flash device with the same process a > few more times and the problem did not happen again. From then on, > /data/system consistently ended up with inode 506. Not sure if this is > terribly useful info. > I saw this same duplicate-directory-entry issue again (this time with 2 different directories) on a second device. There was is an error that appears on the console each time on boot: yaffs: dev is 32505863 name is "mtdblock7" yaffs: passed flags "" yaffs: Attempting MTD mount on 31.7, "mtdblock7" yaffs tragedy: Bad object type, -1 != 15, for object 268435455 at chunk 67709 during scan yaffs tragedy: Bad object type, 1 != 3, for object 266 at chunk 92802 during scan yaffs_read_super: isCheckpointed 0 yaffs: dev is 32505864 name is "mtdblock8" yaffs: passed flags "" yaffs: Attempting MTD mount on 31.8, "mtdblock8" yaffs_read_super: isCheckpointed 0 I remember seeing a "yaffs tragedy" error msg on the last system, but I did not capture the error text, so I do not know if it was also a "Bad object type". Is this helpful at all? > >> -- Charles >> >> >> >> >