Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp550235pxb; Wed, 6 Oct 2021 10:17:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMNul0VMb0GkyCIvk8sODb+LjkTJeehtKWkPRsNRoBOfwDL1wfUrZUpGjDCZYs8rIxir+T X-Received: by 2002:a17:90a:181:: with SMTP id 1mr12392905pjc.214.1633540647659; Wed, 06 Oct 2021 10:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633540647; cv=none; d=google.com; s=arc-20160816; b=swR24lO2/Co4C/GkKnN/KgTWNKWF+sYDBTxHPfjSFroUb8IDBCKaXVQSIv8Jlq/AO+ zs+Pu3ZncWsyraLFVTvpsIn2AF7DxqFQwXX4p3lURNSdyUo0eFK+mjC7Fx4gToIykzvt uYOj9+aGSympiM2RfjTTSIkbBwQWW6XbrGYXZt9FZcCmP57YZGteWAosyObFzPQGeZCa j+mKCki25AntCMAc+Uk/iA5K96xdnB0zHZ7kxX0VVO6e6gwsyejHkYJ4A4qx21M1cTT1 jS7dwoUfozv/kFCdoty8dWdPE2mYo2rZWlJmCjET74YQLiI56/PR9l/Y0VwMxdDD2bBR Rm+w== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=Z2Y4eQKCGMlkQkSt3y/8+c1KH4dOiH7+fhTB1mD+8Qs=; b=lXPifWruIGwtqNn+6rZRlAvoDVWlP0xsifS9GOFxhUjEfAD+APlq2YaGiBandj3/jw BSHHb6P7zY+INXEU14cDDUMFZpK9H7H5ieaeSXssqkI+x/nN5v4NSbl+oaIDyutyoZoR WLEhMEjVA4xZTeP25s/oFkaOrkSNJqjYj59TxbIzUx8+NK8UtxtuFyoW8I2LgPJ9CkwY oJA0FoGKYTBCU61oRLn8KJ+Yuqpb1blcYVps6LAod82t/Fs8s0v94qq6+WzJkF3sSrYW rCuMlo+cRAf9cJgrocaE+7G25/v95Fo56s/vOc/v8djml6AVBxj0IaM2pfTkWM4UrIGm EB5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Er5+Nhb+; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 13si6629575pli.91.2021.10.06.10.16.54; Wed, 06 Oct 2021 10:17:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-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=@redhat.com header.s=mimecast20190719 header.b=Er5+Nhb+; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231528AbhJFRSo (ORCPT + 99 others); Wed, 6 Oct 2021 13:18:44 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:29868 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229992AbhJFRSn (ORCPT ); Wed, 6 Oct 2021 13:18:43 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633540611; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Z2Y4eQKCGMlkQkSt3y/8+c1KH4dOiH7+fhTB1mD+8Qs=; b=Er5+Nhb+jvtRwne9qkrZJ12WGzMG4WILJpuX9rwpNThJxvwvx8bheYcui+D17QY/lD1OZn f4vlSjSaUNl/aYFW3d3wlMWTpi50RvMpylWs+UT5R1awNvpqb2kHx3rrbTIntKsD0hAlCB FF8ZHvvbBL38Hf0g8n/7IuLit+MOwRg= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-521-EJrTy5hrOzOYsnpO56NEtQ-1; Wed, 06 Oct 2021 13:16:48 -0400 X-MC-Unique: EJrTy5hrOzOYsnpO56NEtQ-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 881FB835DE4; Wed, 6 Oct 2021 17:16:47 +0000 (UTC) Received: from bcodding.csb (ovpn-66-66.rdu2.redhat.com [10.10.66.66]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4EA6D60657; Wed, 6 Oct 2021 17:16:47 +0000 (UTC) Received: by bcodding.csb (Postfix, from userid 24008) id DE95D1043453; Wed, 6 Oct 2021 13:16:46 -0400 (EDT) From: Benjamin Coddington To: bfields@fieldses.org, chuck.lever@oracle.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH] NFSD: Keep existing listners on portlist error Date: Wed, 6 Oct 2021 13:16:46 -0400 Message-Id: <74ed9f09bc3e3efbc70ff0414fb13c533b810a20.1633540569.git.bcodding@redhat.com> In-Reply-To: <45b916f1aa3fb7c059a574f61188a8f2f615410e.1633529847.git.bcodding@redhat.com> References: <45b916f1aa3fb7c059a574f61188a8f2f615410e.1633529847.git.bcodding@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org 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 callingn nfsd_destroy(). Signed-off-by: Benjamin Coddington --- 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 c2c3d9077dc5..696a217255fc 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -793,7 +793,10 @@ static ssize_t __write_ports_addxprt(char *buf, struct net *net, const struct cr 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.30.2