pkgsrc/net/samba4/patches/patch-source3_smbd_process.c
hauke 714c311d97 Solarish pthreads expect mutex datastructures to be properly zeroed
out, unlike the Linux implementation, which upstream mainly
targets. This leads to "tdb_open_ex: tdb_mutex_init failed for
/var/samba/lock/gencache.tdb: Device busy" errors, described in
<https://illumos.topicbox.com/groups/developer/T28dcabf2f69cac04>.

Illumos kernel code attempted to mitigate the problem as of
<https://www.illumos.org/issues/9959>, but the changes have yet to
show up in releases.

The patches originate from
<https://github.com/oposs/pkg.oetiker.ch-build/blob/master/build/samba4/patches/pthread_mutex_init>,
modified appropriately.

Tested on omniosce r151030.
2019-09-05 12:39:56 +00:00

23 lines
814 B
C

$NetBSD: patch-source3_smbd_process.c,v 1.1 2019/09/05 12:39:56 hauke Exp $
On SunOS (OpenSolaris), pthread_mutex_init() expects a zeroed-out
mutex data structure
--- source3/smbd/process.c.orig 2019-01-15 10:07:00.000000000 +0000
+++ source3/smbd/process.c
@@ -3342,6 +3342,7 @@ bool fork_echo_handler(struct smbXsrv_co
goto fail;
}
+ memset(&a, 0, sizeof(pthread_mutexattr_t));
res = pthread_mutexattr_init(&a);
if (res != 0) {
DEBUG(1, ("pthread_mutexattr_init failed: %s\n",
@@ -3369,6 +3370,7 @@ bool fork_echo_handler(struct smbXsrv_co
pthread_mutexattr_destroy(&a);
goto fail;
}
+ memset(xconn->smb1.echo_handler.socket_mutex, 0, sizeof(pthread_mutex_t));
res = pthread_mutex_init(xconn->smb1.echo_handler.socket_mutex,
&a);
pthread_mutexattr_destroy(&a);