1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-22 13:34:15 +03:00
samba-mirror/lib/tdb/common
Volker Lendecke b9f06ab347 tdb: Use atomic operations for tdb_[increment|get]_seqnum
With locking.tdb now based on g_lock.c code, we change locking.tdb a
lot more often. I have a customer case where LDX tortures smbd very
hard with 800+ concurrent connections, which now completely falls over
where 4.12 still worked fine. Some debugging showed a thundering herd
on fcntl locking.tdb index 48 (TDB_SEQNUM_OFS). We still use fcntl for
the seqnum, back when we converted the chainlocks to mutexes we did
not consider it to be a problem. Now it is, but all we need to do with
the SEQNUM is to increment it, so an __atomic_add_fetch() of one is
sufficient.

I've taken a look at the C11 standard atomics, but I could not figure
out how to use them properly, to me they seem more general to be
initialized first etc. All we need is a X86 "lock incl 48(%rax)" to be
emitted, and the gcc __atomic_add_fetch seems to do this.

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Jeremy Allison <jra@samba.org>
2021-12-15 00:15:33 +00:00
..
check.c tdb: Introduce tdb_oob() 2019-08-06 21:49:27 +00:00
dump.c tdb: Align an integer type 2018-10-29 23:36:24 +01:00
error.c
freelist.c tdb: Introduce tdb_oob() 2019-08-06 21:49:27 +00:00
freelistcheck.c lib/tdb/common: clang: Fix 'Value stored to 'last_ptr' is never read' 2019-06-11 13:31:01 +00:00
hash.c lib:tdb: Add FALL_THROUGH statements in hash.c 2018-03-01 04:37:41 +01:00
io.c tdb: Inline the common part of tdb_oob 2019-08-06 21:49:27 +00:00
lock.c tdb: fix studio compiler build 2020-11-10 06:53:43 +00:00
mutex.c tdb: Align integer types 2020-01-23 20:41:46 +00:00
open.c tdb: Introduce tdb_oob() 2019-08-06 21:49:27 +00:00
rescue.c tdb: Introduce tdb_oob() 2019-08-06 21:49:27 +00:00
summary.c tdb: Make get_hash_length circular-safe 2018-10-08 22:17:10 +02:00
tdb_private.h tdb: Inline the common part of tdb_oob 2019-08-06 21:49:27 +00:00
tdb.c tdb: Use atomic operations for tdb_[increment|get]_seqnum 2021-12-15 00:15:33 +00:00
transaction.c lib:tdb: Fix a memory leak on error 2021-07-08 09:30:40 +00:00
traverse.c tdb: Introduce tdb_oob() 2019-08-06 21:49:27 +00:00