Hi,

On 08 Feb 2011, Zabaluev Mikhail (Nokia-MS/Helsinki) wrote:
>> I would use fdatasync().
> 
> What about ensuring that file metadata are synced as well (e.g. the
> file itself cannot be lost on the filesystem)?

Rémi already responded about fdatasync semantics, but I do
wonder a bit about directory flushing (or lack of it).

Many filesystems implement special-casing for rename() which in 
practise solves the problem, but current ofono code does not 
actually call rename but instead 'link(tmp,real);unlink(tmp)'. This 
is ok for transaction safety, but possibly problematic for data safety.

So AFAIU, even if we flush tmp (with the patch I sent today), 
and hardlink, the directory inode might not be flushed for a long 
time.

And I just noticed that e.g. btrfs (which is the default in
e.g. MeeGo) does not special case rename() in case destination is 
not overwritten (but it does have a special case for the 
overwriting-rename case -> https://btrfs.wiki.kernel.org/index.php/FAQ). 
So just using fdatasync+rename won't solve all cases either.

Hmm, so fdatasync on the file, rename and fsync on directory should 
be ok then.

_______________________________________________
ofono mailing list
ofono@ofono.org
http://lists.ofono.org/listinfo/ofono

Reply via email to