]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
btrfs: change BUG_ON to assertion in reset_balance_state()
authorDavid Sterba <dsterba@suse.com>
Wed, 24 Jan 2024 16:23:11 +0000 (17:23 +0100)
committerDavid Sterba <dsterba@suse.com>
Mon, 4 Mar 2024 15:24:48 +0000 (16:24 +0100)
The balance state machine is complex so it's good to verify the
assumptions in helpers, however reset_balance_state() is used
at the end of balance and fs_info::balance_ctl is properly set up before
and protected by the exclusive op ownership in btrfs_balance().

Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Anand Jain <anand.jain@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c

index 56b0b167e3867b5c51fb00744820613076733397..4ad9eca9b46c4ac8ea161bb14801ade2c1b229da 100644 (file)
@@ -3632,7 +3632,7 @@ static void reset_balance_state(struct btrfs_fs_info *fs_info)
        struct btrfs_balance_control *bctl = fs_info->balance_ctl;
        int ret;
 
-       BUG_ON(!fs_info->balance_ctl);
+       ASSERT(fs_info->balance_ctl);
 
        spin_lock(&fs_info->balance_lock);
        fs_info->balance_ctl = NULL;