aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2012-05-18 21:54:19 -0400
committerJ. Bruce Fields <bfields@redhat.com>2012-05-31 20:29:59 -0400
commit63db46328a9854d0adcde69871a28d94e0fc7746 (patch)
tree44c26667054a3740a82d3d555f5f36c26fc0c91a /fs/nfsd/nfs4state.c
parente98479b8d6a451bfae1a29e9b2dd503e435f7a48 (diff)
nfsd4: setclientid/confirm comment cleanup
Be a little more concise. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c67
1 files changed, 11 insertions, 56 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 7bb4e88f33c7..dd4c6d36534b 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -2169,17 +2169,13 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
2169 if (status) 2169 if (status)
2170 return status; 2170 return status;
2171 2171
2172 /*
2173 * XXX The Duplicate Request Cache (DRC) has been checked (??)
2174 * We get here on a DRC miss.
2175 */
2176
2177 strhashval = clientstr_hashval(dname); 2172 strhashval = clientstr_hashval(dname);
2178 2173
2174 /* Cases below refer to rfc 3530 section 14.2.33: */
2179 nfs4_lock_state(); 2175 nfs4_lock_state();
2180 conf = find_confirmed_client_by_str(dname, strhashval); 2176 conf = find_confirmed_client_by_str(dname, strhashval);
2181 if (conf) { 2177 if (conf) {
2182 /* RFC 3530 14.2.33 CASE 0: */ 2178 /* case 0: */
2183 status = nfserr_clid_inuse; 2179 status = nfserr_clid_inuse;
2184 if (clp_used_exchangeid(conf)) 2180 if (clp_used_exchangeid(conf))
2185 goto out; 2181 goto out;
@@ -2192,18 +2188,10 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
2192 goto out; 2188 goto out;
2193 } 2189 }
2194 } 2190 }
2195 /*
2196 * section 14.2.33 of RFC 3530 (under the heading "IMPLEMENTATION")
2197 * has a description of SETCLIENTID request processing consisting
2198 * of 5 bullet points, labeled as CASE0 - CASE4 below.
2199 */
2200 unconf = find_unconfirmed_client_by_str(dname, strhashval); 2191 unconf = find_unconfirmed_client_by_str(dname, strhashval);
2201 status = nfserr_jukebox; 2192 status = nfserr_jukebox;
2202 if (!conf) { 2193 if (!conf) {
2203 /* 2194 /* case 4: placed first, because it's the normal case */
2204 * RFC 3530 14.2.33 CASE 4:
2205 * placed first, because it is the normal case
2206 */
2207 if (unconf) 2195 if (unconf)
2208 expire_client(unconf); 2196 expire_client(unconf);
2209 new = create_client(clname, dname, rqstp, &clverifier); 2197 new = create_client(clname, dname, rqstp, &clverifier);
@@ -2211,10 +2199,7 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
2211 goto out; 2199 goto out;
2212 gen_clid(new); 2200 gen_clid(new);
2213 } else if (same_verf(&conf->cl_verifier, &clverifier)) { 2201 } else if (same_verf(&conf->cl_verifier, &clverifier)) {
2214 /* 2202 /* case 1: probable callback update */
2215 * RFC 3530 14.2.33 CASE 1:
2216 * probable callback update
2217 */
2218 if (unconf) { 2203 if (unconf) {
2219 /* Note this is removing unconfirmed {*x***}, 2204 /* Note this is removing unconfirmed {*x***},
2220 * which is stronger than RFC recommended {vxc**}. 2205 * which is stronger than RFC recommended {vxc**}.
@@ -2228,21 +2213,13 @@ nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
2228 goto out; 2213 goto out;
2229 copy_clid(new, conf); 2214 copy_clid(new, conf);
2230 } else if (!unconf) { 2215 } else if (!unconf) {
2231 /* 2216 /* case 2: probable client reboot: */
2232 * RFC 3530 14.2.33 CASE 2:
2233 * probable client reboot; state will be removed if
2234 * confirmed.
2235 */
2236 new = create_client(clname, dname, rqstp, &clverifier); 2217 new = create_client(clname, dname, rqstp, &clverifier);
2237 if (new == NULL) 2218 if (new == NULL)
2238 goto out; 2219 goto out;
2239 gen_clid(new); 2220 gen_clid(new);
2240 } else { 2221 } else {
2241 /* 2222 /* case 3: probable client reboot: */
2242 * RFC 3530 14.2.33 CASE 3:
2243 * probable client reboot; state will be removed if
2244 * confirmed.
2245 */
2246 expire_client(unconf); 2223 expire_client(unconf);
2247 new = create_client(clname, dname, rqstp, &clverifier); 2224 new = create_client(clname, dname, rqstp, &clverifier);
2248 if (new == NULL) 2225 if (new == NULL)
@@ -2266,11 +2243,6 @@ out:
2266} 2243}
2267 2244
2268 2245
2269/*
2270 * Section 14.2.34 of RFC 3530 (under the heading "IMPLEMENTATION") has
2271 * a description of SETCLIENTID_CONFIRM request processing consisting of 4
2272 * bullets, labeled as CASE1 - CASE4 below.
2273 */
2274__be32 2246__be32
2275nfsd4_setclientid_confirm(struct svc_rqst *rqstp, 2247nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
2276 struct nfsd4_compound_state *cstate, 2248 struct nfsd4_compound_state *cstate,
@@ -2293,17 +2265,10 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
2293 conf = find_confirmed_client(clid); 2265 conf = find_confirmed_client(clid);
2294 unconf = find_unconfirmed_client(clid); 2266 unconf = find_unconfirmed_client(clid);
2295 2267
2296 /* 2268 /* cases below refer to rfc 3530 section 14.2.34: */
2297 * section 14.2.34 of RFC 3530 has a description of
2298 * SETCLIENTID_CONFIRM request processing consisting
2299 * of 4 bullet points, labeled as CASE1 - CASE4 below.
2300 */
2301 status = nfserr_clid_inuse; 2269 status = nfserr_clid_inuse;
2302 if (conf && unconf && same_verf(&confirm, &unconf->cl_confirm)) { 2270 if (conf && unconf && same_verf(&confirm, &unconf->cl_confirm)) {
2303 /* 2271 /* case 1: callback update */
2304 * RFC 3530 14.2.34 CASE 1:
2305 * callback update
2306 */
2307 if (!same_creds(&conf->cl_cred, &unconf->cl_cred)) 2272 if (!same_creds(&conf->cl_cred, &unconf->cl_cred))
2308 status = nfserr_clid_inuse; 2273 status = nfserr_clid_inuse;
2309 else { 2274 else {
@@ -2313,21 +2278,14 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
2313 status = nfs_ok; 2278 status = nfs_ok;
2314 } 2279 }
2315 } else if (conf && !unconf) { 2280 } else if (conf && !unconf) {
2316 /* 2281 /* case 2: probable retransmit: */
2317 * RFC 3530 14.2.34 CASE 2:
2318 * probable retransmitted request; play it safe and
2319 * do nothing.
2320 */
2321 if (!same_creds(&conf->cl_cred, &rqstp->rq_cred)) 2282 if (!same_creds(&conf->cl_cred, &rqstp->rq_cred))
2322 status = nfserr_clid_inuse; 2283 status = nfserr_clid_inuse;
2323 else 2284 else
2324 status = nfs_ok; 2285 status = nfs_ok;
2325 } else if (!conf && unconf 2286 } else if (!conf && unconf
2326 && same_verf(&unconf->cl_confirm, &confirm)) { 2287 && same_verf(&unconf->cl_confirm, &confirm)) {
2327 /* 2288 /* case 3: normal case; new or rebooted client */
2328 * RFC 3530 14.2.34 CASE 3:
2329 * Normal case; new or rebooted client:
2330 */
2331 if (!same_creds(&unconf->cl_cred, &rqstp->rq_cred)) { 2289 if (!same_creds(&unconf->cl_cred, &rqstp->rq_cred)) {
2332 status = nfserr_clid_inuse; 2290 status = nfserr_clid_inuse;
2333 } else { 2291 } else {
@@ -2346,10 +2304,7 @@ nfsd4_setclientid_confirm(struct svc_rqst *rqstp,
2346 } 2304 }
2347 } else if ((!conf || !same_verf(&conf->cl_confirm, &confirm)) 2305 } else if ((!conf || !same_verf(&conf->cl_confirm, &confirm))
2348 && (!unconf || !same_verf(&unconf->cl_confirm, &confirm))) { 2306 && (!unconf || !same_verf(&unconf->cl_confirm, &confirm))) {
2349 /* 2307 /* case 4: client hasn't noticed we rebooted yet? */
2350 * RFC 3530 14.2.34 CASE 4:
2351 * Client probably hasn't noticed that we rebooted yet.
2352 */
2353 status = nfserr_stale_clientid; 2308 status = nfserr_stale_clientid;
2354 } 2309 }
2355 2310