Luc Van Oostenryck wrote:
> Luc Van Oostenryck wrote:
> <snip>
>
>
> An updated fix is now in CVS (an unlock_page() was missing).
>
While, the patch I commited seems to not harm, I think it is wrong.
First, the check that I added is only valid if yaffs_writepage is
only called when resizing a file; I can't guarantee this (I need to check
what is done for writes via mmap).
Secondly, the a similar problem exist when downsizing a file (but the situation
is reversed: the size in the object is already updated, but the inode size is not).
Example: the old size is 0x3db22, we truncate to 0xf7:
setattr 1: obj = 000f7, ino = 3db22, attr = 000f7
yaffs_writepage at 00010000, size 00001000
writepag0: obj = 000f7, ino = 000f7
writepag1: obj = 11000, ino = 000f7
^^^^^
Boing!
My conclusion, for the moment, is that these sort of checks can only be done
correctely if we know what sort of operation is being down: downsizing, upsizing,
other and I not sure at all we can know this.
I think the correct fix we be to implement a truncate method (called by vmtruncate
before the call to writepage are done) and do there the check, update of the object
or inode size and in case of downsizing mark the old page as dirty (like other fs seems
to do). Probably the call to yaffs_ResizeFile() should be done there also.
I will look at this sunday.
Luc