From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6592E1C07 for ; Wed, 28 Dec 2022 16:03:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E15FDC433EF; Wed, 28 Dec 2022 16:03:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1672243418; bh=43AF6sQG+Whwj/cUZ/1+g5aRM0w+7UnMnjN8ongqtHk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SneD9b2mKxbt8z1tIonsXzd8h75dH+a7IvdG8DmB14hWjXTn7oBnrHoSWTiPiwao0 H0kucB+QZrYQHt/AdfRxpQ7IDjoZAgwFKB7sl0kZyn8umVQeECLwE2n6yzDrVw/8+O 1qab8ABAeUR5DZK+NpjnugYiwmA4lJ4slza6Rs2g= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, ChenXiaoSong , Trond Myklebust , Sasha Levin Subject: [PATCH 6.1 0490/1146] NFSv4.x: Fail client initialisation if state manager thread cant run Date: Wed, 28 Dec 2022 15:33:49 +0100 Message-Id: <20221228144343.493226431@linuxfoundation.org> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20221228144330.180012208@linuxfoundation.org> References: <20221228144330.180012208@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Trond Myklebust [ Upstream commit b4e4f66901658fae0614dea5bf91062a5387eda7 ] If the state manager thread fails to start, then we should just mark the client initialisation as failed so that other processes or threads don't get stuck in nfs_wait_client_init_complete(). Reported-by: ChenXiaoSong Fixes: 4697bd5e9419 ("NFSv4: Fix a race in the net namespace mount notification") Signed-off-by: Trond Myklebust Signed-off-by: Sasha Levin --- fs/nfs/nfs4state.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c index a2d2d5d1b088..03087ef1c7b4 100644 --- a/fs/nfs/nfs4state.c +++ b/fs/nfs/nfs4state.c @@ -1230,6 +1230,8 @@ void nfs4_schedule_state_manager(struct nfs_client *clp) if (IS_ERR(task)) { printk(KERN_ERR "%s: kthread_run: %ld\n", __func__, PTR_ERR(task)); + if (!nfs_client_init_is_complete(clp)) + nfs_mark_client_ready(clp, PTR_ERR(task)); nfs4_clear_state_manager_bit(clp); clear_bit(NFS4CLNT_MANAGER_AVAILABLE, &clp->cl_state); nfs_put_client(clp); -- 2.35.1