Received: by 2002:a05:7412:85a1:b0:e2:908c:2ebd with SMTP id n33csp78633rdh; Mon, 30 Oct 2023 14:34:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGROTk9rGQ/jXiALKLO2ZyPgDIDitMsLZfE9e7Wm0narbWftpRlJrfV3K8rd2hbyxAzPQf0 X-Received: by 2002:a17:903:1207:b0:1cc:5378:6a40 with SMTP id l7-20020a170903120700b001cc53786a40mr3541765plh.23.1698701646438; Mon, 30 Oct 2023 14:34:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698701646; cv=none; d=google.com; s=arc-20160816; b=Ng/YFPvrUB9MOIU0fnwgNy3rvzAy3PPRsOL6vg5xmtNxmHcLUqySGmbJy1Gjw6MrP3 +ej99+jn710jEf558LHbKNz5fHOrM7DgWO7TFhvbcMJbFjeyy4VSspMWXRDCGcoquftL JwMflbekzgfpZaJPiL1nk9QOuVdvaGeArD9Fv+uHTBh4pBO/xtIkLr3WUvwH0bocwAf4 SpMo+a1zWz7N4J7EQIOqlT2/swsSFDXhZSORv2gkXlH9jSAx3lbmvUrb5jIEoFefzUih UOD9/CHb54CjfpllPvGMOZEInlt/mgvxImCHvLeyvla4NJhW1J3Bbg57+erswzWsBkck 4kVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:references:in-reply-to:subject :cc:to:from:mime-version:content-transfer-encoding:dkim-signature :dkim-signature; bh=b7lSEG/712moXpupryJuVYCtv58RazdNCEsa1sLuvuw=; fh=CrJgJmy3AiV+9Jx+gMcOwmQGTivPckx7Khdn4d0ezj4=; b=VOZD00Q6rkZkfj7lKBYcafFUpFETeIG+tljMEslUBizNA7VOqHGpnWnDfibH4E0fFJ w0BZBfB9sby4+KYEHIk80MUumbYcw1P2qZ4d9nBnS8hWGmosWTlCSXAUxufuhKCKc5zj v/GmK2hFj82qeTy3WQmmoMKwpioTDQWfWQpkrqmKnctsHnhl24bWCEJxAWaB8GoVQhAg 0l00DCA6D2rFk+Aba+xvmYO7vMI3Z5iLJQ4WnWtU8G7BCS1yDMx+bXNrkP7AF6ElOAmj HPu6WkUcNOX4PsLZEdubDXHYjkWH5vbXnY6BhEs/9okuyvnmcjx/1ea+mmYcfQlaHblV ALcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=zsGpI+jv; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id u3-20020a170902e5c300b001c89c86160bsi977213plf.385.2023.10.30.14.34.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Oct 2023 14:34:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b=zsGpI+jv; dkim=neutral (no key) header.i=@suse.de header.s=susede2_ed25519; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-nfs-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=suse.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 1DE86804A4FE; Mon, 30 Oct 2023 14:34:02 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229884AbjJ3VeC (ORCPT + 99 others); Mon, 30 Oct 2023 17:34:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46130 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229598AbjJ3VeB (ORCPT ); Mon, 30 Oct 2023 17:34:01 -0400 Received: from smtp-out1.suse.de (smtp-out1.suse.de [IPv6:2001:67c:2178:6::1c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 748F09F; Mon, 30 Oct 2023 14:33:59 -0700 (PDT) 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 F34E4218F2; Mon, 30 Oct 2023 21:33:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1698701637; 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=b7lSEG/712moXpupryJuVYCtv58RazdNCEsa1sLuvuw=; b=zsGpI+jvNAZtSOZhYPus4+hE2G2/1GlnKh88VYt4+O/HZb3y497mEqtJQMcYHoDTqogKwP eiFFC9LM14qhSN5fmUDIU1J6mwmex4gkFdmMnI4CWoQNI+TLlt/aFnK6J0Hz7Ybrz+Dq0z gNr8dKbcLJCZpMwTBy9oqT2VfKH6k/w= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1698701637; 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=b7lSEG/712moXpupryJuVYCtv58RazdNCEsa1sLuvuw=; b=tCArXslRGuJNUOzlSCQ9nT+zM6AaLznm38LFjUN5lxjX+hcfbVbksteigmVDIWDv3JbWkW LOOurkQ53cQHtHCA== 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 64962138F8; Mon, 30 Oct 2023 21:33:54 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id 7K2mB0IhQGWrIwAAMHmgww (envelope-from ); Mon, 30 Oct 2023 21:33:54 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: "Jeff Layton" Cc: "Chuck Lever" , "Olga Kornievskaia" , "Dai Ngo" , "Tom Talpey" , linux-nfs@vger.kernel.org, linux-kernel@vger.kernel.org, "Zhi Li" , "Jeff Layton" Subject: Re: [PATCH RFC] nfsd: fix error handling in nfsd_svc In-reply-to: <20231030-kdevops-v1-1-bae6baf62c69@kernel.org> References: <20231030-kdevops-v1-1-bae6baf62c69@kernel.org> Date: Tue, 31 Oct 2023 08:33:50 +1100 Message-id: <169870163037.24305.14020614041859684912@noble.neil.brown.name> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-nfs@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 30 Oct 2023 14:34:02 -0700 (PDT) On Tue, 31 Oct 2023, Jeff Layton wrote: > Once we've set the nfsd_serv pointer in nfsd_svc, we still need to call > nfsd_last_thread if the server fails to be started. Remove the special > casing for nfsd_up_before case since shutting down the per-net stuff is > also handled by nfsd_last_thread. >=20 > Finally, add a new special case at the start and skip doing anything if > the service already exists, 0 threads were requested and > serv->sv_nrthreads is 0. This is very similar to my=20 Commit bf32075256e9 ("NFSD: simplify error paths in nfsd_svc()") The main difference being that special case you mention. I don't like that bit. If I run "rpc.nfsd 0" then I want the nfsd_svc to be destroyed, whether there were threads running or not. Is there a reason my patch isn't sufficient? Thanks, NeilBrown >=20 > Fixes: 9f28a971ee9f ("nfsd: separate nfsd_last_thread() from nfsd_put()") > Reported-by: Zhi Li > Signed-off-by: Jeff Layton > --- > Here's what I was thinking for a targeted patch for stable. Testing it > now, but I won't have results until tomorrow. > --- > fs/nfsd/nfssvc.c | 15 +++++---------- > 1 file changed, 5 insertions(+), 10 deletions(-) >=20 > diff --git a/fs/nfsd/nfssvc.c b/fs/nfsd/nfssvc.c > index 3deef000afa9..187b68769815 100644 > --- a/fs/nfsd/nfssvc.c > +++ b/fs/nfsd/nfssvc.c > @@ -787,7 +787,6 @@ int > nfsd_svc(int nrservs, struct net *net, const struct cred *cred) > { > int error; > - bool nfsd_up_before; > struct nfsd_net *nn =3D net_generic(net, nfsd_net_id); > struct svc_serv *serv; > =20 > @@ -797,8 +796,9 @@ nfsd_svc(int nrservs, struct net *net, const struct cre= d *cred) > nrservs =3D max(nrservs, 0); > nrservs =3D min(nrservs, NFSD_MAXSERVS); > error =3D 0; > + serv =3D nn->nfsd_serv; > =20 > - if (nrservs =3D=3D 0 && nn->nfsd_serv =3D=3D NULL) > + if (nrservs =3D=3D 0 && (serv =3D=3D NULL || serv->sv_nrthreads =3D=3D 0)) > goto out; > =20 > strscpy(nn->nfsd_name, utsname()->nodename, > @@ -808,22 +808,17 @@ nfsd_svc(int nrservs, struct net *net, const struct c= red *cred) > if (error) > goto out; > =20 > - nfsd_up_before =3D nn->nfsd_net_up; > serv =3D nn->nfsd_serv; > =20 > error =3D nfsd_startup_net(net, cred); > if (error) > goto out_put; > error =3D svc_set_num_threads(serv, NULL, nrservs); > - if (error) > - goto out_shutdown; > - error =3D serv->sv_nrthreads; > if (error =3D=3D 0) > - nfsd_last_thread(net); > -out_shutdown: > - if (error < 0 && !nfsd_up_before) > - nfsd_shutdown_net(net); > + error =3D serv->sv_nrthreads; > out_put: > + if (serv->sv_nrthreads =3D=3D 0) > + nfsd_last_thread(net); > /* Threads now hold service active */ > if (xchg(&nn->keep_active, 0)) > svc_put(serv); >=20 > --- > base-commit: 31b5a36c4b88b44c91cdd523997b1e86fb47339d > change-id: 20231030-kdevops-5f7366897ef4 >=20 > Best regards, > --=20 > Jeff Layton >=20 >=20