Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp10429237ybi; Wed, 24 Jul 2019 23:03:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwwqytevTXUTqlDXvPi7OBJoLCjrAovn3qqyPe4HXsc2Eo6xq3/iJMj+iitz+7aI5bhCxER X-Received: by 2002:a17:902:7043:: with SMTP id h3mr61498723plt.10.1564034637447; Wed, 24 Jul 2019 23:03:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564034637; cv=none; d=google.com; s=arc-20160816; b=bPeZ7hC5uGKJ9kvj6eWk2Ko4kBHd/nravkrf5+sQjnS9OEGgeFEWw/ccYvabXBnHtd gDLCVqxBxriIWXL/ie7cA3gqtGfidHjL83xcISJSo1bH9i7TDwmjqbhXZfCyEsgSsToj 0afpTEFnQOX9dORyesryBKf4AIIh0oNkZ/iP5c/Zh6DJcmdyB056XqVUwO9gBddOsaJO t3SCbSGjuSiOD/i4a8ORSH2maiElZ55RXzQNG75g4Escc8ma71xU/UCauJ6pTgq0uqAo WIAvuckT4bIxbQ0wF7JtAX79+1Dx7NGJBot5waUAb9ncgTpXnBwR8bk3hp7PGyygkrGG A6Aw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=OTDGc/ehmJ0RYZ+8OWCIeWPlNqW6vWDzhu2j+1TH9/s=; b=ESuTbqbgTMxAb2ZwlPlTAASkB4Z0ZtKdb0s0beJEj/dnK+YTpOrR8YPA1WV3uNcif+ nSUQgNnGA+NqgcYmzMwPIWFBfZEMVAuTiePdGTf6QXfgP4Sffe1JEeTcJPSEFqJK+OyH syFggZLnTnoWFCeMmKKpZsAJeC6uO/CBhywHsw3+ll5SKqD2jXk5SQEGDcbI7uHL70LZ CWIkOvNIUOsatANmYiEF48gg12m0TKzKID+B71nvgTqQWQdLHSXxftiLNPEw6M4Njrec Vz6Mp0nHTtYhCsq20xOF5vQDygRCffz5RTqYPIesF3wn4uA7tx5DM0RWQ2hUdM/iO8xe G8zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kuTG3WPQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p11si17951572plk.67.2019.07.24.23.03.39; Wed, 24 Jul 2019 23:03:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=kuTG3WPQ; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2391374AbfGYFp4 (ORCPT + 99 others); Thu, 25 Jul 2019 01:45:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:33376 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387470AbfGYFpy (ORCPT ); Thu, 25 Jul 2019 01:45:54 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.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 4165521850; Thu, 25 Jul 2019 05:45:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1564033553; bh=J7andB2/FvMjqKSofEQTJjA8xw4+etPlg/dUUrjmMiY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kuTG3WPQqYGD7QketuVug8lngHVSELygDjUKbpepj+NTLo1VCGbOwtSNU8Tkr+B2d 08eUPQKrxYh7PIQjufuxNFtaBb8d6+tsb9AGtNIGEk90ZibmTxVeRdYYfSLkNBlGs3 RLoVkCY6d8YIKhRq1JL/BAQ2gJYTl8kICEue4rsk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, "Darrick J. Wong" , Christoph Hellwig , Dave Chinner , Amir Goldstein , Luis Chamberlain , Sasha Levin Subject: [PATCH 4.19 247/271] xfs: reserve blocks for ifree transaction during log recovery Date: Wed, 24 Jul 2019 21:21:56 +0200 Message-Id: <20190724191716.361251878@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190724191655.268628197@linuxfoundation.org> References: <20190724191655.268628197@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 15a268d9f263ed3a0601a1296568241a5a3da7aa upstream. Log recovery frees all the inodes stored in the unlinked list, which can cause expansion of the free inode btree. The ifree code skips block reservations if it thinks there's a per-AG space reservation, but we don't set up the reservation until after log recovery, which means that a finobt expansion blows up in xfs_trans_mod_sb when we exceed the transaction's block reservation. To fix this, we set the "no finobt reservation" flag to true when we create the xfs_mount and only set it to false if we confirm that every AG had enough free space to put aside for the finobt. Signed-off-by: Darrick J. Wong Reviewed-by: Christoph Hellwig Reviewed-by: Dave Chinner Suggested-by: Amir Goldstein Reviewed-by: Amir Goldstein Signed-off-by: Luis Chamberlain Signed-off-by: Sasha Levin --- fs/xfs/xfs_fsops.c | 1 + fs/xfs/xfs_super.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/fs/xfs/xfs_fsops.c b/fs/xfs/xfs_fsops.c index 7c00b8bedfe3..09fd602507ef 100644 --- a/fs/xfs/xfs_fsops.c +++ b/fs/xfs/xfs_fsops.c @@ -534,6 +534,7 @@ xfs_fs_reserve_ag_blocks( int error = 0; int err2; + mp->m_finobt_nores = false; for (agno = 0; agno < mp->m_sb.sb_agcount; agno++) { pag = xfs_perag_get(mp, agno); err2 = xfs_ag_resv_init(pag, NULL); diff --git a/fs/xfs/xfs_super.c b/fs/xfs/xfs_super.c index 207ee302b1bb..dce8114e3198 100644 --- a/fs/xfs/xfs_super.c +++ b/fs/xfs/xfs_super.c @@ -1561,6 +1561,13 @@ xfs_mount_alloc( INIT_DELAYED_WORK(&mp->m_eofblocks_work, xfs_eofblocks_worker); INIT_DELAYED_WORK(&mp->m_cowblocks_work, xfs_cowblocks_worker); mp->m_kobj.kobject.kset = xfs_kset; + /* + * We don't create the finobt per-ag space reservation until after log + * recovery, so we must set this to true so that an ifree transaction + * started during log recovery will not depend on space reservations + * for finobt expansion. + */ + mp->m_finobt_nores = true; return mp; } -- 2.20.1