On Tue, 2012-03-06 at 10:12 -0500, Andy Adamson wrote: > On Tue, Mar 6, 2012 at 9:53 AM, Myklebust, Trond > <Trond.Myklebust@xxxxxxxxxx> wrote: > > On Tue, 2012-03-06 at 09:46 -0500, andros@xxxxxxxxxx wrote: > >> From: Andy Adamson <andros@xxxxxxxxxx> > >> > >> nfs41_open_expired() will test the delegation stateid based on > >> NFS_DELEGATED_STATE being set. If the stateid is bad, nfs4_open_recover > >> will clear the NFS_DELEGATED_STATE bit recovering the delegation. > >> > >> Signed-off-by: Andy Adamson <andros@xxxxxxxxxx> > >> Cc: stable@xxxxxxxxxxxxxxx > >> --- > >> fs/nfs/nfs4state.c | 5 ++++- > >> 1 files changed, 4 insertions(+), 1 deletions(-) > >> > >> diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c > >> index 7bd9822..44fcd60 100644 > >> --- a/fs/nfs/nfs4state.c > >> +++ b/fs/nfs/nfs4state.c > >> @@ -696,7 +696,10 @@ static void __nfs4_close(struct nfs4_state *state, > >> call_close |= test_bit(NFS_O_RDWR_STATE, &state->flags); > >> } > >> if (newstate == 0) > >> +{ > >> +printk("%s CLEAR NFS_DELEGATED_STATE state %p\n", __func__, state); > >> clear_bit(NFS_DELEGATED_STATE, &state->flags); > >> +}\ > > > > Ewww..... > > > >> } > >> nfs4_state_set_mode_locked(state, newstate); > >> spin_unlock(&owner->so_lock); > >> @@ -1097,7 +1100,7 @@ void nfs4_schedule_stateid_recovery(const struct nfs_server *server, struct nfs4 > >> { > >> struct nfs_client *clp = server->nfs_client; > >> > >> - if (test_and_clear_bit(NFS_DELEGATED_STATE, &state->flags)) > >> + if (test_bit(NFS_DELEGATED_STATE, &state->flags)) > >> nfs_async_inode_return_delegation(state->inode, &state->stateid); > >> nfs4_state_mark_reclaim_nograce(clp, state); > >> nfs4_schedule_state_manager(clp); > > > > Actually, the latest incarnation of the patch 2/3 removes the > > async_inode_return_delegation from nfs4_schedule_stateid_recovery. > > OK - but I think we still need to postpone clearing the > NFS_DELEGATED_STATE bit until after calling nfs41_open_expired. > Otherwise nfs41_check_expired_stateid will not test the delegation > stateid, and nfs4_open_recover will not be called, as no stateid is > deemed bad, and the OPEN with CLAIM_NULL to (potentially) recover the > delegation will not be sent. In this case, the old bad delegation > stateid will be resent. Agreed. Please see the 'v2' patch that I sent you: it removes _both_ lines above (the test/clearing of the bit and the delegation return). -- Trond Myklebust Linux NFS client maintainer NetApp Trond.Myklebust@xxxxxxxxxx www.netapp.com ��.n��������+%������w��{.n�����{��w���jg��������ݢj����G�������j:+v���w�m������w�������h�����٥