hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/fs/btrfs/free-space-cache.c
....@@ -794,15 +794,16 @@
794794 }
795795 spin_lock(&ctl->tree_lock);
796796 ret = link_free_space(ctl, e);
797
- ctl->total_bitmaps++;
798
- ctl->op->recalc_thresholds(ctl);
799
- spin_unlock(&ctl->tree_lock);
800797 if (ret) {
798
+ spin_unlock(&ctl->tree_lock);
801799 btrfs_err(fs_info,
802800 "Duplicate entries in free space cache, dumping");
803801 kmem_cache_free(btrfs_free_space_cachep, e);
804802 goto free_cache;
805803 }
804
+ ctl->total_bitmaps++;
805
+ ctl->op->recalc_thresholds(ctl);
806
+ spin_unlock(&ctl->tree_lock);
806807 list_add_tail(&e->list, &bitmaps);
807808 }
808809