[linux-cifs-client] Re: [PATCH] cifs: fix O_APPEND on directio mounts

Steve French smfrench at gmail.com
Thu Aug 28 02:24:29 GMT 2008


On Wed, Aug 27, 2008 at 7:24 PM, Jeff Layton <jlayton at redhat.com> wrote:
> The direct I/O write codepath for CIFS is done through
> cifs_user_write(). That function does not currently call
> generic_write_checks() so the file position isn't being properly set
> when the file is opened with O_APPEND.  It's also not doing the other
> "normal" checks that should be done for a write call.
>
> The problem is currently that when you open a file with O_APPEND on a
> mount with the directio mount option, the file position is set to the
> beginning of the file. This makes any subsequent writes clobber the data
> in the file starting at the beginning.

Is this important enough to go into stable after it goes to mainline
(seems like a good candidate)?

> This seems to fix the problem in cursory testing. It is, however
> important to note that NFS disallows the combination of
> (O_DIRECT|O_APPEND). If my understanding is correct, the concern is
> races with multiple clients appending to a file clobbering each others'
> data. Since the write model for CIFS and NFS is pretty similar in this
> regard,
At least for oplocked files (which NFSv3 does not have support for) we
could allow append.   (when appending on an O_DIRECT open or mount,
also might be possible to open with DENY_WRITE mode rather than
failing if races with other clients must be prevented but that could
break apps).

-- 
Thanks,

Steve


More information about the linux-cifs-client mailing list