linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: "Berthier, Emmanuel" <emmanuel.berthier@intel.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: Re: fsync() does not flush all the file
Date: Fri, 2 Sep 2011 04:13:12 -0400	[thread overview]
Message-ID: <20110902081312.GA20157@infradead.org> (raw)
In-Reply-To: <65CD3FC07F3BF942ABE211646D72D77001C375@IRSMSX102.ger.corp.intel.com>

On Fri, Sep 02, 2011 at 07:59:56AM +0000, Berthier, Emmanuel wrote:
> 
> I've reproduced the issue on a PC with Ubuntu 10.04, but as the SSD drive contains cache, it's clear that this configuration can't guaranty the immediate flushing of the file on the flash memory.
> 
> A new info of today: the issue disappears if I call fflush() before fsync(): all the file is well flushed at a time.
> The problem is that this is not the behavior of Sqlite3.6.2 (I've trace sys calls with strace, no fflush() on journal) (same for last 3.7.7.1).
> 
> Who's wrong? FS or Sqlite?

Oh. that actually sounds very much like a bug in sqlite.

If you use the fread/fwrite family of userspace-buffered stream I/O you
do need the fflush call to actually make the written data visible to the
kernel, fsync has no chance to pick it up before that.

It really surprise me sqlite uses fwrite for its intent log, as loggin
generall is absolutely latency an integrity critical, and the streaming
I/O APIs just make that more complicated.

  reply	other threads:[~2011-09-02  8:13 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-01 18:12 fsync() does not flush all the file Berthier, Emmanuel
2011-09-01 21:50 ` Christoph Hellwig
2011-09-02  7:59   ` Berthier, Emmanuel
2011-09-02  8:13     ` Christoph Hellwig [this message]
2011-09-02 10:53       ` Berthier, Emmanuel

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=20110902081312.GA20157@infradead.org \
    --to=hch@infradead.org \
    --cc=emmanuel.berthier@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    /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).