source: branches/fc15-dev/server/common/patches/openafs-0007-Linux-2.6.38-deal-with-dcache_lock-removal.patch @ 1876

Last change on this file since 1876 was 1835, checked in by achernya, 13 years ago
OpenAFS builds on F15 Get OpenAFS to build on F15, using the cherry-picked patches.
File size: 4.8 KB
  • acinclude.m4

    From 2c3b79c8c242d12398eff647753370787b7cf300 Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Fri, 28 Jan 2011 20:59:17 -0500
    Subject: [PATCH 7/8] Linux: 2.6.38: deal with dcache_lock removal
    
    dcache_lock is gone in 2.6.38, and some of the vfs locking rules
    have changed.
    
    Of interest for openafs:
    - inode->i_lock protects the d_alias list
    - dentry->d_lock protects d_unhashed()
    
    Add a new configure test for dcache_lock, and replace its use by
    the appropriate new lock(s).
    
    Reviewed-on: http://gerrit.openafs.org/3771
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@dementia.org>
    (cherry picked from commit 2eca7aef7b2940e4ef5f9901ce28481af6edb6dd)
    
    Change-Id: Ie405bb1e40cca4ba83bca3e051e2ab54b8850ac6
    Signed-off-by: Anders Kaseorg <andersk@mit.edu>
    Reviewed-on: http://gerrit.openafs.org/3998
    Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com>
    Reviewed-by: Russ Allbery <rra@stanford.edu>
    Reviewed-on: http://gerrit.openafs.org/4043
    Reviewed-by: Derrick Brashear <shadow@dementia.org>
    Tested-by: Derrick Brashear <shadow@dementia.org>
    ---
     acinclude.m4          |    1 +
     src/afs/afs_daemons.c |    8 ++++++++
     src/afs/afs_vcache.c  |   35 +++++++++++++++++++++++++++++++++--
     src/cf/linux-test4.m4 |   11 +++++++++++
     4 files changed, 53 insertions(+), 2 deletions(-)
    
    diff --git a/acinclude.m4 b/acinclude.m4
    index 7904e20..655fb11 100644
    a b case $AFS_SYSNAME in *_linux* | *_umlinux*) 
    817817                 LINUX_GENERIC_FILE_AIO_READ
    818818                 LINUX_INIT_WORK_HAS_DATA
    819819                 LINUX_REGISTER_SYSCTL_TABLE_NOFLAG
     820                 LINUX_HAVE_DCACHE_LOCK
    820821                 LINUX_SYSCTL_TABLE_CHECKING
    821822                 LINUX_STRUCT_CTL_TABLE_HAS_CTL_NAME
    822823                 LINUX_HAVE_IGET
  • src/afs/afs_daemons.c

    diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c
    index bd5bba8..3d9d977 100644
    a b afs_CheckRootVolume(void) 
    376376                    dp = d_find_alias(AFSTOV(afs_globalVp));
    377377                   
    378378#if defined(AFS_LINUX24_ENV)
     379#if defined(HAVE_DCACHE_LOCK)
    379380                    spin_lock(&dcache_lock);
     381#else
     382                    spin_lock(&AFSTOV(vcp)->i_lock);
     383#endif
    380384#if defined(AFS_LINUX26_ENV)
    381385                    spin_lock(&dp->d_lock);
    382386#endif
    afs_CheckRootVolume(void) 
    388392#if defined(AFS_LINUX26_ENV)
    389393                    spin_unlock(&dp->d_lock);
    390394#endif
     395#if defined(HAVE_DCACHE_LOCK)
    391396                    spin_unlock(&dcache_lock);
     397#else
     398                    spin_unlock(&AFSTOV(vcp)->i_lock);
     399#endif
    392400#endif
    393401                    dput(dp);
    394402                   
  • src/afs/afs_vcache.c

    diff --git a/src/afs/afs_vcache.c b/src/afs/afs_vcache.c
    index 201bae7..63e6a27 100644
    a b afs_ShakeLooseVCaches(afs_int32 anumber) 
    673673#if defined(AFS_LINUX22_ENV)
    674674            if (tvc != afs_globalVp && VREFCOUNT(tvc) > 1 && tvc->opens == 0) {
    675675                struct dentry *dentry;
     676                struct inode *inode = AFSTOV(tvc);
    676677                struct list_head *cur, *head;
    677678                AFS_GUNLOCK();
     679
     680#if defined(HAVE_DCACHE_LOCK)
    678681#if defined(AFS_LINUX24_ENV)
    679682                spin_lock(&dcache_lock);
    680683#endif
    681                 head = &(AFSTOV(tvc))->i_dentry;
     684                head = &inode->i_dentry;
    682685
    683686restart:
    684687                cur = head;
    restart: 
    687690
    688691                    if (d_unhashed(dentry))
    689692                        continue;
    690 
    691693                    dget_locked(dentry);
    692694
    693695#if defined(AFS_LINUX24_ENV)
    restart: 
    707709#if defined(AFS_LINUX24_ENV)
    708710                spin_unlock(&dcache_lock);
    709711#endif
     712#else /* HAVE_DCACHE_LOCK */
     713                spin_lock(&inode->i_lock);
     714                head = &inode->i_dentry;
     715
     716restart:
     717                cur = head;
     718                while ((cur = cur->next) != head) {
     719                    dentry = list_entry(cur, struct dentry, d_alias);
     720
     721                    spin_lock(&dentry->d_lock);
     722                    if (d_unhashed(dentry)) {
     723                        spin_unlock(&dentry->d_lock);
     724                        continue;
     725                    }
     726                    spin_unlock(&dentry->d_lock);
     727                    dget(dentry);
     728
     729                    spin_unlock(&inode->i_lock);
     730                    if (d_invalidate(dentry) == -EBUSY) {
     731                        dput(dentry);
     732                        /* perhaps lock and try to continue? (use cur as head?) */
     733                        goto inuse;
     734                    }
     735                    dput(dentry);
     736                    spin_lock(&inode->i_lock);
     737                    goto restart;
     738                }
     739                spin_unlock(&inode->i_lock);
     740#endif /* HAVE_DCACHE_LOCK */
    710741            inuse:
    711742                AFS_GLOCK();
    712743            }
  • src/cf/linux-test4.m4

    diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
    index 88e4863..2f426ce 100644
    a b AC_DEFUN([LINUX_HAVE_INODE_SETATTR], [ 
    13161316  if test "x$ac_cv_linux_inode_setattr" = "xyes"; then
    13171317    AC_DEFINE([HAVE_LINUX_INODE_SETATTR], 1, [define if your kernel has inode_setattr()])
    13181318  fi])
     1319
     1320AC_DEFUN([LINUX_HAVE_DCACHE_LOCK], [
     1321  AC_CHECK_LINUX_BUILD([for dcache_lock],
     1322                        [ac_cv_linux_have_dcache_lock],
     1323                        [#include <linux/dcache.h> ],
     1324                        [printk("%p", &dcache_lock);],
     1325                        [HAVE_DCACHE_LOCK],
     1326                        [define if dcache_lock exists],
     1327                        [])
     1328])
     1329
Note: See TracBrowser for help on using the repository browser.