linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@fieldses.org>
To: Jeff Layton <jlayton@redhat.com>
Cc: "Myklebust, Trond" <Trond.Myklebust@netapp.com>,
	"J. Bruce Fields" <bfields@redhat.com>,
	linux-nfs@vger.kernel.org
Subject: Re: [PATCH] nfs: open-associated setattr shouldn't invalidate own cache
Date: Wed, 2 Nov 2011 10:46:57 -0400	[thread overview]
Message-ID: <20111102144657.GD7721@fieldses.org> (raw)
In-Reply-To: <20111102070742.5354d83c@tlielax.poochiereds.net>

On Wed, Nov 02, 2011 at 07:07:42AM -0400, Jeff Layton wrote:
> On Tue, 1 Nov 2011 21:23:15 -0400
> "J. Bruce Fields" <bfields@fieldses.org> wrote:
> 
> > On Tue, Nov 01, 2011 at 08:43:25PM -0400, Jeff Layton wrote:
> > > On Tue, 1 Nov 2011 16:07:27 -0700
> > > "Myklebust, Trond" <Trond.Myklebust@netapp.com> wrote:
> > > > Is the problem perhaps that we should be clearing the
> > > > NFS_INO_INVALID_DATA flag in nfs_vmtruncate() when the size gets set to
> > > > zero?
> > > > 
> > > 
> > > That was my thinking too. Whenever we truncate the i_size to 0, we
> > > can safely assume that the pagecache is now valid, and should be able
> > > to clear NFS_INO_INVALID_DATA no matter when it was set, right?
> > 
> > I don't understand why 0 is a special case: why should my setting the
> > size ever mean that I have to go reread data from the server?
> > 
> 
> If the server doesn't send pre-op attrs (and linux servers don't) then
> you have no way to know whether someone raced in and did writes to the
> remaining pages just prior to your truncate.
> 
> Size 0 is a special case because there are no remaining pages.

Those 3rd-party writes could also arrive between the truncate and the
read of the post-op attrs.  Is this setattr/write conflict really any
different than write/write conflicts?  In both cases you've got a file
open for write on two different clients.

And we live with the same sort of race in the write/write case.  (Hence
the nfs_post_op_update_inode_force_wcc in nfs4_write_done_cb.)

--b.

  reply	other threads:[~2011-11-02 14:47 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-19  0:09 [PATCH] nfs: open-associated setattr shouldn't invalidate own cache Myklebust, Trond
2011-11-01 20:27 ` J. Bruce Fields
2011-11-01 23:07   ` Myklebust, Trond
2011-11-02  0:43     ` Jeff Layton
2011-11-02  1:23       ` J. Bruce Fields
2011-11-02  1:36         ` Myklebust, Trond
2011-11-02 11:07         ` Jeff Layton
2011-11-02 14:46           ` J. Bruce Fields [this message]
2011-11-02 15:54             ` Jeff Layton
2011-11-03 20:44               ` J. Bruce Fields
2011-11-03 21:03                 ` Trond Myklebust
2011-11-03 21:20                   ` J. Bruce Fields
2011-11-03 21:39                     ` Trond Myklebust
  -- strict thread matches above, loose matches on Subject: below --
2011-07-18 22:23 J. Bruce Fields

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=20111102144657.GD7721@fieldses.org \
    --to=bfields@fieldses.org \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bfields@redhat.com \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@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).