The Samba-Bugzilla – Attachment 15815 Details for
Bug 14291
OmniOS runtime TDB locking failure ("
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
OmniOS Robust Mutex attr initialization patch
mutexattr.patch (text/plain), 1.91 KB, created by
Peter Eriksson
on 2020-02-21 22:03:21 UTC
(
hide
)
Description:
OmniOS Robust Mutex attr initialization patch
Filename:
MIME Type:
Creator:
Peter Eriksson
Created:
2020-02-21 22:03:21 UTC
Size:
1.91 KB
patch
obsolete
># mutexattr's needs to be initialized or locking will fail on OmniOS >diff -u -r samba-4.12.0rc1/lib/tdb/common/mutex.c samba-4.12.0rc1-liu/lib/tdb/common/mutex.c >--- samba-4.12.0rc1/lib/tdb/common/mutex.c tis jan. 21 15:09:48 2020 >+++ samba-4.12.0rc1-liu/lib/tdb/common/mutex.c tors jan. 23 21:41:16 2020 >@@ -220,7 +220,7 @@ > bool waitflag, int *pret) > { > struct tdb_mutexes *m = tdb->mutexes; >- pthread_mutex_t *chain; >+ pthread_mutex_t *chain = NULL; > int ret; > unsigned idx; > bool allrecord_ok; >@@ -558,7 +558,7 @@ > int tdb_mutex_init(struct tdb_context *tdb) > { > struct tdb_mutexes *m; >- pthread_mutexattr_t ma; >+ pthread_mutexattr_t ma = { 0 }; > int i, ret; > > ret = tdb_mutex_mmap(tdb); >@@ -587,6 +587,9 @@ > for (i=0; i<tdb->hash_size+1; i++) { > pthread_mutex_t *chain = &m->hashchains[i]; > >+#ifdef __sun__ >+ memset(chain, 0, sizeof(*chain)); >+#endif > ret = pthread_mutex_init(chain, &ma); > if (ret != 0) { > goto fail; >@@ -594,7 +597,9 @@ > } > > m->allrecord_lock = F_UNLCK; >- >+#ifdef __sun__ >+ memset(&m->allrecord_mutex, 0, sizeof(pthread_mutex_t)); >+#endif > ret = pthread_mutex_init(&m->allrecord_mutex, &ma); > if (ret != 0) { > goto fail; >@@ -661,7 +666,7 @@ > > static bool tdb_mutex_locking_supported(void) > { >- pthread_mutexattr_t ma; >+ pthread_mutexattr_t ma = { 0 }; > pthread_mutex_t m; > int ret; > static bool initialized; >@@ -688,6 +693,9 @@ > if (ret != 0) { > goto cleanup_ma; > } >+#ifdef __sun__ >+ memset(&m, 0, sizeof(m)); >+#endif > ret = pthread_mutex_init(&m, &ma); > if (ret != 0) { > goto cleanup_ma; >@@ -829,7 +837,7 @@ > { > void *ptr = NULL; > pthread_mutex_t *m = NULL; >- pthread_mutexattr_t ma; >+ pthread_mutexattr_t ma = { 0 }; > int ret = 1; > int pipe_down[2] = { -1, -1 }; > int pipe_up[2] = { -1, -1 }; >@@ -885,6 +893,9 @@ > if (ret != 0) { > goto cleanup; > } >+#ifdef __sun__ >+ memset(ptr, 0, sizeof(*ptr)); >+#endif > ret = pthread_mutex_init(ptr, &ma); > if (ret != 0) { > goto cleanup;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 14291
: 15815