diff options
author | J. Bruce Fields <bfields@redhat.com> | 2010-10-02 17:04:00 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2010-10-21 10:11:52 -0400 |
commit | 86c3e16cc7aace4d1143952813b6cc2a80c51295 (patch) | |
tree | 9e05be561cf85e5e5eab57464c0cc63a3cdf7087 /fs/nfsd/nfs4state.c | |
parent | ac7c46f29a44f6d7f6d2e36dc874c0b7056acad2 (diff) |
nfsd4: confirm only on succesful create_session
Following rfc 5661, section 18.36.4: "If the session is not successfully
created, then no changes are made to any client records on the server."
We shouldn't be confirming or incrementing the sequence id in this case.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 6367c445d015..7e817d13cd82 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1487,6 +1487,7 @@ nfsd4_create_session(struct svc_rqst *rqstp, | |||
1487 | struct nfs4_client *conf, *unconf; | 1487 | struct nfs4_client *conf, *unconf; |
1488 | struct nfsd4_session *new; | 1488 | struct nfsd4_session *new; |
1489 | struct nfsd4_clid_slot *cs_slot = NULL; | 1489 | struct nfsd4_clid_slot *cs_slot = NULL; |
1490 | bool confirm_me = false; | ||
1490 | int status = 0; | 1491 | int status = 0; |
1491 | 1492 | ||
1492 | nfs4_lock_state(); | 1493 | nfs4_lock_state(); |
@@ -1509,7 +1510,6 @@ nfsd4_create_session(struct svc_rqst *rqstp, | |||
1509 | cs_slot->sl_seqid, cr_ses->seqid); | 1510 | cs_slot->sl_seqid, cr_ses->seqid); |
1510 | goto out; | 1511 | goto out; |
1511 | } | 1512 | } |
1512 | cs_slot->sl_seqid++; | ||
1513 | } else if (unconf) { | 1513 | } else if (unconf) { |
1514 | if (!same_creds(&unconf->cl_cred, &rqstp->rq_cred) || | 1514 | if (!same_creds(&unconf->cl_cred, &rqstp->rq_cred) || |
1515 | !rpc_cmp_addr(sa, (struct sockaddr *) &unconf->cl_addr)) { | 1515 | !rpc_cmp_addr(sa, (struct sockaddr *) &unconf->cl_addr)) { |
@@ -1525,8 +1525,7 @@ nfsd4_create_session(struct svc_rqst *rqstp, | |||
1525 | goto out; | 1525 | goto out; |
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | cs_slot->sl_seqid++; /* from 0 to 1 */ | 1528 | confirm_me = true; |
1529 | move_to_confirmed(unconf); | ||
1530 | conf = unconf; | 1529 | conf = unconf; |
1531 | } else { | 1530 | } else { |
1532 | status = nfserr_stale_clientid; | 1531 | status = nfserr_stale_clientid; |
@@ -1546,10 +1545,13 @@ nfsd4_create_session(struct svc_rqst *rqstp, | |||
1546 | status = nfs_ok; | 1545 | status = nfs_ok; |
1547 | memcpy(cr_ses->sessionid.data, new->se_sessionid.data, | 1546 | memcpy(cr_ses->sessionid.data, new->se_sessionid.data, |
1548 | NFS4_MAX_SESSIONID_LEN); | 1547 | NFS4_MAX_SESSIONID_LEN); |
1548 | cs_slot->sl_seqid++; | ||
1549 | cr_ses->seqid = cs_slot->sl_seqid; | 1549 | cr_ses->seqid = cs_slot->sl_seqid; |
1550 | 1550 | ||
1551 | /* cache solo and embedded create sessions under the state lock */ | 1551 | /* cache solo and embedded create sessions under the state lock */ |
1552 | nfsd4_cache_create_session(cr_ses, cs_slot, status); | 1552 | nfsd4_cache_create_session(cr_ses, cs_slot, status); |
1553 | if (confirm_me) | ||
1554 | move_to_confirmed(conf); | ||
1553 | out: | 1555 | out: |
1554 | nfs4_unlock_state(); | 1556 | nfs4_unlock_state(); |
1555 | dprintk("%s returns %d\n", __func__, ntohl(status)); | 1557 | dprintk("%s returns %d\n", __func__, ntohl(status)); |