public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [bug report] NFSv4.0: deadlock of state manager and lock
@ 2024-11-26 13:22 Li Lingfeng
  0 siblings, 0 replies; only message in thread
From: Li Lingfeng @ 2024-11-26 13:22 UTC (permalink / raw)
  To: trondmy, anna, trond.myklebust, Jeff Layton
  Cc: linux-nfs, linux-kernel, yukuai (C), Hou Tao, zhangyi (F),
	yangerkun, chengzhihao1

Hi, we have found a deadlock recently due to that only the first task in
the list of nfs_seqid_counter can be executed.

T1 -- NFSPROC4_CLNT_LOCKU
nfs4_locku_prepare
  nfs_wait_on_sequence
   list_add_tail // add to sequence->list
   // This is the first task.

nfs4_locku_done
  nfs4_async_handle_exception
   rpc_sleep_on
   // Sleep on clp->cl_rpcwaitq,
   // and wait for being woken up by T2
   <-------- can not get here -------->
   nfs_release_seqid
    rpc_wake_up_queued_task // wake up T2

T2 -- state manager
nfs4_state_manager
  nfs4_do_reclaim
   nfs4_reclaim_open_state
    __nfs4_reclaim_open_state
     nfs40_open_expired
      nfs4_open_expired
       nfs4_do_open_expired
        _nfs4_open_expired
         nfs4_open_recover
          nfs4_open_recover_helper
           _nfs4_recover_proc_open
            nfs4_run_open_task
            ...
            nfs4_open_prepare
             nfs_wait_on_sequence
              list_add_tail // add to sequence->list
              // This is the second task.
              rpc_sleep_on
              // Sleep on sequence->wait,
              // and wait for being woken up by T1
  <-------- can not get here -------->
  nfs4_clear_state_manager_bit
   rpc_wake_up // wake up T1

T1 occupies the first position of sequence->list and waits to be woken up
by T2.
T2 has to be woken up by T1 who occupies the first position.

We haven't come up with a suitable solution yet. Any suggestions will be
appreciated.

Thanks.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-11-26 13:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-26 13:22 [bug report] NFSv4.0: deadlock of state manager and lock Li Lingfeng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox