Message ID | 20240104142040.2835097-7-libaokun1@huawei.com |
---|---|
State | Awaiting Upstream |
Headers | show |
Series | ext4: fix divide error in mb_update_avg_fragment_size() | expand |
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c index 0c43d2eb6421..2cba94520961 100644 --- a/fs/ext4/mballoc.c +++ b/fs/ext4/mballoc.c @@ -2305,6 +2305,9 @@ void ext4_mb_try_best_found(struct ext4_allocation_context *ac, return; ext4_lock_group(ac->ac_sb, group); + if (unlikely(EXT4_MB_GRP_BBITMAP_CORRUPT(e4b->bd_info))) + goto out; + max = mb_find_extent(e4b, ex.fe_start, ex.fe_len, &ex); if (max > 0) { @@ -2312,6 +2315,7 @@ void ext4_mb_try_best_found(struct ext4_allocation_context *ac, ext4_mb_use_best_found(ac, e4b); } +out: ext4_unlock_group(ac->ac_sb, group); ext4_mb_unload_buddy(e4b); }