> Hi,
> I tried to write to a file on a read-only mounted nfs file
> system. The write system call returns a value depending on
> whether the O_SYNC flag was set during the open system call.
> If O_SYNC flag is set, the nfs_updatepage() function returns
> "Read Only file system" error but if O_SYNC flag is not set the
> nfs_updatepage() returns the count itself. This error is
> subsequently returned by the write system call.
> Can someone help me out with following doubts :
> 1. If O_SYNC flag is not set then does the kernel caches the
> write request? What happens in the NFS V2 protocol (as far as i
> remember in V2 protocol clients do not cache write requests) ?
No: in NFSv2, the server isn't allowed to cache write requests; more
precisely, the server is required to sync the data to disk before
replying to the RPC call. The client is quite free to cache as he
pleases.
> 2. Has POSIX defined some standard for behaviour of read/write
> system calls for an NFS file (or any other standard/rfc in
> use)?
Nope. NFS is not a POSIX-compliant file system due to the stateless
nature.
> 3. This behaviour does no seem to be correct because if an
> application has not set the O_SYNC flag and tries (unknowingly)
> to write to a Read Only NFS file then it will never know that
> an error occured?
You will catch it upon the call to 'fsync()' or 'close()'.
Cheers,
Trond
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/