This is a note to let you know that I've just added the patch titled btrfs: defrag: change BUG_ON to assertion in btrfs_defrag_leaves() to the 6.6-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-defrag-change-bug_on-to-assertion-in-btrfs_def.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit aaad6fc81559acdb7845ba6eb415961987ad06e9 Author: David Sterba <dsterba@xxxxxxxx> Date: Fri Jan 19 20:15:41 2024 +0100 btrfs: defrag: change BUG_ON to assertion in btrfs_defrag_leaves() [ Upstream commit 51d4be540054be32d7ce28b63ea9b84ac6ff1db2 ] The BUG_ON verifies a condition that should be guaranteed by the correct use of the path search (with keep_locks and lowest_level set), an assertion is the suitable check. Reviewed-by: Josef Bacik <josef@xxxxxxxxxxxxxx> Reviewed-by: Anand Jain <anand.jain@xxxxxxxxxx> Signed-off-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/btrfs/defrag.c b/fs/btrfs/defrag.c index a2e614cf3c19c..e1475dfdf7a8b 100644 --- a/fs/btrfs/defrag.c +++ b/fs/btrfs/defrag.c @@ -416,7 +416,7 @@ int btrfs_defrag_leaves(struct btrfs_trans_handle *trans, * keep_locks set and lowest_level is 1, regardless of the value of * path->slots[1]. */ - BUG_ON(path->locks[1] == 0); + ASSERT(path->locks[1] != 0); ret = btrfs_realloc_node(trans, root, path->nodes[1], 0, &last_ret,