mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 10:37:35 +03:00
Linux 2.6.39 compat, mutex owner
Prior to Linux 2.6.39 when CONFIG_DEBUG_MUTEXES was defined the kernel stored a thread_info pointer as the mutex owner. From this you could get the pointer of the current task_struct to compare with get_current(). As of Linux 2.6.39 this behavior has changed and now the mutex stores a pointer to the task_struct. This commit detects the type of pointer stored in the mutex and adjusts the mutex_owner() and mutex_owned() functions to perform the correct comparision.
This commit is contained in:
+9
-12
@@ -48,21 +48,18 @@ typedef struct {
|
||||
static inline kthread_t *
|
||||
mutex_owner(kmutex_t *mp)
|
||||
{
|
||||
struct thread_info *owner;
|
||||
#if defined(HAVE_MUTEX_OWNER_TASK_STRUCT)
|
||||
return ACCESS_ONCE(mp->m.owner);
|
||||
#else
|
||||
struct thread_info *owner = ACCESS_ONCE(mp->m.owner);
|
||||
if (owner)
|
||||
return owner->task;
|
||||
|
||||
owner = ACCESS_ONCE(mp->m.owner);
|
||||
if (owner)
|
||||
return owner->task;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static inline int
|
||||
mutex_owned(kmutex_t *mp)
|
||||
{
|
||||
return (ACCESS_ONCE(mp->m.owner) == current_thread_info());
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
#define mutex_owned(mp) (mutex_owner(mp) == current)
|
||||
#define MUTEX_HELD(mp) mutex_owned(mp)
|
||||
#define MUTEX_NOT_HELD(mp) (!MUTEX_HELD(mp))
|
||||
#undef mutex_init
|
||||
|
||||
Reference in New Issue
Block a user