[Yaffs] [PATCH YAFFS2 CVS] fix writepage when extending a fi…

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Luc Van Oostenryck
Date:  
To: Charles Manning, yaffs
Old-Topics: [Yaffs] [PATCH RFC YAFFS] fix writepage when extending a file
Subject: [Yaffs] [PATCH YAFFS2 CVS] fix writepage when extending a file but ...
Luc Van Oostenryck wrote:
<snip>
> OK, I found it.
> It is changed by the yaffs_writepage() called by vmtruncate(),
> but there is a bug there when we are extending the file.
>
> The problem was detected whe traces in yaffs_writepage() reported the 
> following:
>     yaffs_writepage at 0001d000, size 000001d8
>     writepag0: obj = 0e1d8, ino = 0e1d8
>                      ^^^^^
>     Chunk -1 not found zero instead
>     writepag1: obj = 1d1d8, ino = 0e1d8
>                      ^^^^^

>
> I need to check if there is not similar corner case, but the attached patch
> seems to indeed solve the problems, at least the test is runnig well now.
>
>> Apart this, I think that in the case of a resizing down, the object
>> header
>> can be updated several times: once in yaffs_ResizeFile and once in
>> yaffs_SetAttributes.
>>
>



An updated fix is now in CVS (an unlock_page() was missing).

But the way a file resizing is now done is slighty more costly that it is
really needed: both a resizing up and a resizing down update the object header
two times: one in yaffs_SetAttributes() where we update all the inode field but the size
even if these remain unchanged and another time in yaffs_ResizeFile()
when we are downsizing the file and via yaffs_writepage() whe we extend the file.
Fixing the downsizing case seems easy, for the upsizing, I need to investigate a lot
to first understand how things are supposed to works.
I think we will need to separate in yaffs_setattr() the cases where the size change from
the other cases to solve this.


Luc