diff options
author | Erik Fonnesbeck <efonnes@gmail.com> | 2010-12-04 22:46:45 -0700 |
---|---|---|
committer | Erik Fonnesbeck <efonnes@gmail.com> | 2010-12-04 22:46:45 -0700 |
commit | cd1de64dd14c437f01dc52a67544dec0deb33202 (patch) | |
tree | 2deae2aa7fd1a021223a480c6b1a686db520966b /etc/inc | |
parent | 7ac98d0b35ed894d6044a2d20c11aeabb1841e29 (diff) | |
download | pfsense-cd1de64dd14c437f01dc52a67544dec0deb33202.zip pfsense-cd1de64dd14c437f01dc52a67544dec0deb33202.tar.gz |
Restore locking to filter reload, using an exclusive filter lock around the function, but also leave the existing shared lock for config. Ticket #1071
Diffstat (limited to 'etc/inc')
-rw-r--r-- | etc/inc/filter.inc | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/etc/inc/filter.inc b/etc/inc/filter.inc index 8df7b48..1bf2a83 100644 --- a/etc/inc/filter.inc +++ b/etc/inc/filter.inc @@ -176,8 +176,9 @@ function filter_configure_sync() { global $config, $g, $after_filter_configure_run, $FilterIflist; global $time_based_rules, $filterdns, $aliases; - /* Use config lock to not allow recursion and config changes during this run. */ - $filterlck = lock('config'); + /* Use filter lock to not allow recursion and config lock to prevent changes during this run. */ + $filterlck = lock('filter', LOCK_EX); + $configlck = lock('config'); filter_pflog_start(); @@ -232,6 +233,7 @@ function filter_configure_sync() { update_filter_reload_status("Filter is disabled. Not loading rules."); if($g['booting'] == true) echo "done.\n"; + unlock($configlck); unlock($filterlck); return; } @@ -289,6 +291,7 @@ function filter_configure_sync() { if(!file_put_contents("{$g['tmp_path']}/rules.debug", $rules, LOCK_EX)) { log_error("WARNING: Could not write new rules!"); + unlock($configlck); unlock($filterlck); return; } @@ -327,6 +330,7 @@ function filter_configure_sync() { file_notice("filter_load", "There were error(s) loading the rules: {$rules_error} {$line_error}", "Filter Reload", ""); log_error("There were error(s) loading the rules: {$rules_error} - {$line_error}"); update_filter_reload_status("There were error(s) loading the rules: {$rules_error} - {$line_error}"); + unlock($configlck); unlock($filterlck); return; } @@ -374,7 +378,7 @@ function filter_configure_sync() { fclose($fda); } - unlock($filterlck); + unlock($configlck); if(file_exists("{$g['tmp_path']}/commands.txt")) { mwexec("sh {$g['tmp_path']}/commands.txt &"); @@ -405,6 +409,7 @@ function filter_configure_sync() { if($g['booting'] == true) echo "done.\n"; + unlock($filterlck); return 0; } |