Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDC49C433EF for ; Mon, 29 Nov 2021 04:54:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240981AbhK2E56 (ORCPT ); Sun, 28 Nov 2021 23:57:58 -0500 Received: from smtp-out1.suse.de ([195.135.220.28]:60064 "EHLO smtp-out1.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234279AbhK2Ez6 (ORCPT ); Sun, 28 Nov 2021 23:55:58 -0500 Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id 89A16212FE; Mon, 29 Nov 2021 04:52:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1638161560; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cm28zN4GKlVceZ/q83bSYsbXYaPUYmpNVxruBbeeM3c=; b=Agvg/o8VGhDBV0tw7LOi8ftMgKmfANIkcdNnLmS79H+MvGt8i7xYsDfmG6fP4jok3ZuDSO DxcRtYH10EHS0eaWRCtH3r57g+cVZVszDRFky9d3wZHYsdrofwQsRYVTaWJafwkL1F+cMg sPYsCsnBHupHz5CjYcQS1hkUsg+6m6o= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1638161560; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=cm28zN4GKlVceZ/q83bSYsbXYaPUYmpNVxruBbeeM3c=; b=wstx9N2/brcKdYlx+Eehh0HRROluaBzi6uD5idgvayVKBF/Rt+dMKZT1wBHf9aIfuktCnp c4PgSqMk8WXDWqDg== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6DB7C133FE; Mon, 29 Nov 2021 04:52:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id ieSDCpdcpGHhbgAAMHmgww (envelope-from ); Mon, 29 Nov 2021 04:52:39 +0000 Subject: [PATCH 01/20] NFSD: handle errors better in write_ports_addfd() From: NeilBrown To: "J. Bruce Fields" , Chuck Lever Cc: linux-nfs@vger.kernel.org Date: Mon, 29 Nov 2021 15:51:25 +1100 Message-ID: <163816148551.32298.1997321981162233125.stgit@noble.brown> In-Reply-To: <163816133466.32298.13831616524908720974.stgit@noble.brown> References: <163816133466.32298.13831616524908720974.stgit@noble.brown> User-Agent: StGit/0.23 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org If write_ports_add() fails, we shouldn't destroy the serv, unless we had only just created it. So if there are any permanent sockets already attached, leave the serv in place. Signed-off-by: NeilBrown --- fs/nfsd/nfsctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/nfsd/nfsctl.c b/fs/nfsd/nfsctl.c index af8531c3854a..d47956672f9e 100644 --- a/fs/nfsd/nfsctl.c +++ b/fs/nfsd/nfsctl.c @@ -742,7 +742,7 @@ static ssize_t __write_ports_addfd(char *buf, struct net *net, const struct cred return err; err = svc_addsock(nn->nfsd_serv, fd, buf, SIMPLE_TRANSACTION_LIMIT, cred); - if (err < 0) { + if (err < 0 && list_empty(&nn->nfsd_serv->sv_permsocks)) { nfsd_destroy(net); return err; }