Commit 0ec299e
Fix node drain deadlock when device plugin holds kernel module
When draining a node running a KMM kernel module with an associated device
plugin, a race condition between the Module reconciler and NMC reconciler
can cause a deadlock:
1. Module reconciler removes the module from NMC spec (node unschedulable)
2. NMC reconciler creates an unloader pod (orphan status path)
3. The kmm-ready label stays on the node (removeOrphanedLabels requires
both spec AND status to be absent, but status persists until unload
succeeds)
4. Device plugin DaemonSet pod stays running (nodeSelector still matches
and DaemonSet pods tolerate the unschedulable taint)
5. Unloader's modprobe -r fails indefinitely (device file held open)
Fix: after processing orphan statuses, check if the node is unschedulable
for each orphan module. If so, add the kmm-ready labels to the removal set.
This ensures the device plugin pod is evicted, releasing the device file so
the unloader can succeed.
This fix was written by bug buddy - ai workflow
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent 9d626f4 commit 0ec299e
2 files changed
Lines changed: 84 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
144 | 157 | | |
145 | 158 | | |
146 | 159 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
236 | 236 | | |
237 | 237 | | |
238 | 238 | | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 294 | + | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
239 | 308 | | |
240 | 309 | | |
241 | 310 | | |
| |||
304 | 373 | | |
305 | 374 | | |
306 | 375 | | |
| 376 | + | |
307 | 377 | | |
308 | 378 | | |
309 | 379 | | |
| |||
384 | 454 | | |
385 | 455 | | |
386 | 456 | | |
| 457 | + | |
387 | 458 | | |
388 | 459 | | |
389 | 460 | | |
| |||
0 commit comments