1. 27 8月, 2010 1 次提交
  2. 30 7月, 2010 1 次提交
    • J
      nfsd4: share file descriptors between stateid's · f9d7562f
      J. Bruce Fields 提交于
      The vfs doesn't really allow us to "upgrade" a file descriptor from
      read-only to read-write, and our attempt to do so in nfs4_upgrade_open
      is ugly and incomplete.
      
      Move to a different scheme where we keep multiple opens, shared between
      open stateid's, in the nfs4_file struct.  Each file will be opened at
      most 3 times (for read, write, and read-write), and those opens will be
      shared between all clients and openers.  On upgrade we will do another
      open if necessary instead of attempting to upgrade an existing open.
      We keep count of the number of readers and writers so we know when to
      close the shared files.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      f9d7562f
  3. 13 5月, 2010 3 次提交
  4. 22 4月, 2010 4 次提交
    • J
      nfsd4: allow 4.0 clients to change callback path · 4b21d0de
      J. Bruce Fields 提交于
      The rfc allows a client to change the callback parameters, but we didn't
      previously implement it.
      
      Teach the callbacks to rerun themselves (by placing themselves on a
      workqueue) when they recognize that their rpc task has been killed and
      that the callback connection has changed.
      
      Then we can change the callback connection by setting up a new rpc
      client, modifying the nfs4 client to point at it, waiting for any work
      in progress to complete, and then shutting down the old client.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      4b21d0de
    • J
      nfsd4: rearrange cb data structures · 2bf23875
      J. Bruce Fields 提交于
      Mainly I just want to separate the arguments used for setting up the tcp
      client from the rest.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      2bf23875
    • J
      nfsd4: cl_count is unused · b12a05cb
      J. Bruce Fields 提交于
      Now that the shutdown sequence guarantees callbacks are shut down before
      the client is destroyed, we no longer have a use for cl_count.
      
      We'll probably reinstate a reference count on the client some day, but
      it will be held by users other than callbacks.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      b12a05cb
    • J
      nfsd4: don't sleep in lease-break callback · b5a1a81e
      J. Bruce Fields 提交于
      The NFSv4 server's fl_break callback can sleep (dropping the BKL), in
      order to allocate a new rpc task to send a recall to the client.
      
      As far as I can tell this doesn't cause any races in the current code,
      but the analysis is difficult.  Also, the sleep here may complicate the
      move away from the BKL.
      
      So, just schedule some work to do the job for us instead.  The work will
      later also prove useful for restarting a call after the callback
      information is changed.
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      b5a1a81e
  5. 03 4月, 2010 1 次提交
  6. 16 12月, 2009 2 次提交
  7. 15 12月, 2009 2 次提交
    • B
      nfsd: Move private headers to source directory · 9a74af21
      Boaz Harrosh 提交于
      Lots of include/linux/nfsd/* headers are only used by
      nfsd module. Move them to the source directory
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      9a74af21
    • B
      nfsd: Headers Independence and include cleanups · 72579ac9
      Boaz Harrosh 提交于
      * Add includes that are directly used by headers
      * Remove includes that are not needed
      
      These are the changes made:
      
      [xdr.h]
      struct nfsd_readdirres has an embedded struct readdir_cd from nfsd.h
      fixing that we can drop other includes
      
      [xdr4.h]
      embedded types defined both at state.h and nfsd.h
      
      [syscall.h]
      After export.h fix none of these stuff is needed.
      fix extra space in # include <> statement
      
      [stats.h]
      does not need <linux/nfs4.h> but was export to user-mode
      so I don't touch it
      
      [state.h]
      embedded types from nfsfh.h like struct knfsd_fh. bringing that
      eliminates the need for all other includes
      
      [nfsfh.h]
      directly manipulating types from sunrpc/svc.h.
      Removed Other unused headers.
      
      [nfsd.h]
      removed unused headers include
      
      [export.h]
      lots of sunrpc/svc.h types and a single prototype declaration
      with pointer from nfsfh.h, but all users of export.h do need
      nfsfh.h any way. remove now un-needed include.
      
      [const.h]
      Unfixed (not independent)
      
      [cache.h]
      could do with a forward declaration of "struct svc_rqst;"
      from sunrpc/svc.h but all users absolutely will need
      sunrpc/svc.h it is easier overall this way.
      Signed-off-by: NBoaz Harrosh <bharrosh@panasas.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      72579ac9
  8. 06 11月, 2009 1 次提交
  9. 16 9月, 2009 5 次提交
  10. 02 9月, 2009 2 次提交
    • A
      nfsd41: replace page based DRC with buffer based DRC · 557ce264
      Andy Adamson 提交于
      Use NFSD_SLOT_CACHE_SIZE size buffers for sessions DRC instead of holding nfsd
      pages in cache.
      
      Connectathon testing has shown that 1024 bytes for encoded compound operation
      responses past the sequence operation is sufficient, 512 bytes is a little too
      small. Set NFSD_SLOT_CACHE_SIZE to 1024.
      
      Allocate memory for the session DRC in the CREATE_SESSION operation
      to guarantee that the memory resource is available for caching responses.
      Allocate each slot individually in preparation for slot table size negotiation.
      
      Remove struct nfsd4_cache_entry and helper functions for the old page-based
      DRC.
      
      The iov_len calculation in nfs4svc_encode_compoundres is now always
      correct.  Replay is now done in nfsd4_sequence under the state lock, so
      the session ref count is only bumped on non-replay. Clean up the
      nfs4svc_encode_compoundres session logic.
      
      The nfsd4_compound_state statp pointer is also not used.
      Remove nfsd4_set_statp().
      
      Move useful nfsd4_cache_entry fields into nfsd4_slot.
      
      Signed-off-by: Andy Adamson <andros@netapp.com
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      557ce264
    • A
      nfsd41: bound forechannel drc size by memory usage · a649637c
      Andy Adamson 提交于
      By using the requested ca_maxresponsesize_cached * ca_maxresponses to bound
      a forechannel drc request size, clients can tailor a session to usage.
      
      For example, an I/O session (READ/WRITE only) can have a much smaller
      ca_maxresponsesize_cached (for only WRITE compound responses) and a lot larger
      ca_maxresponses to service a large in-flight data window.
      Signed-off-by: NAndy Adamson <andros@netapp.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      a649637c
  11. 21 8月, 2009 2 次提交
  12. 29 7月, 2009 2 次提交
    • A
      nfsd41: Use separate DRC for setclientid · 49557cc7
      Andy Adamson 提交于
      Instead of trying to share the generic 4.1 reply cache code for the
      CREATE_SESSION reply cache, it's simpler to handle CREATE_SESSION
      separately.
      
      The nfs41 single slot clientid DRC holds the results of create session
      processing.  CREATE_SESSION can be preceeded by a SEQUENCE operation
      (an embedded CREATE_SESSION) and the create session single slot cache must be
      maintained.  nfsd4_replay_cache_entry() and nfsd4_store_cache_entry() do not
      implement the replay of an embedded CREATE_SESSION.
      
      The clientid DRC slot does not need the inuse, cachethis or other fields that
      the multiple slot session cache uses.  Replace the clientid DRC cache struct
      nfs4_slot cache with a new nfsd4_clid_slot cache.  Save the xdr struct
      nfsd4_create_session into the cache at the end of processing, and on a replay,
      replace the struct for the replay request with the cached version all while
      under the state lock.
      
      nfsd4_proc_compound will handle both the solo and embedded CREATE_SESSION case
      via the normal use of encode_operation.
      
      Errors that do not change the create session cache:
      A create session NFS4ERR_STALE_CLIENTID error means that a client record
      (and associated create session slot) could not be found and therefore can't
      be changed.  NFSERR_SEQ_MISORDERED errors do not change the slot cache.
      
      All other errors get cached.
      
      Remove the clientid DRC specific check in nfs4svc_encode_compoundres to
      put the session only if cstate.session is set which will now always be true.
      Signed-off-by: NAndy Adamson <andros@netapp.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      49557cc7
    • A
      nfsd41: hange from page to memory based drc limits · 0c193054
      Andy Adamson 提交于
      NFSD_SLOT_CACHE_SIZE is the size of all encoded operation responses
      (excluding the sequence operation) that we want to cache.
      
      For now, keep NFSD_SLOT_CACHE_SIZE at PAGE_SIZE. It will be reduced
      when the DRC is changed from page based to memory based.
      Signed-off-by: NAndy Adamson <andros@netapp.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      0c193054
  13. 19 6月, 2009 1 次提交
  14. 18 6月, 2009 1 次提交
  15. 17 6月, 2009 1 次提交
  16. 02 5月, 2009 4 次提交
  17. 30 4月, 2009 1 次提交
  18. 04 4月, 2009 6 次提交
    • A
      nfsd41: stateid handling · 6668958f
      Andy Adamson 提交于
      When sessions are used, stateful operation sequenceid and stateid handling
      are not used. When sessions are used,  on the first open set the seqid to 1,
      mark state confirmed and skip seqid processing.
      
      When sessionas are used the stateid generation number is ignored when it is zero
      whereas without sessions bad_stateid or stale stateid is returned.
      
      Add flags to propagate session use to all stateful ops and down to
      check_stateid_generation.
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      Signed-off-by: NAndy Adamson <andros@netapp.com>
      [nfsd4_has_session should return a boolean, not u32]
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      [nfsd41: pass nfsd4_compoundres * to nfsd4_process_open1]
      [nfsd41: calculate HAS_SESSION in nfs4_preprocess_stateid_op]
      [nfsd41: calculate HAS_SESSION in nfs4_preprocess_seqid_op]
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      6668958f
    • B
      nfsd: pass nfsd4_compound_state* to nfs4_preprocess_{state,seq}id_op · dd453dfd
      Benny Halevy 提交于
      Currently we only use cstate->current_fh,
      will also be used by nfsd41 code.
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      dd453dfd
    • A
      nfsd41: non-page DRC for solo sequence responses · bf864a31
      Andy Adamson 提交于
      A session inactivity time compound (lease renewal) or a compound where the
      sequence operation has sa_cachethis set to FALSE do not require any pages
      to be held in the v4.1 DRC. This is because struct nfsd4_slot is already
      caching the session information.
      
      Add logic to the nfs41 server to not cache response pages for solo sequence
      responses.
      
      Return nfserr_replay_uncached_rep on the operation following the sequence
      operation when sa_cachethis is FALSE.
      Signed-off-by: NAndy Adamson <andros@netapp.com>
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      [nfsd41: use cstate session in nfsd4_replay_cache_entry]
      [nfsd41: rename nfsd4_no_page_in_cache]
      [nfsd41 rename nfsd4_enc_no_page_replay]
      [nfsd41 nfsd4_is_solo_sequence]
      [nfsd41 change nfsd4_not_cached return]
      Signed-off-by: NAndy Adamson <andros@netapp.com>
      [changed return type to bool]
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      [nfsd41 drop parens in nfsd4_is_solo_sequence call]
      Signed-off-by: NAndy Adamson <andros@netapp.com>
      [changed "== 0" to "!"]
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      bf864a31
    • A
      nfsd41: Add a create session replay cache · 38eb76a5
      Andy Adamson 提交于
      Replace the nfs4_client cl_seqid field with a single struct nfs41_slot used
      for the create session replay cache.
      
      The CREATE_SESSION slot sets the sl_session pointer to NULL. Otherwise, the
      slot and it's replay cache are used just like the session slots.
      
      Fix unconfirmed create_session replay response by initializing the
      create_session slot sequence id to 0.
      
      A future patch will set the CREATE_SESSION cache when a SEQUENCE operation
      preceeds the CREATE_SESSION operation. This compound is currently only cached
      in the session slot table.
      
      Signed-off-by: Andy Adamson<andros@netapp.com>
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      [nfsd41: use bool inuse for slot state]
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      [nfsd41: revert portion of nfsd4_set_cache_entry]
      Signed-off-by: NAndy Adamson <andros@netpp.com>
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      38eb76a5
    • A
      nfsd41: create_session operation · ec6b5d7b
      Andy Adamson 提交于
      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: NMarc Eshel <eshel@almaden.ibm.com>
      Signed-off-by: NDean 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: NAndy Adamson <andros@netapp.com>
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      [use sessionid_lock spin lock]
      [nfsd41: use bool inuse for slot state]
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      [nfsd41 remove sl_session from alloc_init_session]
      Signed-off-by: NAndy Adamson <andros@netapp.com>
      Signed-off-by: NBenny 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: NBenny Halevy <bhalevy@panasas.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      ec6b5d7b
    • A
      nfsd41: DRC save, restore, and clear functions · 074fe897
      Andy Adamson 提交于
      Cache all the result pages, including the rpc header in rq_respages[0],
      for a request in the slot table cache entry.
      
      Cache the statp pointer from nfsd_dispatch which points into rq_respages[0]
      just past the rpc header. When setting a cache entry, calculate and save the
      length of the nfs data minus the rpc header for rq_respages[0].
      
      When replaying a cache entry, replace the cached rpc header with the
      replayed request rpc result header, unless there is not enough room in the
      cached results first page. In that case, use the cached rpc header.
      
      The sessions fore channel maxresponse size cached is set to NFSD_PAGES_PER_SLOT
      * PAGE_SIZE. For compounds we are cacheing with operations such as READDIR
      that use the xdr_buf->pages to hold data, we choose to cache the extra page of
      data rather than copying data from xdr_buf->pages into the xdr_buf->head page.
      
      [nfsd41: limit cache to maxresponsesize_cached]
      [nfsd41: mv nfsd4_set_statp under CONFIG_NFSD_V4_1]
      [nfsd41: rename nfsd4_move_pages]
      [nfsd41: rename page_no variable]
      [nfsd41: rename nfsd4_set_cache_entry]
      [nfsd41: fix nfsd41_copy_replay_data comment]
      [nfsd41: add to nfsd4_set_cache_entry]
      Signed-off-by: NAndy Adamson <andros@netapp.com>
      Signed-off-by: NBenny Halevy <bhalevy@panasas.com>
      Signed-off-by: NJ. Bruce Fields <bfields@citi.umich.edu>
      074fe897