stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Qu Wenruo <wqu@suse.com>, Anand Jain <anand.jain@oracle.com>,
	David Sterba <dsterba@suse.com>, Sasha Levin <sashal@kernel.org>,
	clm@fb.com, josef@toxicpanda.com, linux-btrfs@vger.kernel.org
Subject: [PATCH AUTOSEL 5.19 23/40] btrfs: dump extra info if one free space cache has more bitmaps than it should
Date: Tue, 11 Oct 2022 10:51:12 -0400	[thread overview]
Message-ID: <20221011145129.1623487-23-sashal@kernel.org> (raw)
In-Reply-To: <20221011145129.1623487-1-sashal@kernel.org>

From: Qu Wenruo <wqu@suse.com>

[ Upstream commit 62cd9d4474282a1eb84f945955c56cbfc42e1ffe ]

There is an internal report on hitting the following ASSERT() in
recalculate_thresholds():

 	ASSERT(ctl->total_bitmaps <= max_bitmaps);

Above @max_bitmaps is calculated using the following variables:

- bytes_per_bg
  8 * 4096 * 4096 (128M) for x86_64/x86.

- block_group->length
  The length of the block group.

@max_bitmaps is the rounded up value of block_group->length / 128M.

Normally one free space cache should not have more bitmaps than above
value, but when it happens the ASSERT() can be triggered if
CONFIG_BTRFS_ASSERT is also enabled.

But the ASSERT() itself won't provide enough info to know which is going
wrong.
Is the bg too small thus it only allows one bitmap?
Or is there something else wrong?

So although I haven't found extra reports or crash dump to do further
investigation, add the extra info to make it more helpful to debug.

Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 fs/btrfs/free-space-cache.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index b1ae3ba2ca2c..16710d4571da 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -693,6 +693,12 @@ static void recalculate_thresholds(struct btrfs_free_space_ctl *ctl)
 
 	max_bitmaps = max_t(u64, max_bitmaps, 1);
 
+	if (ctl->total_bitmaps > max_bitmaps)
+		btrfs_err(block_group->fs_info,
+"invalid free space control: bg start=%llu len=%llu total_bitmaps=%u unit=%u max_bitmaps=%llu bytes_per_bg=%llu",
+			  block_group->start, block_group->length,
+			  ctl->total_bitmaps, ctl->unit, max_bitmaps,
+			  bytes_per_bg);
 	ASSERT(ctl->total_bitmaps <= max_bitmaps);
 
 	/*
-- 
2.35.1


  parent reply	other threads:[~2022-10-11 14:57 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-11 14:50 [PATCH AUTOSEL 5.19 01/40] arm64: dts: qcom: sdm845: narrow LLCC address space Sasha Levin
2022-10-11 14:50 ` [PATCH AUTOSEL 5.19 02/40] ARM: dts: imx6: delete interrupts property if interrupts-extended is set Sasha Levin
2022-10-11 14:50 ` [PATCH AUTOSEL 5.19 03/40] ARM: dts: imx7d-sdb: config the max pressure for tsc2046 Sasha Levin
2022-10-11 14:50 ` [PATCH AUTOSEL 5.19 04/40] soc: mediatek: Let PMIC Wrapper and SCPSYS depend on OF Sasha Levin
2022-10-11 14:50 ` [PATCH AUTOSEL 5.19 05/40] arm64: dts: qcom: sc7280-idp: correct ADC channel node name and unit address Sasha Levin
2022-10-11 14:50 ` [PATCH AUTOSEL 5.19 06/40] ARM: dts: imx6q: add missing properties for sram Sasha Levin
2022-10-11 14:50 ` [PATCH AUTOSEL 5.19 07/40] ARM: dts: imx6dl: " Sasha Levin
2022-10-11 14:50 ` [PATCH AUTOSEL 5.19 08/40] ARM: dts: imx6qp: " Sasha Levin
2022-10-11 14:50 ` [PATCH AUTOSEL 5.19 09/40] ARM: dts: imx6sl: " Sasha Levin
2022-10-11 14:50 ` [PATCH AUTOSEL 5.19 10/40] ARM: dts: imx6sll: " Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 11/40] ARM: dts: imx6sx: " Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 12/40] ARM: dts: imx6sl: use tabs for code indent Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 13/40] ARM: dts: imx6sx-udoo-neo: don't use multiple blank lines Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 14/40] kselftest/arm64: Fix validatation termination record after EXTRA_CONTEXT Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 15/40] kselftest/arm64: Allow larger buffers in get_signal_context() Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 16/40] sparc: Fix the generic IO helpers Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 17/40] arm64: atomics: remove LL/SC trampolines Sasha Levin
2022-10-12  8:53   ` Catalin Marinas
2022-10-13 17:57     ` Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 18/40] arm64: run softirqs on the per-CPU IRQ stack Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 19/40] arm64: dts: imx8mm-kontron: Use the VSELECT signal to switch SD card IO voltage Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 20/40] arm64: dts: imx8ulp: no executable source file permission Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 21/40] arm64: dts: imx8mq-librem5: Add bq25895 as max17055's power supply Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 22/40] ARM: orion: fix include path Sasha Levin
2022-10-11 14:51 ` Sasha Levin [this message]
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 24/40] btrfs: add macros for annotating wait events with lockdep Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 25/40] btrfs: change the lockdep class of free space inode's invalidate_lock Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 26/40] btrfs: scrub: properly report super block errors in system log Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 27/40] btrfs: scrub: try to fix super block errors Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 28/40] btrfs: get rid of block group caching progress logic Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 29/40] btrfs: don't print information about space cache or tree every remount Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 30/40] btrfs: call __btrfs_remove_free_space_cache_locked on cache load failure Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 31/40] btrfs: check superblock to ensure the fs was not modified at thaw time Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 32/40] btrfs: remove the unnecessary result variables Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 33/40] btrfs: introduce BTRFS_QGROUP_RUNTIME_FLAG_CANCEL_RESCAN Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 34/40] btrfs: add KCSAN annotations for unlocked access to block_rsv->full Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 35/40] btrfs: separate out the eb and extent state leak helpers Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 36/40] arm64: dts: uniphier: Add USB-device support for PXs3 reference board Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 37/40] ARM: 9233/1: stacktrace: Skip frame pointer boundary check for call_with_stack() Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 38/40] ARM: 9234/1: stacktrace: Avoid duplicate saving of exception PC value Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 39/40] ARM: 9242/1: kasan: Only map modules if CONFIG_KASAN_VMALLOC=n Sasha Levin
2022-10-11 14:51 ` [PATCH AUTOSEL 5.19 40/40] selftests/cpu-hotplug: Use return instead of exit Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221011145129.1623487-23-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=anand.jain@oracle.com \
    --cc=clm@fb.com \
    --cc=dsterba@suse.com \
    --cc=josef@toxicpanda.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=wqu@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).