stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: Qian Lu <luqia@amazon.com>
Cc: stable@vger.kernel.org, Scott Mayhew <smayhew@redhat.com>,
	Anna Schumaker <Anna.Schumaker@netapp.com>
Subject: Re: [PATCH v4.14-stable v2] nfs: fix a deadlock in nfs client initialization
Date: Thu, 24 Jan 2019 18:51:47 +0100	[thread overview]
Message-ID: <20190124175147.GB7484@kroah.com> (raw)
In-Reply-To: <20190124070024.15342-1-luqia@amazon.com>

On Wed, Jan 23, 2019 at 11:00:24PM -0800, Qian Lu wrote:
> From: Scott Mayhew <smayhew@redhat.com>
> 
> The following deadlock can occur between a process waiting for a client
> to initialize in while walking the client list during nfsv4 server trunking
> detection and another process waiting for the nfs_clid_init_mutex so it
> can initialize that client:
> 
> Process 1                               Process 2
> ---------                               ---------
> spin_lock(&nn->nfs_client_lock);
> list_add_tail(&CLIENTA->cl_share_link,
>         &nn->nfs_client_list);
> spin_unlock(&nn->nfs_client_lock);
>                                         spin_lock(&nn->nfs_client_lock);
>                                         list_add_tail(&CLIENTB->cl_share_link,
>                                                 &nn->nfs_client_list);
>                                         spin_unlock(&nn->nfs_client_lock);
>                                         mutex_lock(&nfs_clid_init_mutex);
>                                         nfs41_walk_client_list(clp, result, cred);
>                                         nfs_wait_client_init_complete(CLIENTA);
> (waiting for nfs_clid_init_mutex)
> 
> Make sure nfs_match_client() only evaluates clients that have completed
> initialization in order to prevent that deadlock.
> 
> This patch also fixes v4.0 trunking behavior by not marking the client
> NFS_CS_READY until the clientid has been confirmed.
> 
> Signed-off-by: Scott Mayhew <smayhew@redhat.com>
> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> Signed-off-by: Qian Lu <luqia@amazon.com>
> ---
>  fs/nfs/client.c     | 11 +++++++++++
>  fs/nfs/nfs4client.c | 17 +++++++++++++----
>  2 files changed, 24 insertions(+), 4 deletions(-)

You forgot to mention the sha1 of the commit :(

I dug it up this time...

greg k-h

      reply	other threads:[~2019-01-24 17:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-24  7:00 [PATCH v4.14-stable v2] nfs: fix a deadlock in nfs client initialization Qian Lu
2019-01-24 17:51 ` Greg KH [this message]

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=20190124175147.GB7484@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=Anna.Schumaker@netapp.com \
    --cc=luqia@amazon.com \
    --cc=smayhew@redhat.com \
    --cc=stable@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).