Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp672205pxb; Mon, 25 Oct 2021 16:21:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxpDhKHPGnZwBkCY3PumeQ8mWr4+HdP6Is9iaVXBSJQPeN/P7juTTh2TXCbXlbV5oH/JCCJ X-Received: by 2002:a17:907:3e14:: with SMTP id hp20mr27096552ejc.507.1635204098011; Mon, 25 Oct 2021 16:21:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635204098; cv=none; d=google.com; s=arc-20160816; b=mHcGI+qX9gMFtSCgQnHErejpoiUioxrHvi+PFRLjJxhrgZX48RsTJu98+U0CYofiET CcGD9IWY2KDuduW3qcn8Z15qpIsQD2Ii/SjdeH7vTEz2iLemssCh2dWMX3R44pUGy70P xwyykQGBzEPlxiFAQ4ia1wPnW/VJQUTKx/gA7YhbGiD5Lr1v8qXlqUlg5+QW+OT0YAV3 Q1fhvTEHg6Z48+PAzGElO/Quq5+d6NatkcPAF/k6hp/fIav/ksKHvvM0O/+xi6+CZ6qF 3ptFADiXkCQblU1dD3sf+WTOmya+ENogkO2bZh0nXV8lO2sJ3w999xiIQB5YNe4gRD/w 1Z5g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WMU/HF6yb4KR6UhtFI0GSMw6za3Cw9ZHZQKPDSl1IiQ=; b=gQcmLECmPXKWOR17gIwqxBD6PtqK5XIjiIcZXz4aKdGEsF4QhxFIc1t9I2uDgTnkPI dIdctakc1CK9Ysv/WiHhcHbQyyQvTe6+8N2M0QXXR0QO75s4MUy4GBNpK8j5cqXw2pD5 21gNnaoKftrCv+aGjvgEtVufzgHodyooMf1HM9bfVVFffQ1uTne1J3AgQP+T/svqwMW0 EOBQePTS0IaVyBxHgBnTBAJ0e5cvtdciZJGB/IOiHbVNmgHNTaD2IVQMBqkUjQE7LbpP 091+J31rrs86LFWLPzU6evFdmb48qg7Mno5riIfuBoZXavVS4XHvi1wM3MMpJ0A8nRts UE0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="o/Obw4lo"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t19si19545726edt.563.2021.10.25.16.21.14; Mon, 25 Oct 2021 16:21:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b="o/Obw4lo"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234500AbhJYTZu (ORCPT + 99 others); Mon, 25 Oct 2021 15:25:50 -0400 Received: from mail.kernel.org ([198.145.29.99]:42844 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231723AbhJYTXo (ORCPT ); Mon, 25 Oct 2021 15:23:44 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 04CDA6103C; Mon, 25 Oct 2021 19:21:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635189681; bh=h3OshlrKzJ5LZMoAMLCu5XevmATvo6gO6WSAgy4xjgY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o/Obw4lo17yStG2hnkp9EcE1cfMG4+CJRxWz1+Sy4RRnw0/oBD+F1BCqcbOvRG714 c01MQTuSqBkwlz4ge4MSpxmUyNMlScVei4d2DCaDh0g7qvAqKmn3mK6hD3K/30GzS/ 0bHtYHtdW8S0cqvuWB1RWSvpe/MCU7EXg1+ZO0wk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Benjamin Coddington , Chuck Lever , Sasha Levin Subject: [PATCH 4.14 05/30] NFSD: Keep existing listeners on portlist error Date: Mon, 25 Oct 2021 21:14:25 +0200 Message-Id: <20211025190924.259563061@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190922.089277904@linuxfoundation.org> References: <20211025190922.089277904@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Benjamin Coddington [ Upstream commit c20106944eb679fa3ab7e686fe5f6ba30fbc51e5 ] If nfsd has existing listening sockets without any processes, then an error returned from svc_create_xprt() for an additional transport will remove those existing listeners. We're seeing this in practice when userspace attempts to create rpcrdma transports without having the rpcrdma modules present before creating nfsd kernel processes. Fix this by checking for existing sockets before calling nfsd_destroy(). Signed-off-by: Benjamin Coddington Signed-off-by: Chuck Lever Signed-off-by: Sasha Levin --- fs/nfsd/nfsctl.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index d44402241d9e..50465ee502c7 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -788,7 +788,10 @@ out_close: svc_xprt_put(xprt); } out_err: - nfsd_destroy(net); + if (!list_empty(&nn->nfsd_serv->sv_permsocks)) + nn->nfsd_serv->sv_nrthreads--; + else + nfsd_destroy(net); return err; } -- 2.33.0