RE: [Yaffs] Chunk Cache BUG

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Gennady Dagman
Date:  
To: yaffs
Subject: RE: [Yaffs] Chunk Cache BUG
Bingo !

After applying proposed fix we were able to get rid of various long
chased yaffs file-system corruptions (yaffs tragedy messages in boot
time, strange objects in lost+found, kernel Oops'es, lost data in files
etc). The trigger for all these problems were system reset/reboot
WITHOUT unmounting yaffs partitions.

Thanks a lot.

I believe this fix should be applied ASAP to yaffs code in repository.

Gennady Dagman.


Artis Kugevics wrote:

>Hello,
>
>following code should save data safely on NAND flash:
>
>unsigned data = 123456;
>int fd = open(any_file_name, O_WRONLY | O_CREAT, 0600);
>write(fd, &data, sizeof(data));
>fchmod(fd, any_mode);
>fsync(fd);
>close(fd);
>
>In reality data is still in Chunk Cache. If power is lost, then data is
>lost as well. Only on umount() data will be written out by
>yaffs_FlushEntireDeviceCache().


>The key here is
>       fchmod(fd, any_mode);
>between data is written and flush is called. Any attribute change on
>that file will call
>        yaffs_UpdateObjectHeader()
>function. That function will mark object as clean without flushing out
>data from Chunk Cache (dev->srCache).
>Following
>        yaffs_FlushFile()
>will not call
>        yaffs_FlushFilesChunkCache() 
>as object is already marked clean.

>
>
>I propose to call
>        yaffs_FlushFilesChunkCache(in)
>before marking object as clean in yaffs_UpdateObjectHeader() function.

>
> Artis