1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-11 05:18:09 +03:00

ldb_wrap: Remove ldb_transaction_cancel_noerr from ldb_wrap_fork_hook()

Writing to a TDB, without locks (these are per-process) in a forked child is never going to
end well, if a transaction is open at this point we have bigger problems.

Signed-off-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
This commit is contained in:
Andrew Bartlett 2018-03-15 13:42:17 +13:00
parent 056b2abde6
commit 46b6f2d782

View File

@ -329,20 +329,11 @@ int samba_ldb_connect(struct ldb_context *ldb, struct loadparm_context *lp_ctx,
} }
/* /*
when we fork() we need to make sure that any open ldb contexts have call tdb_reopen_all() in case there is a TDB open so we are
any open transactions cancelled (ntdb databases doesn't need reopening, not blocked from re-opening it inside ldb_tdb.
as we don't use clear_if_first). */
*/
void ldb_wrap_fork_hook(void) void ldb_wrap_fork_hook(void)
{ {
struct ldb_wrap *w;
for (w=ldb_wrap_list; w; w=w->next) {
if (ldb_transaction_cancel_noerr(w->ldb) != LDB_SUCCESS) {
smb_panic("Failed to cancel child transactions\n");
}
}
if (tdb_reopen_all(1) != 0) { if (tdb_reopen_all(1) != 0) {
smb_panic("tdb_reopen_all failed\n"); smb_panic("tdb_reopen_all failed\n");
} }