All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jayashree Mohan <jayashree2912@gmail.com>
To: "Theodore Y. Ts'o" <tytso@mit.edu>
Cc: Chris Mason <clm@fb.com>, David Sterba <dsterba@suse.cz>,
	linux-btrfs <linux-btrfs@vger.kernel.org>,
	fstests <fstests@vger.kernel.org>,
	Vijaychidambaram Velayudhan Pillai <vijay@cs.utexas.edu>,
	Filipe Manana <fdmanana@kernel.org>
Subject: Re: Inconsistent behavior of fsync in btrfs
Date: Fri, 27 Apr 2018 18:44:37 -0500	[thread overview]
Message-ID: <CA+EzBbAwsZf-AvGG15EnDinrzFyHaoPs_bTCVoZt_mHM06Jptg@mail.gmail.com> (raw)
In-Reply-To: <20180427205313.GM5965@thunk.org>

Thanks Chris and Ted for putting down the expected fsync behaviour of
btrfs and ext4 clearly. This sort of information is not documented
anywhere; it would be really useful if all major filesystems
explicitly stated what fsync behavior to expect. Filesystems
definitely seem to provide more guarantees than POSIX and it would of
great help to researchers and developers, if you all documented what
guarantees we can expect from each filesystem.

On Fri, Apr 27, 2018 at 3:53 PM, Theodore Y. Ts'o <tytso@mit.edu> wrote:
> On Fri, Apr 27, 2018 at 11:33:29AM -0600, Chris Mason wrote:
>> My goal for the fsync tree log was to make it just do the right thing most
>> of the time.  We mostly got there, thanks to a ton of fixes and test cases
>> from Filipe.
>>
>> fsync(some file) -- all the names for this file will exist, without having
>> to fsync the directory.
>>
>> fsync(some dir) -- ugh, don't fsync the directory.  But if you do, all the
>> files/subdirs will exist, and unlinks will be done and renames will be
>> included.  This is slow and may require a full FS commit, which is why we
>> don't want dirs fsunk.
>
> What ext4 does is this:
>
> fsync(some file) -- for a newly created file, the filename that it was
>         created under will exist.  If the file has a hard-link added,
>         the hard link is not guarnateed to be written to disk
>
> fsync(some dir) -- all changes to file names in thentee directory will
>         exist after the crash.  It does *not* guarantee that any data
>         changes to any of files in the directories will persist after
>         a crash.
>
> It seems to me that it would be desirable if all of the major file
> systems have roughly the same minimum guarantee for fsync(2), so that
> application writers don't have to make file-system specific
> assumptions.  In general the goal ought to be "the right thing" should
> happen.
>
> The reason why ext4 doesn't sync all possible hard link names is that
> (a) that's not a common requiremnt for most applications, and (b) it's
> too hard to find all of the directories which might contain a hard
> link to a particular file.  But otherwise, the semantics seem to
> largely match up with what Chris as suggested for btrfs.
>
>                                     - Ted

  parent reply	other threads:[~2018-04-27 23:44 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 [this message]
2018-04-29 20:55             ` Vijay Chidambaram
2018-04-29 22:16               ` Theodore Y. Ts'o
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=CA+EzBbAwsZf-AvGG15EnDinrzFyHaoPs_bTCVoZt_mHM06Jptg@mail.gmail.com \
    --to=jayashree2912@gmail.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.cz \
    --cc=fdmanana@kernel.org \
    --cc=fstests@vger.kernel.org \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=tytso@mit.edu \
    --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.