Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 192375
b: refs/heads/master
c: 9089f1b
h: refs/heads/master
i:
  192373: 88a552c
  192371: 59e00ae
  192367: 457f6f1
v: v3
  • Loading branch information
Benny Halevy authored and J. Bruce Fields committed May 12, 2010
1 parent c9f06ce commit 351b785
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 5d4cec2f2fdbb3d830fa014226d0d965df548bad
refs/heads/master: 9089f1b4782ff52835059779fd37b7ad765a25c7
26 changes: 14 additions & 12 deletions trunk/fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,9 @@ unhash_delegation(struct nfs4_delegation *dp)
* SETCLIENTID state
*/

/* client_lock protects the session hash table */
static DEFINE_SPINLOCK(client_lock);

/* Hash tables for nfs4_clientid state */
#define CLIENT_HASH_BITS 4
#define CLIENT_HASH_SIZE (1 << CLIENT_HASH_BITS)
Expand Down Expand Up @@ -368,7 +371,6 @@ static void release_openowner(struct nfs4_stateowner *sop)
nfs4_put_stateowner(sop);
}

static DEFINE_SPINLOCK(sessionid_lock);
#define SESSION_HASH_SIZE 512
static struct list_head sessionid_hashtbl[SESSION_HASH_SIZE];

Expand Down Expand Up @@ -566,10 +568,10 @@ alloc_init_session(struct svc_rqst *rqstp, struct nfs4_client *clp,

new->se_flags = cses->flags;
kref_init(&new->se_ref);
spin_lock(&sessionid_lock);
spin_lock(&client_lock);
list_add(&new->se_hash, &sessionid_hashtbl[idx]);
list_add(&new->se_perclnt, &clp->cl_sessions);
spin_unlock(&sessionid_lock);
spin_unlock(&client_lock);

status = nfs_ok;
out:
Expand All @@ -580,7 +582,7 @@ alloc_init_session(struct svc_rqst *rqstp, struct nfs4_client *clp,
goto out;
}

/* caller must hold sessionid_lock */
/* caller must hold client_lock */
static struct nfsd4_session *
find_in_sessionid_hashtbl(struct nfs4_sessionid *sessionid)
{
Expand All @@ -603,7 +605,7 @@ find_in_sessionid_hashtbl(struct nfs4_sessionid *sessionid)
return NULL;
}

/* caller must hold sessionid_lock */
/* caller must hold client_lock */
static void
unhash_session(struct nfsd4_session *ses)
{
Expand All @@ -614,9 +616,9 @@ unhash_session(struct nfsd4_session *ses)
static void
release_session(struct nfsd4_session *ses)
{
spin_lock(&sessionid_lock);
spin_lock(&client_lock);
unhash_session(ses);
spin_unlock(&sessionid_lock);
spin_unlock(&client_lock);
nfsd4_put_session(ses);
}

Expand Down Expand Up @@ -1379,15 +1381,15 @@ nfsd4_destroy_session(struct svc_rqst *r,
return nfserr_not_only_op;
}
dump_sessionid(__func__, &sessionid->sessionid);
spin_lock(&sessionid_lock);
spin_lock(&client_lock);
ses = find_in_sessionid_hashtbl(&sessionid->sessionid);
if (!ses) {
spin_unlock(&sessionid_lock);
spin_unlock(&client_lock);
goto out;
}

unhash_session(ses);
spin_unlock(&sessionid_lock);
spin_unlock(&client_lock);

/* wait for callbacks */
nfsd4_set_callback_client(ses->se_client, NULL);
Expand All @@ -1411,7 +1413,7 @@ nfsd4_sequence(struct svc_rqst *rqstp,
if (resp->opcnt != 1)
return nfserr_sequence_pos;

spin_lock(&sessionid_lock);
spin_lock(&client_lock);
status = nfserr_badsession;
session = find_in_sessionid_hashtbl(&seq->sessionid);
if (!session)
Expand Down Expand Up @@ -1454,7 +1456,7 @@ nfsd4_sequence(struct svc_rqst *rqstp,
/* Hold a session reference until done processing the compound. */
if (cstate->session)
nfsd4_get_session(cstate->session);
spin_unlock(&sessionid_lock);
spin_unlock(&client_lock);
/* Renew the clientid on success and on replay */
if (cstate->session) {
nfs4_lock_state();
Expand Down

0 comments on commit 351b785

Please sign in to comment.