From 7db05a80ddf1fee1281d91453180a56254e45787 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Wed, 26 Jan 2022 08:34:09 -0800 Subject: [PATCH] locking: Fix wrong map id (#14184) Wrong resource is being fetched, since idx is incremented, but mapID is reused. Regression caused by #13454 - that part didn't optimize anything anyway. --- cmd/local-locker.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/local-locker.go b/cmd/local-locker.go index 21df92ef4..f25df8976 100644 --- a/cmd/local-locker.go +++ b/cmd/local-locker.go @@ -322,11 +322,10 @@ func (l *localLocker) Refresh(ctx context.Context, args dsync.LockArgs) (refresh } idx := 0 for { - mapID := formatUUID(args.UID, idx) lris, ok := l.lockMap[resource] if !ok { // Inconsistent. Delete UID. - delete(l.lockUID, mapID) + delete(l.lockUID, formatUUID(args.UID, idx)) return idx > 0, nil } for i := range lris { @@ -335,7 +334,7 @@ func (l *localLocker) Refresh(ctx context.Context, args dsync.LockArgs) (refresh } } idx++ - resource, ok = l.lockUID[mapID] + resource, ok = l.lockUID[formatUUID(args.UID, idx)] if !ok { // No more resources for UID, but we did update at least one. return true, nil