summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVolker Lendecke <vl@samba.org>2010-03-26 13:18:52 +0100
committerVolker Lendecke <vl@samba.org>2010-03-28 15:25:15 +0200
commit4d8a974ddc1333a1e3c6ddf4a0e215a5e41e1074 (patch)
tree0f4eb3a92b3eab198a7392c9b6f9d7398b5b6a6c
parentd5fd1f207757b4f15d15b8744db0c9380fe63cab (diff)
downloadsamba-4d8a974ddc1333a1e3c6ddf4a0e215a5e41e1074.tar.gz
samba-4d8a974ddc1333a1e3c6ddf4a0e215a5e41e1074.tar.bz2
samba-4d8a974ddc1333a1e3c6ddf4a0e215a5e41e1074.zip
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.
-rw-r--r--source3/lib/gencache.c11
1 files changed, 10 insertions, 1 deletions
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;