Skip to contentSkip to conversation

NFSv4.0: deadlock of state manager and lock

bug report Li Lingfeng 1 participant 1 message Nov 26, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.