Commit 6710943
committed
fix 3243
Prevent IOBuf TLS block-pool corruption on duplicate returns
Returning a block that is already cached in TLS can create a portal_next cycle
or drop a reference still owned by the pool when the per-thread cache hits its
limit. That corrupts the free list and can hang later traversals such as
share_tls_block() and remove_tls_block_chain().
Check the whole TLS chain before reinserting single blocks or chains, stop at
the first overlap while preserving any unique prefix, and skip dec_ref() for
blocks that are already owned by TLS on the threshold path. Add regression
tests for head/non-head duplicate returns, partial overlap, and the
IOBufAsZeroCopyOutputStream::BackUp() reproduction path.
Fixes #3243.1 parent d5dab28 commit 6710943
3 files changed
Lines changed: 382 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
| 326 | + | |
327 | 327 | | |
328 | 328 | | |
329 | | - | |
330 | 329 | | |
331 | | - | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
332 | 336 | | |
333 | 337 | | |
334 | | - | |
| 338 | + | |
| 339 | + | |
335 | 340 | | |
336 | 341 | | |
337 | 342 | | |
338 | 343 | | |
| 344 | + | |
339 | 345 | | |
340 | | - | |
341 | 346 | | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
342 | 356 | | |
343 | | - | |
344 | 357 | | |
345 | 358 | | |
346 | 359 | | |
347 | 360 | | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
348 | 364 | | |
349 | 365 | | |
350 | | - | |
| 366 | + | |
351 | 367 | | |
352 | 368 | | |
353 | 369 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
603 | 603 | | |
604 | 604 | | |
605 | 605 | | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
606 | 615 | | |
607 | 616 | | |
608 | 617 | | |
609 | 618 | | |
610 | 619 | | |
611 | 620 | | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
612 | 628 | | |
613 | 629 | | |
614 | 630 | | |
| |||
0 commit comments