Hi all,
I experience a strange phenomenon if I do a power cycle during performing
a file removal. It is easily reproduceable (at least using my setup).
I am using a fairly new (on week old or so) version of yaffs2, kernel
version 2.6.26, yaffs_guts.c version: 1.82.
(however I also got the very same results with a somewhat older version)
(note: all other functionality seems to be OK)
Here is what I do briefly:
- flash_eraseall /dev/mtd13
- mount as yaffs2
- creating 2 files (dd if=/dev/zero of=/mnt/file bs=1M count=100)
- removing the second one (interrupted by power cycle)
- reboot, mount
- df, ls show things correctly
- now I re-create the second file
- ls is correct
- df shows much less free space than expected (the usable space is
limited; free space is 'lost')
here is what I do exactly:
(flash_erase, mount not included, started from creating the second file)
/ $ ls -l /mnt
-rw-r--r-- 1 root root 104857600 Jan 1 00:04 file
drw-rw-rw- 1 root root 2048 Jan 1 00:00 lost+found
/ $ df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/mtdblock5 32768 18184 14584 55% /
tmpfs 63956 0 63956 0% /var/tmp
/dev/mtdblock13 2097152 106372 1990780 5% /mnt
/ $ dd if=/dev/zero of=/mnt/file1 bs=1M count=100
100+0 records in
100+0 records out
/ $ ls -l /mnt
-rw-r--r-- 1 root root 104857600 Jan 1 00:04 file
-rw-r--r-- 1 root root 104857600 Jan 1 00:05 file1
drw-rw-rw- 1 root root 2048 Jan 1 00:00 lost+found
/ $ df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/mtdblock5 32768 18184 14584 55% /
tmpfs 63956 0 63956 0% /var/tmp
/dev/mtdblock13 2097152 208900 1888252 10% /mnt
/ $
/ $ rm /mnt/file1
!!!!!!!! interrupted by power cycle
//after reboot, mount: (still normal)
/ $ ls -l /mnt/
-rw-r--r-- 1 root root 104857600 Jan 1 00:04 file
drw-rw-rw- 1 root root 2048 Jan 1 00:00 lost+found
/ $ df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/mtdblock5 32768 18120 14648 55% /
tmpfs 63956 0 63956 0% /var/tmp
/dev/mtdblock13 2097152 106372 1990780 5% /mnt
/ $
// and the strange part:
/ $ dd if=/dev/zero of=/mnt/file1 bs=1M count=100
ls -l /mnt
df
100+0 records in
100+0 records out
/ $ ls -l /mnt
-rw-r--r-- 1 root root 104857600 Jan 1 00:05 file
-rw-r--r-- 1 root root 104857600 Jan 1 00:01 file1
drw-rw-rw- 1 root root 2048 Jan 1 00:00 lost+found
/ $ df
Filesystem 1k-blocks Used Available Use% Mounted on
/dev/mtdblock5 32768 18124 14644 55% /
tmpfs 63956 0 63956 0% /var/tmp
/dev/mtdblock13 2097152 742624 1354528 35% /mnt
/ $
It can be seen that the number of used blocks is very high (without
reason).
/ $ cat /proc/yaffs
YAFFS built:May 19 2009 05:24:47
$Id: yaffs_fs.c,v 1.79 2009/03/17 01:12:00 wookey Exp $
$Id: yaffs_guts.c,v 1.82 2009/03/09 04:24:17 charles Exp $
Device 0 "MAP"
startBlock......... 0
endBlock........... 16383
totalBytesPerChunk. 2048
nDataBytesPerChunk. 2048
chunkGroupBits..... 0
chunkGroupSize..... 1
nErasedBlocks...... 14764
nReservedBlocks.... 5
blocksInCheckpoint. 0
nTnodesCreated..... 7400
nFreeTnodes........ 77
nObjectsCreated.... 200
nFreeObjects....... 93
nFreeChunks........ 678095
nPageWrites........ 0
nPageReads......... 0
nBlockErasures..... 695
nGCCopies.......... 2
garbageCollections. 4865
passiveGCs......... 4865
nRetriedWrites..... 0
nShortOpCaches..... 10
nRetireBlocks...... 0
eccFixed........... 0
eccUnfixed......... 0
tagsEccFixed....... 0
tagsEccUnfixed..... 0
cacheHits.......... 0
nDeletedFiles...... 1
nUnlinkedFiles..... 1
nBackgroudDeletions 0
useNANDECC......... 1
isYaffs2........... 1
inbandTags......... 0
/ $
Note: the same happens with any number of files (including 1)
I have searched the net for similar cases but the ones I found are 4 years
old and seemingly solved.
Is the problem familiar to anyone here?
What logs/traces should I make to find the lost blocks?
Any help is appreciated,
Viktor Babrian