• Andy Adamson's avatar
    nfsd41: create_session operation · ec6b5d7b
    Andy Adamson authored
    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: default avatarMarc Eshel <eshel@almaden.ibm.com>
    Signed-off-by: default avatarDean 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: default avatarAndy Adamson <andros@netapp.com>
    Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
    [use sessionid_lock spin lock]
    [nfsd41: use bool inuse for slot state]
    Signed-off-by: default avatarBenny Halevy <bhalevy@panasas.com>
    [nfsd41 remove sl_session from alloc_init_session]
    Signed-off-by: default avatarAndy Adamson <andros@netapp.com>
    Signed-off-by: default avatarBenny 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: default avatarBenny Halevy <bhalevy@panasas.com>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
    ec6b5d7b
nfs4xdr.c 79.8 KB