mirror of
				https://github.com/torvalds/linux.git
				synced 2025-11-04 10:40:15 +02:00 
			
		
		
		
	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>
This commit is contained in:
		
							parent
							
								
									ac7c46f29a
								
							
						
					
					
						commit
						86c3e16cc7
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		| 
						 | 
					@ -1487,6 +1487,7 @@ nfsd4_create_session(struct svc_rqst *rqstp,
 | 
				
			||||||
	struct nfs4_client *conf, *unconf;
 | 
						struct nfs4_client *conf, *unconf;
 | 
				
			||||||
	struct nfsd4_session *new;
 | 
						struct nfsd4_session *new;
 | 
				
			||||||
	struct nfsd4_clid_slot *cs_slot = NULL;
 | 
						struct nfsd4_clid_slot *cs_slot = NULL;
 | 
				
			||||||
 | 
						bool confirm_me = false;
 | 
				
			||||||
	int status = 0;
 | 
						int status = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	nfs4_lock_state();
 | 
						nfs4_lock_state();
 | 
				
			||||||
| 
						 | 
					@ -1509,7 +1510,6 @@ nfsd4_create_session(struct svc_rqst *rqstp,
 | 
				
			||||||
				cs_slot->sl_seqid, cr_ses->seqid);
 | 
									cs_slot->sl_seqid, cr_ses->seqid);
 | 
				
			||||||
			goto out;
 | 
								goto out;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		cs_slot->sl_seqid++;
 | 
					 | 
				
			||||||
	} else if (unconf) {
 | 
						} else if (unconf) {
 | 
				
			||||||
		if (!same_creds(&unconf->cl_cred, &rqstp->rq_cred) ||
 | 
							if (!same_creds(&unconf->cl_cred, &rqstp->rq_cred) ||
 | 
				
			||||||
		    !rpc_cmp_addr(sa, (struct sockaddr *) &unconf->cl_addr)) {
 | 
							    !rpc_cmp_addr(sa, (struct sockaddr *) &unconf->cl_addr)) {
 | 
				
			||||||
| 
						 | 
					@ -1525,8 +1525,7 @@ nfsd4_create_session(struct svc_rqst *rqstp,
 | 
				
			||||||
			goto out;
 | 
								goto out;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		cs_slot->sl_seqid++; /* from 0 to 1 */
 | 
							confirm_me = true;
 | 
				
			||||||
		move_to_confirmed(unconf);
 | 
					 | 
				
			||||||
		conf = unconf;
 | 
							conf = unconf;
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		status = nfserr_stale_clientid;
 | 
							status = nfserr_stale_clientid;
 | 
				
			||||||
| 
						 | 
					@ -1546,10 +1545,13 @@ nfsd4_create_session(struct svc_rqst *rqstp,
 | 
				
			||||||
	status = nfs_ok;
 | 
						status = nfs_ok;
 | 
				
			||||||
	memcpy(cr_ses->sessionid.data, new->se_sessionid.data,
 | 
						memcpy(cr_ses->sessionid.data, new->se_sessionid.data,
 | 
				
			||||||
	       NFS4_MAX_SESSIONID_LEN);
 | 
						       NFS4_MAX_SESSIONID_LEN);
 | 
				
			||||||
 | 
						cs_slot->sl_seqid++;
 | 
				
			||||||
	cr_ses->seqid = cs_slot->sl_seqid;
 | 
						cr_ses->seqid = cs_slot->sl_seqid;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	/* cache solo and embedded create sessions under the state lock */
 | 
						/* cache solo and embedded create sessions under the state lock */
 | 
				
			||||||
	nfsd4_cache_create_session(cr_ses, cs_slot, status);
 | 
						nfsd4_cache_create_session(cr_ses, cs_slot, status);
 | 
				
			||||||
 | 
						if (confirm_me)
 | 
				
			||||||
 | 
							move_to_confirmed(conf);
 | 
				
			||||||
out:
 | 
					out:
 | 
				
			||||||
	nfs4_unlock_state();
 | 
						nfs4_unlock_state();
 | 
				
			||||||
	dprintk("%s returns %d\n", __func__, ntohl(status));
 | 
						dprintk("%s returns %d\n", __func__, ntohl(status));
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue