diff options
author | Andy Adamson <andros@netapp.com> | 2009-04-03 01:27:43 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-04-03 20:41:13 -0400 |
commit | 7116ed6b9973021ff43edeb10f4cb834db94000f (patch) | |
tree | fb47a0d182cbf2afb87f482ac03d1a1763f8ee3b | |
parent | 10add806c38c022d18af48f3ec28c91b4eaf7bb3 (diff) |
nfsd41: sessions basic data types
This patch provides basic data structures representing the nfs41
sessions and slots, plus helpers for keeping a reference count
on the session and freeing it.
Note that our server only support a headerpadsz of 0 and
it ignores backchannel attributes at the moment.
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfsd41: remove headerpadsz from channel attributes]
[nfsd41: embed nfsd4_channel in nfsd4_session]
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfsd41: use bool inuse for slot state]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfsd41 remove sl_session from nfsd4_slot]
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
-rw-r--r-- | fs/nfsd/nfs4state.c | 18 | ||||
-rw-r--r-- | include/linux/nfsd/state.h | 33 |
2 files changed, 51 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c index 070e9e5c0452..8c70f12159b6 100644 --- a/fs/nfsd/nfs4state.c +++ b/fs/nfsd/nfs4state.c | |||
@@ -382,6 +382,24 @@ static void release_openowner(struct nfs4_stateowner *sop) | |||
382 | nfs4_put_stateowner(sop); | 382 | nfs4_put_stateowner(sop); |
383 | } | 383 | } |
384 | 384 | ||
385 | static void | ||
386 | release_session(struct nfsd4_session *ses) | ||
387 | { | ||
388 | list_del(&ses->se_hash); | ||
389 | list_del(&ses->se_perclnt); | ||
390 | nfsd4_put_session(ses); | ||
391 | } | ||
392 | |||
393 | void | ||
394 | free_session(struct kref *kref) | ||
395 | { | ||
396 | struct nfsd4_session *ses; | ||
397 | |||
398 | ses = container_of(kref, struct nfsd4_session, se_ref); | ||
399 | kfree(ses->se_slots); | ||
400 | kfree(ses); | ||
401 | } | ||
402 | |||
385 | static inline void | 403 | static inline void |
386 | renew_client(struct nfs4_client *clp) | 404 | renew_client(struct nfs4_client *clp) |
387 | { | 405 | { |
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h index a6e4a00fa392..baea7f1fdb4a 100644 --- a/include/linux/nfsd/state.h +++ b/include/linux/nfsd/state.h | |||
@@ -99,6 +99,39 @@ struct nfs4_callback { | |||
99 | struct rpc_clnt * cb_client; | 99 | struct rpc_clnt * cb_client; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | struct nfsd4_slot { | ||
103 | bool sl_inuse; | ||
104 | u32 sl_seqid; | ||
105 | }; | ||
106 | |||
107 | struct nfsd4_session { | ||
108 | struct kref se_ref; | ||
109 | struct list_head se_hash; /* hash by sessionid */ | ||
110 | struct list_head se_perclnt; | ||
111 | u32 se_flags; | ||
112 | struct nfs4_client *se_client; /* for expire_client */ | ||
113 | struct nfs4_sessionid se_sessionid; | ||
114 | u32 se_fmaxreq_sz; | ||
115 | u32 se_fmaxresp_sz; | ||
116 | u32 se_fmaxresp_cached; | ||
117 | u32 se_fmaxops; | ||
118 | u32 se_fnumslots; | ||
119 | struct nfsd4_slot *se_slots; /* forward channel slots */ | ||
120 | }; | ||
121 | |||
122 | static inline void | ||
123 | nfsd4_put_session(struct nfsd4_session *ses) | ||
124 | { | ||
125 | extern void free_session(struct kref *kref); | ||
126 | kref_put(&ses->se_ref, free_session); | ||
127 | } | ||
128 | |||
129 | static inline void | ||
130 | nfsd4_get_session(struct nfsd4_session *ses) | ||
131 | { | ||
132 | kref_get(&ses->se_ref); | ||
133 | } | ||
134 | |||
102 | #define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */ | 135 | #define HEXDIR_LEN 33 /* hex version of 16 byte md5 of cl_name plus '\0' */ |
103 | 136 | ||
104 | /* | 137 | /* |