diff options
author | Ricardo Labiaga <Ricardo.Labiaga@netapp.com> | 2009-04-01 09:23:34 -0400 |
---|---|---|
committer | Benny Halevy <bhalevy@panasas.com> | 2009-06-17 14:11:43 -0700 |
commit | 963891ac43ecf9974d82f4c178752e11e007cf87 (patch) | |
tree | a083f74aa6c024773e91c0cd095ae1175bde6aa7 /fs/nfs/callback_proc.c | |
parent | f8625a6a4bb76207302be58453603d8e324df490 (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/callback_proc.c')
-rw-r--r-- | fs/nfs/callback_proc.c | 36 |
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: #if defined(CONFIG_NFS_V4_1) +/* + * Returns a pointer to a held 'struct nfs_client' that matches the server's + * address, major version number, and session ID. It is the caller's + * responsibility to release the returned reference. + * + * Returns NULL if there are no connections with sessions, or if no session + * matches the one of interest. + */ + static struct nfs_client *find_client_with_session( + const struct sockaddr *addr, u32 nfsversion, + struct nfs4_sessionid *sessionid) +{ + struct nfs_client *clp; + + clp = nfs_find_client(addr, 4); + if (clp == NULL) + return NULL; + + do { + struct nfs_client *prev = clp; + + if (clp->cl_session != NULL) { + if (memcmp(clp->cl_session->sess_id.data, + sessionid->data, + NFS4_MAX_SESSIONID_LEN) == 0) { + /* Returns a held reference to clp */ + return clp; + } + } + clp = nfs_find_client_next(prev); + nfs_put_client(prev); + } while (clp != NULL); + + return NULL; +} + /* FIXME: validate args->cbs_{sequence,slot}id */ /* FIXME: referring calls should be processed */ unsigned nfs4_callback_sequence(struct cb_sequenceargs *args, |