source: trunk/server/common/patches/openafs-linux-support.patch @ 2337

Last change on this file since 2337 was 2337, checked in by andersk, 11 years ago
Revert to OpenAFS 1.6.1 plus minimal patches for Linux 3.6
File size: 33.5 KB
  • acinclude.m4

    From 53774c945e91ea344cbe51c9fafae8acf711f558 Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Mon, 28 May 2012 21:43:12 -0400
    Subject: [PATCH 01/12] Linux 3.4: replace end_writeback with clear_inode
    
    end_writeback() is renamed to clear_inode().  Add a configure test
    and cope.
    
    Change-Id: Icaf5b6b54d0ee377fabcf0b295d690eaa6b4be5e
    Reviewed-on: http://gerrit.openafs.org/7503
    Reviewed-by: Derrick Brashear <shadow@dementix.org>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    (cherry picked from commit 2b33384a4a7b88842281021129ffccc837d91d36)
    ---
     acinclude.m4               | 3 +++
     src/afs/LINUX/osi_vfsops.c | 4 ++++
     2 files changed, 7 insertions(+)
    
    diff --git a/acinclude.m4 b/acinclude.m4
    index 6e2c9ae..c14b581 100644
    a b case $AFS_SYSNAME in *_linux* | *_umlinux*) 
    840840#include <linux/page-flags.h>],
    841841                                     [struct page *_page;
    842842                                      int bchecked = PageFsMisc(_page);])
     843                 AC_CHECK_LINUX_FUNC([clear_inode],
     844                                     [#include <linux/fs.h>],
     845                                     [clear_inode(NULL);])
    843846                 AC_CHECK_LINUX_FUNC([current_kernel_time],
    844847                                     [#include <linux/time.h>],
    845848                                     [struct timespec s;
  • src/afs/LINUX/osi_vfsops.c

    diff --git a/src/afs/LINUX/osi_vfsops.c b/src/afs/LINUX/osi_vfsops.c
    index a6be1b3..bc951a2 100644
    a b afs_evict_inode(struct inode *ip) 
    284284        osi_Panic("inode freed while still hashed");
    285285
    286286    truncate_inode_pages(&ip->i_data, 0);
     287#if defined(HAVE_LINUX_CLEAR_INODE)
     288    clear_inode(ip);
     289#else
    287290    end_writeback(ip);
     291#endif
    288292
    289293#if !defined(STRUCT_SUPER_OPERATIONS_HAS_ALLOC_INODE)
    290294    afs_osi_Free(ip->u.generic_ip, sizeof(struct vcache));
  • acinclude.m4

    -- 
    1.8.0
    
    
    From 235dee4c449bb5d5307f9b14d5effa4509d58efc Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Sat, 2 Jun 2012 21:35:53 -0400
    Subject: [PATCH 02/12] Linux 3.5: encode_fh API change
    
    The encode_fh export operation now expects two inode arguments
    instead of a dentry and a "connectable" flag.  Use the inode of
    the dentry we're interested in, and NULL as the parent inode which
    is the same as passing a 0 flag in the previous API.
    
    Change-Id: I05cf146fb2a4bacdca20a9f108d04ccb11530804
    Reviewed-on: http://gerrit.openafs.org/7523
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@dementix.org>
    (cherry picked from commit 5227148ae17949705487ea673d558ebfe143e635)
    ---
     acinclude.m4               |  1 +
     src/afs/LINUX/osi_compat.h |  4 ++++
     src/cf/linux-test4.m4      | 14 ++++++++++++++
     3 files changed, 19 insertions(+)
    
    diff --git a/acinclude.m4 b/acinclude.m4
    index c14b581..25484cf 100644
    a b case $AFS_SYSNAME in *_linux* | *_umlinux*) 
    958958                 LINUX_D_COUNT_IS_INT
    959959                 LINUX_IOP_MKDIR_TAKES_UMODE_T
    960960                 LINUX_IOP_CREATE_TAKES_UMODE_T
     961                 LINUX_EXPORT_OP_ENCODE_FH_TAKES_INODES
    961962
    962963                 dnl If we are guaranteed that keyrings will work - that is
    963964                 dnl  a) The kernel has keyrings enabled
  • src/afs/LINUX/osi_compat.h

    diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
    index b94295c..4c7c261 100644
    a b afs_get_dentry_from_fh(struct super_block *afs_cacheSBp, afs_dcache_id_t *ainode 
    333333static inline int
    334334afs_get_fh_from_dentry(struct dentry *dp, afs_ufs_dcache_id_t *ainode, int *max_lenp) {
    335335    if (dp->d_sb->s_export_op->encode_fh)
     336#if defined(EXPORT_OP_ENCODE_FH_TAKES_INODES)
     337        return dp->d_sb->s_export_op->encode_fh(dp->d_inode, &ainode->raw[0], max_lenp, NULL);
     338#else
    336339        return dp->d_sb->s_export_op->encode_fh(dp, &ainode->raw[0], max_lenp, 0);
     340#endif
    337341#if defined(NEW_EXPORT_OPS)
    338342    /* If fs doesn't provide an encode_fh method, assume the default INO32 type */
    339343    *max_lenp = sizeof(struct fid)/4;
  • src/cf/linux-test4.m4

    diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
    index f5e91b1..f13e97d 100644
    a b AC_DEFUN([LINUX_IOP_CREATE_TAKES_UMODE_T], [ 
    661661                        [define if inode.i_op->create takes a umode_t argument],
    662662                        [-Werror])
    663663])
     664
     665
     666AC_DEFUN([LINUX_EXPORT_OP_ENCODE_FH_TAKES_INODES], [
     667  AC_CHECK_LINUX_BUILD([whether export operation encode_fh takes inode arguments],
     668                        [ac_cv_linux_export_op_encode_fh__takes_inodes],
     669                        [#include <linux/exportfs.h>],
     670                        [struct export_operations _exp_ops;
     671                        int _encode_fh(struct inode *i, __u32 *fh, int *len, struct inode *p)
     672                                {return 0;};
     673                        _exp_ops.encode_fh = _encode_fh;],
     674                        [EXPORT_OP_ENCODE_FH_TAKES_INODES],
     675                        [define if encode_fh export op takes inode arguments],
     676                        [-Werror])
     677])
  • src/afsd/afsd_kernel.c

    -- 
    1.8.0
    
    
    From f6093c4716d36b7499b5c84950e6ec4480745467 Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Sat, 2 Jun 2012 20:45:08 -0400
    Subject: [PATCH 03/12] afsd: include sys/resource.h in afsd_kernel.c
    
    With a recent glibc update, sys/wait.h no longer includes
    sys/resource.h unless __USE_SVID, __USE_XOPEN or __USE_XOPEN2K8
    are set.
    
    Don't rely on the indirect inclusion to get the bits we need;
    include it directly in afsd_kernel.c.  This include used to be
    there but was dropped when afsd_kernel.c was split off.
    
    Reviewed-on: http://gerrit.openafs.org/7522
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@dementix.org>
    (cherry picked from commit bc3a32a84facb8114a8c7de87025f972d0281098)
    
    Change-Id: Ia5ba6a0e662607e680b4431f146c969b7069bcfd
    Reviewed-on: http://gerrit.openafs.org/8155
    Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    Tested-by: Derrick Brashear <shadow@your-file-system.com>
    (cherry picked from commit 5842f856652051a4386b1e0170f18dca911ca4c6)
    ---
     src/afsd/afsd_kernel.c | 4 ++++
     1 file changed, 4 insertions(+)
    
    diff --git a/src/afsd/afsd_kernel.c b/src/afsd/afsd_kernel.c
    index 1f7fdbb..e1e87a7 100644
    a b  
    3737#include <sys/param.h>
    3838#endif
    3939
     40#if defined(AFS_LINUX20_ENV)
     41#include <sys/resource.h>
     42#endif
     43
    4044#ifdef HAVE_SYS_FS_TYPES_H
    4145#include <sys/fs_types.h>
    4246#endif
  • src/afs/afs_bypasscache.c

    -- 
    1.8.0
    
    
    From 31a7f5ef2fcb81c2510834befd15fb057d067eaf Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Mon, 13 Aug 2012 20:32:08 -0400
    Subject: [PATCH 04/12] Linux: bypass: consolidate copy_page macros into a
     single function
    
    The copy_page(s) macros are very similar; combine them into a
    single function that can be used for all cases.
    
    This will make it easier to add some pre-processor logic around
    the kmap_atomic calls to adapt to Linux API changes.
    
    Reviewed-on: http://gerrit.openafs.org/7980
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@dementix.org>
    (cherry picked from commit 0a8256a26fafb490b454f2a857b0c15d859572c5)
    
    Change-Id: I6835a024428b26a8cd8d073f6304d0d0b3042b24
    Reviewed-on: http://gerrit.openafs.org/8077
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    (cherry picked from commit 54db9af1a87c03d6f00ab70565c9d1f733813fc2)
    ---
     src/afs/afs_bypasscache.c | 63 ++++++++++++++++++-----------------------------
     1 file changed, 24 insertions(+), 39 deletions(-)
    
    diff --git a/src/afs/afs_bypasscache.c b/src/afs/afs_bypasscache.c
    index e447024..b350233 100644
    a b done: 
    270270#ifdef UKERNEL
    271271typedef void * bypass_page_t;
    272272
    273 #define copy_page(pp, pageoff, rxiov, iovno, iovoff, auio, curiov)      \
    274     do { \
    275         int dolen = auio->uio_iov[curiov].iov_len - pageoff; \
    276         memcpy(((char *)pp) + pageoff,                 \
    277                ((char *)rxiov[iovno].iov_base) + iovoff, dolen);        \
    278         auio->uio_resid -= dolen; \
    279     } while(0)
    280 
    281 #define copy_pages(pp, pageoff, rxiov, iovno, iovoff, auio, curiov)     \
    282     do { \
    283         int dolen = rxiov[iovno].iov_len - iovoff; \
    284         memcpy(((char *)pp) + pageoff,                          \
    285                ((char *)rxiov[iovno].iov_base) + iovoff, dolen);        \
    286         auio->uio_resid -= dolen;       \
    287     } while(0)
    288 
    289273#define unlock_and_release_pages(auio)
    290274#define release_full_page(pp, pageoff)
    291275
    292276#else
    293277typedef struct page * bypass_page_t;
    294278
    295 #define copy_page(pp, pageoff, rxiov, iovno, iovoff, auio, curiov)      \
    296     do { \
    297         char *address;                                          \
    298         int dolen = auio->uio_iov[curiov].iov_len - pageoff; \
    299         address = kmap_atomic(pp, KM_USER0); \
    300         memcpy(address + pageoff, \
    301                (char *)(rxiov[iovno].iov_base) + iovoff, dolen);        \
    302         kunmap_atomic(address, KM_USER0); \
    303     } while(0)
    304 
    305 #define copy_pages(pp, pageoff, rxiov, iovno, iovoff, auio, curiov)     \
    306     do { \
    307         char *address; \
    308         int dolen = rxiov[iovno].iov_len - iovoff; \
    309         address = kmap_atomic(pp, KM_USER0); \
    310         memcpy(address + pageoff, \
    311                (char *)(rxiov[iovno].iov_base) + iovoff, dolen);        \
    312         kunmap_atomic(address, KM_USER0); \
    313     } while(0)
    314 
    315 
    316279#define unlock_and_release_pages(auio) \
    317280    do { \
    318281        struct iovec *ciov;     \
    typedef struct page * bypass_page_t; 
    347310            afs_warn("afs_NoCacheFetchProc: page not locked!\n"); \
    348311        put_page(pp); /* decrement refcount */ \
    349312    } while(0)
     313#endif
     314
     315static void
     316afs_bypass_copy_page(bypass_page_t pp, int pageoff, struct iovec *rxiov,
     317        int iovno, int iovoff, struct uio *auio, int curiov, int partial)
     318{
     319    char *address;
     320    int dolen;
     321
     322    if (partial)
     323        dolen = rxiov[iovno].iov_len - iovoff;
     324    else
     325        dolen = auio->uio_iov[curiov].iov_len - pageoff;
    350326
     327#if !defined(UKERNEL)
     328    address = kmap_atomic(pp, KM_USER0);
     329#else
     330    address = pp;
    351331#endif
     332    memcpy(address + pageoff, (char *)(rxiov[iovno].iov_base) + iovoff, dolen);
     333#if !defined(UKERNEL)
     334    kunmap_atomic(address, KM_USER0);
     335#endif
     336}
    352337
    353338/* no-cache prefetch routine */
    354339static afs_int32
    afs_NoCacheFetchProc(struct rx_call *acall, 
    447432                if (pageoff + (rxiov[iovno].iov_len - iovoff) <= auio->uio_iov[curpage].iov_len) {
    448433                    /* Copy entire (or rest of) current iovec into current page */
    449434                    if (pp)
    450                         copy_pages(pp, pageoff, rxiov, iovno, iovoff, auio, curpage);
     435                        afs_bypass_copy_page(pp, pageoff, rxiov, iovno, iovoff, auio, curpage, 0);
    451436                    length -= (rxiov[iovno].iov_len - iovoff);
    452437                    pageoff += rxiov[iovno].iov_len - iovoff;
    453438                    iovno++;
    afs_NoCacheFetchProc(struct rx_call *acall, 
    455440                } else {
    456441                    /* Copy only what's needed to fill current page */
    457442                    if (pp)
    458                         copy_page(pp, pageoff, rxiov, iovno, iovoff, auio, curpage);
     443                        afs_bypass_copy_page(pp, pageoff, rxiov, iovno, iovoff, auio, curpage, 1);
    459444                    length -= (auio->uio_iov[curpage].iov_len - pageoff);
    460445                    iovoff += auio->uio_iov[curpage].iov_len - pageoff;
    461446                    pageoff = auio->uio_iov[curpage].iov_len;
  • acinclude.m4

    -- 
    1.8.0
    
    
    From 51102503174a33c0bbb74a062a9413a0f041588e Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Tue, 14 Aug 2012 16:34:42 -0400
    Subject: [PATCH 05/12] Linux 3.6: kmap_atomic API change
    
    kmap_atomic no longer requires a KM_TYPE argument.  Test for this
    and adjust the affected code.
    
    Reviewed-on: http://gerrit.openafs.org/7981
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@dementix.org>
    (cherry picked from commit 049c485b4a39ba510035788b4959d839ef668c55)
    
    Change-Id: Iac8be7901da4b277864b1b6cc987cf5087992789
    Reviewed-on: http://gerrit.openafs.org/8078
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
    Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    (cherry picked from commit 76ab286feb1570efa9763e076020fc43fb0a95fa)
    ---
     acinclude.m4              |  1 +
     src/afs/afs_bypasscache.c |  8 ++++++++
     src/cf/linux-test4.m4     | 12 ++++++++++++
     3 files changed, 21 insertions(+)
    
    diff --git a/acinclude.m4 b/acinclude.m4
    index 25484cf..20fd15e 100644
    a b case $AFS_SYSNAME in *_linux* | *_umlinux*) 
    959959                 LINUX_IOP_MKDIR_TAKES_UMODE_T
    960960                 LINUX_IOP_CREATE_TAKES_UMODE_T
    961961                 LINUX_EXPORT_OP_ENCODE_FH_TAKES_INODES
     962                 LINUX_KMAP_ATOMIC_TAKES_NO_KM_TYPE
    962963
    963964                 dnl If we are guaranteed that keyrings will work - that is
    964965                 dnl  a) The kernel has keyrings enabled
  • src/afs/afs_bypasscache.c

    diff --git a/src/afs/afs_bypasscache.c b/src/afs/afs_bypasscache.c
    index b350233..1138f89 100644
    a b afs_bypass_copy_page(bypass_page_t pp, int pageoff, struct iovec *rxiov, 
    325325        dolen = auio->uio_iov[curiov].iov_len - pageoff;
    326326
    327327#if !defined(UKERNEL)
     328# if defined(KMAP_ATOMIC_TAKES_NO_KM_TYPE)
     329    address = kmap_atomic(pp);
     330# else
    328331    address = kmap_atomic(pp, KM_USER0);
     332# endif
    329333#else
    330334    address = pp;
    331335#endif
    332336    memcpy(address + pageoff, (char *)(rxiov[iovno].iov_base) + iovoff, dolen);
    333337#if !defined(UKERNEL)
     338# if defined(KMAP_ATOMIC_TAKES_NO_KM_TYPE)
     339    kunmap_atomic(address);
     340# else
    334341    kunmap_atomic(address, KM_USER0);
     342# endif
    335343#endif
    336344}
    337345
  • src/cf/linux-test4.m4

    diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
    index f13e97d..7db805f 100644
    a b AC_DEFUN([LINUX_EXPORT_OP_ENCODE_FH_TAKES_INODES], [ 
    675675                        [define if encode_fh export op takes inode arguments],
    676676                        [-Werror])
    677677])
     678
     679
     680AC_DEFUN([LINUX_KMAP_ATOMIC_TAKES_NO_KM_TYPE], [
     681  AC_CHECK_LINUX_BUILD([whether kmap_atomic takes no km_type argument],
     682                        [ac_cv_linux_kma_atomic_takes_no_km_type],
     683                        [#include <linux/highmem.h>],
     684                        [struct page *p = NULL;
     685                        kmap_atomic(p);],
     686                        [KMAP_ATOMIC_TAKES_NO_KM_TYPE],
     687                        [define if kmap_atomic takes no km_type argument],
     688                        [-Werror])
     689])
  • acinclude.m4

    -- 
    1.8.0
    
    
    From f842c54d6cba963ce34f2d092c9586c6ee21a13c Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Mon, 13 Aug 2012 21:36:15 -0400
    Subject: [PATCH 06/12] Linux 3.6: dentry_open API change
    
    dentry_open now takes a path argument that combines the dentry and
    the vfsmount pointers.
    Add a configure test and a new compat inline function to keep things
    cleaner in the main source file.
    
    Reviewed-on: http://gerrit.openafs.org/7982
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@dementix.org>
    (cherry picked from commit 8766a65e97eb90cb6c97ccd35181c441ece14f8a)
    
    Change-Id: I2c0f59ad9aa6e544a2a613e902933d463f22a5b6
    Reviewed-on: http://gerrit.openafs.org/8079
    Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    (cherry picked from commit 1bba9760b26bdb1ef1e17f9d1e15be9d565828cc)
    ---
     acinclude.m4               |  1 +
     src/afs/LINUX/osi_compat.h | 16 ++++++++++++++++
     src/afs/LINUX/osi_file.c   |  4 ++--
     src/cf/linux-test4.m4      | 12 ++++++++++++
     4 files changed, 31 insertions(+), 2 deletions(-)
    
    diff --git a/acinclude.m4 b/acinclude.m4
    index 20fd15e..d99c755 100644
    a b case $AFS_SYSNAME in *_linux* | *_umlinux*) 
    960960                 LINUX_IOP_CREATE_TAKES_UMODE_T
    961961                 LINUX_EXPORT_OP_ENCODE_FH_TAKES_INODES
    962962                 LINUX_KMAP_ATOMIC_TAKES_NO_KM_TYPE
     963                 LINUX_DENTRY_OPEN_TAKES_PATH
    963964
    964965                 dnl If we are guaranteed that keyrings will work - that is
    965966                 dnl  a) The kernel has keyrings enabled
  • src/afs/LINUX/osi_compat.h

    diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
    index 4c7c261..84fcaa5 100644
    a b afs_get_dentry_ref(struct path *path, struct vfsmount **mnt, struct dentry **dpp 
    445445#endif
    446446}
    447447
     448#if defined(STRUCT_TASK_STRUCT_HAS_CRED)
     449static inline struct file *
     450afs_dentry_open(struct dentry *dp, struct vfsmount *mnt, int flags, const struct cred *creds) {
     451#if defined(DENTRY_OPEN_TAKES_PATH)
     452    struct path path;
     453    struct file *filp;
     454    path.mnt = mnt;
     455    path.dentry = dp;
     456    filp = dentry_open(&path, flags, creds);
     457    return filp;
     458#else
     459    return dentry_open(dp, mntget(mnt), flags, creds);
     460#endif
     461}
     462#endif
     463
    448464#endif /* AFS_LINUX_OSI_COMPAT_H */
  • src/afs/LINUX/osi_file.c

    diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c
    index 3c20fd9..27806ab 100644
    a b afs_linux_raw_open(afs_dcache_id_t *ainode) 
    5656
    5757#if defined(STRUCT_TASK_STRUCT_HAS_CRED)
    5858    /* Use stashed credentials - prevent selinux/apparmor problems  */
    59     filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, cache_creds);
     59    filp = afs_dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, cache_creds);
    6060    if (IS_ERR(filp))
    61         filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, current_cred());
     61        filp = afs_dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, current_cred());
    6262#else
    6363    filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR);
    6464#endif
  • src/cf/linux-test4.m4

    diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
    index 7db805f..427c5e1 100644
    a b AC_DEFUN([LINUX_KMAP_ATOMIC_TAKES_NO_KM_TYPE], [ 
    687687                        [define if kmap_atomic takes no km_type argument],
    688688                        [-Werror])
    689689])
     690
     691
     692AC_DEFUN([LINUX_DENTRY_OPEN_TAKES_PATH], [
     693  AC_CHECK_LINUX_BUILD([whether dentry_open takes a path argument],
     694                        [ac_cv_linux_dentry_open_takes_path],
     695                        [#include <linux/fs.h>],
     696                        [struct path p;
     697                        dentry_open(&p, 0, NULL);],
     698                        [DENTRY_OPEN_TAKES_PATH],
     699                        [define if dentry_open takes a path argument],
     700                        [-Werror])
     701])
  • acinclude.m4

    -- 
    1.8.0
    
    
    From 1aebd8757ba9684e0be18d722797a594146cefce Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Mon, 13 Aug 2012 21:55:25 -0400
    Subject: [PATCH 07/12] Linux 3.6: d_alias and i_dentry are now hlists
    
    The d_alias pointer is now the head of an hlist.  This means the
    iterator is a different macro and has no "reverse" version since
    hlists have no direct pointer to the list tail.
    
    inode->i_dentry gets the same treatment.  Adjust where we use it.
    
    Reviewed-on: http://gerrit.openafs.org/7983
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@dementix.org>
    (cherry picked from commit 6bea047fb404bde828c6358ae06f7941aa2bc959)
    
    Change-Id: I7e7b87e5f5c240f3f0ff25fa723c857ab9d0108c
    Reviewed-on: http://gerrit.openafs.org/8080
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    (cherry picked from commit b5a66fb391b47848f023042e96c87a1b7d49b888)
    ---
     acinclude.m4               |  1 +
     src/afs/LINUX/osi_vcache.c | 12 ++++++++++++
     src/afs/afs_daemons.c      |  5 +++++
     src/cf/linux-test4.m4      | 13 +++++++++++++
     4 files changed, 31 insertions(+)
    
    diff --git a/acinclude.m4 b/acinclude.m4
    index d99c755..d52d149 100644
    a b case $AFS_SYSNAME in *_linux* | *_umlinux*) 
    961961                 LINUX_EXPORT_OP_ENCODE_FH_TAKES_INODES
    962962                 LINUX_KMAP_ATOMIC_TAKES_NO_KM_TYPE
    963963                 LINUX_DENTRY_OPEN_TAKES_PATH
     964                 LINUX_D_ALIAS_IS_HLIST
    964965
    965966                 dnl If we are guaranteed that keyrings will work - that is
    966967                 dnl  a) The kernel has keyrings enabled
  • src/afs/LINUX/osi_vcache.c

    diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c
    index e82d78e..cd61c65 100644
    a b osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { 
    1919
    2020    struct dentry *dentry;
    2121    struct inode *inode = AFSTOV(avc);
     22#if defined(D_ALIAS_IS_HLIST)
     23    struct hlist_node *cur, *head;
     24#else
    2225    struct list_head *cur, *head;
     26#endif
    2327
    2428    /* First, see if we can evict the inode from the dcache */
    2529    if (defersleep && avc != afs_globalVp && VREFCOUNT(avc) > 1 && avc->opens == 0) {
    restart: 
    5357        spin_unlock(&dcache_lock);
    5458#else /* HAVE_DCACHE_LOCK */
    5559        spin_lock(&inode->i_lock);
     60#if defined(D_ALIAS_IS_HLIST)
     61        head = inode->i_dentry.first;
     62#else
    5663        head = &inode->i_dentry;
     64#endif
    5765
    5866restart:
    5967        cur = head;
    6068        while ((cur = cur->next) != head) {
     69#if defined(D_ALIAS_IS_HLIST)
     70            dentry = hlist_entry(cur, struct dentry, d_alias);
     71#else
    6172            dentry = list_entry(cur, struct dentry, d_alias);
     73#endif
    6274
    6375            spin_lock(&dentry->d_lock);
    6476            if (d_unhashed(dentry)) {
  • src/afs/afs_daemons.c

    diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c
    index 23655e3..f47be0e 100644
    a b afs_CheckRootVolume(void) 
    396396                    spin_lock(&dp->d_lock);
    397397#endif
    398398#endif
     399#if defined(D_ALIAS_IS_HLIST)
     400                    hlist_del_init(&dp->d_alias);
     401                    hlist_add_head(&dp->d_alias, &(AFSTOV(vcp)->i_dentry));
     402#else
    399403                    list_del_init(&dp->d_alias);
    400404                    list_add(&dp->d_alias, &(AFSTOV(vcp)->i_dentry));
     405#endif
    401406                    dp->d_inode = AFSTOV(vcp);
    402407#if defined(AFS_LINUX24_ENV)
    403408#if defined(AFS_LINUX26_ENV)
  • src/cf/linux-test4.m4

    diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
    index 427c5e1..6b70059 100644
    a b AC_DEFUN([LINUX_DENTRY_OPEN_TAKES_PATH], [ 
    699699                        [define if dentry_open takes a path argument],
    700700                        [-Werror])
    701701])
     702
     703
     704AC_DEFUN([LINUX_D_ALIAS_IS_HLIST], [
     705  AC_CHECK_LINUX_BUILD([whether dentry->d_alias is an hlist],
     706                        [ac_cv_linux_d_alias_is_hlist],
     707                        [#include <linux/fs.h>],
     708                        [struct dentry *d = NULL;
     709                        struct hlist_node *hn = NULL;
     710                        d->d_alias = *hn;],
     711                        [D_ALIAS_IS_HLIST],
     712                        [define if dentry->d_alias is an hlist],
     713                        [])
     714])
  • src/afs/LINUX/osi_vnodeops.c

    -- 
    1.8.0
    
    
    From 10f8f641542d9bc16c9a9c953324fa9d89b81607 Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Tue, 14 Aug 2012 17:11:08 -0400
    Subject: [PATCH 08/12] Linux: fix variable used to test for the iop create
     API
    
    Use correct variable when testing for the create API to use.
    
    This is just for looks - there is no effect since mkdir and create
    were changed in the same kernel release.
    
    Reviewed-on: http://gerrit.openafs.org/7984
    Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@dementix.org>
    (cherry picked from commit c633a92a1bc7881f18ee641082ff2efe7da1a8cb)
    
    Change-Id: Ib23fe9a34bc07227614c149b0f16d3b0a067501b
    Reviewed-on: http://gerrit.openafs.org/8081
    Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    (cherry picked from commit aecd183acb34a0a9b850fb69eed472d2c9a27612)
    ---
     src/afs/LINUX/osi_vnodeops.c | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
    index 4cda547..b3bf115 100644
    a b struct dentry_operations afs_dentry_operations = { 
    10941094 * name is in kernel space at this point.
    10951095 */
    10961096static int
    1097 #if defined(IOP_MKDIR_TAKES_UMODE_T)
     1097#if defined(IOP_CREATE_TAKES_UMODE_T)
    10981098afs_linux_create(struct inode *dip, struct dentry *dp, umode_t mode,
    10991099                 struct nameidata *nd)
    11001100#else
  • acinclude.m4

    -- 
    1.8.0
    
    
    From 6cbb9a258b73c28c0295f93b75cbd437efe3713a Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Tue, 14 Aug 2012 17:28:50 -0400
    Subject: [PATCH 09/12] Linux 3.6: create inode operation API change
    
    The nameidata argument is dropped and a flag is added.
    
    Reviewed-on: http://gerrit.openafs.org/7985
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@dementix.org>
    (cherry picked from commit 020e32779c103817ca89caa51259fb53bc3dde79)
    
    Change-Id: Iae2a0301a1c4acb6835eb0bdca6ae22b143b2cda
    Reviewed-on: http://gerrit.openafs.org/8082
    Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    (cherry picked from commit 5210d97865d974d5e14f68eec6a58b292d6b7893)
    ---
     acinclude.m4                 |  1 +
     src/afs/LINUX/osi_vnodeops.c |  9 +++++----
     src/cf/linux-test4.m4        | 15 +++++++++++++++
     3 files changed, 21 insertions(+), 4 deletions(-)
    
    diff --git a/acinclude.m4 b/acinclude.m4
    index d52d149..1c84354 100644
    a b case $AFS_SYSNAME in *_linux* | *_umlinux*) 
    962962                 LINUX_KMAP_ATOMIC_TAKES_NO_KM_TYPE
    963963                 LINUX_DENTRY_OPEN_TAKES_PATH
    964964                 LINUX_D_ALIAS_IS_HLIST
     965                 LINUX_IOP_I_CREATE_TAKES_BOOL
    965966
    966967                 dnl If we are guaranteed that keyrings will work - that is
    967968                 dnl  a) The kernel has keyrings enabled
  • src/afs/LINUX/osi_vnodeops.c

    diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
    index b3bf115..8c8045b 100644
    a b struct dentry_operations afs_dentry_operations = { 
    10941094 * name is in kernel space at this point.
    10951095 */
    10961096static int
    1097 #if defined(IOP_CREATE_TAKES_UMODE_T)
     1097#if defined(IOP_CREATE_TAKES_BOOL)
     1098afs_linux_create(struct inode *dip, struct dentry *dp, umode_t mode,
     1099                 bool excl)
     1100#elif defined(IOP_CREATE_TAKES_UMODE_T)
    10981101afs_linux_create(struct inode *dip, struct dentry *dp, umode_t mode,
    10991102                 struct nameidata *nd)
    1100 #else
    1101 #ifdef IOP_CREATE_TAKES_NAMEIDATA
     1103#elif defined(IOP_CREATE_TAKES_NAMEIDATA)
    11021104afs_linux_create(struct inode *dip, struct dentry *dp, int mode,
    11031105                 struct nameidata *nd)
    11041106#else
    11051107afs_linux_create(struct inode *dip, struct dentry *dp, int mode)
    11061108#endif
    1107 #endif
    11081109{
    11091110    struct vattr vattr;
    11101111    cred_t *credp = crref();
  • src/cf/linux-test4.m4

    diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
    index 6b70059..dc30770 100644
    a b AC_DEFUN([LINUX_D_ALIAS_IS_HLIST], [ 
    712712                        [define if dentry->d_alias is an hlist],
    713713                        [])
    714714])
     715
     716
     717AC_DEFUN([LINUX_IOP_I_CREATE_TAKES_BOOL], [
     718  AC_CHECK_LINUX_BUILD([whether inode_operations.create takes a bool],
     719                        [ac_cv_linux_func_i_create_takes_bool],
     720                        [#include <linux/fs.h>
     721                        #include <linux/namei.h>],
     722                        [struct inode _inode = {};
     723                        struct dentry _dentry;
     724                        bool b = true;
     725                        (void)_inode.i_op->create(&_inode, &_dentry, 0, b);],
     726                       [IOP_CREATE_TAKES_BOOL],
     727                       [define if your iops.create takes a bool argument],
     728                       [-Werror])
     729])
  • acinclude.m4

    -- 
    1.8.0
    
    
    From ebfd3de107e0dd97127aa12e572684cc98a457cf Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Tue, 14 Aug 2012 18:08:51 -0400
    Subject: [PATCH 10/12] Linux 3.6: revalidate dentry op API change
    
    The nameidata argument is dropped, replaced by an unsigned flags
    value.  The configure test is very specific; kernels with the
    older API with a signed int flags value should fall through.
    
    Reviewed-on: http://gerrit.openafs.org/7986
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@dementix.org>
    (cherry picked from commit 7413cd09a53f89882a46fd100bf6c501348f2188)
    
    Change-Id: Ie68d70dcf414d24e7e980c8a8f35b83550d2da7c
    Reviewed-on: http://gerrit.openafs.org/8083
    Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    (cherry picked from commit 4ab59d7ee924a6be1d553f75a67b0b253cc85e88)
    ---
     acinclude.m4                 |  1 +
     src/afs/LINUX/osi_vnodeops.c |  8 +++++++-
     src/cf/linux-test4.m4        | 14 ++++++++++++++
     3 files changed, 22 insertions(+), 1 deletion(-)
    
    diff --git a/acinclude.m4 b/acinclude.m4
    index 1c84354..8bb5bf7 100644
    a b case $AFS_SYSNAME in *_linux* | *_umlinux*) 
    963963                 LINUX_DENTRY_OPEN_TAKES_PATH
    964964                 LINUX_D_ALIAS_IS_HLIST
    965965                 LINUX_IOP_I_CREATE_TAKES_BOOL
     966                 LINUX_DOP_D_REVALIDATE_TAKES_UNSIGNED
    966967
    967968                 dnl If we are guaranteed that keyrings will work - that is
    968969                 dnl  a) The kernel has keyrings enabled
  • src/afs/LINUX/osi_vnodeops.c

    diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
    index 8c8045b..49f8b96 100644
    a b afs_linux_getattr(struct vfsmount *mnt, struct dentry *dentry, struct kstat *sta 
    906906 * later on, we shouldn't have to do it until later. Perhaps in the future..
    907907 */
    908908static int
    909 #ifdef DOP_REVALIDATE_TAKES_NAMEIDATA
     909#if defined(DOP_REVALIDATE_TAKES_UNSIGNED)
     910afs_linux_dentry_revalidate(struct dentry *dp, unsigned int flags)
     911#elif defined(DOP_REVALIDATE_TAKES_NAMEIDATA)
    910912afs_linux_dentry_revalidate(struct dentry *dp, struct nameidata *nd)
    911913#else
    912914afs_linux_dentry_revalidate(struct dentry *dp, int flags)
    afs_linux_dentry_revalidate(struct dentry *dp, int flags) 
    921923
    922924#ifdef LOOKUP_RCU
    923925    /* We don't support RCU path walking */
     926# if defined(DOP_REVALIDATE_TAKES_UNSIGNED)
     927    if (flags & LOOKUP_RCU)
     928# else
    924929    if (nd->flags & LOOKUP_RCU)
     930# endif
    925931       return -ECHILD;
    926932#endif
    927933    AFS_GLOCK();
  • src/cf/linux-test4.m4

    diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
    index dc30770..4a6ec02 100644
    a b AC_DEFUN([LINUX_IOP_I_CREATE_TAKES_BOOL], [ 
    727727                       [define if your iops.create takes a bool argument],
    728728                       [-Werror])
    729729])
     730
     731
     732AC_DEFUN([LINUX_DOP_D_REVALIDATE_TAKES_UNSIGNED], [
     733  AC_CHECK_LINUX_BUILD([whether dentry_operations.d_revalidate takes an unsigned int],
     734                        [ac_cv_linux_func_d_revalidate_takes_unsigned],
     735                        [#include <linux/fs.h>
     736                        #include <linux/namei.h>],
     737                        [struct dentry_operations dops;
     738                        int reval(struct dentry *d, unsigned int i) { return 0; };
     739                        dops.d_revalidate = reval;],
     740                       [DOP_REVALIDATE_TAKES_UNSIGNED],
     741                       [define if your dops.d_revalidate takes an unsigned int argument],
     742                       [-Werror])
     743])
  • acinclude.m4

    -- 
    1.8.0
    
    
    From 208d7925bd59490712bfd6bedc41ba5e3a8f4a6c Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Tue, 14 Aug 2012 18:26:24 -0400
    Subject: [PATCH 11/12] Linux 3.6: lookup inode operation API change
    
    The nameidata argument is replaced with an unsigned int flags
    argument.
    
    Reviewed-on: http://gerrit.openafs.org/7987
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@dementix.org>
    (cherry picked from commit ec48dca871ef98adb69792a34047c6be5818f1b2)
    
    Change-Id: Ic8be26141ede6e1c4062872c79a846efb0045bda
    Reviewed-on: http://gerrit.openafs.org/8084
    Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    (cherry picked from commit 6c22f2e1de91fa3080221df22fdcd05064b57307)
    ---
     acinclude.m4                 |  1 +
     src/afs/LINUX/osi_vnodeops.c |  5 ++++-
     src/cf/linux-test4.m4        | 14 ++++++++++++++
     3 files changed, 19 insertions(+), 1 deletion(-)
    
    diff --git a/acinclude.m4 b/acinclude.m4
    index 8bb5bf7..4b49449 100644
    a b case $AFS_SYSNAME in *_linux* | *_umlinux*) 
    964964                 LINUX_D_ALIAS_IS_HLIST
    965965                 LINUX_IOP_I_CREATE_TAKES_BOOL
    966966                 LINUX_DOP_D_REVALIDATE_TAKES_UNSIGNED
     967                 LINUX_IOP_LOOKUP_TAKES_UNSIGNED
    967968
    968969                 dnl If we are guaranteed that keyrings will work - that is
    969970                 dnl  a) The kernel has keyrings enabled
  • src/afs/LINUX/osi_vnodeops.c

    diff --git a/src/afs/LINUX/osi_vnodeops.c b/src/afs/LINUX/osi_vnodeops.c
    index 49f8b96..c376bd1 100644
    a b afs_linux_create(struct inode *dip, struct dentry *dp, int mode) 
    11471147
    11481148/* afs_linux_lookup */
    11491149static struct dentry *
    1150 #ifdef IOP_LOOKUP_TAKES_NAMEIDATA
     1150#if defined(IOP_LOOKUP_TAKES_UNSIGNED)
     1151afs_linux_lookup(struct inode *dip, struct dentry *dp,
     1152                 unsigned flags)
     1153#elif defined(IOP_LOOKUP_TAKES_NAMEIDATA)
    11511154afs_linux_lookup(struct inode *dip, struct dentry *dp,
    11521155                 struct nameidata *nd)
    11531156#else
  • src/cf/linux-test4.m4

    diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4
    index 4a6ec02..fc0149f 100644
    a b AC_DEFUN([LINUX_DOP_D_REVALIDATE_TAKES_UNSIGNED], [ 
    741741                       [define if your dops.d_revalidate takes an unsigned int argument],
    742742                       [-Werror])
    743743])
     744
     745
     746AC_DEFUN([LINUX_IOP_LOOKUP_TAKES_UNSIGNED], [
     747  AC_CHECK_LINUX_BUILD([whether inode operation lookup takes an unsigned int],
     748                        [ac_cv_linux_func_lookup_takes_unsigned],
     749                        [#include <linux/fs.h>
     750                        #include <linux/namei.h>],
     751                        [struct inode_operations iops;
     752                        struct dentry *look(struct inode *i, struct dentry *d, unsigned int j) { return NULL; };
     753                        iops.lookup = look;],
     754                       [IOP_LOOKUP_TAKES_UNSIGNED],
     755                       [define if your iops.lookup takes an unsigned int argument],
     756                       [-Werror])
     757])
  • src/afs/LINUX/osi_vcache.c

    -- 
    1.8.0
    
    
    From 6c53a1dea7d8fe3174405febf2bf7b98a219824d Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Fri, 12 Oct 2012 16:25:43 -0400
    Subject: [PATCH 12/12] Linux: osi_vcache: Fix loop for the hlist case
    
    An hlist is not circular, and the end is marked by a NULL next
    pointer.
    
    Reviewed-on: http://gerrit.openafs.org/8233
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    (cherry picked from commit 78ae01fb9837d79e7bbdb2918872ab106d4c7e98)
    
    Change-Id: I7e4e3ed2515dd8c2ec765d8acbb97eba189d6aeb
    Reviewed-on: http://gerrit.openafs.org/8239
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    (cherry picked from commit 0506af9c058e22e3475f7e152c022571c0823253)
    ---
     src/afs/LINUX/osi_vcache.c | 8 +++++---
     1 file changed, 5 insertions(+), 3 deletions(-)
    
    diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c
    index cd61c65..dc3685b 100644
    a b osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep) { 
    2020    struct dentry *dentry;
    2121    struct inode *inode = AFSTOV(avc);
    2222#if defined(D_ALIAS_IS_HLIST)
    23     struct hlist_node *cur, *head;
     23    struct hlist_node *cur, *head, *list_end;
    2424#else
    25     struct list_head *cur, *head;
     25    struct list_head *cur, *head, *list_end;
    2626#endif
    2727
    2828    /* First, see if we can evict the inode from the dcache */
    restart: 
    5959        spin_lock(&inode->i_lock);
    6060#if defined(D_ALIAS_IS_HLIST)
    6161        head = inode->i_dentry.first;
     62        list_end = NULL;
    6263#else
    6364        head = &inode->i_dentry;
     65        list_end = head;
    6466#endif
    6567
    6668restart:
    6769        cur = head;
    68         while ((cur = cur->next) != head) {
     70        while ((cur = cur->next) != list_end) {
    6971#if defined(D_ALIAS_IS_HLIST)
    7072            dentry = hlist_entry(cur, struct dentry, d_alias);
    7173#else
Note: See TracBrowser for help on using the repository browser.