linux-xfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Dave Chinner <david@fromorbit.com>
To: Romain Le Disez <romain.le-disez@corp.ovh.com>
Cc: "linux-xfs@vger.kernel.org" <linux-xfs@vger.kernel.org>
Subject: Re: [QUESTION] multiple fsync() vs single sync()
Date: Fri, 19 Oct 2018 23:12:17 +1100	[thread overview]
Message-ID: <20181019121217.GN6311@dastard> (raw)
In-Reply-To: <0C4E81C1-739F-432E-88A3-C2B1E4B1A310@corp.ovh.com>

On Fri, Oct 19, 2018 at 08:16:27AM +0000, Romain Le Disez wrote:
> Thanks all for your answers, it is really helpful, I have now a clearer vision of how it works.
> 
> I have one last question.
> 
> If I’m in the process of creating 1000 files this way, but the server crashes before the syncfs() function was called, what will happen to the files that were already rename()/linkat()?

files up to a certain point will be there in order, data in those
files is likely to be missing. What files are there and what files
have data will be completely random.

i.e. you'll have a mess to clean up.

> Do they follow the same ordering, so I’m sure they are either complete (all data/xattr + xfs metadata) or not in the destination directory?
> 
> Or, is syncfs() the only way to ensure this ordering?

syncfs is like a bulk checkpoint. Until it completes, there are no
guarantees about anything. Only way to guarantee per file data
integrity and ordering is to use fsync.

Cheers,

Dave.
-- 
Dave Chinner
david@fromorbit.com

      reply	other threads:[~2018-10-19 20:18 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-16 10:22 [QUESTION] multiple fsync() vs single sync() Romain Le Disez
2018-10-16 12:57 ` Carlos Maiolino
2018-10-16 13:53   ` Stefan Ring
2018-10-16 14:09     ` Romain Le Disez
2018-10-18 11:43       ` Carlos Maiolino
2018-10-17  1:16 ` Dave Chinner
2018-10-19  8:16   ` Romain Le Disez
2018-10-19 12:12     ` Dave Chinner [this message]

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=20181019121217.GN6311@dastard \
    --to=david@fromorbit.com \
    --cc=linux-xfs@vger.kernel.org \
    --cc=romain.le-disez@corp.ovh.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).