FreeBSD Bugzilla – Attachment 153477 Details for
Bug 198014
Signals can lead to an inconsistency in PI mutex ownership
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch to return errors from _thr_umutex_unlock2
pthread_unlock_errors.patch (text/plain), 1.82 KB, created by
eric
on 2015-02-24 21:27:32 UTC
(
hide
)
Description:
Patch to return errors from _thr_umutex_unlock2
Filename:
MIME Type:
Creator:
eric
Created:
2015-02-24 21:27:32 UTC
Size:
1.82 KB
patch
obsolete
>commit d366828bcc93f5411671f8815fbc78066549a84c >Author: evangyzen <eric_van_gyzen@dell.com> >Date: Sun Feb 22 14:19:07 2015 -0500 > > Propagate errors from _thr_umutex_unlock2 through mutex_unlock_common > > Errors from _thr_umutex_unlock2 should "never happen" in normal > circumstances. If they do, however, return them to the application > so it can fail early and loudly. Hiding the errors will only delay > the inevitable failure, making it harder to find and diagnose. > > Submitted by: Eric van Gyzen <eric_van_gyzen@dell.com> > Obtained from: Dell Inc. > >diff --git a/lib/libthr/thread/thr_mutex.c b/lib/libthr/thread/thr_mutex.c >index 61ff077..26e8776 100644 >--- a/lib/libthr/thread/thr_mutex.c >+++ b/lib/libthr/thread/thr_mutex.c >@@ -633,7 +633,7 @@ mutex_unlock_common(struct pthread_mutex *m, int cv, int *mtx_defer) > { > struct pthread *curthread = _get_curthread(); > uint32_t id; >- int defered; >+ int defered, error; > > if (__predict_false(m <= THR_MUTEX_DESTROYED)) { > if (m == THR_MUTEX_DESTROYED) >@@ -647,6 +647,7 @@ mutex_unlock_common(struct pthread_mutex *m, int cv, int *mtx_defer) > if (__predict_false(m->m_owner != curthread)) > return (EPERM); > >+ error = 0; > id = TID(curthread); > if (__predict_false( > PMUTEX_TYPE(m->m_flags) == PTHREAD_MUTEX_RECURSIVE && >@@ -660,7 +661,7 @@ mutex_unlock_common(struct pthread_mutex *m, int cv, int *mtx_defer) > defered = 0; > > DEQUEUE_MUTEX(curthread, m); >- _thr_umutex_unlock2(&m->m_lock, id, mtx_defer); >+ error = _thr_umutex_unlock2(&m->m_lock, id, mtx_defer); > > if (mtx_defer == NULL && defered) { > _thr_wake_all(curthread->defer_waiters, >@@ -670,7 +671,7 @@ mutex_unlock_common(struct pthread_mutex *m, int cv, int *mtx_defer) > } > if (!cv && m->m_flags & PMUTEX_FLAG_PRIVATE) > THR_CRITICAL_LEAVE(curthread); >- return (0); >+ return (error); > } > > int
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 Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 198014
:
153475
|
153476
| 153477 |
153485
|
153486
|
153487
|
153524