--- samba-4.14.0-orig/lib/tdb/common/mutex.c	tors jan. 21 14:20:40 2021
+++ samba-4.14.0/lib/tdb/common/mutex.c	ons mars 17 19:56:17 2021
@@ -558,12 +558,13 @@
 int tdb_mutex_init(struct tdb_context *tdb)
 {
 	struct tdb_mutexes *m;
-	pthread_mutexattr_t ma;
+	pthread_mutexattr_t ma = { 0 };	/* Due to a bug in Illumos this needs to be zeroed - doesn't hurt anyone else */
 	uint32_t i;
 	int ret;
 
 	ret = tdb_mutex_mmap(tdb);
 	if (ret == -1) {
+		TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_mutex_mmap failed: %s\n", strerror(errno)));
 		return -1;
 	}
 	m = tdb->mutexes;
@@ -570,18 +571,22 @@
 
 	ret = pthread_mutexattr_init(&ma);
 	if (ret != 0) {
+		TDB_LOG((tdb, TDB_DEBUG_FATAL, "pthread_mutexattr_init failed: %s\n", strerror(ret)));
 		goto fail_munmap;
 	}
 	ret = pthread_mutexattr_settype(&ma, PTHREAD_MUTEX_ERRORCHECK);
 	if (ret != 0) {
+		TDB_LOG((tdb, TDB_DEBUG_FATAL,  "pthread_mutexattr_settype failed: %s\n", strerror(ret)));
 		goto fail;
 	}
 	ret = pthread_mutexattr_setpshared(&ma, PTHREAD_PROCESS_SHARED);
 	if (ret != 0) {
+		TDB_LOG((tdb, TDB_DEBUG_FATAL, "pthread_mutexattr_setpshared failed: %s\n", strerror(ret)));
 		goto fail;
 	}
 	ret = pthread_mutexattr_setrobust(&ma, PTHREAD_MUTEX_ROBUST);
 	if (ret != 0) {
+		TDB_LOG((tdb, TDB_DEBUG_FATAL, "pthread_mutexattr_setrobust failed: %s\n", strerror(ret)));
 		goto fail;
 	}
 
@@ -589,7 +594,8 @@
 		pthread_mutex_t *chain = &m->hashchains[i];
 
 		ret = pthread_mutex_init(chain, &ma);
-		if (ret != 0) {
+		if (ret != 0 && ret != EBUSY) {
+		  	TDB_LOG((tdb, TDB_DEBUG_FATAL, "pthread_mutex_init(&m->hashchains[%d]) failed: %s\n", i, strerror(ret)));
 			goto fail;
 		}
 	}
@@ -597,7 +603,8 @@
 	m->allrecord_lock = F_UNLCK;
 
 	ret = pthread_mutex_init(&m->allrecord_mutex, &ma);
-	if (ret != 0) {
+	if (ret != 0 && ret != EBUSY) {
+	  	TDB_LOG((tdb, TDB_DEBUG_FATAL, "pthread_mutex_init(&m->allrecord_mutex) failed: %s\n", strerror(ret)));
 		goto fail;
 	}
 	ret = 0;
