CRITICAL: Check ALL task states for volume conflicts

Fix major scheduling bug where only active tasks were checked for conflicts.

Changes:
- Check PENDING tasks: Prevent scheduling if task is queued for same volume
- Check ASSIGNED/ACTIVE tasks: Prevent scheduling if task is running on same volume
- Check RECENT tasks: Prevent immediate re-scheduling on same volume after completion

This prevents dangerous scenarios like:
 Scheduling vacuum while another vacuum is pending on same volume
 Scheduling balance while erasure coding is queued for same volume
 Immediately re-scheduling failed tasks without cooldown period

Critical safety improvement ensuring comprehensive volume-level task isolation.
This commit is contained in:
chrislu
2025-08-10 18:04:31 -07:00
parent 751cfac7d7
commit 72f0a47563

View File

@@ -84,13 +84,28 @@ func (at *ActiveTopology) isDiskAvailableForVolume(disk *activeDisk, taskType Ta
return false
}
// Check for volume-specific conflicts
// Check for volume-specific conflicts in ALL task states:
// 1. Pending tasks (queued but not yet started)
for _, task := range disk.pendingTasks {
if at.areTasksConflicting(task, taskType, volumeID) {
return false
}
}
// 2. Assigned/Active tasks (currently running)
for _, task := range disk.assignedTasks {
if at.areTasksConflicting(task, taskType, volumeID) {
return false
}
}
// 3. Recent tasks (just completed - avoid immediate re-scheduling on same volume)
for _, task := range disk.recentTasks {
if at.areTasksConflicting(task, taskType, volumeID) {
return false
}
}
return true
}