1. 11 8月, 2015 6 次提交
  2. 23 6月, 2015 1 次提交
    • C
      nfsd: take struct file setup fully into nfs4_preprocess_stateid_op · af90f707
      Christoph Hellwig 提交于
      This patch changes nfs4_preprocess_stateid_op so it always returns
      a valid struct file if it has been asked for that.  For that we
      now allocate a temporary struct file for special stateids, and check
      permissions if we got the file structure from the stateid.  This
      ensures that all callers will get their handling of special stateids
      right, and avoids code duplication.
      
      There is a little wart in here because the read code needs to know
      if we allocated a file structure so that it can copy around the
      read-ahead parameters.  In the long run we should probably aim to
      cache full file structures used with special stateids instead.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      af90f707
  3. 20 6月, 2015 1 次提交
  4. 29 5月, 2015 1 次提交
    • A
      nfsd: work around a gcc-5.1 warning · 6ac75368
      Arnd Bergmann 提交于
      gcc-5.0 warns about a potential uninitialized variable use in nfsd:
      
      fs/nfsd/nfs4state.c: In function 'nfsd4_process_open2':
      fs/nfsd/nfs4state.c:3781:3: warning: 'old_deny_bmap' may be used uninitialized in this function [-Wmaybe-uninitialized]
         reset_union_bmap_deny(old_deny_bmap, stp);
         ^
      fs/nfsd/nfs4state.c:3760:16: note: 'old_deny_bmap' was declared here
        unsigned char old_deny_bmap;
                      ^
      
      This is a false positive, the code path that is warned about cannot
      actually be reached.
      
      This adds an initialization for the variable to make the warning go
      away.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      6ac75368
  5. 05 5月, 2015 4 次提交
  6. 22 4月, 2015 1 次提交
  7. 16 4月, 2015 1 次提交
  8. 03 4月, 2015 1 次提交
    • J
      locks: change lm_get_owner and lm_put_owner prototypes · cae80b30
      Jeff Layton 提交于
      The current prototypes for these operations are somewhat awkward as they
      deal with fl_owners but take struct file_lock arguments. In the future,
      we'll want to be able to take references without necessarily dealing
      with a struct file_lock.
      
      Change them to take fl_owner_t arguments instead and have the callers
      deal with assigning the values to the file_lock structs.
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      cae80b30
  9. 01 4月, 2015 2 次提交
  10. 26 3月, 2015 2 次提交
  11. 27 2月, 2015 1 次提交
  12. 03 2月, 2015 7 次提交
    • C
      nfsd: implement pNFS layout recalls · c5c707f9
      Christoph Hellwig 提交于
      Add support to issue layout recalls to clients.  For now we only support
      full-file recalls to get a simple and stable implementation.  This allows
      to embedd a nfsd4_callback structure in the layout_state and thus avoid
      any memory allocations under spinlocks during a recall.  For normal
      use cases that do not intent to share a single file between multiple
      clients this implementation is fully sufficient.
      
      To ensure layouts are recalled on local filesystem access each layout
      state registers a new FL_LAYOUT lease with the kernel file locking code,
      which filesystems that support pNFS exports that require recalls need
      to break on conflicting access patterns.
      
      The XDR code is based on the old pNFS server implementation by
      Andy Adamson, Benny Halevy, Boaz Harrosh, Dean Hildebrand, Fred Isaman,
      Marc Eshel, Mike Sager and Ricardo Labiaga.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      c5c707f9
    • C
      nfsd: implement pNFS operations · 9cf514cc
      Christoph Hellwig 提交于
      Add support for the GETDEVICEINFO, LAYOUTGET, LAYOUTCOMMIT and
      LAYOUTRETURN NFSv4.1 operations, as well as backing code to manage
      outstanding layouts and devices.
      
      Layout management is very straight forward, with a nfs4_layout_stateid
      structure that extends nfs4_stid to manage layout stateids as the
      top-level structure.  It is linked into the nfs4_file and nfs4_client
      structures like the other stateids, and contains a linked list of
      layouts that hang of the stateid.  The actual layout operations are
      implemented in layout drivers that are not part of this commit, but
      will be added later.
      
      The worst part of this commit is the management of the pNFS device IDs,
      which suffers from a specification that is not sanely implementable due
      to the fact that the device-IDs are global and not bound to an export,
      and have a small enough size so that we can't store the fsid portion of
      a file handle, and must never be reused.  As we still do need perform all
      export authentication and validation checks on a device ID passed to
      GETDEVICEINFO we are caught between a rock and a hard place.  To work
      around this issue we add a new hash that maps from a 64-bit integer to a
      fsid so that we can look up the export to authenticate against it,
      a 32-bit integer as a generation that we can bump when changing the device,
      and a currently unused 32-bit integer that could be used in the future
      to handle more than a single device per export.  Entries in this hash
      table are never deleted as we can't reuse the ids anyway, and would have
      a severe lifetime problem anyway as Linux export structures are temporary
      structures that can go away under load.
      
      Parts of the XDR data, structures and marshaling/unmarshaling code, as
      well as many concepts are derived from the old pNFS server implementation
      from Andy Adamson, Benny Halevy, Dean Hildebrand, Marc Eshel, Fred Isaman,
      Mike Sager, Ricardo Labiaga and many others.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      9cf514cc
    • C
      4d227fca
    • C
      e6ba76e1
    • C
    • C
      nfsd: move nfsd_fh_match to nfsfh.h · 4d94c2ef
      Christoph Hellwig 提交于
      The pnfs code will need it too.  Also remove the nfsd_ prefix to match the
      other filehandle helpers in that file.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      4d94c2ef
    • C
      fs: track fl_owner for leases · 2ab99ee1
      Christoph Hellwig 提交于
      Just like for other lock types we should allow different owners to have
      a read lease on a file.  Currently this can't happen, but with the addition
      of pNFS layout leases we'll need this feature.
      Signed-off-by: NChristoph Hellwig <hch@lst.de>
      2ab99ee1
  13. 23 1月, 2015 1 次提交
  14. 17 1月, 2015 3 次提交
  15. 16 1月, 2015 1 次提交
  16. 08 1月, 2015 2 次提交
  17. 11 12月, 2014 1 次提交
    • D
      net: replace remaining users of arch_fast_hash with jhash · 87545899
      Daniel Borkmann 提交于
      This patch effectively reverts commit 500f8087 ("net: ovs: use CRC32
      accelerated flow hash if available"), and other remaining arch_fast_hash()
      users such as from nfsd via commit 6282cd56 ("NFSD: Don't hand out
      delegations for 30 seconds after recalling them.") where it has been used
      as a hash function for bloom filtering.
      
      While we think that these users are actually not much of concern, it has
      been requested to remove the arch_fast_hash() library bits that arose
      from [1] entirely as per recent discussion [2]. The main argument is that
      using it as a hash may introduce bias due to its linearity (see avalanche
      criterion) and thus makes it less clear (though we tried to document that)
      when this security/performance trade-off is actually acceptable for a
      general purpose library function.
      
      Lets therefore avoid any further confusion on this matter and remove it to
      prevent any future accidental misuse of it. For the time being, this is
      going to make hashing of flow keys a bit more expensive in the ovs case,
      but future work could reevaluate a different hashing discipline.
      
        [1] https://patchwork.ozlabs.org/patch/299369/
        [2] https://patchwork.ozlabs.org/patch/418756/
      
      Cc: Neil Brown <neilb@suse.de>
      Cc: Francesco Fusco <fusco@ntop.org>
      Cc: Jesse Gross <jesse@nicira.com>
      Cc: Thomas Graf <tgraf@suug.ch>
      Signed-off-by: NDaniel Borkmann <dborkman@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      87545899
  18. 10 12月, 2014 1 次提交
    • R
      fs: nfsd: Fix signedness bug in compare_blob · ef17af2a
      Rasmus Villemoes 提交于
      Bugs similar to the one in acbbe6fb (kcmp: fix standard comparison
      bug) are in rich supply.
      
      In this variant, the problem is that struct xdr_netobj::len has type
      unsigned int, so the expression o1->len - o2->len _also_ has type
      unsigned int; it has completely well-defined semantics, and the result
      is some non-negative integer, which is always representable in a long
      long. But this means that if the conditional triggers, we are
      guaranteed to return a positive value from compare_blob.
      
      In this case it could be fixed by
      
      -       res = o1->len - o2->len;
      +       res = (long long)o1->len - (long long)o2->len;
      
      but I'd rather eliminate the usually broken 'return a - b;' idiom.
      Reviewed-by: NJeff Layton <jlayton@primarydata.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: NRasmus Villemoes <linux@rasmusvillemoes.dk>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      ef17af2a
  19. 08 11月, 2014 1 次提交
    • J
      nfsd: convert nfs4_file searches to use RCU · 5b095e99
      Jeff Layton 提交于
      The global state_lock protects the file_hashtbl, and that has the
      potential to be a scalability bottleneck.
      
      Address this by making the file_hashtbl use RCU. Add a rcu_head to the
      nfs4_file and use that when freeing ones that have been hashed. In order
      to conserve space, we union the fi_rcu field with the fi_delegations
      list_head which must be clear by the time the last reference to the file
      is dropped.
      
      Convert find_file_locked to use RCU lookup primitives and not to require
      that the state_lock be held, and convert find_file to do a lockless
      lookup. Convert find_or_add_file to attempt a lockless lookup first, and
      then fall back to doing a locked search and insert if that fails to find
      anything.
      
      Also, minimize the number of times we need to calculate the hash value
      by passing it in as an argument to the search and insert functions, and
      optimize the order of arguments in nfsd4_init_file.
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      5b095e99
  20. 24 10月, 2014 1 次提交
    • C
      NFSD: Always initialize cl_cb_addr · b0d2e42c
      Chuck Lever 提交于
      A client may not want to use the back channel on a transport it sent
      CREATE_SESSION on, in which case it clears SESSION4_BACK_CHAN.
      
      However, cl_cb_addr should be populated anyway, to be used if the
      client binds other connections to this session. If cl_cb_addr is
      not initialized, rpc_create() fails when the server attempts to
      set up a back channel on such secondary transports.
      Signed-off-by: NChuck Lever <chuck.lever@oracle.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      b0d2e42c
  21. 08 10月, 2014 1 次提交
    • J
      locks: give lm_break a return value · 4d01b7f5
      Jeff Layton 提交于
      Christoph suggests:
      
         "Add a return value to lm_break so that the lock manager can tell the
          core code "you can delete this lease right now".  That gets rid of
          the games with the timeout which require all kinds of race avoidance
          code in the users."
      
      Do that here and have the nfsd lease break routine use it when it detects
      that there was a race between setting up the lease and it being broken.
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      Reviewed-by: NChristoph Hellwig <hch@lst.de>
      4d01b7f5