1. 18 7月, 2022 2 次提交
  2. 15 6月, 2021 1 次提交
    • N
      SUNRPC in case of backlog, hand free slots directly to waiting task · f7c69614
      NeilBrown 提交于
      stable inclusion
      from stable-5.10.42
      commit 5343fcfc6cc8747438f60cc60a73c7f4a9082b16
      bugzilla: 55093
      CVE: NA
      
      --------------------------------
      
      commit e877a88d upstream.
      
      If sunrpc.tcp_max_slot_table_entries is small and there are tasks
      on the backlog queue, then when a request completes it is freed and the
      first task on the queue is woken.  The expectation is that it will wake
      and claim that request.  However if it was a sync task and the waiting
      process was killed at just that moment, it will wake and NOT claim the
      request.
      
      As long as TASK_CONGESTED remains set, requests can only be claimed by
      tasks woken from the backlog, and they are woken only as requests are
      freed, so when a task doesn't claim a request, no other task can ever
      get that request until TASK_CONGESTED is cleared.  Each time this
      happens the number of available requests is decreased by one.
      
      With a sufficiently high workload and sufficiently low setting of
      max_slot (16 in the case where this was seen), TASK_CONGESTED can remain
      set for an extended period, and the above scenario (of a process being
      killed just as its task was woken) can repeat until no requests can be
      allocated.  Then traffic stops.
      
      This patch addresses the problem by introducing a positive handover of a
      request from a completing task to a backlog task - the request is never
      freed when there is a backlog.
      
      When a task is woken it might not already have a request attached in
      which case it is *not* freed (as with current code) but is initialised
      (if needed) and used.  If it isn't used it will eventually be freed by
      rpc_exit_task().  xprt_release() is enhanced to be able to correctly
      release an uninitialised request.
      
      Fixes: ba60eb25 ("SUNRPC: Fix a livelock problem in the xprt->backlog queue")
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: NChen Jun <chenjun102@huawei.com>
      Acked-by: NWeilong Chen <chenweilong@huawei.com>
      Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
      f7c69614
  3. 03 6月, 2021 2 次提交
  4. 21 9月, 2020 9 次提交
  5. 24 8月, 2020 1 次提交
  6. 12 6月, 2020 6 次提交
  7. 15 5月, 2020 1 次提交
    • J
      SUNRPC: 'Directory with parent 'rpc_clnt' already present!' · 933496e9
      J. Bruce Fields 提交于
      Each rpc_client has a cl_clid which is allocated from a global ida, and
      a debugfs directory which is named after cl_clid.
      
      We're releasing the cl_clid before we free the debugfs directory named
      after it.  As soon as the cl_clid is released, that value is available
      for another newly created client.
      
      That leaves a window where another client may attempt to create a new
      debugfs directory with the same name as the not-yet-deleted debugfs
      directory from the dying client.  Symptoms are log messages like
      
      	Directory 4 with parent 'rpc_clnt' already present!
      
      Fixes: 7c4310ff "SUNRPC: defer slow parts of rpc_free_client() to a workqueue."
      Signed-off-by: NJ. Bruce Fields <bfields@redhat.com>
      Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
      933496e9
  8. 12 5月, 2020 1 次提交
  9. 11 5月, 2020 1 次提交
  10. 29 4月, 2020 1 次提交
    • N
      SUNRPC: defer slow parts of rpc_free_client() to a workqueue. · 7c4310ff
      NeilBrown 提交于
      The rpciod workqueue is on the write-out path for freeing dirty memory,
      so it is important that it never block waiting for memory to be
      allocated - this can lead to a deadlock.
      
      rpc_execute() - which is often called by an rpciod work item - calls
      rcp_task_release_client() which can lead to rpc_free_client().
      
      rpc_free_client() makes two calls which could potentially block wating
      for memory allocation.
      
      rpc_clnt_debugfs_unregister() calls into debugfs and will block while
      any of the debugfs files are being accessed.  In particular it can block
      while any of the 'open' methods are being called and all of these use
      malloc for one thing or another.  So this can deadlock if the memory
      allocation waits for NFS to complete some writes via rpciod.
      
      rpc_clnt_remove_pipedir() can take the inode_lock() and while it isn't
      obvious that memory allocations can happen while the lock it held, it is
      safer to assume they might and to not let rpciod call
      rpc_clnt_remove_pipedir().
      
      So this patch moves these two calls (together with the final kfree() and
      rpciod_down()) into a work-item to be run from the system work-queue.
      rpciod can continue its important work, and the final stages of the free
      can happen whenever they happen.
      
      I have seen this deadlock on a 4.12 based kernel where debugfs used
      synchronize_srcu() when removing objects.  synchronize_srcu() requires a
      workqueue and there were no free workther threads and none could be
      allocated.  While debugsfs no longer uses SRCU, I believe the deadlock
      is still possible.
      Signed-off-by: NNeilBrown <neilb@suse.de>
      Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
      7c4310ff
  11. 22 4月, 2020 1 次提交
  12. 17 3月, 2020 1 次提交
  13. 16 3月, 2020 2 次提交
  14. 15 1月, 2020 1 次提交
  15. 04 11月, 2019 1 次提交
    • T
      NFSv4.1: Don't rebind to the same source port when reconnecting to the server · e6237b6f
      Trond Myklebust 提交于
      NFSv2, v3 and NFSv4 servers often have duplicate replay caches that look
      at the source port when deciding whether or not an RPC call is a replay
      of a previous call. This requires clients to perform strange TCP gymnastics
      in order to ensure that when they reconnect to the server, they bind
      to the same source port.
      
      NFSv4.1 and NFSv4.2 have sessions that provide proper replay semantics,
      that do not look at the source port of the connection. This patch therefore
      ensures they can ignore the rebind requirement.
      Signed-off-by: NTrond Myklebust <trond.myklebust@hammerspace.com>
      e6237b6f
  16. 24 10月, 2019 1 次提交
  17. 21 9月, 2019 1 次提交
  18. 18 9月, 2019 2 次提交
  19. 27 8月, 2019 3 次提交
  20. 19 7月, 2019 1 次提交
  21. 18 7月, 2019 1 次提交