All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olga Kornievskaia <aglo@umich.edu>
To: Trond Myklebust <trondmy@primarydata.com>
Cc: bcodding redhat <bcodding@redhat.com>,
	"jlayton@redhat.com" <jlayton@redhat.com>,
	"linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>
Subject: Re: [PATCH 1/2] NFSv4: Fix CLOSE races with OPEN
Date: Wed, 14 Feb 2018 17:17:28 -0500	[thread overview]
Message-ID: <CAN-5tyH0hS0X_=QAf_R6fJjKUMXs5w3DfamWu==fAs9Fk5RSGg@mail.gmail.com> (raw)
In-Reply-To: <1518627560.7484.4.camel@primarydata.com>

On Wed, Feb 14, 2018 at 11:59 AM, Trond Myklebust
<trondmy@primarydata.com> wrote:
> On Wed, 2018-02-14 at 11:06 -0500, Olga Kornievskaia wrote:
>> On Wed, Feb 14, 2018 at 10:42 AM, Benjamin Coddington
>> <bcodding@redhat.com> wrote:
>> > On 14 Feb 2018, at 10:29, Trond Myklebust wrote:
>> > > On Wed, 2018-02-14 at 10:21 -0500, Jeff Layton wrote:
>> > > > On Wed, 2018-02-14 at 10:05 -0500, Benjamin Coddington wrote:
>> > > > > Hi Olga,
>> > > > >
>> > > > > On 13 Feb 2018, at 15:08, Olga Kornievskaia wrote:
>> > > > >
>> > > > > > On Mon, Nov 14, 2016 at 11:19 AM, Trond Myklebust
>> > > > > > <trond.myklebust@primarydata.com> wrote:
>> > > > > > ...
>> > > > >
>> > > > > Ah, good question there..  Even though the stateid is not
>> > > > > useful
>> > > > > for
>> > > > > operations that follow, I think the sequenceid should be
>> > > > > incremented because
>> > > > > the CLOSE is an operation that modifies the set of locks or
>> > > > > state:
>> > > > >
>> > > >
>> > > > It doesn't matter.
>> >
>> > Yes, good condensed point.  It doesn't matter.
>> >
>> > > > > ...
>> > >
>> > > Is there a proposal to change the current client behaviour here?
>> > > As far
>> > > as I can tell, the answer is "no". Am I missing something?
>> >
>> > Not that I can see.  I think we're just comparing linux and netapp
>> > server
>> > behaviors..
>> >
>> > Ben
>>
>> I just found very surprising that in nfs4_close_done() which calls
>> eventually calls nfs_clear_open_stateid_locked() we change the state
>> based on the stateid received from the CLOSE.
>> nfs_clear_open_stateid_locked() is only called from nfs4_close_done()
>> and no other function.
>>
>> I guess I'm not wondering if we had this problem described in this
>> patch of the delayed CLOSE, if we didn't update the state after
>> receiving the close... (so yes this is a weak proposal).
>>
>
> nfs4_close_done() doesn't only deal with CLOSE. It also has to handle
> OPEN_DOWNGRADE.

What about doing an update for OPEN_DOWNGRADE but not for the CLOSE (untested):

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index f8a2b226..5868a6a 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1472,7 +1472,7 @@ static void nfs_clear_open_stateid_locked(struct
nfs4_state *state,
        if (stateid == NULL)
                return;
        /* Handle OPEN+OPEN_DOWNGRADE races */
-       if (nfs4_stateid_match_other(stateid, &state->open_stateid) &&
+       if (fmode && nfs4_stateid_match_other(stateid, &state->open_stateid) &&
            !nfs4_stateid_is_newer(stateid, &state->open_stateid)) {
                nfs_resync_open_stateid_locked(state);
                goto out;

>
> --
> Trond Myklebust
> Linux NFS client maintainer, PrimaryData
> trond.myklebust@primarydata.com

  reply	other threads:[~2018-02-14 22:17 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-14 16:19 [PATCH 0/2] Fix CLOSE races Trond Myklebust
2016-11-14 16:19 ` [PATCH 1/2] NFSv4: Fix CLOSE races with OPEN Trond Myklebust
2016-11-14 16:19   ` [PATCH 2/2] NFSv4: Don't call close if the open stateid has already been cleared Trond Myklebust
2016-11-14 16:40   ` [PATCH 1/2] NFSv4: Fix CLOSE races with OPEN Jeff Layton
2016-11-14 16:48     ` Trond Myklebust
2018-02-13 20:08   ` Olga Kornievskaia
2018-02-14 15:05     ` Benjamin Coddington
2018-02-14 15:21       ` Jeff Layton
2018-02-14 15:29         ` Trond Myklebust
2018-02-14 15:42           ` Benjamin Coddington
2018-02-14 16:06             ` Olga Kornievskaia
2018-02-14 16:59               ` Trond Myklebust
2018-02-14 22:17                 ` Olga Kornievskaia [this message]
2018-02-15 12:19     ` Mkrtchyan, Tigran
2018-02-15 12:23       ` Jeff Layton
2018-02-15 15:29         ` Bruce Fields
2018-02-15 15:37           ` Trond Myklebust

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='CAN-5tyH0hS0X_=QAf_R6fJjKUMXs5w3DfamWu==fAs9Fk5RSGg@mail.gmail.com' \
    --to=aglo@umich.edu \
    --cc=bcodding@redhat.com \
    --cc=jlayton@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@primarydata.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.