diff options
author | Volker Lendecke <vl@samba.org> | 2012-01-08 19:04:39 +0100 |
---|---|---|
committer | Volker Lendecke <vlendec@samba.org> | 2012-01-18 14:48:04 +0100 |
commit | 333c92384b0680b8f8e5198dd68d49b249b34ec7 (patch) | |
tree | 8042feeb87bf2a0f763b0972facca268a935a8c6 /source3/lib/dbwrap/dbwrap_open.c | |
parent | 45e61fcf61ed9863fbe2b116fe0763fc139bbe0d (diff) | |
download | samba-333c92384b0680b8f8e5198dd68d49b249b34ec7.tar.gz |
s3: Enforce a lock order in dbwrap
This makes sure we do not deadlock from doing two dbwrap_fetch_locked in two
processes in different orders. At open time, we assign a strict order to all
databases. lock_order 1 will be locked first, lock_order 2 second. No two
records of the same lock order may be locked at the same time.
Diffstat (limited to 'source3/lib/dbwrap/dbwrap_open.c')
-rw-r--r-- | source3/lib/dbwrap/dbwrap_open.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/source3/lib/dbwrap/dbwrap_open.c b/source3/lib/dbwrap/dbwrap_open.c index 23d299511b4..af24ed88474 100644 --- a/source3/lib/dbwrap/dbwrap_open.c +++ b/source3/lib/dbwrap/dbwrap_open.c @@ -124,5 +124,8 @@ struct db_context *db_open(TALLOC_CTX *mem_ctx, result = db_open_tdb(mem_ctx, name, hash_size, tdb_flags, open_flags, mode); } + if (result != NULL) { + result->lock_order = lock_order; + } return result; } |