mirror of
https://github.com/minio/minio.git
synced 2025-03-30 17:23:42 -04:00
Don't send a canceled context to Unlock (#20409)
AFAICT we send a canceled context to unlock (and thereby releaseAll). This will cause network calls to fail. Instead use background and add 30s timeout.
This commit is contained in:
parent
fb24bcfee0
commit
b1c849bedc
@ -185,7 +185,7 @@ func (di *distLockInstance) Unlock(lc LockContext) {
|
|||||||
if lc.cancel != nil {
|
if lc.cancel != nil {
|
||||||
lc.cancel()
|
lc.cancel()
|
||||||
}
|
}
|
||||||
di.rwMutex.Unlock(lc.ctx)
|
di.rwMutex.Unlock(context.Background())
|
||||||
}
|
}
|
||||||
|
|
||||||
// RLock - block until read lock is taken or timeout has occurred.
|
// RLock - block until read lock is taken or timeout has occurred.
|
||||||
|
@ -643,6 +643,8 @@ func (dm *DRWMutex) Unlock(ctx context.Context) {
|
|||||||
// Do async unlocking.
|
// Do async unlocking.
|
||||||
// This means unlock will no longer block on the network or missing quorum.
|
// This means unlock will no longer block on the network or missing quorum.
|
||||||
go func() {
|
go func() {
|
||||||
|
ctx, done := context.WithTimeout(ctx, drwMutexUnlockCallTimeout)
|
||||||
|
defer done()
|
||||||
for !releaseAll(ctx, dm.clnt, tolerance, owner, &locks, isReadLock, restClnts, dm.Names...) {
|
for !releaseAll(ctx, dm.clnt, tolerance, owner, &locks, isReadLock, restClnts, dm.Names...) {
|
||||||
time.Sleep(time.Duration(dm.rng.Float64() * float64(dm.lockRetryMinInterval)))
|
time.Sleep(time.Duration(dm.rng.Float64() * float64(dm.lockRetryMinInterval)))
|
||||||
if time.Since(started) > dm.clnt.Timeouts.UnlockCall {
|
if time.Since(started) > dm.clnt.Timeouts.UnlockCall {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user