Re: NFS v4 and async writes
jon wayne wrote:[color=blue]
> Hi
> I had the following doubts, could someone clear them please?
> [
> environ
> linux - 2.6 or above
> nfs - v4
> ]
>
>
>
> 1.Does a fwrite on a file opened with O_SYNC block until the data is
> actually written by the server on the
> disk.
>
> 2.In case I open a file without using the O_SYNC option and do an fsync
> after all the writes are thru, will
> a positive response mean that the data is actually copied to disk
> from the buffers on the server side??
>
> thanks
> Jon[/color]
The short answer to both questions is "yes, usually". It's not clear
whether you're using Linux 2.6 as clients or servers or both. So I
won't make any assumptions there.
To qualify the "usually", here're a few ways you can lose your data
with O_SYNC:
1. The server may not be NFS compliant. I doubt that Windows NFS (SFU)
sync to disk immediately, for example.
2. Linux servers may turn off synchronous writes with the "async"
export option.
3. Even hard disks have write cache. Having written to "disk" doesn't
mean it's on
stable storage.
Cases (1) and (2) may be under your control, on what kind of server to
use and how to configure it. I wouldn't worry about case (3) too much,
unless your app is super mission critical. In that case, I'd use a
dedicated NAS appliance.
bc