Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

Fix P1: Config Persistence transaction field synchronization

rcourtman431769024fc3
diff --git a/internal/config/persistence.go b/internal/config/persistence.go
index 5b407211cf..7097626987 100644
--- a/internal/config/persistence.go
+++ b/internal/config/persistence.go
@@ -105,9 +105,15 @@ func (c *ConfigPersistence) endTransaction(tx *importTransaction) {
c.mu.Unlock()
}
+// writeConfigFileLocked writes a config file, staging it in a transaction if one is active.
+// NOTE: Caller MUST hold c.mu lock (despite reading c.tx, which has separate synchronization)
func (c *ConfigPersistence) writeConfigFileLocked(path string, data []byte, perm os.FileMode) error {
- if c.tx != nil {
- return c.tx.StageFile(path, data, perm)
+ // Read transaction pointer - safe because caller holds c.mu
+ // Transaction field is only modified while holding c.mu in begin/endTransaction
+ tx := c.tx
+
+ if tx != nil {
+ return tx.StageFile(path, data, perm)
}
tmp := path + ".tmp"