1. 17 6月, 2018 1 次提交
    • J
      nfsd4: extend reclaim period for reclaiming clients · 03f318ca
      J. Bruce Fields 提交于
      If the client is only renewing state a little sooner than once a lease
      period, then it might not discover the server has restarted till close
      to the end of the grace period, and might run out of time to do the
      actual reclaim.
      
      Extend the grace period by a second each time we notice there are
      clients still trying to reclaim, up to a limit of another whole lease
      period.
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      03f318ca
  2. 28 11月, 2017 1 次提交
  3. 08 11月, 2017 1 次提交
    • A
      nfds: avoid gettimeofday for nfssvc_boot time · 256a89fa
      Arnd Bergmann 提交于
      do_gettimeofday() is deprecated and we should generally use time64_t
      based functions instead.
      
      In case of nfsd, all three users of nfssvc_boot only use the initial
      time as a unique token, and are not affected by it overflowing, so they
      are not affected by the y2038 overflow.
      
      This converts the structure to timespec64 anyway and adds comments
      to all uses, to document that we have thought about it and avoid
      having to look at it again.
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      256a89fa
  4. 18 11月, 2016 1 次提交
    • A
      netns: make struct pernet_operations::id unsigned int · c7d03a00
      Alexey Dobriyan 提交于
      Make struct pernet_operations::id unsigned.
      
      There are 2 reasons to do so:
      
      1)
      This field is really an index into an zero based array and
      thus is unsigned entity. Using negative value is out-of-bound
      access by definition.
      
      2)
      On x86_64 unsigned 32-bit data which are mixed with pointers
      via array indexing or offsets added or subtracted to pointers
      are preffered to signed 32-bit data.
      
      "int" being used as an array index needs to be sign-extended
      to 64-bit before being used.
      
      	void f(long *p, int i)
      	{
      		g(p[i]);
      	}
      
        roughly translates to
      
      	movsx	rsi, esi
      	mov	rdi, [rsi+...]
      	call 	g
      
      MOVSX is 3 byte instruction which isn't necessary if the variable is
      unsigned because x86_64 is zero extending by default.
      
      Now, there is net_generic() function which, you guessed it right, uses
      "int" as an array index:
      
      	static inline void *net_generic(const struct net *net, int id)
      	{
      		...
      		ptr = ng->ptr[id - 1];
      		...
      	}
      
      And this function is used a lot, so those sign extensions add up.
      
      Patch snipes ~1730 bytes on allyesconfig kernel (without all junk
      messing with code generation):
      
      	add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)
      
      Unfortunately some functions actually grow bigger.
      This is a semmingly random artefact of code generation with register
      allocator being used differently. gcc decides that some variable
      needs to live in new r8+ registers and every access now requires REX
      prefix. Or it is shifted into r12, so [r12+0] addressing mode has to be
      used which is longer than [r8]
      
      However, overall balance is in negative direction:
      
      	add/remove: 0/0 grow/shrink: 70/598 up/down: 396/-2126 (-1730)
      	function                                     old     new   delta
      	nfsd4_lock                                  3886    3959     +73
      	tipc_link_build_proto_msg                   1096    1140     +44
      	mac80211_hwsim_new_radio                    2776    2808     +32
      	tipc_mon_rcv                                1032    1058     +26
      	svcauth_gss_legacy_init                     1413    1429     +16
      	tipc_bcbase_select_primary                   379     392     +13
      	nfsd4_exchange_id                           1247    1260     +13
      	nfsd4_setclientid_confirm                    782     793     +11
      		...
      	put_client_renew_locked                      494     480     -14
      	ip_set_sockfn_get                            730     716     -14
      	geneve_sock_add                              829     813     -16
      	nfsd4_sequence_done                          721     703     -18
      	nlmclnt_lookup_host                          708     686     -22
      	nfsd4_lockt                                 1085    1063     -22
      	nfs_get_client                              1077    1050     -27
      	tcf_bpf_init                                1106    1076     -30
      	nfsd4_encode_fattr                          5997    5930     -67
      	Total: Before=154856051, After=154854321, chg -0.00%
      Signed-off-by: NAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c7d03a00
  5. 25 10月, 2016 1 次提交
  6. 27 9月, 2016 1 次提交
    • J
      nfsd: add a LRU list for blocked locks · 7919d0a2
      Jeff Layton 提交于
      It's possible for a client to call in on a lock that is blocked for a
      long time, but discontinue polling for it. A malicious client could
      even set a lock on a file, and then spam the server with failing lock
      requests from different lockowners that pile up in a DoS attack.
      
      Add the blocked lock structures to a per-net namespace LRU when hashing
      them, and timestamp them. If the lock request is not revisited after a
      lease period, we'll drop it under the assumption that the client is no
      longer interested.
      
      This also gives us a mechanism to clean up these objects at server
      shutdown time as well.
      Signed-off-by: NJeff Layton <jlayton@redhat.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      7919d0a2
  7. 24 11月, 2015 1 次提交
  8. 11 8月, 2015 1 次提交
  9. 06 8月, 2014 1 次提交
  10. 05 8月, 2014 1 次提交
    • J
      nfsd: protect clid and verifier generation with client_lock · 294ac32e
      Jeff Layton 提交于
      The clid counter is a global counter currently. Move it to be a per-net
      property so that it can be properly protected by the nn->client_lock
      instead of relying on the client_mutex.
      
      The verifier generator is also potentially racy if there are two
      simultaneous callers. Generate the verifier when we generate the clid
      value, so it's also created under the client_lock. With this, there's
      no need to keep two counters as they'd always be in sync anyway, so
      just use the clientid_counter for both.
      
      As Trond points out, what would be best is to eventually move this
      code to use IDR instead of the hash tables. That would also help ensure
      uniqueness, but that's probably best done as a separate project.
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      294ac32e
  11. 01 8月, 2014 1 次提交
  12. 10 7月, 2014 1 次提交
  13. 09 7月, 2014 1 次提交
    • J
      nfsd: add a new /proc/fs/nfsd/max_connections file · 5b8db00b
      Jeff Layton 提交于
      Currently, the maximum number of connections that nfsd will allow
      is based on the number of threads spawned. While this is fine for a
      default, there really isn't a clear relationship between the two.
      
      The number of threads corresponds to the number of concurrent requests
      that we want to allow the server to process at any given time. The
      connection limit corresponds to the maximum number of clients that we
      want to allow the server to handle. These are two entirely different
      quantities.
      
      Break the dependency on increasing threads in order to allow for more
      connections, by adding a new per-net parameter that can be set to a
      non-zero value. The default is still to base it on the number of threads,
      so there should be no behavior change for anyone who doesn't use it.
      
      Cc: Trond Myklebust <trond.myklebust@primarydata.com>
      Signed-off-by: NJeff Layton <jlayton@primarydata.com>
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      5b8db00b
  14. 04 1月, 2014 1 次提交
  15. 05 4月, 2013 1 次提交
  16. 11 12月, 2012 4 次提交
  17. 03 12月, 2012 1 次提交
  18. 28 11月, 2012 5 次提交
  19. 15 11月, 2012 11 次提交
  20. 28 7月, 2012 3 次提交
  21. 12 4月, 2012 1 次提交