source: trunk/server/common/patches/openafs-linux-3.8-enablement.patch @ 2401

Last change on this file since 2401 was 2401, checked in by achernya, 9 years ago
Add the openafs 3.8 enablement patch
File size: 20.9 KB
  • src/afs/LINUX/osi_machdep.h

    From 5a21be491adc6acd3cc01990910c5675393be953 Mon Sep 17 00:00:00 2001
    From: Andrew Deason <adeason@sinenomine.net>
    Date: Wed, 29 Aug 2012 11:34:06 -0500
    Subject: [PATCH] LINUX: Indent osi_machdep.h maze
    
    This one isn't so bad, actually, but it still benefits from some
    indentation.
    
    Reviewed-on: http://gerrit.openafs.org/8018
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@dementix.org>
    (cherry picked from commit 579048cb1ec24b09a869928ceb521c8db4201a43)
    
    Change-Id: I91bddcafe4141c5e6789b01cc4be1a879b6464d1
    Reviewed-on: http://gerrit.openafs.org/9330
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    ---
     src/afs/LINUX/osi_machdep.h |  240 +++++++++++++++++++++----------------------
     1 file changed, 120 insertions(+), 120 deletions(-)
    
    diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h
    index a2c16f5..9260733 100644
    a b  
    1717
    1818#include <linux/version.h>
    1919#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,4)
    20 #define AFS_LINUX26_ONEGROUP_ENV 1
     20# define AFS_LINUX26_ONEGROUP_ENV 1
    2121#endif
    2222
    2323/* Only needed for xdr.h in glibc 2.1.x */
    2424#ifndef quad_t
    25 #define quad_t __quad_t
    26 #define u_quad_t __u_quad_t
     25# define quad_t __quad_t
     26# define u_quad_t __u_quad_t
    2727#endif
    2828
    2929#undef getuerror
    3030
    3131#ifdef STRUCT_TASK_STRUCT_HAS_TGID
    32 #define getpid() current->tgid
    33 #ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
    34 #define getppid() current->real_parent->tgid
    35 #elif defined(STRUCT_TASK_STRUCT_HAS_PARENT)
    36 #define getppid() current->parent->tgid
    37 #else
    38 #define getppid() current->p_opptr->tgid
    39 #endif
     32# define getpid() current->tgid
     33# ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
     34#  define getppid() current->real_parent->tgid
     35# elif defined(STRUCT_TASK_STRUCT_HAS_PARENT)
     36#  define getppid() current->parent->tgid
     37# else
     38#  define getppid() current->p_opptr->tgid
     39# endif
    4040#else /* !STRUCT_TASK_STRUCT_HAS_TGID */
    41 #define getpid() current->pid
    42 #ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
    43 #define getppid() current->real_parent->pid
    44 #elif defined(STRUCT_TASK_STRUCT_HAS_PARENT)
    45 #define getppid() current->parent->pid
    46 #else
    47 #define getppid() current->p_opptr->pid
    48 #endif
     41# define getpid() current->pid
     42# ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT
     43#  define getppid() current->real_parent->pid
     44# elif defined(STRUCT_TASK_STRUCT_HAS_PARENT)
     45#  define getppid() current->parent->pid
     46# else
     47#  define getppid() current->p_opptr->pid
     48# endif
    4949#endif /* STRUCT_TASK_STRUCT_HAS_TGID */
    5050
    5151#ifdef RECALC_SIGPENDING_TAKES_VOID
    52 #define RECALC_SIGPENDING(X) recalc_sigpending()
     52# define RECALC_SIGPENDING(X) recalc_sigpending()
    5353#else
    54 #define RECALC_SIGPENDING(X) recalc_sigpending(X)
     54# define RECALC_SIGPENDING(X) recalc_sigpending(X)
    5555#endif
    5656
    5757#if defined (STRUCT_TASK_STRUCT_HAS_SIGMASK_LOCK)
    58 #define SIG_LOCK(X) spin_lock_irq(&X->sigmask_lock)
    59 #define SIG_UNLOCK(X) spin_unlock_irq(&X->sigmask_lock)
     58# define SIG_LOCK(X) spin_lock_irq(&X->sigmask_lock)
     59# define SIG_UNLOCK(X) spin_unlock_irq(&X->sigmask_lock)
    6060#elif defined (STRUCT_TASK_STRUCT_HAS_SIGHAND)
    61 #define SIG_LOCK(X) spin_lock_irq(&X->sighand->siglock)
    62 #define SIG_UNLOCK(X) spin_unlock_irq(&X->sighand->siglock)
     61# define SIG_LOCK(X) spin_lock_irq(&X->sighand->siglock)
     62# define SIG_UNLOCK(X) spin_unlock_irq(&X->sighand->siglock)
    6363#else
    64 #define SIG_LOCK(X) spin_lock_irq(&X->sig->siglock)
    65 #define SIG_UNLOCK(X) spin_unlock_irq(&X->sig->siglock)
     64# define SIG_LOCK(X) spin_lock_irq(&X->sig->siglock)
     65# define SIG_UNLOCK(X) spin_unlock_irq(&X->sig->siglock)
    6666#endif
    6767
    6868#if defined (STRUCT_TASK_STRUCT_HAS_RLIM)
    69 #define TASK_STRUCT_RLIM rlim
     69# define TASK_STRUCT_RLIM rlim
    7070#elif defined (STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM)
    71 #define TASK_STRUCT_RLIM signal->rlim
     71# define TASK_STRUCT_RLIM signal->rlim
    7272#else
    73 #error Not sure what to do about rlim (should be in the Linux task struct somewhere....)
     73# error Not sure what to do about rlim (should be in the Linux task struct somewhere....)
    7474#endif
    7575
    7676
    static inline time_t osi_Time(void) { 
    8383    return xtime.tv_sec;
    8484}
    8585#else
    86 #define osi_Time() (xtime.tv_sec)
     86# define osi_Time() (xtime.tv_sec)
    8787#endif
    8888
    8989
    9090
    9191#ifdef AFS_LINUX_64BIT_KERNEL
    92 #define osi_GetTime(V)                                 \
     92# define osi_GetTime(V)                                 \
    9393    do {                                               \
    9494       struct timeval __afs_tv;                              \
    9595       do_gettimeofday(&__afs_tv);                           \
    static inline time_t osi_Time(void) { 
    9797       (V)->tv_usec = (afs_int32)__afs_tv.tv_usec;           \
    9898    } while (0)
    9999#else
    100 #define osi_GetTime(V) do_gettimeofday((V))
     100# define osi_GetTime(V) do_gettimeofday((V))
    101101#endif
    102102
    103103#undef gop_lookupname
    typedef struct task_struct afs_proc_t; 
    149149typedef struct cred afs_ucred_t;
    150150typedef struct cred cred_t;
    151151
    152 #define afs_cr_uid(cred) ((cred)->fsuid)
    153 #define afs_cr_gid(cred) ((cred)->fsgid)
    154 #define afs_cr_ruid(cred) ((cred)->uid)
    155 #define afs_cr_rgid(cred) ((cred)->gid)
    156 #define afs_cr_group_info(cred) ((cred)->group_info)
    157 #define crhold(c) (get_cred(c))
     152# define afs_cr_uid(cred) ((cred)->fsuid)
     153# define afs_cr_gid(cred) ((cred)->fsgid)
     154# define afs_cr_ruid(cred) ((cred)->uid)
     155# define afs_cr_rgid(cred) ((cred)->gid)
     156# define afs_cr_group_info(cred) ((cred)->group_info)
     157# define crhold(c) (get_cred(c))
    158158static inline void
    159159afs_set_cr_uid(cred_t *cred, uid_t uid) {
    160160    cred->fsuid = uid;
    afs_set_cr_group_info(cred_t *cred, struct group_info *group_info) { 
    176176    cred->group_info = group_info;
    177177}
    178178
    179 #define current_group_info() (current->cred->group_info)
    180 #define task_gid(task) (task->cred->gid)
    181 #define task_user(task) (task->cred->user)
    182 #define task_session_keyring(task) (task->cred->tgcred->session_keyring)
    183 #define current_session_keyring() (current->cred->tgcred->session_keyring)
     179# define current_group_info() (current->cred->group_info)
     180# define task_gid(task) (task->cred->gid)
     181# define task_user(task) (task->cred->user)
     182# define task_session_keyring(task) (task->cred->tgcred->session_keyring)
     183# define current_session_keyring() (current->cred->tgcred->session_keyring)
    184184
    185185#else
    186186
    typedef struct afs_cred { 
    194194} cred_t;
    195195
    196196typedef struct afs_cred afs_ucred_t;
    197 #define afs_cr_group_info(cred) ((cred)->cr_group_info)
     197# define afs_cr_group_info(cred) ((cred)->cr_group_info)
    198198static inline void
    199199afs_set_cr_group_info(cred_t *cred, struct group_info *group_info) {
    200200    cred->cr_group_info = group_info;
    201201}
    202202
    203 #define current_group_info() (current->group_info)
    204 #if !defined(task_gid)
    205 #define task_gid(task) (task->gid)
    206 #endif
    207 #if !defined(task_uid)
    208 #define task_uid(task) (task->uid)
    209 #endif
    210 #define task_user(task) (task->user)
    211 #define task_session_keyring(task) (task->signal->session_keyring)
    212 #define current_session_keyring() (current->signal->session_keyring)
    213 #define crhold(c) atomic_inc(&(c)->cr_ref)
     203# define current_group_info() (current->group_info)
     204# if !defined(task_gid)
     205#  define task_gid(task) (task->gid)
     206# endif
     207# if !defined(task_uid)
     208#  define task_uid(task) (task->uid)
     209# endif
     210# define task_user(task) (task->user)
     211# define task_session_keyring(task) (task->signal->session_keyring)
     212# define current_session_keyring() (current->signal->session_keyring)
     213# define crhold(c) atomic_inc(&(c)->cr_ref)
    214214
    215215#endif /* defined(STRUCT_TASK_STRUCT_HAS_CRED) */
    216216
    217217#if !defined(current_cred)
    218 #define current_gid() (current->gid)
    219 #define current_uid() (current->uid)
    220 #define current_fsgid() (current->fsgid)
    221 #define current_fsuid() (current->fsuid)
     218# define current_gid() (current->gid)
     219# define current_uid() (current->uid)
     220# define current_fsgid() (current->fsgid)
     221# define current_fsuid() (current->fsuid)
    222222#endif
    223223
    224224/* UIO manipulation */
    struct uio { 
    245245#define OSIFILE_INODE(a) FILE_INODE((a)->filp)
    246246
    247247#if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV)
    248 #define NEED_IOCTL32
     248# define NEED_IOCTL32
    249249#endif
    250250
    251251#include <linux/version.h>
    struct uio { 
    256256extern struct mutex afs_global_lock;
    257257#else
    258258extern struct semaphore afs_global_lock;
    259 #define mutex_lock(lock) down(lock)
    260 #define mutex_unlock(lock) up(lock)
     259# define mutex_lock(lock) down(lock)
     260# define mutex_unlock(lock) up(lock)
    261261#endif
    262262extern int afs_global_owner;
    263263
    do { \ 
    285285#ifdef AFS_AMD64_LINUX20_ENV
    286286/* RHEL5 beta's kernel doesn't define these. They aren't gonna change, so... */
    287287
    288 #ifndef __NR_ia32_afs_syscall
    289 #define __NR_ia32_afs_syscall 137
    290 #endif
    291 #ifndef __NR_ia32_setgroups
    292 #define __NR_ia32_setgroups 81
    293 #endif
    294 #ifndef __NR_ia32_setgroups32
    295 #define __NR_ia32_setgroups32 206
    296 #endif
    297 #ifndef __NR_ia32_close
    298 #define __NR_ia32_close 6
    299 #endif
    300 #ifndef __NR_ia32_chdir
    301 #define __NR_ia32_chdir 12
    302 #endif
    303 #ifndef __NR_ia32_break
    304 #define __NR_ia32_break 17
    305 #endif
    306 #ifndef __NR_ia32_stty
    307 #define __NR_ia32_stty 31
    308 #endif
    309 #ifndef __NR_ia32_gtty
    310 #define __NR_ia32_gtty 32
    311 #endif
    312 #ifndef __NR_ia32_ftime
    313 #define __NR_ia32_ftime 35
    314 #endif
    315 #ifndef __NR_ia32_prof
    316 #define __NR_ia32_prof 44
    317 #endif
    318 #ifndef __NR_ia32_lock
    319 #define __NR_ia32_lock 53
    320 #endif
    321 #ifndef __NR_ia32_mpx
    322 #define __NR_ia32_mpx 56
    323 #endif
    324 #ifndef __NR_ia32_exit
    325 #define __NR_ia32_exit 1
    326 #endif
    327 #ifndef __NR_ia32_mount
    328 #define __NR_ia32_mount 21
    329 #endif
    330 #ifndef __NR_ia32_read
    331 #define __NR_ia32_read 3
    332 #endif
    333 #ifndef __NR_ia32_write
    334 #define __NR_ia32_write 4
    335 #endif
    336 #ifndef __NR_ia32_open
    337 #define __NR_ia32_open 5
    338 #endif
    339 #ifndef __NR_ia32_close
    340 #define __NR_ia32_close 6
    341 #endif
    342 #ifndef __NR_ia32_unlink
    343 #define __NR_ia32_unlink 10
    344 #endif
     288# ifndef __NR_ia32_afs_syscall
     289#  define __NR_ia32_afs_syscall 137
     290# endif
     291# ifndef __NR_ia32_setgroups
     292#  define __NR_ia32_setgroups 81
     293# endif
     294# ifndef __NR_ia32_setgroups32
     295#  define __NR_ia32_setgroups32 206
     296# endif
     297# ifndef __NR_ia32_close
     298#  define __NR_ia32_close 6
     299# endif
     300# ifndef __NR_ia32_chdir
     301#  define __NR_ia32_chdir 12
     302# endif
     303# ifndef __NR_ia32_break
     304#  define __NR_ia32_break 17
     305# endif
     306# ifndef __NR_ia32_stty
     307#  define __NR_ia32_stty 31
     308# endif
     309# ifndef __NR_ia32_gtty
     310#  define __NR_ia32_gtty 32
     311# endif
     312# ifndef __NR_ia32_ftime
     313#  define __NR_ia32_ftime 35
     314# endif
     315# ifndef __NR_ia32_prof
     316#  define __NR_ia32_prof 44
     317# endif
     318# ifndef __NR_ia32_lock
     319#  define __NR_ia32_lock 53
     320# endif
     321# ifndef __NR_ia32_mpx
     322#  define __NR_ia32_mpx 56
     323# endif
     324# ifndef __NR_ia32_exit
     325#  define __NR_ia32_exit 1
     326# endif
     327# ifndef __NR_ia32_mount
     328#  define __NR_ia32_mount 21
     329# endif
     330# ifndef __NR_ia32_read
     331#  define __NR_ia32_read 3
     332# endif
     333# ifndef __NR_ia32_write
     334#  define __NR_ia32_write 4
     335# endif
     336# ifndef __NR_ia32_open
     337#  define __NR_ia32_open 5
     338# endif
     339# ifndef __NR_ia32_close
     340#  define __NR_ia32_close 6
     341# endif
     342# ifndef __NR_ia32_unlink
     343#  define __NR_ia32_unlink 10
     344# endif
    345345#endif
    346346
    347347#define osi_procname(procname, size) strncpy(procname, current->comm, size)
  • acinclude.m4

    -- 
    1.7.9.6 (Apple Git-31.1)
    
    From 314fcfa35917de0f688374137f0ffa040ea3660d Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Wed, 9 Jan 2013 19:26:54 -0500
    Subject: [PATCH] Linux 3.8: session_keyring changes
    
    The session_keyring is now attached directly to the cred structure
    and the thread_group_cred structure (cred->tgcred) no longer exists.
    
    Adapt code that makes use of tgcred, and use the standard rcu based
    mechanism to update session_keyring.
    
    Reviewed-on: http://gerrit.openafs.org/8905
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    (cherry picked from commit c6d27e322a8d3b352554650473a048235a9c763a)
    
    Change-Id: If0998ee777ab0d196e19162499eb3ee60c5ff85d
    Reviewed-on: http://gerrit.openafs.org/8941
    Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>
    Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
    Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
    ---
     acinclude.m4                |    1 +
     src/afs/LINUX/osi_compat.h  |   34 ++++++++++++++++++++++++++++++++--
     src/afs/LINUX/osi_groups.c  |    9 ++-------
     src/afs/LINUX/osi_machdep.h |    9 +++++++--
     4 files changed, 42 insertions(+), 11 deletions(-)
    
    diff --git a/acinclude.m4 b/acinclude.m4
    index 8c57779..0a05caa 100644
    a b case $AFS_SYSNAME in *_linux* | *_umlinux*) 
    812812                                       [write_begin], [fs.h])
    813813                 AC_CHECK_LINUX_STRUCT([backing_dev_info], [name],
    814814                                       [backing-dev.h])
     815                 AC_CHECK_LINUX_STRUCT([cred], [session_keyring], [cred.h])
    815816                 AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h])
    816817                 AC_CHECK_LINUX_STRUCT([dentry_operations], [d_automount], [dcache.h])
    817818                 AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h])
  • src/afs/LINUX/osi_compat.h

    diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
    index 2dda136..a777542 100644
    a b afs_linux_key_alloc(struct key_type *type, const char *desc, uid_t uid, 
    186186}
    187187
    188188# if defined(STRUCT_TASK_STRUCT_HAS_CRED)
     189static inline struct key *
     190afs_session_keyring(afs_ucred_t *cred)
     191{
     192#  if defined(STRUCT_CRED_HAS_SESSION_KEYRING)
     193    return cred->session_keyring;
     194#  else
     195    return cred->tgcred->session_keyring;
     196#  endif
     197}
     198
    189199static inline struct key*
    190200afs_linux_search_keyring(afs_ucred_t *cred, struct key_type *type)
    191201{
    192202    key_ref_t key_ref;
    193203
    194     if (cred->tgcred->session_keyring) {
     204    if (afs_session_keyring(cred)) {
    195205        key_ref = keyring_search(
    196                       make_key_ref(cred->tgcred->session_keyring, 1),
     206                      make_key_ref(afs_session_keyring(cred), 1),
    197207                      type, "_pag");
    198208        if (IS_ERR(key_ref))
    199209            return ERR_CAST(key_ref);
    afs_set_name(afs_name_t aname, char *string) { 
    507517}
    508518#endif
    509519
     520static_inline struct key *
     521afs_set_session_keyring(struct key *keyring)
     522{
     523    struct key *old;
     524#if defined(STRUCT_CRED_HAS_SESSION_KEYRING)
     525    struct cred *new_creds;
     526    old = current_session_keyring();
     527    new_creds = prepare_creds();
     528    rcu_assign_pointer(new_creds->session_keyring, keyring);
     529    commit_creds(new_creds);
     530#else
     531    spin_lock_irq(&current->sighand->siglock);
     532    old = task_session_keyring(current);
     533    smp_wmb();
     534    task_session_keyring(current) = keyring;
     535    spin_unlock_irq(&current->sighand->siglock);
     536#endif
     537    return old;
     538}
     539
    510540#endif /* AFS_LINUX_OSI_COMPAT_H */
  • src/afs/LINUX/osi_groups.c

    diff --git a/src/afs/LINUX/osi_groups.c b/src/afs/LINUX/osi_groups.c
    index c2a0308..e351344 100644
    a b install_session_keyring(struct key *keyring) 
    214214    }
    215215
    216216    /* install the keyring */
    217     spin_lock_irq(&current->sighand->siglock);
    218     old = task_session_keyring(current);
    219     smp_wmb();
    220     task_session_keyring(current) = keyring;
    221     spin_unlock_irq(&current->sighand->siglock);
    222 
     217    old = afs_set_session_keyring(keyring);
    223218    if (old)
    224             key_put(old);
     219        key_put(old);
    225220
    226221out:
    227222    return code;
  • src/afs/LINUX/osi_machdep.h

    diff --git a/src/afs/LINUX/osi_machdep.h b/src/afs/LINUX/osi_machdep.h
    index 9260733..0202d0d 100644
    a b afs_set_cr_group_info(cred_t *cred, struct group_info *group_info) { 
    179179# define current_group_info() (current->cred->group_info)
    180180# define task_gid(task) (task->cred->gid)
    181181# define task_user(task) (task->cred->user)
    182 # define task_session_keyring(task) (task->cred->tgcred->session_keyring)
    183 # define current_session_keyring() (current->cred->tgcred->session_keyring)
     182# if defined(STRUCT_CRED_HAS_SESSION_KEYRING)
     183#  define task_session_keyring(task) (task->cred->session_keyring)
     184#  define current_session_keyring() (current->cred->session_keyring)
     185# else
     186#  define task_session_keyring(task) (task->cred->tgcred->session_keyring)
     187#  define current_session_keyring() (current->cred->tgcred->session_keyring)
     188# endif
    184189
    185190#else
    186191
  • acinclude.m4

    -- 
    1.7.9.6 (Apple Git-31.1)
    
    From bf9bcd09e6a54eb40e47c7a6cdc060be43be9495 Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Wed, 9 Jan 2013 21:22:27 -0500
    Subject: [PATCH] Linux 3.8: vmtruncate removal
    
    vmtruncate had been deprecated for a while and has now been
    removed.  Do things the new way based on truncate_setsize.
    
    Reviewed-on: http://gerrit.openafs.org/8906
    Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    (cherry picked from commit d0479bbaf43900d6733c3f7517926ee9813c9610)
    
    Change-Id: Iafc64e19544dec9fcaefad5ad274eac4133f4083
    Reviewed-on: http://gerrit.openafs.org/8942
    Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>
    Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
    Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
    ---
     acinclude.m4               |    1 +
     src/afs/LINUX/osi_compat.h |   14 ++++++++++++++
     src/afs/LINUX/osi_vm.c     |    5 ++---
     3 files changed, 17 insertions(+), 3 deletions(-)
    
    diff --git a/acinclude.m4 b/acinclude.m4
    index 0a05caa..4223bb1 100644
    a b case $AFS_SYSNAME in *_linux* | *_umlinux*) 
    824824                 AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h])
    825825                 AC_CHECK_LINUX_STRUCT([file_system_type], [mount], [fs.h])
    826826                 AC_CHECK_LINUX_STRUCT([filename], [name], [fs.h])
     827                 AC_CHECK_LINUX_STRUCT([inode_operations], [truncate], [fs.h])
    827828                 AC_CHECK_LINUX_STRUCT([key_type], [preparse], [key-type.h])
    828829                 AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h])
    829830                 AC_CHECK_LINUX_STRUCT([proc_dir_entry], [owner], [proc_fs.h])
  • src/afs/LINUX/osi_compat.h

    diff --git a/src/afs/LINUX/osi_compat.h b/src/afs/LINUX/osi_compat.h
    index a777542..e8bf003 100644
    a b afs_set_session_keyring(struct key *keyring) 
    537537    return old;
    538538}
    539539
     540static inline int
     541afs_truncate(struct inode *inode, int len)
     542{
     543    int code;
     544#if defined(STRUCT_INODE_OPERATIONS_HAS_TRUNCATE)
     545    code = vmtruncate(inode, len);
     546#else
     547    code = inode_newsize_ok(inode, len);
     548    if (!code)
     549        truncate_setsize(inode, len);
     550#endif
     551    return code;
     552}
     553
    540554#endif /* AFS_LINUX_OSI_COMPAT_H */
  • src/afs/LINUX/osi_vm.c

    diff --git a/src/afs/LINUX/osi_vm.c b/src/afs/LINUX/osi_vm.c
    index 2cd34f9..8bc792e 100644
    a b osi_VM_FlushVCache(struct vcache *avc, int *slept) 
    5151    if (avc->opens != 0)
    5252        return EBUSY;
    5353
    54     return vmtruncate(ip, 0);
    55     return 0;
     54    return afs_truncate(ip, 0);
    5655}
    5756
    5857/* Try to invalidate pages, for "fs flush" or "fs flushv"; or
    osi_VM_FlushPages(struct vcache *avc, afs_ucred_t *credp) 
    132131void
    133132osi_VM_Truncate(struct vcache *avc, int alen, afs_ucred_t *acred)
    134133{
    135     vmtruncate(AFSTOV(avc), alen);
     134    afs_truncate(AFSTOV(avc), alen);
    136135}
  • src/afs/afs_pioctl.c

    -- 
    1.7.9.6 (Apple Git-31.1)
    
    From b0a10607f90c4097206bc38cb9bd16e842dbda10 Mon Sep 17 00:00:00 2001
    From: Marc Dionne <marc.c.dionne@gmail.com>
    Date: Fri, 18 Jan 2013 22:40:03 -0500
    Subject: [PATCH] Linux: setpag() may replace credentials
    
    For recent Linux. setpag() may replace the current process' cred
    structure with a new one.  This is not a problem for most callers,
    but in the case of processing a SetTokens2 pioctl with the setpag
    option, the new credentials should be used to determine the target
    for the token.
    
    Reviewed-on: http://gerrit.openafs.org/8924
    Reviewed-by: Chas Williams - CONTRACTOR <chas@cmf.nrl.navy.mil>
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Derrick Brashear <shadow@your-file-system.com>
    (cherry picked from commit b61eac783e8c092cd4ba9f53a2b5ca7d43e08b1b)
    
    Change-Id: I66b5f171318964ff40fe78be24e75519183c3a82
    Reviewed-on: http://gerrit.openafs.org/8948
    Tested-by: BuildBot <buildbot@rampaginggeek.com>
    Reviewed-by: Andrew Deason <adeason@sinenomine.net>
    Reviewed-by: Paul Smeddle <paul.smeddle@gmail.com>
    Reviewed-by: Ken Dreyer <ktdreyer@ktdreyer.com>
    Reviewed-by: Stephan Wiesand <stephan.wiesand@desy.de>
    ---
     src/afs/afs_pioctl.c |    8 ++++++++
     1 file changed, 8 insertions(+)
    
    diff --git a/src/afs/afs_pioctl.c b/src/afs/afs_pioctl.c
    index 3c01be5..98919a3 100644
    a b DECL_PIOCTL(PSetTokens) 
    18591859    afs_PutCell(tcell, READ_LOCK);
    18601860    if (set_parent_pag) {
    18611861        afs_uint32 pag;
     1862#if defined(AFS_LINUX26_ENV)
     1863        afs_ucred_t *old_cred = *acred;
     1864#endif
    18621865#if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV)
    18631866        char procname[256];
    18641867        osi_procname(procname, 256);
    DECL_PIOCTL(PSetTokens) 
    18681871#else
    18691872        if (!setpag(acred, -1, &pag, 1)) {
    18701873#endif
     1874#if defined(AFS_LINUX26_ENV)
     1875            /* setpag() may have changed our credentials */
     1876            *acred = crref();
     1877            crfree(old_cred);
     1878#endif
    18711879            afs_InitReq(&treq, *acred);
    18721880            areq = &treq;
    18731881        }
Note: See TracBrowser for help on using the repository browser.