From 95ae6c4b493bee2865c1cfe7edfefa0eeb76c3d2 Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Thu, 20 Aug 2020 08:48:09 -0700 Subject: [PATCH] Fix missing unlock in *healSequence.hasEnded() (#10305) The background healing sequence would always hang when this function is called. --- cmd/admin-heal-ops.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/admin-heal-ops.go b/cmd/admin-heal-ops.go index ad9fc989f..091675c6a 100644 --- a/cmd/admin-heal-ops.go +++ b/cmd/admin-heal-ops.go @@ -502,13 +502,12 @@ func (h *healSequence) isQuitting() bool { // check if the heal sequence has ended func (h *healSequence) hasEnded() bool { h.mutex.RLock() + defer h.mutex.RUnlock() // background heal never ends if h.clientToken == bgHealingUUID { return false } - ended := len(h.currentStatus.Items) == 0 || h.currentStatus.Summary == healStoppedStatus || h.currentStatus.Summary == healFinishedStatus - h.mutex.RUnlock() - return ended + return len(h.currentStatus.Items) == 0 || h.currentStatus.Summary == healStoppedStatus || h.currentStatus.Summary == healFinishedStatus } // stops the heal sequence - safe to call multiple times.