Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp442015iog; Mon, 13 Jun 2022 06:05:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+iY4l/kfRSMRGlY3mz2kzgtZDtivGBuWlvI07cIa5sdzfZgnWMIn+zJfMlKjJekVHGWNz X-Received: by 2002:a05:6402:13ca:b0:433:27f5:cd13 with SMTP id a10-20020a05640213ca00b0043327f5cd13mr28581581edx.396.1655125409930; Mon, 13 Jun 2022 06:03:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655125409; cv=none; d=google.com; s=arc-20160816; b=S1+RDnylMyjJt6n21C3MN/59L9Jf7ho2RbhGAy2aqLmSKGzB4aJXeanqYLQz6kAJ0G +a1KqtUHyNuvEkwcGfIrb1y4uP3OyBLUNZ0KGjY7fAxrop1pbHZgd9dxkgoS8+YjOX4g Uxmq/3DY620dpD/oKcsoZ3mlfmJqAkgGlhLxpjICXqd1Owvk5Kv1GBW8UylE0DzqClMf LkTrHm5KYNAee2ll3xZ260vHBXkDQ+riFA4hYtzBvtNb7sBfcAfZdkU89sEUATAdSRdj emAm/+PkXdsC9oJu7dJ/xcnP1hHt4oRN/MDJJZsoURyEcyhSdgrUex7fhaFka8+GOSwR 7Gpw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=4fcIe9+F7W5Td1NeC0TWGGK9+Q21sBSPuy7DFsO/0Ns=; b=YlYnBVHoEq/E+5d602+6Dv+h7aR9jrmbSbtUdomcWQiQ4FlRENn+3V5vewhvbgZl6t 7t119fZmPepHJaBNlXjCERn6ZxCe+zRMpfpV/N9GefmBDB6q/Hi3j8N6wBhHRTY9DxU7 EcJ5Nfo6uuwmBxK2gemm74jY0IEXHLdyiijhlo3tVDOLGpHpXU2YE7uZZwQ2Ca9pXOtl HL1YSEADQapuOnTM3Erv/lngLEgp154sIcABSOv3M6q3o1K/8+ihyG71NrI9DQeVj1O2 WnxwSOZBDsGy6ytsYWEdgDdVcrjh8VavXa1xRBJTYbt5hztjpqx36ZPJKRrKGdqglLm4 aHzQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hXfBGZR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id z10-20020aa7cf8a000000b0042b23753d1fsi7607750edx.350.2022.06.13.06.03.02; Mon, 13 Jun 2022 06:03:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=hXfBGZR8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355855AbiFMLmB (ORCPT + 99 others); Mon, 13 Jun 2022 07:42:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33050 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1355136AbiFMLel (ORCPT ); Mon, 13 Jun 2022 07:34:41 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E36B434B3; Mon, 13 Jun 2022 03:47:49 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7B14461248; Mon, 13 Jun 2022 10:47:48 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 609BDC34114; Mon, 13 Jun 2022 10:47:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1655117267; bh=xtjsKvZys24tV3+kGdskfHL2KBHqGA1fm76Zsp7xHDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hXfBGZR8/I4TxJG6N0w5jFXrwzscB02eioNTJKlBO5X7MzR2az38mHMUY549ljX/Y INT7fXF7LbJiB+LZcahDG9/vaffrybkhRiu5NSlgk9TWYgvhTo+N51MPdssIdEYTz+ Pb6E6A4TMjKbiz6dMfWZ8Y8qUu262Y2h3a4sKdWo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Trond Myklebust , Anna Schumaker , Sasha Levin Subject: [PATCH 5.4 345/411] NFSv4: Dont hold the layoutget locks across multiple RPC calls Date: Mon, 13 Jun 2022 12:10:18 +0200 Message-Id: <20220613094939.053365113@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220613094928.482772422@linuxfoundation.org> References: <20220613094928.482772422@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Trond Myklebust [ Upstream commit 6949493884fe88500de4af182588e071cf1544ee ] When doing layoutget as part of the open() compound, we have to be careful to release the layout locks before we can call any further RPC calls, such as setattr(). The reason is that those calls could trigger a recall, which could deadlock. Signed-off-by: Trond Myklebust Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- fs/nfs/nfs4proc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index cf3b00751ff6..ba4a03a69fbf 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c @@ -3041,6 +3041,10 @@ static int _nfs4_open_and_get_state(struct nfs4_opendata *opendata, } out: + if (opendata->lgp) { + nfs4_lgopen_release(opendata->lgp); + opendata->lgp = NULL; + } if (!opendata->cancelled) nfs4_sequence_free_slot(&opendata->o_res.seq_res); return ret; -- 2.35.1