partition: correcting lock ordering
authorAaron Haslett <aaronhaslett@catalyst.net.nz>
Thu, 11 Jul 2019 05:12:06 +0000 (17:12 +1200)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 24 Jul 2019 05:50:23 +0000 (05:50 +0000)
commit7f4bc0ea81f2b34607849911f1271b030be8ca02
treea58d82b1929802cd3429a57624716cf1bd3853a7
parent54af94ff21a7f395133bcc13458cc2e1f52183be
partition: correcting lock ordering

A schema reading bug was traced to a lock ordering issue in partition.c.
This patch fixes the problem by:
1. Releasing locks/transactions in the order they were acquired.
2. Always lock/start_trans on metadata.tdb first, before any other
databases, and release it last, after all others. This is so that we are
never exposed to MDB's lock semantics, which we don't support.

Signed-off-by: Aaron Haslett <aaronhaslett@catalyst.net.nz>
Reviewed-by: Garming Sam <garming@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
source4/dsdb/samdb/ldb_modules/partition.c