From 33ae575a6aa831d9eb5536554486bce97e7ad5a6 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Thu, 12 Jul 2001 16:37:31 +0000 Subject: [PATCH] linux24-handle-inode-address-space-page-lock-spinlock-20010712 One line patch to initialize spin lock added in a RedHat kernel patch. This should fix the RedHat 7.1 SMP problem. Also includes configure glue to turn it on. Thanks to Chaskiel Grundman for suggesting the fix, Garry Zacheiss for suggesting it affected the SMP kernel generally and not just SMP hardware, and Andrei Maslennikov for noting the problem did not affect vanilla 2.4.3 with only the Alan Cox (AC14 in this case) patch. --- acconfig.h | 1 + configure.in | 4 ++++ src/afs/afs_vcache.c | 3 +++ src/cf/linux-test2.m4 | 15 +++++++++++++++ 4 files changed, 23 insertions(+) diff --git a/acconfig.h b/acconfig.h index 1a1aa2a3c..0979d194f 100644 --- a/acconfig.h +++ b/acconfig.h @@ -29,3 +29,4 @@ static /**/const char *const rcsid[] = { (char *)rcsid, "\100(#)" msg } #undef INODE_SETATTR_NOT_VOID #undef STRUCT_INODE_HAS_I_BYTES +#undef STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK diff --git a/configure.in b/configure.in index b7ed3ce44..5087e39d5 100644 --- a/configure.in +++ b/configure.in @@ -91,6 +91,7 @@ case $system in AC_MSG_RESULT(linux) if test "x$enable_kernel_module" = "xyes"; then LINUX_FS_STRUCT_INODE_HAS_I_BYTES + LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK LINUX_INODE_SETATTR_RETURN_TYPE LINUX_NEED_RHCONFIG LINUX_WHICH_MODULES @@ -100,6 +101,9 @@ case $system in if test "x$ac_cv_linux_fs_struct_inode_has_i_bytes" = "xyes"; then AC_DEFINE(STRUCT_INODE_HAS_I_BYTES) fi + if test "x$ac_cv_linux_fs_struct_address_space_has_page_lock" = "xyes"; then + AC_DEFINE(STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK) + fi : fi ;; diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c index b7b38191e..c206ebe02 100644 --- a/src/afs/afs_vcache.c +++ b/src/afs/afs_vcache.c @@ -951,6 +951,9 @@ struct vcache *afs_NewVCache(struct VenusFid *afid, struct server *serverp, sema_init(&ip->i_zombie, 1); init_waitqueue_head(&ip->i_wait); spin_lock_init(&ip->i_data.i_shared_lock); +#ifdef STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK + spin_lock_init(&ip->i_data.page_lock); +#endif INIT_LIST_HEAD(&ip->i_data.clean_pages); INIT_LIST_HEAD(&ip->i_data.dirty_pages); INIT_LIST_HEAD(&ip->i_data.locked_pages); diff --git a/src/cf/linux-test2.m4 b/src/cf/linux-test2.m4 index c7a7f2e06..beefbae3f 100644 --- a/src/cf/linux-test2.m4 +++ b/src/cf/linux-test2.m4 @@ -13,3 +13,18 @@ ac_cv_linux_fs_struct_inode_has_i_bytes=no)]) AC_MSG_RESULT($ac_cv_linux_fs_struct_inode_has_i_bytes) CPPFLAGS="$save_CPPFLAGS"]) +AC_DEFUN(LINUX_FS_STRUCT_ADDRESS_SPACE_HAS_PAGE_LOCK, [ +AC_MSG_CHECKING(for page_lock in struct address_space) +save_CPPFLAGS="$CPPFLAGS" +CPPFLAGS="-I${LINUX_KERNEL_PATH}/include -D__KERNEL__ $CPPFLAGS" +AC_CACHE_VAL(ac_cv_linux_fs_struct_address_space_has_page_lock, +[ +AC_TRY_COMPILE( +[#include ], +[struct address_space _a_s; +printf("%x\n", _a_s.page_lock);], +ac_cv_linux_fs_struct_address_space_has_page_lock=yes, +ac_cv_linux_fs_struct_address_space_has_page_lock=no)]) +AC_MSG_RESULT($ac_cv_linux_fs_struct_address_space_has_page_lock) +CPPFLAGS="$save_CPPFLAGS"]) + -- 2.39.5