From: Amir Goldstein <amir73il@gmail.com>
To: Vijaychidambaram Velayudhan Pillai <vijay@cs.utexas.edu>
Cc: Jayashree Mohan <jayashree2912@gmail.com>,
linux-btrfs <linux-btrfs@vger.kernel.org>,
fstests <fstests@vger.kernel.org>,
linux-f2fs-devel@lists.sourceforge.net
Subject: Re: Symlink not persisted even after fsync
Date: Fri, 13 Apr 2018 16:16:20 +0300 [thread overview]
Message-ID: <CAOQ4uxhRoAnxr36Cy1pov+ExnNJ8Y+inmUc7chD77ONPt=u9qw@mail.gmail.com> (raw)
In-Reply-To: <CAPaz=E+-baGSWhL3nD-8X4jn6rKdn2AVGLeqWh3EY5Nh-RodRA@mail.gmail.com>
On Fri, Apr 13, 2018 at 3:54 PM, Vijay Chidambaram <vijay@cs.utexas.edu> wrote:
> Hi Amir,
>
> Thanks for the reply!
>
> On Fri, Apr 13, 2018 at 12:52 AM, Amir Goldstein <amir73il@gmail.com> wrote:
>>
>> Not a bug.
>>
>> From man 2 fsync:
>>
>> "Calling fsync() does not necessarily ensure that the entry in the
>> directory containing the file has also reached disk. For that an
>> explicit fsync() on a file descriptor for the directory is also needed."
>
>
> Are we understanding this right:
>
> ext4 and xfs fsync the parent directory if a sym link file is fsync-ed. But
> btrfs does not. Is this what we are seeing?
Nope.
You are seeing an unintentional fsync of parent, because both
parent update and symlink update are metadata updates that are
tracked by the same transaction.
fsync of symlink forces the current transaction to the journal,
pulling in the parent update with it.
>
> I agree that fsync of a file does not mean fsync of its directory entry, but
> it seems odd to do it for regular files and not for sym links. We do not see
> this behavior if we use a regular file instead of a sym link file.
>
fsync of regular file behaves differently than fsync of non regular file.
I suggest this read:
https://thunk.org/tytso/blog/2009/03/12/delayed-allocation-and-the-zero-length-file-problem/
>>
>> There is a reason why this behavior is not being reproduces in
>> ext4/xfs, but you should be able to reproduce a similar issue
>> like this:
>>
>>
>> 1. symlink (foo, bar.tmp)
>> 2. open bar.tmp
>> 3. fsync bar.tmp
>> 4. rename(bar.tmp, bar)
>> 5. fsync bar
>> ----crash here----
>
>
> I'm guessing xfs/ext4 detect the symlink-fsync pattern and fsync the parent
> dir in our workload, but would miss it because of the rename in the workload
> you provided?
>
No pattern detecting by xfs/ext4 AFAIK.
rename does not change metadata of victim, so fsync(bar)
may (depending on fs) trigger no metadata transaction commit.
Thanks,
Amir.
next prev parent reply other threads:[~2018-04-13 13:16 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-04-12 17:51 Symlink not persisted even after fsync Jayashree Mohan
2018-04-13 5:52 ` Amir Goldstein
2018-04-13 12:57 ` Vijay Chidambaram
[not found] ` <CAPaz=E+-baGSWhL3nD-8X4jn6rKdn2AVGLeqWh3EY5Nh-RodRA@mail.gmail.com>
2018-04-13 13:16 ` Amir Goldstein [this message]
2018-04-13 14:39 ` Jayashree Mohan
2018-04-14 1:20 ` Dave Chinner
2018-04-14 3:27 ` Vijay Chidambaram
2018-04-14 21:55 ` Dave Chinner
2018-04-15 1:13 ` Vijay Chidambaram
2018-04-15 1:30 ` Theodore Y. Ts'o
2018-04-15 1:40 ` Vijay Chidambaram
2018-04-15 1:17 ` Theodore Y. Ts'o
2018-04-15 1:38 ` Vijay Chidambaram
[not found] ` <CAHWVdUXAyyeTGNXrtTTc+tUbA3t9TUjJPSF=M4Cetj4+d1w3eQ@mail.gmail.com>
2018-04-15 14:13 ` Theodore Y. Ts'o
2018-04-16 0:10 ` Vijay Chidambaram
2018-04-16 5:39 ` Amir Goldstein
2018-04-16 15:17 ` Vijay Chidambaram
2018-04-16 5:52 ` Theodore Y. Ts'o
2018-04-16 15:09 ` Vijay Chidambaram
2018-04-17 0:07 ` Dave Chinner
2018-04-17 2:56 ` Vijay Chidambaram
2018-04-13 14:06 ` Dave Chinner
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='CAOQ4uxhRoAnxr36Cy1pov+ExnNJ8Y+inmUc7chD77ONPt=u9qw@mail.gmail.com' \
--to=amir73il@gmail.com \
--cc=fstests@vger.kernel.org \
--cc=jayashree2912@gmail.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-f2fs-devel@lists.sourceforge.net \
--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 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).