Re: [PATCH v8 00/11] Fix OPEN/CLOSE races

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2017-11-07 at 11:59 -0500, Andrew W Elble wrote:
> Trond Myklebust <trondmy@xxxxxxxxxxxxxxx> writes:
> 
> > On Mon, 2017-11-06 at 17:46 -0500, Andrew W Elble wrote:
> > > Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx> writes:
> > > 
> > > > v8:
> > > > - Really fix compile issue when CONFIG_NFS_V4_1=n
> > > > - nfs_inode_find_state_and_recover() should also try to match
> > > > the
> > > >   open_stateid.
> > > 
> > > Seeing a lot of TEST_STATEID's for the invalid stateid go over
> > > the
> > > wire - this also makes the server hit this quite a bit:
> > > 
> > > pr_warn_ratelimited("NFSD: client %s testing state ID "
> > >                         "with incorrect client ID\n", addr_str);
> > > 
> > 
> > I'm not seeing that at all. Can you please elaborate on which
> > server
> > errors are triggering this? I'd not expect to ever see TEST_STATEID
> > on
> > a normal run.
> 
> Hopefully this helps.
> 
> Not completely sure this is correct, but this makes the client no
> longer
> test the _invalid_ stateid:
> 
> diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
> index 6eccbd1b98cc..7dc914a6356f 100644
> --- a/fs/nfs/nfs4proc.c
> +++ b/fs/nfs/nfs4proc.c
> @@ -1436,6 +1436,8 @@ static void
> nfs_clear_open_stateid_locked(struct nfs4_state *state,
>                 nfs_resync_open_stateid_locked(state);
>                 goto out;
>         }
> +       if (test_bit(NFS_OPEN_STATE, &state->flags) == 0)
> +               stateid->type = NFS4_INVALID_STATEID_TYPE;
>         if (test_bit(NFS_DELEGATED_STATE, &state->flags) == 0)
>                 nfs4_stateid_copy(&state->stateid, stateid);
>         nfs4_stateid_copy(&state->open_stateid, stateid);
> 
> 
> The TEST_STATEID's are being issued from the "freeme" path of
> update_open_stateid() via nfs4_opendata_to_nfs4_state(). I put a
> tracepoint
> there:

Ah, I see. Can we in that case please rather do the following?

8<--------------------------------------------------------
>From e3ed21c194f4207cf3a00b624fe86b9a9b188c13 Mon Sep 17 00:00:00 2001
From: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
Date: Tue, 7 Nov 2017 13:10:46 -0500
Subject: [PATCH 1/2] NFSv4: nfs_set_open_stateid must not trigger state
 recovery for closed state

In nfs_set_open_stateid_locked, we must ignore stateids from closed state.

Reported-by: Andrew W Elble <aweits@xxxxxxx>
Signed-off-by: Trond Myklebust <trond.myklebust@xxxxxxxxxxxxxxx>
---
 fs/nfs/nfs4proc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index d536d4ed990f..0aa8461e7341 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -1541,7 +1541,8 @@ static void nfs_set_open_stateid_locked(struct nfs4_state *state,
 		write_seqlock(&state->seqlock);
 	}
 
-	if (!nfs4_stateid_match_other(stateid, &state->open_stateid)) {
+	if (test_bit(NFS_OPEN_STATE, &state->flags) &&
+	    !nfs4_stateid_match_other(stateid, &state->open_stateid)) {
 		nfs4_stateid_copy(freeme, &state->open_stateid);
 		nfs_test_and_clear_all_open_stateid(state);
 	}
-- 
2.13.6

-- 
Trond Myklebust
Linux NFS client maintainer, PrimaryData
trond.myklebust@xxxxxxxxxxxxxxx
��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux