fix: RLock UID memory leak (#13607)

UID were misnamed in RLock, leading to memory buildup.

Regression in #13430
This commit is contained in:
Klaus Post
2021-11-08 07:35:50 -08:00
committed by GitHub
parent fe0df01448
commit 9afdbe3648
2 changed files with 241 additions and 2 deletions

View File

@@ -190,12 +190,12 @@ func (l *localLocker) RLock(ctx context.Context, args dsync.LockArgs) (reply boo
if reply = !isWriteLock(lri); reply {
// Unless there is a write lock
l.lockMap[resource] = append(l.lockMap[resource], lrInfo)
l.lockUID[args.UID] = formatUUID(resource, 0)
l.lockUID[formatUUID(args.UID, 0)] = resource
}
} else {
// No locks held on the given name, so claim (first) read lock
l.lockMap[resource] = []lockRequesterInfo{lrInfo}
l.lockUID[args.UID] = formatUUID(resource, 0)
l.lockUID[formatUUID(args.UID, 0)] = resource
reply = true
}
return reply, nil