linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Steve French" <smfrench@gmail.com>
To: "Jeff Layton" <jlayton@redhat.com>
Cc: linux-cifs-client@lists.samba.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH] cifs: fix O_APPEND on directio mounts
Date: Wed, 27 Aug 2008 21:24:29 -0500	[thread overview]
Message-ID: <524f69650808271924u1b24b598r7a248f899fda92e7@mail.gmail.com> (raw)
In-Reply-To: <1219883092-6923-1-git-send-email-jlayton@redhat.com>

On Wed, Aug 27, 2008 at 7:24 PM, Jeff Layton <jlayton@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

  reply	other threads:[~2008-08-28  2:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-28  0:24 [PATCH] cifs: fix O_APPEND on directio mounts Jeff Layton
2008-08-28  2:24 ` Steve French [this message]
2008-08-28 11:06   ` Jeff Layton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=524f69650808271924u1b24b598r7a248f899fda92e7@mail.gmail.com \
    --to=smfrench@gmail.com \
    --cc=jlayton@redhat.com \
    --cc=linux-cifs-client@lists.samba.org \
    --cc=linux-fsdevel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).