Commit 96b0ad3
lease: fix Renew/Revoke race by closing revokec eagerly (Issue 14758)
Close revokec at the start of Revoke() (while holding le.mu) instead
of deferring it to function exit. This signals "revocation has started"
before keys are deleted.
In Renew(), add a non-blocking check on revokec after re-acquiring
le.mu and confirming the lease exists in leaseMap. If revokec is
closed, Renew returns ErrLeaseNotFound instead of refreshing the lease.
Both operations happen under le.mu, so they are properly ordered: once
Revoke closes revokec, any concurrent Renew will see it and refuse to
refresh.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: Yishuai Li <yishuai.li@pingcap.com>1 parent b76056d commit 96b0ad3
1 file changed
+12
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
332 | 332 | | |
333 | 333 | | |
334 | 334 | | |
335 | | - | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
336 | 339 | | |
337 | 340 | | |
338 | 341 | | |
| |||
448 | 451 | | |
449 | 452 | | |
450 | 453 | | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
451 | 462 | | |
452 | 463 | | |
453 | 464 | | |
| |||
0 commit comments