Author: Babrian Viktor Date: To: yaffs Subject: [Yaffs] power cycle during rm
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).
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?