mirror_zfs/spl_config.h.in
Ned Bass 46aa7b3939 Correctly handle rwsem_is_locked() behavior
A race condition in rwsem_is_locked() was fixed in Linux 2.6.33 and the fix was
backported to RHEL5 as of kernel 2.6.18-190.el5.  Details can be found here:

https://bugzilla.redhat.com/show_bug.cgi?id=526092

The race condition was fixed in the kernel by acquiring the semaphore's
wait_lock inside rwsem_is_locked().  The SPL worked around the race condition
by acquiring the wait_lock before calling that function, but with the fix in
place it must not do that.

This commit implements an autoconf test to detect whether the fixed version of
rwsem_is_locked() is present.  The previous version of rwsem_is_locked() was an
inline static function while the new version is exported as a symbol which we
can check for in module.symvers.  Depending on the result we correctly
implement the needed compatibility macros for proper spinlock handling.

Finally, we do the right thing with spin locks in RW_*_HELD() by using the
new compatibility macros.  We only only acquire the semaphore's wait_lock if
it is calling a rwsem_is_locked() that does not itself try to acquire the lock.

Some new overhead and a small harmless race is introduced by this change.
This is because RW_READ_HELD() and RW_WRITE_HELD() now acquire and release
the wait_lock twice: once for the call to rwsem_is_locked() and once for
the call to rw_owner().  This can't be avoided if calling a rwsem_is_locked()
that takes the wait_lock, as it will in more recent kernels.

The other case which only occurs in legacy kernels could be optimized by
taking the lock only once, as was done prior to this commit.  However, I
decided that the performance gain probably wasn't significant enough to
justify the messy special cases required.

The function spl_rw_get_owner() was only used to enable the afore-mentioned
optimization.  Since it is no longer used, I removed it.

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2010-08-10 16:43:00 -07:00

267 lines
6.0 KiB
C

