From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9AACC282C3 for ; Thu, 24 Jan 2019 17:51:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6E17F218C3 for ; Thu, 24 Jan 2019 17:51:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548352311; bh=S6qq/7Phey/99COlQMzaFMYjIAZQFjiL1z9ZqkS7tvs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:List-ID:From; b=XMPzTjZ76B0OwWquFzoYMt4Ed664+GWhwYIyVLKZnygf9q5fXWEr/mppthpZeM5Kc dNtGvLG3DUYPta19fQyaXF9rAyK4Rq6MVTcolmDI1Cg5CZyU6H4OyRsJk/KDjT8rSK Rt9EVBp75cYWBQAy33gd8wuclv+E1uPyAYGS44ts= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727991AbfAXRvv (ORCPT ); Thu, 24 Jan 2019 12:51:51 -0500 Received: from mail.kernel.org ([198.145.29.99]:34540 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727765AbfAXRvu (ORCPT ); Thu, 24 Jan 2019 12:51:50 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 8B5EE218A6; Thu, 24 Jan 2019 17:51:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548352310; bh=S6qq/7Phey/99COlQMzaFMYjIAZQFjiL1z9ZqkS7tvs=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=tdv0AFCpPebi99BT8UTkZFPhbLr+la5yM+caRdcg2HX8e2Aj1Z5DwPGpPU6X5MqKT oNmXFlEsLiiGq14NnL/iMn61W5pBmwWt9H77tNbbL1mlMziUx2n9yX6ZM/1Xa1ZmZT U2Sp/2ptaPm8kOHT3KuPb/hlYy6BAdcx0pyDwsCI= Date: Thu, 24 Jan 2019 18:51:47 +0100 From: Greg KH To: Qian Lu Cc: stable@vger.kernel.org, Scott Mayhew , Anna Schumaker Subject: Re: [PATCH v4.14-stable v2] nfs: fix a deadlock in nfs client initialization Message-ID: <20190124175147.GB7484@kroah.com> References: <20190124070024.15342-1-luqia@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190124070024.15342-1-luqia@amazon.com> User-Agent: Mutt/1.11.2 (2019-01-07) Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org On Wed, Jan 23, 2019 at 11:00:24PM -0800, Qian Lu wrote: > From: Scott Mayhew > > The following deadlock can occur between a process waiting for a client > to initialize in while walking the client list during nfsv4 server trunking > detection and another process waiting for the nfs_clid_init_mutex so it > can initialize that client: > > Process 1 Process 2 > --------- --------- > spin_lock(&nn->nfs_client_lock); > list_add_tail(&CLIENTA->cl_share_link, > &nn->nfs_client_list); > spin_unlock(&nn->nfs_client_lock); > spin_lock(&nn->nfs_client_lock); > list_add_tail(&CLIENTB->cl_share_link, > &nn->nfs_client_list); > spin_unlock(&nn->nfs_client_lock); > mutex_lock(&nfs_clid_init_mutex); > nfs41_walk_client_list(clp, result, cred); > nfs_wait_client_init_complete(CLIENTA); > (waiting for nfs_clid_init_mutex) > > Make sure nfs_match_client() only evaluates clients that have completed > initialization in order to prevent that deadlock. > > This patch also fixes v4.0 trunking behavior by not marking the client > NFS_CS_READY until the clientid has been confirmed. > > Signed-off-by: Scott Mayhew > Signed-off-by: Anna Schumaker > Signed-off-by: Qian Lu > --- > fs/nfs/client.c | 11 +++++++++++ > fs/nfs/nfs4client.c | 17 +++++++++++++---- > 2 files changed, 24 insertions(+), 4 deletions(-) You forgot to mention the sha1 of the commit :( I dug it up this time... greg k-h