Commit e74540b
ocfs2: protect extent tree in ocfs2_prepare_inode_for_write()
When the extent tree is modified, it should be protected by inode
cluster lock and ip_alloc_sem.
The extent tree is accessed and modified in the
ocfs2_prepare_inode_for_write, but isn't protected by ip_alloc_sem.
The following is a case. The function ocfs2_fiemap is accessing the
extent tree, which is modified at the same time.
kernel BUG at fs/ocfs2/extent_map.c:475!
invalid opcode: 0000 [#1] SMP
Modules linked in: tun ocfs2 ocfs2_nodemanager configfs ocfs2_stackglue [...]
CPU: 16 PID: 14047 Comm: o2info Not tainted 4.1.12-124.23.1.el6uek.x86_64 #2
Hardware name: Oracle Corporation ORACLE SERVER X7-2L/ASM, MB MECH, X7-2L, BIOS 42040600 10/19/2018
task: ffff88019487e200 ti: ffff88003daa4000 task.ti: ffff88003daa4000
RIP: ocfs2_get_clusters_nocache.isra.11+0x390/0x550 [ocfs2]
Call Trace:
ocfs2_fiemap+0x1e3/0x430 [ocfs2]
do_vfs_ioctl+0x155/0x510
SyS_ioctl+0x81/0xa0
system_call_fastpath+0x18/0xd8
Code: 18 48 c7 c6 60 7f 65 a0 31 c0 bb e2 ff ff ff 48 8b 4a 40 48 8b 7a 28 48 c7 c2 78 2d 66 a0 e8 38 4f 05 00 e9 28 fe ff ff 0f 1f 00 <0f> 0b 66 0f 1f 44 00 00 bb 86 ff ff ff e9 13 fe ff ff 66 0f 1f
RIP ocfs2_get_clusters_nocache.isra.11+0x390/0x550 [ocfs2]
---[ end trace c8aa0c8180e869dc ]---
Kernel panic - not syncing: Fatal exception
Kernel Offset: disabled
This issue can be reproduced every week in a production environment.
This issue is related to the usage mode. If others use ocfs2 in this
mode, the kernel will panic frequently.
[[email protected]: coding style fixes]
[Fix new warning due to unused function by removing said function - Linus ]
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Shuning Zhang <[email protected]>
Reviewed-by: Junxiao Bi <[email protected]>
Reviewed-by: Gang He <[email protected]>
Cc: Mark Fasheh <[email protected]>
Cc: Joel Becker <[email protected]>
Cc: Joseph Qi <[email protected]>
Cc: Changwei Ge <[email protected]>
Cc: Jun Piao <[email protected]>
Cc: <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>1 parent 169226f commit e74540b
1 file changed
+90
-44
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2098 | 2098 | | |
2099 | 2099 | | |
2100 | 2100 | | |
2101 | | - | |
2102 | | - | |
2103 | | - | |
2104 | | - | |
| 2101 | + | |
| 2102 | + | |
| 2103 | + | |
| 2104 | + | |
| 2105 | + | |
| 2106 | + | |
2105 | 2107 | | |
2106 | | - | |
2107 | | - | |
2108 | | - | |
2109 | | - | |
2110 | | - | |
| 2108 | + | |
2111 | 2109 | | |
2112 | | - | |
2113 | | - | |
2114 | | - | |
| 2110 | + | |
| 2111 | + | |
| 2112 | + | |
| 2113 | + | |
| 2114 | + | |
| 2115 | + | |
2115 | 2116 | | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
| 2122 | + | |
| 2123 | + | |
| 2124 | + | |
| 2125 | + | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
| 2131 | + | |
| 2132 | + | |
2116 | 2133 | | |
2117 | 2134 | | |
2118 | | - | |
| 2135 | + | |
2119 | 2136 | | |
2120 | | - | |
2121 | | - | |
2122 | | - | |
| 2137 | + | |
| 2138 | + | |
| 2139 | + | |
2123 | 2140 | | |
2124 | | - | |
2125 | 2141 | | |
2126 | 2142 | | |
2127 | 2143 | | |
| 2144 | + | |
| 2145 | + | |
| 2146 | + | |
| 2147 | + | |
| 2148 | + | |
| 2149 | + | |
| 2150 | + | |
| 2151 | + | |
| 2152 | + | |
| 2153 | + | |
| 2154 | + | |
| 2155 | + | |
| 2156 | + | |
| 2157 | + | |
| 2158 | + | |
| 2159 | + | |
| 2160 | + | |
2128 | 2161 | | |
2129 | 2162 | | |
2130 | 2163 | | |
2131 | 2164 | | |
| 2165 | + | |
2132 | 2166 | | |
2133 | 2167 | | |
2134 | 2168 | | |
| 2169 | + | |
| 2170 | + | |
2135 | 2171 | | |
2136 | 2172 | | |
2137 | 2173 | | |
2138 | 2174 | | |
2139 | 2175 | | |
2140 | 2176 | | |
2141 | | - | |
2142 | | - | |
2143 | | - | |
2144 | | - | |
2145 | | - | |
| 2177 | + | |
| 2178 | + | |
| 2179 | + | |
| 2180 | + | |
| 2181 | + | |
| 2182 | + | |
2146 | 2183 | | |
2147 | | - | |
2148 | 2184 | | |
2149 | 2185 | | |
2150 | 2186 | | |
| |||
2156 | 2192 | | |
2157 | 2193 | | |
2158 | 2194 | | |
2159 | | - | |
2160 | | - | |
2161 | | - | |
2162 | | - | |
2163 | 2195 | | |
2164 | 2196 | | |
2165 | | - | |
2166 | | - | |
2167 | | - | |
2168 | 2197 | | |
2169 | 2198 | | |
2170 | 2199 | | |
| |||
2183 | 2212 | | |
2184 | 2213 | | |
2185 | 2214 | | |
2186 | | - | |
| 2215 | + | |
| 2216 | + | |
| 2217 | + | |
| 2218 | + | |
2187 | 2219 | | |
2188 | 2220 | | |
2189 | 2221 | | |
| |||
2197 | 2229 | | |
2198 | 2230 | | |
2199 | 2231 | | |
2200 | | - | |
2201 | | - | |
2202 | | - | |
2203 | | - | |
2204 | | - | |
2205 | | - | |
2206 | | - | |
2207 | | - | |
| 2232 | + | |
| 2233 | + | |
| 2234 | + | |
| 2235 | + | |
| 2236 | + | |
| 2237 | + | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
| 2242 | + | |
| 2243 | + | |
| 2244 | + | |
| 2245 | + | |
| 2246 | + | |
| 2247 | + | |
| 2248 | + | |
| 2249 | + | |
| 2250 | + | |
| 2251 | + | |
| 2252 | + | |
2208 | 2253 | | |
2209 | 2254 | | |
2210 | 2255 | | |
2211 | | - | |
| 2256 | + | |
| 2257 | + | |
2212 | 2258 | | |
2213 | 2259 | | |
2214 | 2260 | | |
| |||
2219 | 2265 | | |
2220 | 2266 | | |
2221 | 2267 | | |
2222 | | - | |
2223 | | - | |
2224 | | - | |
2225 | | - | |
| 2268 | + | |
| 2269 | + | |
| 2270 | + | |
| 2271 | + | |
2226 | 2272 | | |
2227 | 2273 | | |
2228 | 2274 | | |
| |||
0 commit comments