public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
From: Artem Bityutskiy <dedekind1@gmail.com>
To: "Albrecht Dreß" <albrecht.dress@arcor.de>
Cc: Sven <svenjaborek@gmx.de>, linux-mtd@lists.infradead.org
Subject: Re: JFFS2: truncated files after power loss scenario
Date: Sun, 06 Feb 2011 19:39:37 +0200	[thread overview]
Message-ID: <1297013977.4460.78.camel@localhost> (raw)
In-Reply-To: <1297012353.1854.1@antares>

On Sun, 2011-02-06 at 18:12 +0100, Albrecht Dreß wrote:
> Am 06.02.11 17:03 schrieb(en) Artem Bityutskiy:
> > The bottom line is that it is difficult to fix broken applications
> by
> > changing JFFS2. The right way to update configuration files is
> described
> > here:
> > http://www.linux-mtd.infradead.org/faq/ubifs.html#L_atomic_change
> 
> Dumb question: isn't it necessary to also run sync() after the fsync()
> - close() - rename() sequence, as to ensure that the directory entries
> are actually flushed to the flash?  Or does a call to
> 
> 	rename("configfile.tmp", "configfile");
> 
> *ensure* that after a crash during this call either the entry of the
> old file (configfile) or of the newly written contents
> (configfile.tmp) is accessible, independent of the moment when the
> crash happens?

Well, there was a huge debate about this. Rename does not ensure sync in
many file-systems, and posix does not require this. But user-spaces
relies on this and many people believe this should obviously be
guaranteed. So ext4 and may be some other FSes adjusted accordingly. I
wrote about this in UBIFS FAQ:

http://www.linux-mtd.infradead.org/doc/ubifs.html#L_sync_exceptions

You'll find all the relevant links there.


-- 
Best Regards,
Artem Bityutskiy (Артём Битюцкий)

  reply	other threads:[~2011-02-06 17:40 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-06 14:59 JFFS2: truncated files after power loss scenario Sven
2011-02-06 15:25 ` Artem Bityutskiy
2011-02-06 15:47   ` Sven
2011-02-06 16:03     ` Artem Bityutskiy
2011-02-06 17:12       ` Albrecht Dreß
2011-02-06 17:39         ` Artem Bityutskiy [this message]
2011-02-06 18:40           ` Albrecht Dreß
2011-02-11 14:00             ` Artem Bityutskiy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1297013977.4460.78.camel@localhost \
    --to=dedekind1@gmail.com \
    --cc=albrecht.dress@arcor.de \
    --cc=linux-mtd@lists.infradead.org \
    --cc=svenjaborek@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox