[Devel] [PATCH RHEL7 COMMIT] ms/NFS: make nfs_match_client killable

Konstantin Khorenko khorenko at virtuozzo.com
Thu Oct 3 18:47:22 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.27.2.vz7.107.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.27.2.vz7.107.13
------>
commit a287f34a1ffa19e0fad7d9cf43e68cdf79bbad2c
Author: Roberto Bergantinos Corpas <rbergant at redhat.com>
Date:   Thu Oct 3 18:47:20 2019 +0300

    ms/NFS: make nfs_match_client killable
    
        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 at redhat.com>
    Reviewed-by: Benjamin Coddington <bcodding at redhat.com>
    Signed-off-by: Anna Schumaker <Anna.Schumaker at Netapp.com>
    
    https://jira.sw.ru/browse/PSBM-98297
    (cherry picked from commit 950a578c6128c2886e295b9c7ecb0b6b22fcc92b)
    Signed-off-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
 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 a41b3d61486e..e9e23421a36e 100644
--- a/fs/nfs/client.c
+++ b/fs/nfs/client.c
@@ -295,6 +295,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) {
@@ -307,8 +308,10 @@ static struct nfs_client *nfs_match_client(const struct nfs_client_initdata *dat
 		if (clp->cl_cons_state > NFS_CS_READY) {
 			atomic_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;
 		}
@@ -426,6 +429,8 @@ 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);



More information about the Devel mailing list