aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs
diff options
context:
space:
mode:
authorRicardo Labiaga <Ricardo.Labiaga@netapp.com>2009-04-01 09:23:34 -0400
committerBenny Halevy <bhalevy@panasas.com>2009-06-17 17:11:43 -0400
commit963891ac43ecf9974d82f4c178752e11e007cf87 (patch)
treea083f74aa6c024773e91c0cd095ae1175bde6aa7 /fs/nfs
parentf8625a6a4bb76207302be58453603d8e324df490 (diff)
nfs41: Backchannel: New find_client_with_session()
Finds the 'struct nfs_client' that matches the server's address, major version number, and session ID. Signed-off-by: Ricardo Labiaga <Ricardo.Labiaga@netapp.com> Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Diffstat (limited to 'fs/nfs')
-rw-r--r--fs/nfs/callback_proc.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/fs/nfs/callback_proc.c b/fs/nfs/callback_proc.c
index f731bbe7ac6a..6b342e82ebb3 100644
--- a/fs/nfs/callback_proc.c
+++ b/fs/nfs/callback_proc.c
@@ -104,6 +104,42 @@ out:
104 104
105#if defined(CONFIG_NFS_V4_1) 105#if defined(CONFIG_NFS_V4_1)
106 106
107/*
108 * Returns a pointer to a held 'struct nfs_client' that matches the server's
109 * address, major version number, and session ID. It is the caller's
110 * responsibility to release the returned reference.
111 *
112 * Returns NULL if there are no connections with sessions, or if no session
113 * matches the one of interest.
114 */
115 static struct nfs_client *find_client_with_session(
116 const struct sockaddr *addr, u32 nfsversion,
117 struct nfs4_sessionid *sessionid)
118{
119 struct nfs_client *clp;
120
121 clp = nfs_find_client(addr, 4);
122 if (clp == NULL)
123 return NULL;
124
125 do {
126 struct nfs_client *prev = clp;
127
128 if (clp->cl_session != NULL) {
129 if (memcmp(clp->cl_session->sess_id.data,
130 sessionid->data,
131 NFS4_MAX_SESSIONID_LEN) == 0) {
132 /* Returns a held reference to clp */
133 return clp;
134 }
135 }
136 clp = nfs_find_client_next(prev);
137 nfs_put_client(prev);
138 } while (clp != NULL);
139
140 return NULL;
141}
142
107/* FIXME: validate args->cbs_{sequence,slot}id */ 143/* FIXME: validate args->cbs_{sequence,slot}id */
108/* FIXME: referring calls should be processed */ 144/* FIXME: referring calls should be processed */
109unsigned nfs4_callback_sequence(struct cb_sequenceargs *args, 145unsigned nfs4_callback_sequence(struct cb_sequenceargs *args,