linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jamie Lokier <jamie@shareable.org>
To: Rik van Riel <riel@redhat.com>
Cc: linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Ray Strode <rstrode@redhat.com>,
	elb@psg.com
Subject: Re: RFC: O_PONIES semantics (well O_REWRITE)
Date: Fri, 12 Jun 2009 03:07:38 +0100	[thread overview]
Message-ID: <20090612020738.GD25550@shareable.org> (raw)
In-Reply-To: <4A3057DD.1050703@redhat.com>

Rik van Riel wrote:
> The ext4 automatic-fsync-on-rename discussion has shown that
> many applications simply Do It Wrong when it comes to rewriting
> configuration files.

I got the impression ext4 has
automatic-fsync-on-rename-only-if-the-old-file-exists, which is a bit
less reliable.

By the way, the kernel has some generic support for O_SYNC and
O_DSYNC, and generic MS_SYNC mount option.

So I guess it could also have generic support for mount options
"sync_on_rename" and "sync_on_close", instead of only doing it with ext4.

For example, this came up recently on the linux-mtd list which deals
with flash filesystems.  The ext4-like behaviour is being considerd in
a flash filesystem.  So if it's that important, maybe it would be even
better to make it a generic VFS mount option for all filesystems.

> Some of the common failures are:
> - program overwrites the old config file
> - program writes a new file, but forgets to fsync before rename
> - program writes the new file in /tmp, so the rename fails on
>   some systems
> - program writes a new file and fsyncs, but forgets to give the
>   new file the same file ownership, permission and/or extended
>   attributes as the old file

It's also really hard to do those things from shell scripts, so they
are almost never done there.

> Glibc has the advantage of it not being in the kernel, but
> implementing it in-kernel might give us the opportunity for
> performance enhancements, like reducing step (5) to merely
> enforcing ordering between filesystem operations, instead
> of requiring an fsync.

I think the performance enhancement from order-without-sync might be
useful, I'm not sure, but if so not just for this operation, which is
still quite specialised.

-- Jamie

  parent reply	other threads:[~2009-06-12  2:07 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-11  1:03 RFC: O_PONIES semantics (well O_REWRITE) Rik van Riel
2009-06-11  5:53 ` Andreas Dilger
2009-06-11 14:06   ` Rik van Riel
2009-06-11 14:23     ` Trond Myklebust
2009-06-11 14:32       ` Ray Strode
2009-06-17 13:52       ` Rik van Riel
2009-06-11  9:51 ` Artem Bityutskiy
2009-06-12  2:07 ` Jamie Lokier [this message]
2009-06-12  2:20   ` Matthew Wilcox
2009-06-12 17:06     ` Ray Strode

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=20090612020738.GD25550@shareable.org \
    --to=jamie@shareable.org \
    --cc=elb@psg.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=riel@redhat.com \
    --cc=rstrode@redhat.com \
    /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;
as well as URLs for NNTP newsgroup(s).