Commit 7b9aa31
btrfs: zoned: properly take lock to read/update block group's zoned variables
__btrfs_add_free_space_zoned() references and modifies bg's alloc_offset,
ro, and zone_unusable, but without taking the lock. It is mostly safe
because they monotonically increase (at least for now) and this function is
mostly called by a transaction commit, which is serialized by itself.
Still, taking the lock is a safer and correct option and I'm going to add a
change to reset zone_unusable while a block group is still alive. So, add
locking around the operations.
Fixes: 169e0da ("btrfs: zoned: track unusable bytes for zones")
CC: [email protected] # 5.15+
Reviewed-by: Johannes Thumshirn <[email protected]>
Signed-off-by: Naohiro Aota <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>1 parent d30b326 commit 7b9aa31
1 file changed
+8
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2697 | 2697 | | |
2698 | 2698 | | |
2699 | 2699 | | |
2700 | | - | |
| 2700 | + | |
2701 | 2701 | | |
2702 | 2702 | | |
2703 | | - | |
| 2703 | + | |
2704 | 2704 | | |
| 2705 | + | |
| 2706 | + | |
2705 | 2707 | | |
2706 | 2708 | | |
2707 | 2709 | | |
2708 | | - | |
2709 | 2710 | | |
2710 | 2711 | | |
2711 | 2712 | | |
| |||
2718 | 2719 | | |
2719 | 2720 | | |
2720 | 2721 | | |
| 2722 | + | |
2721 | 2723 | | |
| 2724 | + | |
2722 | 2725 | | |
2723 | 2726 | | |
2724 | 2727 | | |
| |||
2727 | 2730 | | |
2728 | 2731 | | |
2729 | 2732 | | |
2730 | | - | |
2731 | 2733 | | |
2732 | | - | |
2733 | 2734 | | |
2734 | | - | |
2735 | 2735 | | |
2736 | 2736 | | |
2737 | 2737 | | |
| |||
2745 | 2745 | | |
2746 | 2746 | | |
2747 | 2747 | | |
| 2748 | + | |
| 2749 | + | |
2748 | 2750 | | |
2749 | 2751 | | |
2750 | 2752 | | |
| |||
0 commit comments