/* spl_config.h.in. Generated from configure.ac by autoheader. */
/* Atomic types use spinlocks */
#undef ATOMIC_SPINLOCK
/* Define to 1 to enable basic kmem accounting */
#undef DEBUG_KMEM
/* Define to 1 to enable detailed kmem tracking */
#undef DEBUG_KMEM_TRACKING
/* register_sysctl_table() wants 2 args */
#undef HAVE_2ARGS_REGISTER_SYSCTL
/* set_fs_pwd() wants 2 args */
#undef HAVE_2ARGS_SET_FS_PWD
/* vfs_unlink() wants 2 args */
#undef HAVE_2ARGS_VFS_UNLINK
/* file_fsync() wants 3 args */
#undef HAVE_3ARGS_FILE_FSYNC
/* INIT_WORK wants 3 args */
#undef HAVE_3ARGS_INIT_WORK
/* on_each_cpu wants 3 args */
#undef HAVE_3ARGS_ON_EACH_CPU
/* vfs_rename() wants 4 args */
#undef HAVE_4ARGS_VFS_RENAME
/* device_create wants 5 args */
#undef HAVE_5ARGS_DEVICE_CREATE
/* proc_handler() wants 5 args */
#undef HAVE_5ARGS_PROC_HANDLER
/* kernel defines atomic64_cmpxchg */
#undef HAVE_ATOMIC64_CMPXCHG
/* kernel defines atomic64_t */
#undef HAVE_ATOMIC64_T
/* kernel defines atomic64_xchg */
#undef HAVE_ATOMIC64_XCHG
/* class_device_create() is available */
#undef HAVE_CLASS_DEVICE_CREATE
/* struct cred exists */
#undef HAVE_CRED_STRUCT
/* struct ctl_table has ctl_name */
#undef HAVE_CTL_NAME
/* unnumbered sysctl support exists */
#undef HAVE_CTL_UNNUMBERED
/* device_create() is available */
#undef HAVE_DEVICE_CREATE
/* Define to 1 if you have the <dlfcn.h> header file. */
#undef HAVE_DLFCN_H
/* linux/fdtable.h exists */
#undef HAVE_FDTABLE_HEADER
/* files_fdtable() is available */
#undef HAVE_FILES_FDTABLE
/* first_online_pgdat() is available */
#undef HAVE_FIRST_ONLINE_PGDAT
/* fls64() is available */
#undef HAVE_FLS64
/* get_vmalloc_info() is available */
#undef HAVE_GET_VMALLOC_INFO
/* get_zone_counts() is available */
#undef HAVE_GET_ZONE_COUNTS
/* global_page_state() is available */
#undef HAVE_GLOBAL_PAGE_STATE
/* groups_search() is available */
#undef HAVE_GROUPS_SEARCH
/* init_utsname() is available */
#undef HAVE_INIT_UTSNAME
/* struct inode has i_mutex */
#undef HAVE_INODE_I_MUTEX
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
/* kallsyms_lookup_name() is available */
#undef HAVE_KALLSYMS_LOOKUP_NAME
/* kmalloc_node() is available */
#undef HAVE_KMALLOC_NODE
/* kvasprintf() is available */
#undef HAVE_KVASPRINTF
/* Define to 1 if you have the <memory.h> header file. */
#undef HAVE_MEMORY_H
/* monotonic_clock() is available */
#undef HAVE_MONOTONIC_CLOCK
/* mutex_lock_nested() is available */
#undef HAVE_MUTEX_LOCK_NESTED
/* struct mutex has owner */
#undef HAVE_MUTEX_OWNER
/* next_online_pgdat() is available */
#undef HAVE_NEXT_ONLINE_PGDAT
/* next_zone() is available */
#undef HAVE_NEXT_ZONE
/* struct path used in struct nameidata */
#undef HAVE_PATH_IN_NAMEIDATA
/* pgdat helpers are available */
#undef HAVE_PGDAT_HELPERS
/* pgdat_list is available */
#undef HAVE_PGDAT_LIST
/* __put_task_struct() is available */
#undef HAVE_PUT_TASK_STRUCT
/* set_fs_pwd() is available */
#undef HAVE_SET_FS_PWD
/* set_normalized_timespec() is available as export */
#undef HAVE_SET_NORMALIZED_TIMESPEC_EXPORT
/* set_normalized_timespec() is available as inline */
#undef HAVE_SET_NORMALIZED_TIMESPEC_INLINE
/* set_shrinker() available */
#undef HAVE_SET_SHRINKER
/* Define to 1 if you have the <stdint.h> header file. */
#undef HAVE_STDINT_H
/* Define to 1 if you have the <stdlib.h> header file. */
#undef HAVE_STDLIB_H
/* Define to 1 if you have the <strings.h> header file. */
#undef HAVE_STRINGS_H
/* Define to 1 if you have the <string.h> header file. */
#undef HAVE_STRING_H
/* Define to 1 if you have the <sys/stat.h> header file. */
#undef HAVE_SYS_STAT_H
/* Define to 1 if you have the <sys/types.h> header file. */
#undef HAVE_SYS_TYPES_H
/* task_curr() exported */
#undef HAVE_TASK_CURR
/* timespec_sub() is available */
#undef HAVE_TIMESPEC_SUB
/* linux/uaccess.h exists */
#undef HAVE_UACCESS_HEADER
/* kernel defines uintptr_t */
#undef HAVE_UINTPTR_T
/* Define to 1 if you have the <unistd.h> header file. */
#undef HAVE_UNISTD_H
/* user_path_dir() is available */
#undef HAVE_USER_PATH_DIR
/* Page state NR_ACTIVE is available */
#undef HAVE_ZONE_STAT_ITEM_NR_ACTIVE
/* Page state NR_ACTIVE_ANON is available */
#undef HAVE_ZONE_STAT_ITEM_NR_ACTIVE_ANON
/* Page state NR_ACTIVE_FILE is available */
#undef HAVE_ZONE_STAT_ITEM_NR_ACTIVE_FILE
/* Page state NR_FREE_PAGES is available */
#undef HAVE_ZONE_STAT_ITEM_NR_FREE_PAGES
/* Page state NR_INACTIVE is available */
#undef HAVE_ZONE_STAT_ITEM_NR_INACTIVE
/* Page state NR_INACTIVE_ANON is available */
#undef HAVE_ZONE_STAT_ITEM_NR_INACTIVE_ANON
/* Page state NR_INACTIVE_FILE is available */
#undef HAVE_ZONE_STAT_ITEM_NR_INACTIVE_FILE
/* Define to the sub-directory in which libtool stores uninstalled libraries.
*/
#undef LT_OBJDIR
/* get_zone_counts() is needed */
#undef NEED_GET_ZONE_COUNTS
/* Name of package */
#undef PACKAGE
/* Define to the address where bug reports for this package should be sent. */
#undef PACKAGE_BUGREPORT
/* Define to the full name of this package. */
#undef PACKAGE_NAME
/* Define to the full name and version of this package. */
#undef PACKAGE_STRING
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
/* Define to the version of this package. */
#undef PACKAGE_VERSION
/* rwsem_is_locked() acquires sem->wait_lock */
#undef RWSEM_IS_LOCKED_TAKES_WAIT_LOCK
/* Define the project alias string. */
#undef SPL_META_ALIAS
/* Define the project author. */
#undef SPL_META_AUTHOR
/* Define the project release date. */
#undef SPL_META_DATA
/* Define the libtool library 'age' version information. */
#undef SPL_META_LT_AGE
/* Define the libtool library 'current' version information. */
#undef SPL_META_LT_CURRENT
/* Define the libtool library 'revision' version information. */
#undef SPL_META_LT_REVISION
/* Define the project name. */
#undef SPL_META_NAME
/* Define the project release. */
#undef SPL_META_RELEASE
/* Define the project version. */
#undef SPL_META_VERSION
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Version number of package */
#undef VERSION