diff --git a/nomad/blocked_evals.go b/nomad/blocked_evals.go
index <HASH>..<HASH> 100644
--- a/nomad/blocked_evals.go
+++ b/nomad/blocked_evals.go
@@ -450,10 +450,10 @@ func (b *BlockedEvals) UnblockQuota(quota string, index uint64) {
 // be enqueued into the eval broker.
 func (b *BlockedEvals) UnblockClassAndQuota(class, quota string, index uint64) {
 	b.l.Lock()
-	defer b.l.Unlock()
 
 	// Do nothing if not enabled
 	if !b.enabled {
+		b.l.Unlock()
 		return
 	}
 
@@ -465,7 +465,12 @@ func (b *BlockedEvals) UnblockClassAndQuota(class, quota string, index uint64) {
 	}
 	b.unblockIndexes[class] = index
 
-	b.capacityChangeCh <- &capacityUpdate{
+	// Capture chan inside the lock to prevent a race with it getting reset
+	// in Flush.
+	ch := b.capacityChangeCh
+	b.l.Unlock()
+
+	ch <- &capacityUpdate{
 		computedClass: class,
 		quotaChange:   quota,
 		index:         index,
nomad: fix deadlock in UnblockClassAndQuota

Previous commit could introduce a deadlock if the capacityChangeCh was
full and the receiving side exited before freeing a slot for the sending
side could send. Flush would then block forever waiting to acquire the
lock just to throw the pending update away.

The race is around getting/setting the chan field, not chan operations,
so only lock around getting the chan field.