diff options
author | J. Bruce Fields <bfields@redhat.com> | 2012-09-12 14:41:31 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2012-10-01 17:40:03 -0400 |
commit | 8f9d3d3b7cd25763efec91db23a1cce1971147c2 (patch) | |
tree | 5bcc1686e9201ec519455e8d3aa6aadd8759fe31 /fs/nfsd/nfs4state.c | |
parent | 81f0b2a4965da2a48aed5e992f2bc859e5d35066 (diff) |
nfsd4: expire old client earlier
Before we had to delay expiring a client till we'd found out whether the
session and connection allocations would succeed. That's no longer
necessary.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r-- | fs/nfsd/nfs4state.c | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 1cd80d576952..592cd7fb6f00 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -1756,7 +1756,6 @@ nfsd4_create_session(struct svc_rqst *rqstp, | |||
1756 | struct nfsd4_session *new; | 1756 | struct nfsd4_session *new; |
1757 | struct nfsd4_conn *conn; | 1757 | struct nfsd4_conn *conn; |
1758 | struct nfsd4_clid_slot *cs_slot = NULL; | 1758 | struct nfsd4_clid_slot *cs_slot = NULL; |
1759 | bool confirm_me = false; | ||
1760 | __be32 status = 0; | 1759 | __be32 status = 0; |
1761 | 1760 | ||
1762 | if (cr_ses->flags & ~SESSION4_FLAG_MASK_A) | 1761 | if (cr_ses->flags & ~SESSION4_FLAG_MASK_A) |
@@ -1786,6 +1785,8 @@ nfsd4_create_session(struct svc_rqst *rqstp, | |||
1786 | goto out_free_conn; | 1785 | goto out_free_conn; |
1787 | } | 1786 | } |
1788 | } else if (unconf) { | 1787 | } else if (unconf) { |
1788 | unsigned int hash; | ||
1789 | struct nfs4_client *old; | ||
1789 | if (!same_creds(&unconf->cl_cred, &rqstp->rq_cred) || | 1790 | if (!same_creds(&unconf->cl_cred, &rqstp->rq_cred) || |
1790 | !rpc_cmp_addr(sa, (struct sockaddr *) &unconf->cl_addr)) { | 1791 | !rpc_cmp_addr(sa, (struct sockaddr *) &unconf->cl_addr)) { |
1791 | status = nfserr_clid_inuse; | 1792 | status = nfserr_clid_inuse; |
@@ -1798,7 +1799,11 @@ nfsd4_create_session(struct svc_rqst *rqstp, | |||
1798 | status = nfserr_seq_misordered; | 1799 | status = nfserr_seq_misordered; |
1799 | goto out_free_conn; | 1800 | goto out_free_conn; |
1800 | } | 1801 | } |
1801 | confirm_me = true; | 1802 | hash = clientstr_hashval(unconf->cl_recdir); |
1803 | old = find_confirmed_client_by_str(unconf->cl_recdir, hash); | ||
1804 | if (old) | ||
1805 | expire_client(old); | ||
1806 | move_to_confirmed(unconf); | ||
1802 | conf = unconf; | 1807 | conf = unconf; |
1803 | } else { | 1808 | } else { |
1804 | status = nfserr_stale_clientid; | 1809 | status = nfserr_stale_clientid; |
@@ -1823,14 +1828,6 @@ nfsd4_create_session(struct svc_rqst *rqstp, | |||
1823 | 1828 | ||
1824 | /* cache solo and embedded create sessions under the state lock */ | 1829 | /* cache solo and embedded create sessions under the state lock */ |
1825 | nfsd4_cache_create_session(cr_ses, cs_slot, status); | 1830 | nfsd4_cache_create_session(cr_ses, cs_slot, status); |
1826 | if (confirm_me) { | ||
1827 | unsigned int hash = clientstr_hashval(unconf->cl_recdir); | ||
1828 | struct nfs4_client *old = | ||
1829 | find_confirmed_client_by_str(conf->cl_recdir, hash); | ||
1830 | if (old) | ||
1831 | expire_client(old); | ||
1832 | move_to_confirmed(conf); | ||
1833 | } | ||
1834 | out: | 1831 | out: |
1835 | nfs4_unlock_state(); | 1832 | nfs4_unlock_state(); |
1836 | dprintk("%s returns %d\n", __func__, ntohl(status)); | 1833 | dprintk("%s returns %d\n", __func__, ntohl(status)); |