Skip to content

Commit

Permalink
nfsd4: don't set cl_firststate on first reclaim in 4.1 case
Browse files Browse the repository at this point in the history
We set cl_firststate when we first decide that a client will be
permitted to reclaim state on next boot.  This happens:

	- for new 4.0 clients, when they confirm their first open
	- for returning 4.0 clients, when they reclaim their first open
	- for 4.1+ clients, when they perform reclaim_complete

We also use cl_firststate to decide whether a reclaim_complete has
already been performed, in the 4.1+ case.

We were setting it on 4.1 open reclaims, which caused spurious
COMPLETE_ALREADY errors on RECLAIM_COMPLETE from an nfs4.1 client with
anything to reclaim.

Reported-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
  • Loading branch information
J. Bruce Fields committed Mar 6, 2012
1 parent d24433c commit 1255a8f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -2778,10 +2778,15 @@ nfs4_upgrade_open(struct svc_rqst *rqstp, struct nfs4_file *fp, struct svc_fh *c


static void
nfs4_set_claim_prev(struct nfsd4_open *open)
nfs4_set_claim_prev(struct nfsd4_open *open, bool has_session)
{
open->op_openowner->oo_flags |= NFS4_OO_CONFIRMED;
open->op_openowner->oo_owner.so_client->cl_firststate = 1;
/*
* On a 4.1+ client, we don't create a state record for a client
* until it performs RECLAIM_COMPLETE:
*/
if (!has_session)
open->op_openowner->oo_owner.so_client->cl_firststate = 1;
}

/* Should we give out recallable state?: */
Expand Down Expand Up @@ -3044,7 +3049,7 @@ nfsd4_process_open2(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nf
if (fp)
put_nfs4_file(fp);
if (status == 0 && open->op_claim_type == NFS4_OPEN_CLAIM_PREVIOUS)
nfs4_set_claim_prev(open);
nfs4_set_claim_prev(open, nfsd4_has_session(&resp->cstate));
/*
* To finish the open response, we just need to set the rflags.
*/
Expand Down

0 comments on commit 1255a8f

Please sign in to comment.