Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp248748ybi; Wed, 29 May 2019 20:37:03 -0700 (PDT) X-Google-Smtp-Source: APXvYqwCujzt1bSiRrXNc8LySvrr49tyd9SDL9cSiJn96/Zp6XHfajdtxRJP6+nCMCJX9s9tlqvo X-Received: by 2002:a17:902:e08b:: with SMTP id cb11mr1733137plb.122.1559187423019; Wed, 29 May 2019 20:37:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559187423; cv=none; d=google.com; s=arc-20160816; b=b2tnDEAf4X44rK1ZF5F64yvtJXw/gDuvG4a+zwYwNh1qZXk5Nj4Ahs4d49ELzf79v6 4DHCWSpWQtFy2pR3InBfwF/U+pgC99gx1mbPS1etEUFqyPzIetwTKSObmEQXUWz0b20y kLHw30essZL51I9oA08pcFbvyD+EYbbzExGxutgq8/k1q7TOVtUZF1wA3J1ximAonCDg dTNJlVz75GAlmBUsGuocctFXkUZnv2Y82H3dd6eK9jTP7sDWLs6ZVIiVWdHAm18L7zwW fbHog+j9VqREHZOA7McvWgafsj+OjXr6cM3C75tAx3ppKKZgErNLHOuvjH3+57SUef/D qIDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=h/SjRaE1HXG+hGxAWb8RxeSrIAL6pVz4AWLP7Ddq+Bg=; b=E6WxQt1APirYpJVPmy5x838aT2anLaimqnNHX4/tHJL4TC1YVJZgCjNKLhdDaRQZFB BVjcCUKSJFkJzrK9WsuKMS0eICCpTHxc7h5bAr/VQfBItnbvhwEr7Ae7HLxNBGOMTETF sbRh+v5es+4QwZPDzTLlYUoUxodQXb18zFhTYFe0eihM79DRxC15ZUDzc628rDi66/Pb ORKQWpCe/yxQnhyTjWAsxQ15isYyLtktLaHPiHqHtz8cLrq9yyxYRdMo5Y9HFB84vSUL 8ifwbEg1Ea2KU/dOb/IzCuJPsEe3uW7MRjjSepxp6g1EH+SBLrJQqHJwx+i+TL/z+dzm /X+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h8EKs3Vt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si1700816plb.367.2019.05.29.20.36.47; Wed, 29 May 2019 20:37:03 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=h8EKs3Vt; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732668AbfE3D0H (ORCPT + 99 others); Wed, 29 May 2019 23:26:07 -0400 Received: from mail.kernel.org ([198.145.29.99]:52468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730327AbfE3DSp (ORCPT ); Wed, 29 May 2019 23:18:45 -0400 Received: from localhost (ip67-88-213-2.z213-88-67.customer.algx.net [67.88.213.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D6262247EF; Thu, 30 May 2019 03:18:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1559186325; bh=IlB1S4Tay3XsNKO9BgkUIFJkZjRYXTnPP85jayngyYc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=h8EKs3VtQh9oRLI/R66MYlSdyUfyPjOODjBCSv6n0Mit36k8p+Au7ZLSK5+E+c1xS AGa3d0GlFepP+pzSWO1xOX31aVF5pDVvi2D6525EKqdQzW+mtqRUoS9bLa+tsc9F9p abvKPUJ0dyVONZJcX0wNwckAhljsDNNEiz/m9o68= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Roberto Bergantinos Corpas , Benjamin Coddington , Anna Schumaker , Sasha Levin Subject: [PATCH 4.14 038/193] NFS: make nfs_match_client killable Date: Wed, 29 May 2019 20:04:52 -0700 Message-Id: <20190530030454.763133741@linuxfoundation.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190530030446.953835040@linuxfoundation.org> References: <20190530030446.953835040@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [ 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 Reviewed-by: Benjamin Coddington Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- 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 a98d64a6eda5c..65da2c105f434 100644 --- a/fs/nfs/client.c +++ b/fs/nfs/client.c @@ -290,6 +290,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) { @@ -302,8 +303,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; } @@ -413,6 +416,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