SLES10 Fixes (part 3):
- Configure check for mutex_lock_nested(). This function was introduced as part of the mutex validator in 2.6.18, but if it's unavailable then it's safe to fallback to a plain mutex_lock().
This commit is contained in:
parent
96dded3844
commit
6c9433c150
|
@ -705,6 +705,29 @@ AC_DEFUN([SPL_AC_INODE_I_MUTEX], [
|
|||
])
|
||||
])
|
||||
|
||||
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()'
|
||||
dnl # if the mutex validator is disabled or otherwise unavailable.
|
||||
dnl #
|
||||
AC_DEFUN([SPL_AC_MUTEX_LOCK_NESTED], [
|
||||
AC_MSG_CHECKING([whether mutex_lock_nested() is available])
|
||||
SPL_LINUX_TRY_COMPILE([
|
||||
#include <linux/mutex.h>
|
||||
],[
|
||||
struct mutex mutex;
|
||||
mutex_init(&mutex);
|
||||
mutex_lock_nested(&mutex, 0);
|
||||
],[
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(HAVE_MUTEX_LOCK_NESTED, 1,
|
||||
[mutex_lock_nested() is available])
|
||||
],[
|
||||
AC_MSG_RESULT(no)
|
||||
])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # 2.6.22 API change,
|
||||
dnl # First introduced 'div64_64()' in lib/div64.c
|
||||
|
|
|
@ -20510,6 +20510,73 @@ fi
|
|||
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking whether mutex_lock_nested() is available" >&5
|
||||
echo $ECHO_N "checking whether mutex_lock_nested() is available... $ECHO_C" >&6
|
||||
|
||||
|
||||
cat >conftest.c <<_ACEOF
|
||||
/* confdefs.h. */
|
||||
_ACEOF
|
||||
cat confdefs.h >>conftest.$ac_ext
|
||||
cat >>conftest.$ac_ext <<_ACEOF
|
||||
/* end confdefs.h. */
|
||||
|
||||
|
||||
#include <linux/mutex.h>
|
||||
|
||||
int
|
||||
main (void)
|
||||
{
|
||||
|
||||
struct mutex mutex;
|
||||
mutex_init(&mutex);
|
||||
mutex_lock_nested(&mutex, 0);
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
|
||||
_ACEOF
|
||||
|
||||
|
||||
rm -Rf build && mkdir -p build
|
||||
echo "obj-m := conftest.o" >build/Makefile
|
||||
if { ac_try='cp conftest.c build && make modules LINUXINCLUDE="-Iinclude -Iinclude2 -I$LINUX/include -include include/linux/autoconf.h" -o tmp_include_depends -o scripts -o include/config/MARKER -C $LINUX_OBJ EXTRA_CFLAGS="-Werror-implicit-function-declaration $EXTRA_KCFLAGS" $ARCH_UM M=$PWD/build'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; } >/dev/null && { ac_try='test -s build/conftest.o'
|
||||
{ (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
|
||||
(eval $ac_try) 2>&5
|
||||
ac_status=$?
|
||||
echo "$as_me:$LINENO: \$? = $ac_status" >&5
|
||||
(exit $ac_status); }; }; then
|
||||
|
||||
echo "$as_me:$LINENO: result: yes" >&5
|
||||
echo "${ECHO_T}yes" >&6
|
||||
|
||||
cat >>confdefs.h <<\_ACEOF
|
||||
#define HAVE_MUTEX_LOCK_NESTED 1
|
||||
_ACEOF
|
||||
|
||||
|
||||
else
|
||||
echo "$as_me: failed program was:" >&5
|
||||
sed 's/^/| /' conftest.$ac_ext >&5
|
||||
|
||||
echo "$as_me:$LINENO: result: no" >&5
|
||||
echo "${ECHO_T}no" >&6
|
||||
|
||||
|
||||
|
||||
fi
|
||||
|
||||
rm -Rf build
|
||||
|
||||
|
||||
|
||||
|
||||
echo "$as_me:$LINENO: checking whether symbol div64_64 is exported" >&5
|
||||
echo $ECHO_N "checking whether symbol div64_64 is exported... $ECHO_C" >&6
|
||||
grep -q -E '[[:space:]]div64_64[[:space:]]' $LINUX_OBJ/Module.symvers 2>/dev/null
|
||||
|
|
|
@ -67,6 +67,7 @@ SPL_AC_UACCESS_HEADER
|
|||
SPL_AC_KMALLOC_NODE
|
||||
SPL_AC_MONOTONIC_CLOCK
|
||||
SPL_AC_INODE_I_MUTEX
|
||||
SPL_AC_MUTEX_LOCK_NESTED
|
||||
SPL_AC_DIV64_64
|
||||
SPL_AC_DIV64_U64
|
||||
SPL_AC_3ARGS_ON_EACH_CPU
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#ifndef _SPL_MUTEX_COMPAT_H
|
||||
#define _SPL_MUTEX_COMPAT_H
|
||||
|
||||
#include <linux/mutex.h>
|
||||
|
||||
/* mutex_lock_nested() introduced in 2.6.18 */
|
||||
#ifndef HAVE_MUTEX_LOCK_NESTED
|
||||
# define mutex_lock_nested(lock, subclass) mutex_lock(lock)
|
||||
#endif /* HAVE_MUTEX_LOCK_NESTED */
|
||||
|
||||
#endif /* _SPL_MUTEX_COMPAT_H */
|
||||
|
|
@ -17,6 +17,7 @@ extern "C" {
|
|||
#include <linux/smp_compat.h>
|
||||
#include <linux/workqueue_compat.h>
|
||||
#include <linux/kallsyms_compat.h>
|
||||
#include <linux/mutex_compat.h>
|
||||
|
||||
#ifndef HAVE_UINTPTR_T
|
||||
typedef unsigned long uintptr_t;
|
||||
|
|
|
@ -87,6 +87,9 @@
|
|||
/* monotonic_clock() is available */
|
||||
#undef HAVE_MONOTONIC_CLOCK
|
||||
|
||||
/* mutex_lock_nested() is available */
|
||||
#undef HAVE_MUTEX_LOCK_NESTED
|
||||
|
||||
/* next_online_pgdat() is available */
|
||||
#undef HAVE_NEXT_ONLINE_PGDAT
|
||||
|
||||
|
|
Loading…
Reference in New Issue