Patch "btrfs: dump extra info if one free space cache has more bitmaps than it should" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    btrfs: dump extra info if one free space cache has more bitmaps than it should

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     btrfs-dump-extra-info-if-one-free-space-cache-has-mo.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit e2536c83905ef62006039df009bba4aae0eb7d46
Author: Qu Wenruo <wqu@xxxxxxxx>
Date:   Mon Aug 1 09:35:57 2022 +0800

    btrfs: dump extra info if one free space cache has more bitmaps than it should
    
    [ 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@xxxxxxxxxx>
    Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
    Reviewed-by: David Sterba <dsterba@xxxxxxxx>
    Signed-off-by: David Sterba <dsterba@xxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index da0eee7c9e5f..529907ea3825 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -672,6 +672,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);
 
 	/*



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux