diff --git a/cmd/erasure-server-pool-rebalance.go b/cmd/erasure-server-pool-rebalance.go index d4f57b008..c23c10d83 100644 --- a/cmd/erasure-server-pool-rebalance.go +++ b/cmd/erasure-server-pool-rebalance.go @@ -353,6 +353,7 @@ func (z *erasureServerPools) rebalanceBuckets(ctx context.Context, poolIdx int) z.rebalMu.Lock() z.rebalMeta.PoolStats[poolIdx].Info.Status = rebalStopped z.rebalMeta.PoolStats[poolIdx].Info.EndTime = now + z.rebalMeta.cancel = nil // remove the already used context.CancelFunc z.rebalMu.Unlock() rebalDone = true diff --git a/cmd/notification.go b/cmd/notification.go index 93db127ba..8be8557f5 100644 --- a/cmd/notification.go +++ b/cmd/notification.go @@ -649,6 +649,15 @@ func (sys *NotificationSys) StopRebalance(ctx context.Context) { logger.LogIf(logger.SetReqInfo(ctx, reqInfo), nErr.Err) } } + + objAPI := newObjectLayerFn() + if objAPI == nil { + logger.LogIf(ctx, errServerNotInitialized) + return + } + if pools, ok := objAPI.(*erasureServerPools); ok { + pools.StopRebalance() + } } // LoadRebalanceMeta notifies all peers to load rebalance.bin from object layer.