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.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 4226CC33C9E for ; Sat, 11 Jan 2020 10:02:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 143FC2084D for ; Sat, 11 Jan 2020 10:02:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578736951; bh=/EViJGYuFse92XYSVCsg7n9J7XgD2T3CK4T0Gd9E/EE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=2Ad95/NqaGnYN8935QiSKGSqHNeGcRirHunGdG53tZjBbm61xDp7y7/vjhpHLUBQL zpmJmmSUpIJ6maIspdFUxfo85akkHyhIHv3Pw5WSH8AKIbP1Zmd261PVSrBWT4vJAv e0uP8DymsHLK2+GUxrUxeBeBBe2Hci62tdSxNcXM= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728913AbgAKKCa (ORCPT ); Sat, 11 Jan 2020 05:02:30 -0500 Received: from mail.kernel.org ([198.145.29.99]:32780 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728819AbgAKKC3 (ORCPT ); Sat, 11 Jan 2020 05:02:29 -0500 Received: from localhost (unknown [62.119.166.9]) (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 7918F20842; Sat, 11 Jan 2020 10:02:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1578736949; bh=/EViJGYuFse92XYSVCsg7n9J7XgD2T3CK4T0Gd9E/EE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QPZW5xokp2lf3rm0RISd9NwO2PX0nle5nYNND2HKYz/yy1/0GwlJC3FHbl6CJNCzF CbxNXS64Jf2KqXm6VOCKEznLulZoiXUKW02ziRWh15G/nEtcQjnquMY77wcfTWsf8H XIMuIh1K0IGiRNPdUFuBm2FeYDoWGkYimPYslWng= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Omar Sandoval , "Darrick J. Wong" Subject: [PATCH 4.9 36/91] xfs: dont check for AG deadlock for realtime files in bunmapi Date: Sat, 11 Jan 2020 10:49:29 +0100 Message-Id: <20200111094858.636450376@linuxfoundation.org> X-Mailer: git-send-email 2.24.1 In-Reply-To: <20200111094844.748507863@linuxfoundation.org> References: <20200111094844.748507863@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Omar Sandoval commit 69ffe5960df16938bccfe1b65382af0b3de51265 upstream. Commit 5b094d6dac04 ("xfs: fix multi-AG deadlock in xfs_bunmapi") added a check in __xfs_bunmapi() to stop early if we would touch multiple AGs in the wrong order. However, this check isn't applicable for realtime files. In most cases, it just makes us do unnecessary commits. However, without the fix from the previous commit ("xfs: fix realtime file data space leak"), if the last and second-to-last extents also happen to have different "AG numbers", then the break actually causes __xfs_bunmapi() to return without making any progress, which sends xfs_itruncate_extents_flags() into an infinite loop. Fixes: 5b094d6dac04 ("xfs: fix multi-AG deadlock in xfs_bunmapi") Signed-off-by: Omar Sandoval Reviewed-by: Darrick J. Wong Signed-off-by: Darrick J. Wong Signed-off-by: Greg Kroah-Hartman --- fs/xfs/libxfs/xfs_bmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -5688,7 +5688,7 @@ __xfs_bunmapi( * Make sure we don't touch multiple AGF headers out of order * in a single transaction, as that could cause AB-BA deadlocks. */ - if (!wasdel) { + if (!wasdel && !isrt) { agno = XFS_FSB_TO_AGNO(mp, del.br_startblock); if (prev_agno != NULLAGNUMBER && prev_agno > agno) break;