Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp688567pxb; Mon, 25 Oct 2021 16:41:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOMalxdWLWAaqZLvCOjJiFBWL7LkRjTWLQsi7iJ3hXk9nY9AEjxcbqyHdzoaCSI0MPYhcw X-Received: by 2002:a63:954a:: with SMTP id t10mr16201376pgn.89.1635205309968; Mon, 25 Oct 2021 16:41:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635205309; cv=none; d=google.com; s=arc-20160816; b=AobimHQPsa5xp3G7bSsrf9qjH0hWWeQqY0eur79JoUxvvDZX4o474t9bVUt6Ic9Xrp mH6ryAlgaWfwD4UZFkziPDO8tEYeEC1eVHdT9XVMhITvkBL/0VRx1wEYa59X9DnWlm+I 83yNq5/EzpvmxFwJgfTH5bTRPIuRnuGcPFOuZc3IResO5kuHl6bLxlY0JNuiJf9q8m/y aisRBrzDcviCDXTVA/hLu31/p9PuhNrIo5JExKps3xcUHqSssjX6DQPxOu4hm/6NRHQO +nrJPqRIZ8wPDLDiYTtwsUr4PiC4hAA2aKMDazMrEQu7jUtIImvS4t74w+Blj6Du6h+y Lj9w== 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=2kvwAi/lviB2cVtyh68tp32SCZfwZYes9KB+uJ+xZFc=; b=RMAIDpxGWR7zjQwCVt7JUnUyPlJDNKQLnrH7GZ4Z9XoWglXbD8lVGdLOE6rsj0iYag +iuebfsHnXjS78TSyXKv8l90+WWE4ebcLYnaEDNJhnJWqu8LkVmFlQIHZNlE7hlTdfuB rN/k2tbe3LzsQUiW5s4vUXkmn4aUK3kVihkMW2smOIGuOOJp25RSJbn6/h4qPsW7QKXX jlFlaZ8RhORWn4toKkAeEj5nwpgeCMG6B2PzGXwQ6xTDTw11nxHY5fcGaIoI4ZzaeqnB Hw6RjkPs0zSd1torGeLuNrdWOdlzmvaIkcJ6dExahrnM5feoZwoVfU7HTMot40Er/3f/ 0UJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=l9pSDPz6; 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 l12si31859198plh.175.2021.10.25.16.41.24; Mon, 25 Oct 2021 16:41:49 -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=l9pSDPz6; 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 S235254AbhJYT3j (ORCPT + 99 others); Mon, 25 Oct 2021 15:29:39 -0400 Received: from mail.kernel.org ([198.145.29.99]:40432 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235298AbhJYT0l (ORCPT ); Mon, 25 Oct 2021 15:26:41 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7D642610CB; Mon, 25 Oct 2021 19:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1635189805; bh=sCtYATWhwOmOQOxHj9i5kDiYLJ2uPI8BE2sb55f/YOc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l9pSDPz6ETSIkC/0aHo7ShnV5Id4H3Q9VLc1XeqQ7p5j3OdPCwAsB3JKSCFQO1yQk himsEN53EyCavKOXlhRUX1XBVozUFVktFHVoAptoTAGXnbnN9crqFCv7mU+j+W86a3 7pzCMpHmIQDVKOi59Ukn8VNo92kRkC7auXPw/Jz4= 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.19 04/37] NFSD: Keep existing listeners on portlist error Date: Mon, 25 Oct 2021 21:14:29 +0200 Message-Id: <20211025190929.143886782@linuxfoundation.org> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211025190926.680827862@linuxfoundation.org> References: <20211025190926.680827862@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 cb69660d0779..ff9899cc9913 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