diff --git a/cmd/namespace-lock.go b/cmd/namespace-lock.go index 35235a457..a0f510a37 100644 --- a/cmd/namespace-lock.go +++ b/cmd/namespace-lock.go @@ -185,7 +185,7 @@ func (di *distLockInstance) Unlock(lc LockContext) { if lc.cancel != nil { lc.cancel() } - di.rwMutex.Unlock(lc.ctx) + di.rwMutex.Unlock(context.Background()) } // RLock - block until read lock is taken or timeout has occurred. diff --git a/internal/dsync/drwmutex.go b/internal/dsync/drwmutex.go index 0bfff1710..b682e0a45 100644 --- a/internal/dsync/drwmutex.go +++ b/internal/dsync/drwmutex.go @@ -643,6 +643,8 @@ func (dm *DRWMutex) Unlock(ctx context.Context) { // Do async unlocking. // This means unlock will no longer block on the network or missing quorum. go func() { + ctx, done := context.WithTimeout(ctx, drwMutexUnlockCallTimeout) + defer done() for !releaseAll(ctx, dm.clnt, tolerance, owner, &locks, isReadLock, restClnts, dm.Names...) { time.Sleep(time.Duration(dm.rng.Float64() * float64(dm.lockRetryMinInterval))) if time.Since(started) > dm.clnt.Timeouts.UnlockCall {