Re: [Yaffs] Powerloss behaviour...

Top Page
Attachments:
Message as email
+ (text/plain)
Delete this message
Reply to this message
Author: Charles Manning
Date:  
To: yaffs
Subject: Re: [Yaffs] Powerloss behaviour...
On Tuesday 13 November 2007 05:26:57 Matthieu Vincenot wrote:
> Hello,
>
> I'm using a yaffs1 partition on an embedded device where file integrity
> is of the utmost importance.
>
> To manage the files updates atomically, I'm using a sequence of
> operation where I create working copy under an alias, update it and
> rename it into the name of the original file once the work is completed.
>
>
> If there is a power loss occurring before the rename, we will retrieve
> the original version, if it occurs after that, the new version should be
> there.
>
> It's almost working but it appears that there is a very narrow window
> where a powerloss is leaving me with the two versions under the same
> name (but different inode) in the same directory. The rename and the
> delete of the previous version are 2 distinct operations and if we lose
> power between the 2, the problem occurs.
>
> Is there a way to prevent this? My idea was to alter the intial scanning
> to check for non deleted sibling with the same name and keep the one
> with the most recent sequence number and scrap the other one.
>
> Anyone knows if this issue is specific to yaffs1? Would there be the
> same issue with yaffs2?


This problem was fixed in the yaffs2 codebase. I strongly suggest using that
instead.

The problem was due to rename-over not being handled properly. This was fixed
by introducing "shadowing" in V1.16.


>
> I've got another issue, which is probably specific to yaffs1. I find
> that during the initial scan, if I encounter the header for a deleted
> file (parent is deleted dir), that object is destroyed (Line 5806)
> despite the fact that more chunks for that file may be encountered later
> in the scan... This leads to these chunks being placed in lost+found.
> Has anyone else noticed that ? Is there something I'm doing wrong ?


See if the yaffs2 codebase fixes that too.

-- Charles