Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1538975pxb; Thu, 16 Sep 2021 09:30:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJNbIbzs7O465LAELraN+hd7STYiyX3y9e6R7ETtcelXRpt3SaRm+A1hXDMMn/Sq48UCcd X-Received: by 2002:a02:9282:: with SMTP id b2mr5048770jah.0.1631809807843; Thu, 16 Sep 2021 09:30:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631809807; cv=none; d=google.com; s=arc-20160816; b=cvo47nvFxqsxw0SYN9MxAKi6ypgooE+RMBMrLyjgysex10ojF7CY80N4KkQxf56VZ5 gIrRqPn4KjoZpn2bE3/E1pPZb1Hdw56nq+ExzdeZoKjHob6Qakpgu311FmgbrOBfLA1f jgPAW+8LEUR0/Yq/VLrskP5Vtg8ULNtM2RWNMhApla4KIwx+x4HGkq+CsvFTXWau+Ktp q/JA3sm8vEtRU09CTU45OJBTQVGcb3QbwUWfon8c41HZCpm4OKeeX9SND2rZ9o9RckWl pOOBr5lh68fKLwrkt3scdxKCS1m5yb4EKSOqS6Xn5e97hqhB+VrxswZKRm5khnftU9+I sZ7w== 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=1M2gjejRLqBSznbcQz3TSo0ITCOIuMfoFAESf1YyE60=; b=yNm5H/o2LCuAwzMcX+tq450NWyMeD0R/UMobZd+3Xor9bIo6t1EjceejSoZEcB2LCH vRJn9TCUy6jOlgO8ovRIAhxQPNKfO2ceehLAmnLRv2Oya6YNkmlXc37ln7ULwmBQBTrJ Q5FUH/YfZ8GsG1LxNQ2086pCKsS0Vh8MYHL3ahZu7Sg0NiETfov785Zpzorl8S0HWoAd XL3/hzjiY6xU7s6WouHJAyXYvgygjeNMVUnIm2xhFkDLr5OvUCqZk8f0K+QLcmuREVTA 0ezh154dEzqyerv5D9wQEYuUTrKbSQnVbF5sQ8tPC4kZtmkjgR2Sq722ZlbWV63no7Dq 2T+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YuappmrB; 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=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v18si3389183ilc.7.2021.09.16.09.29.55; Thu, 16 Sep 2021 09:30:07 -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=@linuxfoundation.org header.s=korg header.b=YuappmrB; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242007AbhIPQ3K (ORCPT + 99 others); Thu, 16 Sep 2021 12:29:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:55014 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241222AbhIPQPV (ORCPT ); Thu, 16 Sep 2021 12:15:21 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id CB03D613CE; Thu, 16 Sep 2021 16:11:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808683; bh=Q0lK3HoIcSET0s++2jaRwIXt4hru6VLJ3SveAsdzYjk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YuappmrBX2XRwAAA8cVokRlFs0UHyl8oVZURyCNetXnlaNvGmZqXHmSXmeu1tHGa5 bL0qf/CDbRVyhqzP2t2ymKCoFFGYTE286XuEa63sZ+0ZnFGR76flP2pFyuWP3hEvGM m/0RyNwQgw66PWkiZzCfuFzpRqImc1zWd2sJVxzY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Bob Peterson , Sasha Levin Subject: [PATCH 5.10 184/306] gfs2: Fix glock recursion in freeze_go_xmote_bh Date: Thu, 16 Sep 2021 17:58:49 +0200 Message-Id: <20210916155800.353176323@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 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 3faa421568b0..bf539eab92c6 100644 --- a/fs/gfs2/glops.c +++ b/fs/gfs2/glops.c @@ -623,16 +623,13 @@ static int freeze_go_xmote_bh(struct gfs2_glock *gl, struct gfs2_holder *gh) 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