Skip to content

Commit

Permalink
NFSD: Document the phases of CREATE_SESSION
Browse files Browse the repository at this point in the history
As described in RFC 8881 Section 18.36.4, CREATE_SESSION can be
split into four phases. NFSD's implementation now does it like that
description.

Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
  • Loading branch information
Chuck Lever committed Mar 1, 2024
1 parent e4469c6 commit b910544
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -3762,13 +3762,16 @@ nfsd4_create_session(struct svc_rqst *rqstp,
goto out_free_session;

spin_lock(&nn->client_lock);

/* RFC 8881 Section 18.36.4 Phase 1: Client record look-up. */
unconf = find_unconfirmed_client(&cr_ses->clientid, true, nn);
conf = find_confirmed_client(&cr_ses->clientid, true, nn);
if (!conf && !unconf) {
status = nfserr_stale_clientid;
goto out_free_conn;
}

/* RFC 8881 Section 18.36.4 Phase 2: Sequence ID processing. */
if (conf)
cs_slot = &conf->cl_cs_slot;
else
Expand All @@ -3784,6 +3787,7 @@ nfsd4_create_session(struct svc_rqst *rqstp,
cs_slot->sl_seqid++;
cr_ses->seqid = cs_slot->sl_seqid;

/* RFC 8881 Section 18.36.4 Phase 3: Client ID confirmation. */
if (conf) {
status = nfserr_wrong_cred;
if (!nfsd4_mach_creds_match(conf, rqstp))
Expand All @@ -3810,6 +3814,8 @@ nfsd4_create_session(struct svc_rqst *rqstp,
move_to_confirmed(unconf);
conf = unconf;
}

/* RFC 8881 Section 18.36.4 Phase 4: Session creation. */
status = nfs_ok;
/* Persistent sessions are not supported */
cr_ses->flags &= ~SESSION4_PERSIST;
Expand Down

0 comments on commit b910544

Please sign in to comment.