Commit 22ecd6a
authored
don't complete a writer acquire on a peer's reclaimed marker (#571)
the writer acquire is two-phase, and in phase 2 (waiting for readers to
drain) it refreshes the .write marker on every scan. if the writer is
paused longer than stale_threshold a peer can evict that now-stale
marker and reclaim the slot with its own token, but phase 2 carried on
touching whatever sat at the path and reported success once the readers
had gone, so the original writer would finish its acquire on top of the
peer's live marker and two writers could end up believing they hold the
exclusive lock at the same time. this re-checks that the marker still
carries our token before refreshing it, the same identity check the
heartbeat refresh and the release path already rely on, and re-claims
the slot (waiting behind the peer when it currently holds .write)
instead of trusting a foreign marker. the regression test drives the
eviction mid phase-2 and asserts the acquire no longer completes on a
stranger's marker.1 parent 70ecdb2 commit 22ecd6a
2 files changed
Lines changed: 80 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
400 | 434 | | |
401 | 435 | | |
402 | 436 | | |
| |||
524 | 558 | | |
525 | 559 | | |
526 | 560 | | |
527 | | - | |
528 | | - | |
529 | | - | |
530 | | - | |
531 | | - | |
532 | | - | |
533 | | - | |
534 | | - | |
| 561 | + | |
535 | 562 | | |
536 | 563 | | |
537 | 564 | | |
538 | | - | |
539 | | - | |
540 | | - | |
541 | | - | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
542 | 576 | | |
543 | 577 | | |
544 | 578 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
625 | 625 | | |
626 | 626 | | |
627 | 627 | | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
628 | 662 | | |
629 | 663 | | |
630 | 664 | | |
| |||
0 commit comments