Re: [Yaffs] duplicate directories and file reverting to prev…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: yaffs
CC: Mark Whitney
Subject: Re: [Yaffs] duplicate directories and file reverting to previous contents
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

>
> ...
>
> <reboot>
> 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

>
> ...
>
> <reboot>
>
> ...
>
> 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.

-- Charles