linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH AUTOSEL 5.1 004/375] NFS: make nfs_match_client killable
       [not found] <20190522192115.22666-1-sashal@kernel.org>
@ 2019-05-22 19:15 ` Sasha Levin
  2019-05-23 15:02   ` Benjamin Coddington
  0 siblings, 1 reply; 3+ messages in thread
From: Sasha Levin @ 2019-05-22 19:15 UTC (permalink / raw)
  To: linux-kernel, stable
  Cc: Roberto Bergantinos Corpas, Benjamin Coddington, Anna Schumaker,
	Sasha Levin, linux-nfs

From: Roberto Bergantinos Corpas <rbergant@redhat.com>

[ Upstream commit 950a578c6128c2886e295b9c7ecb0b6b22fcc92b ]

    Actually we don't do anything with return value from
    nfs_wait_client_init_complete in nfs_match_client, as a
    consequence if we get a fatal signal and client is not
    fully initialised, we'll loop to "again" label

    This has been proven to cause soft lockups on some scenarios
    (no-carrier but configured network interfaces)

Signed-off-by: Roberto Bergantinos Corpas <rbergant@redhat.com>
Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/nfs/client.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/fs/nfs/client.c b/fs/nfs/client.c
index 90d71fda65cec..350cfa561e0e8 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -284,6 +284,7 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
 	struct nfs_client *clp;
 	const struct sockaddr *sap = data->addr;
 	struct nfs_net *nn = net_generic(data->net, nfs_net_id);
+	int error;
 
 again:
 	list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) {
@@ -296,8 +297,10 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
 		if (clp->cl_cons_state > NFS_CS_READY) {
 			refcount_inc(&clp->cl_count);
 			spin_unlock(&nn->nfs_client_lock);
-			nfs_wait_client_init_complete(clp);
+			error = nfs_wait_client_init_complete(clp);
 			nfs_put_client(clp);
+			if (error < 0)
+				return ERR_PTR(error);
 			spin_lock(&nn->nfs_client_lock);
 			goto again;
 		}
@@ -407,6 +410,8 @@ struct nfs_client *nfs_get_client(const struct nfs_client_initdata *cl_init)
 		clp = nfs_match_client(cl_init);
 		if (clp) {
 			spin_unlock(&nn->nfs_client_lock);
+			if (IS_ERR(clp))
+				return clp;
 			if (new)
 				new->rpc_ops->free_client(new);
 			return nfs_found_client(cl_init, clp);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH AUTOSEL 5.1 004/375] NFS: make nfs_match_client killable
  2019-05-22 19:15 ` [PATCH AUTOSEL 5.1 004/375] NFS: make nfs_match_client killable Sasha Levin
@ 2019-05-23 15:02   ` Benjamin Coddington
  2019-05-29 18:46     ` Sasha Levin
  0 siblings, 1 reply; 3+ messages in thread
From: Benjamin Coddington @ 2019-05-23 15:02 UTC (permalink / raw)
  To: Sasha Levin
  Cc: linux-kernel, stable, Roberto Bergantinos Corpas, Anna Schumaker,
	linux-nfs

Hi Sasha,  if you take this one, you'll need the fix for it:

c260121a97a3 ("NFS: Fix a double unlock from nfs_match,get_client")

I didn't see this fix go through my inbox for your stable tree, so 
apologies if maybe I missed it.

Looks like you are also applying this one to 4.19 and 4.14, -- I'll just 
reply once here.

Ben

On 22 May 2019, at 15:15, Sasha Levin wrote:

> From: Roberto Bergantinos Corpas <rbergant@redhat.com>
>
> [ Upstream commit 950a578c6128c2886e295b9c7ecb0b6b22fcc92b ]
>
>     Actually we don't do anything with return value from
>     nfs_wait_client_init_complete in nfs_match_client, as a
>     consequence if we get a fatal signal and client is not
>     fully initialised, we'll loop to "again" label
>
>     This has been proven to cause soft lockups on some scenarios
>     (no-carrier but configured network interfaces)
>
> Signed-off-by: Roberto Bergantinos Corpas <rbergant@redhat.com>
> Reviewed-by: Benjamin Coddington <bcodding@redhat.com>
> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
>  fs/nfs/client.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/fs/nfs/client.c b/fs/nfs/client.c
> index 90d71fda65cec..350cfa561e0e8 100644
> --- a/fs/nfs/client.c
> +++ b/fs/nfs/client.c
> @@ -284,6 +284,7 @@ static struct nfs_client *nfs_match_client(const 
> struct nfs_client_initdata *dat
>  	struct nfs_client *clp;
>  	const struct sockaddr *sap = data->addr;
>  	struct nfs_net *nn = net_generic(data->net, nfs_net_id);
> +	int error;
>
>  again:
>  	list_for_each_entry(clp, &nn->nfs_client_list, cl_share_link) {
> @@ -296,8 +297,10 @@ static struct nfs_client *nfs_match_client(const 
> struct nfs_client_initdata *dat
>  		if (clp->cl_cons_state > NFS_CS_READY) {
>  			refcount_inc(&clp->cl_count);
>  			spin_unlock(&nn->nfs_client_lock);
> -			nfs_wait_client_init_complete(clp);
> +			error = nfs_wait_client_init_complete(clp);
>  			nfs_put_client(clp);
> +			if (error < 0)
> +				return ERR_PTR(error);
>  			spin_lock(&nn->nfs_client_lock);
>  			goto again;
>  		}
> @@ -407,6 +410,8 @@ struct nfs_client *nfs_get_client(const struct 
> nfs_client_initdata *cl_init)
>  		clp = nfs_match_client(cl_init);
>  		if (clp) {
>  			spin_unlock(&nn->nfs_client_lock);
> +			if (IS_ERR(clp))
> +				return clp;
>  			if (new)
>  				new->rpc_ops->free_client(new);
>  			return nfs_found_client(cl_init, clp);
> -- 
> 2.20.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH AUTOSEL 5.1 004/375] NFS: make nfs_match_client killable
  2019-05-23 15:02   ` Benjamin Coddington
@ 2019-05-29 18:46     ` Sasha Levin
  0 siblings, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2019-05-29 18:46 UTC (permalink / raw)
  To: Benjamin Coddington
  Cc: linux-kernel, stable, Roberto Bergantinos Corpas, Anna Schumaker,
	linux-nfs

On Thu, May 23, 2019 at 11:02:39AM -0400, Benjamin Coddington wrote:
>Hi Sasha,  if you take this one, you'll need the fix for it:
>
>c260121a97a3 ("NFS: Fix a double unlock from nfs_match,get_client")
>
>I didn't see this fix go through my inbox for your stable tree, so 
>apologies if maybe I missed it.
>
>Looks like you are also applying this one to 4.19 and 4.14, -- I'll 
>just reply once here.

Queued c260121a97a3 up for 5.1-4.14, thank you!

--
Thanks,
Sasha

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-05-29 18:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20190522192115.22666-1-sashal@kernel.org>
2019-05-22 19:15 ` [PATCH AUTOSEL 5.1 004/375] NFS: make nfs_match_client killable Sasha Levin
2019-05-23 15:02   ` Benjamin Coddington
2019-05-29 18:46     ` Sasha Levin

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).