Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp449354pxb; Thu, 9 Sep 2021 04:51:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxNopgY06D8J1psozW0iKt5G9vn2NQbhQhShL17IRvh1/BazD//9Y52aDCZep71LCJN9q1H X-Received: by 2002:a02:a1c3:: with SMTP id o3mr2482139jah.59.1631188311092; Thu, 09 Sep 2021 04:51:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631188311; cv=none; d=google.com; s=arc-20160816; b=ArZInZpLntu+l/AGrilBaE8mabFUeV5IaJzCWiAtdwpppxufZzcLh82Sff/FaTQ71X S6uRWQ1OCiDxVLRiu4CIQ26nIP8pVdbBZlyGXL1nG6blHbM3Jgm2oozqbGzaphiULEsU HbPwpIjsOncIfpfXMxLJM/UYwytCYws5qkQqOwe4jd7UgvsWHcQ3ny1266DnDxwWeJTJ FxGD1jAa4SZYmaJYVu+OdaFDVveBzJmKk0m1Y6vbMlpN5Z9sPnzp6FJ6NvWS5OUhRfMR bC9o78xvkRhQqlLQb3HboiKGsN33IEtYCzjZem/YxQxZ5PiNInwPR27GK84tgO4iLEId WYlg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=UewPNYQRrhC9wpWLC1eByrrBc+C/5ENl97yivUL/fAM=; b=KJNvN5btsvyNIqnPpC1M84Ux/WOyQgxptqFekalR5xsD8kaQHs003s/wH/ync3EHFk MxjrMwxaw0LT/ZXXoI0jVWYp2KhKGmdNG0T2/UyMhy7rLRetvt/b/tn6byXjXRDCNUCD rOV+25NYEZ84DthFZqoArzJ7ZxI8CcFsuIGqylfd6nq0qzrzWN+hoXME0BGFMbMf5SVZ k9IkiCw9aB5lji065yeKV7s23XreqBIYinvRf/T99jKWqktaqJGJZnlTGHGn4cQ0VWx+ nSEi8y92Z/AndrdISeUfAvjkEnfpQSVbqQK0eRxmhmhD9pCmUP6BZ8yNTNdZCdPyCF5G UIDg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=db0Fd+bq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k7si1444537ior.112.2021.09.09.04.51.39; Thu, 09 Sep 2021 04:51:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=db0Fd+bq; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242087AbhIILv0 (ORCPT + 99 others); Thu, 9 Sep 2021 07:51:26 -0400 Received: from mail.kernel.org ([198.145.29.99]:54974 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235499AbhIILsr (ORCPT ); Thu, 9 Sep 2021 07:48:47 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id F0B69611C5; Thu, 9 Sep 2021 11:43:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1631187809; bh=hBMpEcqTLqk1Iuuh/VqFCCsSi3SUvQ2kusH5coJhz90=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=db0Fd+bqXb0Cy3AgVwHc8aN7/VTyxQA+2th0iRCFRuLOw1sqleTBvOO7Jfpo1Nx7m 2sNdkBX2AOQnFCoR96n0GgyuoiGjVw8Ldf6KaFQHb3k84OJtla2oSohdC3ou+THdek ryVCbXcNgY9kdIWVElVB19zLoV3jT+UDE+VAgtPB0yJxVS88n7FHapvtfe6d/5JiJa +d3tXFq05tewfDGkAur8isfSkb7sLGjXAWnt4P6PRhoD7NVN+o4HjJLjnt0NLW2BL/ zJ/DX5clx+D3KE2XwDOJ1gVVTWj3OPt2BP/0Mktvmo+f9IzgUuaZSaTur9UYqdmNnk C0zU3xiUaudRA== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Bob Peterson , Sasha Levin , cluster-devel@redhat.com Subject: [PATCH AUTOSEL 5.14 111/252] gfs2: Fix glock recursion in freeze_go_xmote_bh Date: Thu, 9 Sep 2021 07:38:45 -0400 Message-Id: <20210909114106.141462-111-sashal@kernel.org> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210909114106.141462-1-sashal@kernel.org> References: <20210909114106.141462-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Bob Peterson [ Upstream commit 9d9b16054b7d357afde69a027514c695092b0d22 ] We must not call gfs2_consist (which does a file system withdraw) from the freeze glock's freeze_go_xmote_bh function because the withdraw will try to use the freeze glock, thus causing a glock recursion error. This patch changes freeze_go_xmote_bh to call function gfs2_assert_withdraw_delayed instead of gfs2_consist to avoid recursion. Signed-off-by: Bob Peterson Signed-off-by: Sasha Levin --- fs/gfs2/glops.c | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/fs/gfs2/glops.c b/fs/gfs2/glops.c index 54d3fbeb3002..384565d63eea 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c @@ -610,16 +610,13 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl) j_gl->gl_ops->go_inval(j_gl, DIO_METADATA); error = gfs2_find_jhead(sdp->sd_jdesc, &head, false); - if (error) - gfs2_consist(sdp); - if (!(head.lh_flags & GFS2_LOG_HEAD_UNMOUNT)) - gfs2_consist(sdp); - - /* Initialize some head of the log stuff */ - if (!gfs2_withdrawn(sdp)) { - sdp->sd_log_sequence = head.lh_sequence + 1; - gfs2_log_pointers_init(sdp, head.lh_blkno); - } + if (gfs2_assert_withdraw_delayed(sdp, !error)) + return error; + if (gfs2_assert_withdraw_delayed(sdp, head.lh_flags & + GFS2_LOG_HEAD_UNMOUNT)) + return -EIO; + sdp->sd_log_sequence = head.lh_sequence + 1; + gfs2_log_pointers_init(sdp, head.lh_blkno); } return 0; } -- 2.30.2