Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp553559pxb; Wed, 6 Oct 2021 10:21:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw29lfIia/F6mxCgEayN6S91lGA5EKVhwQhxwpa7Qob8xrFv/hBD2nczKxET2TeggRhwm+w X-Received: by 2002:a17:906:660b:: with SMTP id b11mr33545497ejp.427.1633540893178; Wed, 06 Oct 2021 10:21:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633540893; cv=none; d=google.com; s=arc-20160816; b=J2+4cmvS8I54pYWo31I+ojc1+1ovwo89mb7FhEScEA2lO7Xgo5lKf/9zZe5MZW0bRD 8P3nzhy1FdvIpPFK7FmgVM9l/JG/OfA1YArIMHd/7hV50e1gV5JLYhF79lo0Uh0F3UL7 YuX+/1Wl9xUX5dZAi9FuavbIhFvSL95MM9MhbGhrEmDNUKKTlJfHt0D6iQDLtZU80WmI O/b/G1IypV4bzvauY3ouzl8yoVvDjSUFMiWg/WU5lkXj/QZUFFzExq4LTNHq1uvbfyQl twmZZBP9e1+q0YOytNqMZmhgZx414SpjMVFhXqBh1CL10orBeqBpVKP0ODwC2PyO3r73 9DUA== 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=PzG9OIYXJCMtn8MVm+VRimVQcNoscZauB71pUi/vJZY=; b=H9gzEolHVAyJk3NUbKwXCFO92Df9SEw/V2niNaEm+l6Xaf1ghNvgm+YThBVlJ8OoDM UsgbTHs4wYqYDyJ2uWpkf1LF+i1kPFIZresEOxVKiGUmurgEwB1nsKrk7tBrYLoTLBeN JdDP5072MlF0riMe6qzfWzTaaYbXlIxm6Kddxz5o8e0+KPnxZoKZQAa/bKSI+hRKdTdN Zkm2dOIUc2WOk2y3F6+4xmzHq9+2M7NUreNfeC5fr14nVctvgQnutt4ZY8d4wt803EO8 f/pVUrX1wo/YgPfXVvEUm9fxmOgk8IaDc9eCsejZC9MI8hzZliP5TLXc9ZhSGh2UfaSW Bdtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GBj6itvE; 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 o12si8433331edc.95.2021.10.06.10.21.02; Wed, 06 Oct 2021 10:21:33 -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=GBj6itvE; 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 S239219AbhJFRWm (ORCPT + 99 others); Wed, 6 Oct 2021 13:22:42 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52195 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238946AbhJFRWk (ORCPT ); Wed, 6 Oct 2021 13:22:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1633540848; 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=PzG9OIYXJCMtn8MVm+VRimVQcNoscZauB71pUi/vJZY=; b=GBj6itvEL7NORcy2bDrA/KXhQ0zpnJQ6R2iXTU3l09FAgIQjCEcei/Uhx/HK/6ZlenIV5Y hNpFd66oMP9/JFmbzeF/c+Sggsk2cG/AqUdysZLDIwCAGRUFwV+xFYE/zcYRn7w8vY0+S7 6npwwR65Mb1TdOYr7kTEbqHYzeTWhBE= 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-440-Sw7xNHnaNUKfgSXa_wv3nw-1; Wed, 06 Oct 2021 13:20:47 -0400 X-MC-Unique: Sw7xNHnaNUKfgSXa_wv3nw-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id ACA14A40C1; Wed, 6 Oct 2021 17:20:45 +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 758B8100164A; Wed, 6 Oct 2021 17:20:45 +0000 (UTC) Received: by bcodding.csb (Postfix, from userid 24008) id E82DB1043453; Wed, 6 Oct 2021 13:20:44 -0400 (EDT) From: Benjamin Coddington To: bfields@fieldses.org, chuck.lever@oracle.com Cc: linux-nfs@vger.kernel.org Subject: [PATCH v2] NFSD: Keep existing listeners on portlist error Date: Wed, 6 Oct 2021 13:20:44 -0400 Message-Id: <547ee3794ac9678bc20ccb6ec35ba0fca5fe92f2.1633540771.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.84 on 10.5.11.22 Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org Why V2: further testing to verify INET6 handling, fix spelling mistakes 8<------------------------------------------------------------------------ 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 --- 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