mirror of
https://github.com/samba-team/samba.git
synced 2024-12-27 03:21:53 +03:00
Ensure we don't get an invalid number for total smbd's if the tdb update
fails.
Jeremy.
(This used to be commit e048259472
)
This commit is contained in:
parent
82ecfb9747
commit
38aee23f80
@ -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
|
||||
|
@ -526,12 +526,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);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user