Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp5931898rdb; Sun, 17 Sep 2023 20:31:31 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGKpTFmC2OA1nMkXkPgemWR4irV3tvP1bWfKQEEMRPx7g5yoxVHi+eLQAQ1TTp6hTGO7bC/ X-Received: by 2002:a17:90a:e00b:b0:274:cf7e:f11c with SMTP id u11-20020a17090ae00b00b00274cf7ef11cmr5667624pjy.19.1695007890896; Sun, 17 Sep 2023 20:31:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695007890; cv=none; d=google.com; s=arc-20160816; b=z5sBasVaiTSEiKRnY9pzVRNwLFnvuJvSeeER5RW+8lwfpf/dsSrfWTrktytef/eHq6 iWKXXjWAHCseOeZW0LH1bHouPAH+Iz1yeiBrjNt03OyanpfF8P9V+bdNhxcbHOwYLKRe D2yUBHCGQKOqP7XGdd9hkoTcefrokA5IWYYHUUqjtOjZWMbhkPSUUmkfwneon9ux2rZv cj24uX4gaxgQPg6y0i0jaqrnvv0V2l14AvXjZweKAe5+3j4Pu0XcPd4aDXnBEGdjoiaM CwDpuaF4wK0HkMgyGYrMYrIAacgspetcTWkW4q9tgSvsAXiYePaXUq4UVJhmZsUPfKFn OH/w== 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=0waZ0nR0XXD2llSLXQNPTlEoYAJTFuE8L0T9U76V940=; fh=RXpcLFPse+UuwQ94ftFW8DymbY/iHVA4yc+N680vOHg=; b=kS7J1IiZAEDaekObFsNfhhR4TIo3NQ/ewWGD0UMTzYLW4LhWMzoEYhbBd8pGFF4Q7e Pbvj/s8OcLpqcOFaFxZuUKqDHqh3tfXxkDCQAAz4Az9CEmH8M6lVCeYb5RMRJ9A1s5pb rPFeh7RD1QvxHLAKd2E/Imv1r7kWfEDkpcbubwTl8MzMLGPacLd7+SNJiCdS5Jr10q31 kzP4rPT3zxAZHuFFeZYYlHJ36K4WfikPmJGJDyJpXmTgxpjAFxw8gN045Hpd6u5QSSVE ZhyhI75vdceTJ6AwGdHs7s6wSgOaaGSGsg3yt41GtzkoVXbx++os3pIE5SBB/zzrvKaN Bggg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="t/E0wyv1"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id s70-20020a637749000000b00563d3ecfb13si7053099pgc.117.2023.09.17.20.31.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 17 Sep 2023 20:31:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.de header.s=susede2_rsa header.b="t/E0wyv1"; dkim=neutral (no key) header.i=@suse.de; spf=pass (google.com: domain of linux-nfs-owner@vger.kernel.org designates 23.128.96.31 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 morse.vger.email (Postfix) with ESMTP id A5684801C1E5; Sun, 17 Sep 2023 18:21:25 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233943AbjIRBR6 (ORCPT + 99 others); Sun, 17 Sep 2023 21:17:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235378AbjIRBRr (ORCPT ); Sun, 17 Sep 2023 21:17:47 -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 2871A124 for ; Sun, 17 Sep 2023 18:17:42 -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 9BFFF21986; Mon, 18 Sep 2023 01:17:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1694999860; 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=0waZ0nR0XXD2llSLXQNPTlEoYAJTFuE8L0T9U76V940=; b=t/E0wyv16S8buaZPh0zVnyOYfZgPyWj1Hj79JmbI24jCoff7P2fIdvx5/No9t1L4aEpz2W uqbMCoO0BIzy8+ftNkk6eH/HRGPFG4rBiwC827C20Lm1LgZ4hc5F8qxq6f+VitNKI+1jYp XR9I70wlOvGw1k8YWTcOTeo1m5VemHw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1694999860; 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=0waZ0nR0XXD2llSLXQNPTlEoYAJTFuE8L0T9U76V940=; b=B2s0abvbADTBmbMZuqC1fPEB0HN5fr1OUYVJ4wxRPquWBvehKAo9JxFG8yI0HQBbUzzKi4 7FqM3EryFnLoZHDA== 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 5A40A134F3; Mon, 18 Sep 2023 01:17:39 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id o1uaAzOlB2XeSQAAMHmgww (envelope-from ); Mon, 18 Sep 2023 01:17:39 +0000 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 From: "NeilBrown" To: trondmy@kernel.org Cc: "Anna Schumaker" , linux-nfs@vger.kernel.org Subject: Re: [PATCH 1/2] NFSv4: Fix a nfs4_state_manager() race In-reply-to: <20230917230551.30483-1-trondmy@kernel.org> References: <20230917230551.30483-1-trondmy@kernel.org> Date: Mon, 18 Sep 2023 11:17:35 +1000 Message-id: <169499985553.8274.16707412085976640956@noble.neil.brown.name> X-Spam-Status: No, score=-0.9 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 morse.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 (morse.vger.email [0.0.0.0]); Sun, 17 Sep 2023 18:21:25 -0700 (PDT) On Mon, 18 Sep 2023, trondmy@kernel.org wrote: > From: Trond Myklebust >=20 > If the NFS4CLNT_RUN_MANAGER flag got set just before we cleared > NFS4CLNT_MANAGER_RUNNING, then we might have won the race against > nfs4_schedule_state_manager(), and are responsible for handling the > recovery situation. >=20 > Fixes: aeabb3c96186 ("NFSv4: Fix a NFSv4 state manager deadlock") > Signed-off-by: Trond Myklebust > --- > fs/nfs/nfs4state.c | 7 +++++++ > 1 file changed, 7 insertions(+) >=20 > diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c > index e079987af4a3..0bc160fbabec 100644 > --- a/fs/nfs/nfs4state.c > +++ b/fs/nfs/nfs4state.c > @@ -2703,6 +2703,13 @@ static void nfs4_state_manager(struct nfs_client *cl= p) > nfs4_end_drain_session(clp); > nfs4_clear_state_manager_bit(clp); > =20 > + if (test_bit(NFS4CLNT_RUN_MANAGER, &clp->cl_state) && > + !test_and_set_bit(NFS4CLNT_MANAGER_RUNNING, > + &clp->cl_state)) { > + memflags =3D memalloc_nofs_save(); > + continue; > + } > + I cannot see what race this closes. When we cleared MANAGER_RUNNING, the only possible consequence is that nfs4_wait_clnt_recover could have woken up. This leads to nfs4_schedule_state_manager() being run, which sets RUN_MANAGER whether it was set or not. I understand that there are problems with MANAGER_AVAILABLE which your next patch addresses, but I cannot see what this one actually fixes. Can you help me? Thanks, NeilBrown > if (!test_and_set_bit(NFS4CLNT_RECALL_RUNNING, &clp->cl_state)) { > if (test_and_clear_bit(NFS4CLNT_DELEGRETURN, &clp->cl_state)) { > nfs_client_return_marked_delegations(clp); > --=20 > 2.41.0 >=20 >=20