summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2011-06-24 11:57:14 -0700
committerBrian Behlendorf <[email protected]>2011-06-24 13:00:08 -0700
commit86fd39f354778eb10e77a7c1660b59ca16ffcc16 (patch)
treeddba0bbdcc45babd1863a732c96bc475a19251a7 /config
parent79593b0dec57ee94c5bb56cdc2770ebde81ecea9 (diff)
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.
Diffstat (limited to 'config')
-rw-r--r--config/spl-build.m427
1 files changed, 27 insertions, 0 deletions
diff --git a/config/spl-build.m4 b/config/spl-build.m4
index 75267bb83..ea5078507 100644
--- a/config/spl-build.m4
+++ b/config/spl-build.m4
@@ -48,6 +48,7 @@ AC_DEFUN([SPL_AC_CONFIG_KERNEL], [
SPL_AC_MONOTONIC_CLOCK
SPL_AC_INODE_I_MUTEX
SPL_AC_MUTEX_OWNER
+ SPL_AC_MUTEX_OWNER_TASK_STRUCT
SPL_AC_MUTEX_LOCK_NESTED
SPL_AC_3ARGS_ON_EACH_CPU
SPL_AC_KALLSYMS_LOOKUP_NAME
@@ -1129,6 +1130,32 @@ AC_DEFUN([SPL_AC_MUTEX_OWNER], [
])
dnl #
+dnl # 2.6.39 API change,
+dnl # Owner type change. A Linux mutex prior to 2.6.39 would store
+dnl # the owner as a thread_info pointer when CONFIG_DEBUG_MUTEXES
+dnl # was defined. As of 2.6.39 this was changed to a task_struct
+dnl # pointer which frankly makes a lot more sense.
+dnl #
+AC_DEFUN([SPL_AC_MUTEX_OWNER_TASK_STRUCT], [
+ AC_MSG_CHECKING([whether struct mutex owner is a task_struct])
+ tmp_flags="$EXTRA_KCFLAGS"
+ EXTRA_KCFLAGS="-Werror"
+ SPL_LINUX_TRY_COMPILE([
+ #include <linux/mutex.h>
+ ],[
+ struct mutex mtx __attribute__ ((unused));
+ mtx.owner = current;
+ ],[
+ AC_MSG_RESULT(yes)
+ AC_DEFINE(HAVE_MUTEX_OWNER_TASK_STRUCT, 1,
+ [struct mutex owner is a task_struct])
+ ],[
+ AC_MSG_RESULT(no)
+ ])
+ EXTRA_KCFLAGS="$tmp_flags"
+])
+
+dnl #
dnl # 2.6.18 API change,
dnl # First introduced 'mutex_lock_nested()' in include/linux/mutex.h,
dnl # as part of the mutex validator. Fallback to using 'mutex_lock()'