diff --git a/src/opnsense/mvc/app/library/OPNsense/Core/Config.php b/src/opnsense/mvc/app/library/OPNsense/Core/Config.php index 1f89fa1c9..30b4bfcd1 100644 --- a/src/opnsense/mvc/app/library/OPNsense/Core/Config.php +++ b/src/opnsense/mvc/app/library/OPNsense/Core/Config.php @@ -414,7 +414,6 @@ class Config extends Singleton { $this->simplexml = null; $this->statusIsValid = false; - // exception handling if (!file_exists($this->config_file)) { throw new ConfigException('file not found'); @@ -781,16 +780,17 @@ class Config extends Singleton /** * lock configuration - * @param boolean $reload reload config from open file handle to enforce synchronicity + * @param boolean $reload reload config from open file handle to enforce synchronicity, when not already locked */ public function lock($reload = true) { if ($this->config_file_handle !== null) { flock($this->config_file_handle, LOCK_EX); - $this->statusIsLocked = true; - if ($reload) { + if ($reload && !$this->statusIsLocked) { + /* Only lock when the exclusive lock wasn't ours yet. */ $this->load(); } + $this->statusIsLocked = true; } return $this; }