summaryrefslogtreecommitdiffstats
path: root/etc/rc.openvpn
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2013-09-04 08:48:23 +0000
committerErmal <eri@pfsense.org>2013-09-04 08:48:23 +0000
commit8171a2c2de98c8f505e99ddfb4859058cdb32cba (patch)
tree7e48ccaf7a971ccc1ab8fb2f7a2e9511d510eaaa /etc/rc.openvpn
parentf33dcc5c79c54af7daf91a81cfdd7f489e8cb67c (diff)
downloadpfsense-8171a2c2de98c8f505e99ddfb4859058cdb32cba.zip
pfsense-8171a2c2de98c8f505e99ddfb4859058cdb32cba.tar.gz
Introduce two new functions to be used on locking.
- try_lock: used for trying to get an EXCLUSIVE lock for a specified timeout by default of 5 - unlock_force: which just releases any locks held on a specified lock Use this new functions on rc.openvpn to avoid spurious stale locks around.
Diffstat (limited to 'etc/rc.openvpn')
-rwxr-xr-xetc/rc.openvpn8
1 files changed, 7 insertions, 1 deletions
diff --git a/etc/rc.openvpn b/etc/rc.openvpn
index 4cabffe..f60ad56 100755
--- a/etc/rc.openvpn
+++ b/etc/rc.openvpn
@@ -80,7 +80,13 @@ if(is_array($config['openvpn']['openvpn-server']) || is_array($config['openvpn']
} else
return;
-$openvpnlck = lock('openvpn', LOCK_EX);
+$openvpnlck = try_lock('openvpn', 10);
+if (!$openvpnlck) {
+ log_error(gettext("Could not obtain openvpn lock for executing rc.openvpn for more than 10 seconds continuing..."));
+ unlock_force('openvpn');
+ $openvpnlck = lock('openvpn', LOCK_EX);
+}
+
$arg_array = explode(",",$argument);
foreach ($arg_array as $arg_element) {
$gwgroups = array();
OpenPOWER on IntegriCloud