From 4d8a974ddc1333a1e3c6ddf4a0e215a5e41e1074 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Fri, 26 Mar 2010 13:18:52 +0100 Subject: s3: Use tdb_transaction_start_nonblock in gencache_stabilize This avoids the thundering herd problem when 5000 smbds exit simultaneously because the network went down. --- source3/lib/gencache.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/source3/lib/gencache.c b/source3/lib/gencache.c index 9a4cbc2cd7..a78e60a153 100644 --- a/source3/lib/gencache.c +++ b/source3/lib/gencache.c @@ -416,8 +416,17 @@ bool gencache_stabilize(void) return false; } - res = tdb_transaction_start(cache); + res = tdb_transaction_start_nonblock(cache); if (res == -1) { + + if (tdb_error(cache) == TDB_ERR_NOLOCK) { + /* + * Someone else already does the stabilize, + * this does not have to be done twice + */ + return true; + } + DEBUG(10, ("Could not start transaction on gencache.tdb: " "%s\n", tdb_errorstr(cache))); return false; -- cgit