From: "Theodore Y. Ts'o" <tytso@mit.edu>
To: Vijay Chidambaram <vijay@cs.utexas.edu>
Cc: Jayashree Mohan <jayashree2912@gmail.com>,
Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.cz>,
linux-btrfs <linux-btrfs@vger.kernel.org>,
fstests <fstests@vger.kernel.org>,
Filipe Manana <fdmanana@kernel.org>
Subject: Re: Inconsistent behavior of fsync in btrfs
Date: Sun, 29 Apr 2018 18:16:06 -0400 [thread overview]
Message-ID: <20180429221606.GR5965@thunk.org> (raw)
In-Reply-To: <CAPaz=EKt+zBSun725V5PuV2mO_v49HSgbMkcjYF5ARBKPkfOtA@mail.gmail.com>
On Sun, Apr 29, 2018 at 03:55:39PM -0500, Vijay Chidambaram wrote:
> In the spirit of clarifying fsync behavior, we have one more case
> where we'd like to find out what should be expected.
>
> Consider this:
>
> Mkdir A
> Creat A/bar
> Fsync A/bar
> Rename A to B
> Fsync B/bar
> -- Crash --
>
> A/bar has been fsynced previously, so its not a newly created file.
> After the crash, in ext4 and btrfs, can we expect directory B and
> B/bar to exist?
or ext4, no. The POSIX semantics apply: bar will *either* be in A,
or in B.
If you modify the file bar such that the mod time has been updated,
then fsync(2) --- but not necessarily fdatasync(2) --- will cause the
inode modifications to be written committed, and this will cause the
updates to directory B from the rename to be committed as a
side-effect.
Note though that there are plenty of people who consider this to be a
performance bug, and not a feature, and there have been papers
proposed by your fellow academics that if implemented, would change
this to no longer be true.
In general with these sorts of things it would be useful to reason
about this in the context of real world applications and why they want
such guarantees. These guarantees can cost performance hits, and so
there is a cost/benefit tradeoff involved. So my preference is to
negotiate with applicationt writes, and ask *why* they want such
guarantees, and to explore whether there better ways of achieving
their high level goals before we legislate this to be an iron-clad
commitment which might application A happy, but performance-seeking
user B unhappy.
> I know this is not POSIX compliant, but from prior comments, it seems
> like both ext4 and btrfs would like to persist directory entries upon
> fsync of newly created files. So we were wondering if this extended to
> this case.
We had real world examples of users/applications who suffered data
loss when the directory entries for newly created files were not
persisted. It was on the basis of these complaints that we made this
commitment, since it seemed more important than the relatively minor
performance hit.
Cheers,
- Ted
next prev parent reply other threads:[~2018-04-29 22:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-25 2:35 Inconsistent behavior of fsync in btrfs Jayashree Mohan
2018-04-25 3:08 ` Chris Murphy
[not found] ` <CAJCQCtT7S9Qb-m3-7EXJPwtMT9nuUJjDykHi915KU+fc4fB-aQ@mail.gmail.com>
2018-04-25 3:10 ` Vijaychidambaram Velayudhan Pillai
2018-04-25 3:16 ` Vijaychidambaram Velayudhan Pillai
2018-04-25 12:36 ` Ashlie Martinez
2018-04-25 13:53 ` Ashlie Martinez
2018-04-26 16:28 ` Chris Mason
2018-04-27 0:59 ` Jayashree Mohan
2018-04-27 15:26 ` Chris Mason
2018-04-27 16:07 ` David Sterba
2018-04-27 17:33 ` Chris Mason
2018-04-27 20:53 ` Theodore Y. Ts'o
2018-04-27 23:24 ` Chris Murphy
2018-04-27 23:44 ` Jayashree Mohan
2018-04-29 20:55 ` Vijay Chidambaram
2018-04-29 22:16 ` Theodore Y. Ts'o [this message]
2018-04-29 23:21 ` Vijay Chidambaram
2018-04-30 14:30 ` Chris Mason
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=20180429221606.GR5965@thunk.org \
--to=tytso@mit.edu \
--cc=clm@fb.com \
--cc=dsterba@suse.cz \
--cc=fdmanana@kernel.org \
--cc=fstests@vger.kernel.org \
--cc=jayashree2912@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=vijay@cs.utexas.edu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.