Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 217295
b: refs/heads/master
c: a663bdd
h: refs/heads/master
i:
  217293: 7b0f17b
  217291: e9dff3d
  217287: 2872796
  217279: 25d77e2
v: v3
  • Loading branch information
J. Bruce Fields committed Oct 25, 2010
1 parent 4ee205b commit 95071a9
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 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: 5d18c1c2a9a74e0f966c257520b8b7f5136c87b3
refs/heads/master: a663bdd8c5d18d287f7468470816c9e0e66343c1
31 changes: 17 additions & 14 deletions trunk/fs/nfsd/nfs4state.c
Original file line number Diff line number Diff line change
Expand Up @@ -1628,33 +1628,25 @@ nfsd4_destroy_session(struct svc_rqst *r,
return status;
}

static struct nfsd4_conn *__nfsd4_find_conn(struct svc_rqst *r, struct nfsd4_session *s)
static struct nfsd4_conn *__nfsd4_find_conn(struct svc_xprt *xpt, struct nfsd4_session *s)
{
struct nfsd4_conn *c;

list_for_each_entry(c, &s->se_conns, cn_persession) {
if (c->cn_xprt == r->rq_xprt) {
if (c->cn_xprt == xpt) {
return c;
}
}
return NULL;
}

static void nfsd4_sequence_check_conn(struct svc_rqst *rqstp, struct nfsd4_session *ses)
static void nfsd4_sequence_check_conn(struct nfsd4_conn *new, struct nfsd4_session *ses)
{
struct nfs4_client *clp = ses->se_client;
struct nfsd4_conn *c, *new = NULL;

spin_lock(&clp->cl_lock);
c = __nfsd4_find_conn(rqstp, ses);
spin_unlock(&clp->cl_lock);
if (c)
return;

new = alloc_conn(rqstp, NFS4_CDFC4_FORE);
struct nfsd4_conn *c;

spin_lock(&clp->cl_lock);
c = __nfsd4_find_conn(rqstp, ses);
c = __nfsd4_find_conn(new->cn_xprt, ses);
if (c) {
spin_unlock(&clp->cl_lock);
free_conn(new);
Expand All @@ -1674,11 +1666,20 @@ nfsd4_sequence(struct svc_rqst *rqstp,
struct nfsd4_compoundres *resp = rqstp->rq_resp;
struct nfsd4_session *session;
struct nfsd4_slot *slot;
struct nfsd4_conn *conn;
int status;

if (resp->opcnt != 1)
return nfserr_sequence_pos;

/*
* Will be either used or freed by nfsd4_sequence_check_conn
* below.
*/
conn = alloc_conn(rqstp, NFS4_CDFC4_FORE);
if (!conn)
return nfserr_jukebox;

spin_lock(&client_lock);
status = nfserr_badsession;
session = find_in_sessionid_hashtbl(&seq->sessionid);
Expand Down Expand Up @@ -1710,7 +1711,8 @@ nfsd4_sequence(struct svc_rqst *rqstp,
if (status)
goto out;

nfsd4_sequence_check_conn(rqstp, session);
nfsd4_sequence_check_conn(conn, session);
conn = NULL;

/* Success! bump slot seqid */
slot->sl_inuse = true;
Expand All @@ -1726,6 +1728,7 @@ nfsd4_sequence(struct svc_rqst *rqstp,
nfsd4_get_session(cstate->session);
atomic_inc(&session->se_client->cl_refcount);
}
kfree(conn);
spin_unlock(&client_lock);
dprintk("%s: return %d\n", __func__, ntohl(status));
return status;
Expand Down

0 comments on commit 95071a9

Please sign in to comment.