linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "J. Bruce Fields" <bfields@redhat.com>
To: linux-nfs@vger.kernel.org
Cc: "J. Bruce Fields" <bfields@redhat.com>
Subject: [PATCH 06/11] nfsd4: exchange_id cleanup: comments
Date: Wed, 16 May 2012 08:48:34 -0400	[thread overview]
Message-ID: <1337172519-17335-7-git-send-email-bfields@redhat.com> (raw)
In-Reply-To: <1337172519-17335-1-git-send-email-bfields@redhat.com>

From: "J. Bruce Fields" <bfields@redhat.com>

Make these comments a bit more concise and uniform.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
 fs/nfsd/nfs4state.c |   36 ++++++++++--------------------------
 1 file changed, 10 insertions(+), 26 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index e7c4b04..1239ff4 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1513,6 +1513,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp,
 
 	strhashval = clientstr_hashval(dname);
 
+	/* Cases below refer to rfc 5661 section 18.35.4: */
 	nfs4_lock_state();
 	conf = find_confirmed_client_by_str(dname, strhashval);
 	if (conf) {
@@ -1520,26 +1521,24 @@ nfsd4_exchange_id(struct svc_rqst *rqstp,
 		bool verfs_match = same_verf(&verf, &conf->cl_verifier);
 
 		if (!clp_used_exchangeid(conf)) {
-			if (update) {
-				status = nfserr_inval; /* buggy client */
+			if (update) { /* buggy client */
+				status = nfserr_inval;
 				goto out;
 			}
 		}
-		if (!creds_match) {
-			/* 18.35.4 case 9 */
+		if (!creds_match) { /* case 9 */
 			if (update)
 				status = nfserr_perm;
 			else /* case 3 */
 				status = nfserr_clid_inuse;
 			goto out;
 		}
-		if (!verfs_match) {
-			/* 18.35.4 case 8 */
+		if (!verfs_match) { /* case 8 */
 			if (update) {
 				status = nfserr_not_same;
 				goto out;
 			}
-			/* Client reboot: destroy old state */
+			/* case 5, client reboot */
 			expire_client(conf);
 			goto out_new;
 		}
@@ -1547,38 +1546,23 @@ nfsd4_exchange_id(struct svc_rqst *rqstp,
 			status = nfserr_inval;
 			goto out;
 		}
-		/*
-		 * Set bit when the owner id and verifier map to an already
-		 * confirmed client id (18.35.3).
-		 */
+		/* case 2 */
 		exid->flags |= EXCHGID4_FLAG_CONFIRMED_R;
-
-		/*
-		 * Falling into 18.35.4 case 2, possible router replay.
-		 * Leave confirmed record intact and return same result.
-		 */
 		new = conf;
 		goto out_copy;
 	}
 
-	/* 18.35.4 case 7 */
-	if (update) {
+	if (update) { /* case 7 */
 		status = nfserr_noent;
 		goto out;
 	}
 
 	unconf  = find_unconfirmed_client_by_str(dname, strhashval);
-	if (unconf) {
-		/*
-		 * Possible retry or client restart.  Per 18.35.4 case 4,
-		 * a new unconfirmed record should be generated regardless
-		 * of whether any properties have changed.
-		 */
+	if (unconf) /* case 4, possible retry or client restart */
 		expire_client(unconf);
-	}
 
+	/* case 1 (normal case) */
 out_new:
-	/* Normal case */
 	new = create_client(exid->clname, dname, rqstp, &verf);
 	if (new == NULL) {
 		status = nfserr_jukebox;
-- 
1.7.9.5


  parent reply	other threads:[~2012-05-16 12:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-16 12:48 exchange_id changes for 3.5 J. Bruce Fields
2012-05-16 12:48 ` [PATCH 01/11] nfsd4: exchange_id has a pointless copy J. Bruce Fields
2012-05-16 12:48 ` [PATCH 02/11] nfsd4: exchange_id error cleanup J. Bruce Fields
2012-05-16 12:48 ` [PATCH 03/11] nfsd4: exchange_id: check creds before killing confirmed client J. Bruce Fields
2012-05-16 12:48 ` [PATCH 04/11] nfsd4: allow an EXCHANGE_ID to kill a 4.0 client J. Bruce Fields
2012-05-16 12:48 ` [PATCH 05/11] nfsd4: exchange_id cleanup: local shorthands for repeated tests J. Bruce Fields
2012-05-16 12:48 ` J. Bruce Fields [this message]
2012-05-16 12:48 ` [PATCH 07/11] nfsd4: rearrange exchange_id logic to simplify J. Bruce Fields
2012-05-16 12:48 ` [PATCH 08/11] nfsd4: allow removing clients not holding state J. Bruce Fields
2012-05-16 12:48 ` [PATCH 09/11] nfsd4: move principal name into svc_cred J. Bruce Fields
2012-05-16 12:48 ` [PATCH 10/11] nfsd4: stricter cred comparison for setclientid/exchange_id J. Bruce Fields
2012-05-16 12:48 ` [PATCH 11/11] nfsd4: move rq_flavor into svc_cred J. Bruce Fields

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1337172519-17335-7-git-send-email-bfields@redhat.com \
    --to=bfields@redhat.com \
    --cc=linux-nfs@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).