RE: fsync() does not flush all the file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> From: linux-fsdevel-owner@xxxxxxxxxxxxxxx [mailto:linux-fsdevel-owner@xxxxxxxxxxxxxxx] On Behalf Of Christoph Hellwig
> 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.

You're right, I used fprintf(). After replacing these calls by write() ones, no more issue!
And yes, Sqlite uses write() calls also.

Thanks a lot!

---------------------------------------------------------------------
Intel Corporation SAS (French simplified joint stock company)
Registered headquarters: "Les Montalets"- 2, rue de Paris, 
92196 Meudon Cedex, France
Registration Number:  302 456 199 R.C.S. NANTERRE
Capital: 4,572,000 Euros

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.

--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux