Call fdatasync() after writing to the real file
commit0fd8c17c54bcbdae8480ed91a1ba8dbb2bb5f203
authorAlberto Bertogli <albertito@blitiri.com.ar>
Sun, 29 Mar 2009 02:06:40 +0000 (28 23:06 -0300)
committerAlberto Bertogli <albertito@blitiri.com.ar>
Sun, 29 Mar 2009 02:33:22 +0000 (28 23:33 -0300)
treef708fe1daf06b6e457288248c45f1e981de90862
parent6e8652bb2d1e40dd8ce59ac4a8ca4891f0f06ab9
Call fdatasync() after writing to the real file

If O_SYNC was not passed to jopen(), then we could loose data because
jtrans_commit() assumes writes to the file are synchronous. That behaviour
was undocumented, so the user could have assumed O_SYNC was not necessary.

This patch implements a much more sane semantic by calling fdatasync() on
the file fd after writing the transaction when lingering transactions are
not enabled, avoiding the need to open the file with O_SYNC.

Signed-off-by: Alberto Bertogli <albertito@blitiri.com.ar>
UPGRADING
libjio/trans.c