diff options
author | Andy Adamson <andros@netapp.com> | 2009-04-03 01:28:28 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@citi.umich.edu> | 2009-04-03 20:41:18 -0400 |
commit | ec6b5d7b5064fde27aee798b81107ea3a830de85 (patch) | |
tree | de1571b6773201268796fe5bf3db9bb0f8d23812 /include/linux/nfsd | |
parent | 14778a133e3be332be77d981552a79260a61ee17 (diff) |
nfsd41: create_session operation
Implement the create_session operation confoming to
http://tools.ietf.org/html/draft-ietf-nfsv4-minorversion1-26
Look up the client id (generated by the server on exchange_id,
given by the client on create_session).
If neither a confirmed or unconfirmed client is found
then the client id is stale
If a confirmed cilent is found (i.e. we already received
create_session for it) then compare the sequence id
to determine if it's a replay or possibly a mis-ordered rpc.
If the seqid is in order, update the confirmed client seqid
and procedd with updating the session parameters.
If an unconfirmed client_id is found then verify the creds
and seqid. If both match move the client id to confirmed state
and proceed with processing the create_session.
Currently, we do not support persistent sessions, and RDMA.
alloc_init_session generates a new sessionid and creates
a session structure.
NFSD_PAGES_PER_SLOT is used for the max response cached calculation, and for
the counting of DRC pages using the hard limits set in struct srv_serv.
A note on NFSD_PAGES_PER_SLOT:
Other patches in this series allow for NFSD_PAGES_PER_SLOT + 1 pages to be
cached in a DRC slot when the response size is less than NFSD_PAGES_PER_SLOT *
PAGE_SIZE but xdr_buf pages are used. e.g. a READDIR operation will encode a
small amount of data in the xdr_buf head, and then the READDIR in the xdr_buf
pages. So, the hard limit calculation use of pages by a session is
underestimated by the number of cached operations using the xdr_buf pages.
Yet another patch caches no pages for the solo sequence operation, or any
compound where cache_this is False. So the hard limit calculation use of
pages by a session is overestimated by the number of these operations in the
cache.
TODO: improve resource pre-allocation and negotiate session
parameters accordingly. Respect and possibly adjust
backchannel attributes.
Signed-off-by: Marc Eshel <eshel@almaden.ibm.com>
Signed-off-by: Dean Hildebrand <dhildeb@us.ibm.com>
[nfsd41: remove headerpadsz from channel attributes]
Our client and server only support a headerpadsz of 0.
[nfsd41: use DRC limits in fore channel init]
[nfsd41: do not change CREATE_SESSION back channel attrs]
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[use sessionid_lock spin lock]
[nfsd41: use bool inuse for slot state]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[nfsd41 remove sl_session from alloc_init_session]
Signed-off-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
[simplify nfsd4_encode_create_session error handling]
[nfsd41: fix comment style in init_forechannel_attrs]
[nfsd41: allocate struct nfsd4_session and slot table in one piece]
[nfsd41: no need to INIT_LIST_HEAD in alloc_init_session just prior to list_add]
Signed-off-by: Benny Halevy <bhalevy@panasas.com>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Diffstat (limited to 'include/linux/nfsd')
-rw-r--r-- | include/linux/nfsd/state.h | 7 | ||||
-rw-r--r-- | include/linux/nfsd/xdr4.h | 21 |
2 files changed, 26 insertions, 2 deletions
diff --git a/include/linux/nfsd/state.h b/include/linux/nfsd/state.h index f1edb1d98523..692edf4c2e7c 100644 --- a/include/linux/nfsd/state.h +++ b/include/linux/nfsd/state.h | |||
@@ -99,8 +99,12 @@ struct nfs4_callback { | |||
99 | struct rpc_clnt * cb_client; | 99 | struct rpc_clnt * cb_client; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | /* Maximum number of slots per session. 128 is useful for long haul TCP */ | ||
103 | #define NFSD_MAX_SLOTS_PER_SESSION 128 | ||
102 | /* Maximum number of pages per slot cache entry */ | 104 | /* Maximum number of pages per slot cache entry */ |
103 | #define NFSD_PAGES_PER_SLOT 1 | 105 | #define NFSD_PAGES_PER_SLOT 1 |
106 | /* Maximum number of operations per session compound */ | ||
107 | #define NFSD_MAX_OPS_PER_COMPOUND 16 | ||
104 | 108 | ||
105 | struct nfsd4_cache_entry { | 109 | struct nfsd4_cache_entry { |
106 | __be32 ce_status; | 110 | __be32 ce_status; |
@@ -129,7 +133,7 @@ struct nfsd4_session { | |||
129 | u32 se_fmaxresp_cached; | 133 | u32 se_fmaxresp_cached; |
130 | u32 se_fmaxops; | 134 | u32 se_fmaxops; |
131 | u32 se_fnumslots; | 135 | u32 se_fnumslots; |
132 | struct nfsd4_slot *se_slots; /* forward channel slots */ | 136 | struct nfsd4_slot se_slots[]; /* forward channel slots */ |
133 | }; | 137 | }; |
134 | 138 | ||
135 | static inline void | 139 | static inline void |
@@ -188,6 +192,7 @@ struct nfs4_client { | |||
188 | struct list_head cl_sessions; | 192 | struct list_head cl_sessions; |
189 | u32 cl_seqid; /* seqid for create_session */ | 193 | u32 cl_seqid; /* seqid for create_session */ |
190 | u32 cl_exchange_flags; | 194 | u32 cl_exchange_flags; |
195 | struct nfs4_sessionid cl_sessionid; | ||
191 | }; | 196 | }; |
192 | 197 | ||
193 | /* struct nfs4_client_reset | 198 | /* struct nfs4_client_reset |
diff --git a/include/linux/nfsd/xdr4.h b/include/linux/nfsd/xdr4.h index 69cb467cb720..9468829adb70 100644 --- a/include/linux/nfsd/xdr4.h +++ b/include/linux/nfsd/xdr4.h | |||
@@ -359,8 +359,27 @@ struct nfsd4_exchange_id { | |||
359 | int spa_how; | 359 | int spa_how; |
360 | }; | 360 | }; |
361 | 361 | ||
362 | struct nfsd4_channel_attrs { | ||
363 | u32 headerpadsz; | ||
364 | u32 maxreq_sz; | ||
365 | u32 maxresp_sz; | ||
366 | u32 maxresp_cached; | ||
367 | u32 maxops; | ||
368 | u32 maxreqs; | ||
369 | u32 nr_rdma_attrs; | ||
370 | u32 rdma_attrs; | ||
371 | }; | ||
372 | |||
362 | struct nfsd4_create_session { | 373 | struct nfsd4_create_session { |
363 | int foo; /* stub */ | 374 | clientid_t clientid; |
375 | struct nfs4_sessionid sessionid; | ||
376 | u32 seqid; | ||
377 | u32 flags; | ||
378 | struct nfsd4_channel_attrs fore_channel; | ||
379 | struct nfsd4_channel_attrs back_channel; | ||
380 | u32 callback_prog; | ||
381 | u32 uid; | ||
382 | u32 gid; | ||
364 | }; | 383 | }; |
365 | 384 | ||
366 | struct nfsd4_sequence { | 385 | struct nfsd4_sequence { |