diff options
author | J. Bruce Fields <bfields@redhat.com> | 2012-05-14 09:08:10 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-05-31 20:29:52 -0400 |
commit | 83e08fd46cea3b59dce9285461e3854b594042af (patch) | |
tree | e0c90f655459e83b011a94e85d31df4aac2495d3 /fs/nfsd/nfs4state.c | |
parent | 1a308118c238c5aa0af3d303b42fa6bbee279394 (diff) |
nfsd4: exchange_id cleanup: local shorthands for repeated tests
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index c88f5c103e87..3b6d61008673 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1520,6 +1520,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, | |||
1520 | char addr_str[INET6_ADDRSTRLEN]; | 1520 | char addr_str[INET6_ADDRSTRLEN]; |
1521 | nfs4_verifier verf = exid->verifier; | 1521 | nfs4_verifier verf = exid->verifier; |
1522 | struct sockaddr *sa = svc_addr(rqstp); | 1522 | struct sockaddr *sa = svc_addr(rqstp); |
1523 | bool update = exid->flags & EXCHGID4_FLAG_UPD_CONFIRMED_REC_A; | ||
1523 | 1524 | ||
1524 | rpc_ntop(sa, addr_str, sizeof(addr_str)); | 1525 | rpc_ntop(sa, addr_str, sizeof(addr_str)); |
1525 | dprintk("%s rqstp=%p exid=%p clname.len=%u clname.data=%p " | 1526 | dprintk("%s rqstp=%p exid=%p clname.len=%u clname.data=%p " |
@@ -1552,23 +1553,26 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, | |||
1552 | nfs4_lock_state(); | 1553 | nfs4_lock_state(); |
1553 | conf = find_confirmed_client_by_str(dname, strhashval); | 1554 | conf = find_confirmed_client_by_str(dname, strhashval); |
1554 | if (conf) { | 1555 | if (conf) { |
1556 | bool creds_match = same_creds(&conf->cl_cred, &rqstp->rq_cred); | ||
1557 | bool verfs_match = same_verf(&verf, &conf->cl_verifier); | ||
1558 | |||
1555 | if (!clp_used_exchangeid(conf)) { | 1559 | if (!clp_used_exchangeid(conf)) { |
1556 | if (exid->flags & EXCHGID4_FLAG_UPD_CONFIRMED_REC_A) { | 1560 | if (update) { |
1557 | status = nfserr_inval; /* buggy client */ | 1561 | status = nfserr_inval; /* buggy client */ |
1558 | goto out; | 1562 | goto out; |
1559 | } | 1563 | } |
1560 | } | 1564 | } |
1561 | if (!same_creds(&conf->cl_cred, &rqstp->rq_cred)) { | 1565 | if (!creds_match) { |
1562 | /* 18.35.4 case 9 */ | 1566 | /* 18.35.4 case 9 */ |
1563 | if (exid->flags & EXCHGID4_FLAG_UPD_CONFIRMED_REC_A) | 1567 | if (update) |
1564 | status = nfserr_perm; | 1568 | status = nfserr_perm; |
1565 | else /* case 3 */ | 1569 | else /* case 3 */ |
1566 | status = nfserr_clid_inuse; | 1570 | status = nfserr_clid_inuse; |
1567 | goto out; | 1571 | goto out; |
1568 | } | 1572 | } |
1569 | if (!same_verf(&verf, &conf->cl_verifier)) { | 1573 | if (!verfs_match) { |
1570 | /* 18.35.4 case 8 */ | 1574 | /* 18.35.4 case 8 */ |
1571 | if (exid->flags & EXCHGID4_FLAG_UPD_CONFIRMED_REC_A) { | 1575 | if (update) { |
1572 | status = nfserr_not_same; | 1576 | status = nfserr_not_same; |
1573 | goto out; | 1577 | goto out; |
1574 | } | 1578 | } |
@@ -1595,7 +1599,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp, | |||
1595 | } | 1599 | } |
1596 | 1600 | ||
1597 | /* 18.35.4 case 7 */ | 1601 | /* 18.35.4 case 7 */ |
1598 | if (exid->flags & EXCHGID4_FLAG_UPD_CONFIRMED_REC_A) { | 1602 | if (update) { |
1599 | status = nfserr_noent; | 1603 | status = nfserr_noent; |
1600 | goto out; | 1604 | goto out; |
1601 | } | 1605 | } |