Commit c31b963
btrfs: zoned: fix lock ordering in btrfs_zone_activate()
The btrfs CI reported a lockdep warning as follows by running generic
generic/129.
WARNING: possible circular locking dependency detected
6.7.0-rc5+ #1 Not tainted
------------------------------------------------------
kworker/u5:5/793427 is trying to acquire lock:
ffff88813256d028 (&cache->lock){+.+.}-{2:2}, at: btrfs_zone_finish_one_bg+0x5e/0x130
but task is already holding lock:
ffff88810a23a318 (&fs_info->zone_active_bgs_lock){+.+.}-{2:2}, at: btrfs_zone_finish_one_bg+0x34/0x130
which lock already depends on the new lock.
the existing dependency chain (in reverse order) is:
-> #1 (&fs_info->zone_active_bgs_lock){+.+.}-{2:2}:
...
-> #0 (&cache->lock){+.+.}-{2:2}:
...
This is because we take fs_info->zone_active_bgs_lock after a block_group's
lock in btrfs_zone_activate() while doing the opposite in other places.
Fix the issue by expanding the fs_info->zone_active_bgs_lock's critical
section and taking it before a block_group's lock.
Fixes: a7e1ac7 ("btrfs: zoned: reserve zones for an active metadata/system block group")
CC: [email protected] # 6.6
Signed-off-by: Naohiro Aota <[email protected]>
Reviewed-by: David Sterba <[email protected]>
Signed-off-by: David Sterba <[email protected]>1 parent 690381c commit c31b963
1 file changed
+2
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2072 | 2072 | | |
2073 | 2073 | | |
2074 | 2074 | | |
| 2075 | + | |
2075 | 2076 | | |
2076 | 2077 | | |
2077 | 2078 | | |
| |||
2084 | 2085 | | |
2085 | 2086 | | |
2086 | 2087 | | |
2087 | | - | |
2088 | 2088 | | |
2089 | 2089 | | |
2090 | 2090 | | |
| |||
2104 | 2104 | | |
2105 | 2105 | | |
2106 | 2106 | | |
2107 | | - | |
2108 | 2107 | | |
2109 | 2108 | | |
2110 | 2109 | | |
2111 | 2110 | | |
2112 | 2111 | | |
2113 | 2112 | | |
2114 | | - | |
2115 | 2113 | | |
2116 | 2114 | | |
2117 | 2115 | | |
2118 | 2116 | | |
2119 | 2117 | | |
2120 | | - | |
2121 | 2118 | | |
2122 | 2119 | | |
2123 | 2120 | | |
2124 | 2121 | | |
2125 | 2122 | | |
2126 | 2123 | | |
2127 | 2124 | | |
2128 | | - | |
2129 | | - | |
2130 | 2125 | | |
2131 | 2126 | | |
2132 | 2127 | | |
2133 | 2128 | | |
2134 | 2129 | | |
2135 | 2130 | | |
2136 | 2131 | | |
| 2132 | + | |
2137 | 2133 | | |
2138 | 2134 | | |
2139 | 2135 | | |
| |||
0 commit comments