Re: [PATCH] enforce fflush before fdatasync for stdio users

2013-04-20 Thread Eric Wong
Oswald Buddenhagen wrote: > On Sat, Apr 20, 2013 at 12:36:30AM +, Eric Wong wrote: > > fdatasync only flushes data to disk the kernel knows about, > > so we must tell the kernel about the data [...] before > > we fdatasync. > > > as it happens, we do: > > > > setlinebuf( svars->jfp ); Oops,

Re: [PATCH] enforce fflush before fdatasync for stdio users

2013-04-20 Thread Oswald Buddenhagen
On Sat, Apr 20, 2013 at 12:36:30AM +, Eric Wong wrote: > fdatasync only flushes data to disk the kernel knows about, > so we must tell the kernel about the data [...] before > we fdatasync. > as it happens, we do: > > setlinebuf( svars->jfp ); that's also the reason why it works reliably wit

[PATCH] enforce fflush before fdatasync for stdio users

2013-04-19 Thread Eric Wong
fdatasync only flushes data to disk the kernel knows about, so we must tell the kernel about the data via fflush before we fdatasync. Using an Fflushsync wrapper function should make it easier to avoid this mistake in the future when we use stdio but need fdatasync. --- IMHO, this makes the code