diff options
author | Jeremy Allison <jra@samba.org> | 2003-01-08 21:42:43 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2003-01-08 21:42:43 +0000 |
commit | 65195b4d5489645edfbda7ff3230cc9fdb975fa6 (patch) | |
tree | 6cfd9e266208b2704e52ab3ebf739fc029b5e89c /source3/smbd | |
parent | 83ce5fd3a30e9c5d909654adfebbc759abfb7af5 (diff) | |
download | samba-65195b4d5489645edfbda7ff3230cc9fdb975fa6.tar.gz samba-65195b4d5489645edfbda7ff3230cc9fdb975fa6.tar.bz2 samba-65195b4d5489645edfbda7ff3230cc9fdb975fa6.zip |
Ensure we don't get an invalid number for total smbd's if the tdb update
fails.
Jeremy.
(This used to be commit 99e69fd74d5a2e7396e7f24924d72374d5cb32c2)
Diffstat (limited to 'source3/smbd')
-rw-r--r-- | source3/smbd/process.c | 6 | ||||
-rw-r--r-- | source3/smbd/server.c | 18 |
2 files changed, 18 insertions, 6 deletions
diff --git a/source3/smbd/process.c b/source3/smbd/process.c index 7421c16b40..03b1e007ba 100644 --- a/source3/smbd/process.c +++ b/source3/smbd/process.c @@ -809,17 +809,13 @@ static BOOL smbd_process_limit(void) * subtracts one. */ - total_smbds = 1; /* In case we need to create the entry. */ - if (!conn_tdb_ctx()) { DEBUG(0,("smbd_process_limit: max smbd processes parameter set with status parameter not \ set. Ignoring max smbd restriction.\n")); return False; } - if (tdb_change_int32_atomic(conn_tdb_ctx(), "INFO/total_smbds", &total_smbds, 1) == -1) - return True; - + total_smbds = increment_smbd_process_count(); return total_smbds > lp_max_smbd_processes(); } else diff --git a/source3/smbd/server.c b/source3/smbd/server.c index c235283f6c..a69f4c8c54 100644 --- a/source3/smbd/server.c +++ b/source3/smbd/server.c @@ -530,12 +530,28 @@ static BOOL dump_core(void) update the current smbd process count ****************************************************************************/ -static void decrement_smbd_process_count(void) +static BOOL process_count_update_successful = False; + +int32 increment_smbd_process_count(void) { int32 total_smbds; if (lp_max_smbd_processes()) { total_smbds = 0; + if (tdb_change_int32_atomic(conn_tdb_ctx(), "INFO/total_smbds", &total_smbds, -1) == -1) + return 1; + process_count_update_successful = True; + return total_smbds + 1; + } + return 1; +} + +static void decrement_smbd_process_count(void) +{ + int32 total_smbds; + + if (lp_max_smbd_processes() && process_count_update_successful) { + total_smbds = 1; tdb_change_int32_atomic(conn_tdb_ctx(), "INFO/total_smbds", &total_smbds, -1); } } |