public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
From: Li Lingfeng <lilingfeng3@huawei.com>
To: <trondmy@kernel.org>, <anna@kernel.org>,
	<trond.myklebust@hammerspace.com>,
	Jeff Layton <jlayton@kernel.org>
Cc: <linux-nfs@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	"yukuai (C)" <yukuai3@huawei.com>, Hou Tao <houtao1@huawei.com>,
	"zhangyi (F)" <yi.zhang@huawei.com>,
	yangerkun <yangerkun@huawei.com>, <chengzhihao1@huawei.com>
Subject: [bug report] NFSv4.0: deadlock of state manager and lock
Date: Tue, 26 Nov 2024 21:22:31 +0800	[thread overview]
Message-ID: <d695379f-3dbb-4e5a-a857-e4cd31df6843@huawei.com> (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.


                 reply	other threads:[~2024-11-26 13:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d695379f-3dbb-4e5a-a857-e4cd31df6843@huawei.com \
    --to=lilingfeng3@huawei.com \
    --cc=anna@kernel.org \
    --cc=chengzhihao1@huawei.com \
    --cc=houtao1@huawei.com \
    --cc=jlayton@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trond.myklebust@hammerspace.com \
    --cc=trondmy@kernel.org \
    --cc=yangerkun@huawei.com \
    --cc=yi.zhang@huawei.com \
    --cc=yukuai3@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox