source:
branches/fc19-dev/server/common/patches/openafs-linux-3.8-enablement.patch
@
2431
Last change on this file since 2431 was 2401, checked in by achernya, 11 years ago | |
---|---|
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 17 17 18 18 #include <linux/version.h> 19 19 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,4) 20 # define AFS_LINUX26_ONEGROUP_ENV 120 # define AFS_LINUX26_ONEGROUP_ENV 1 21 21 #endif 22 22 23 23 /* Only needed for xdr.h in glibc 2.1.x */ 24 24 #ifndef quad_t 25 # define quad_t __quad_t26 # define u_quad_t __u_quad_t25 # define quad_t __quad_t 26 # define u_quad_t __u_quad_t 27 27 #endif 28 28 29 29 #undef getuerror 30 30 31 31 #ifdef STRUCT_TASK_STRUCT_HAS_TGID 32 # define getpid() current->tgid33 # ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT34 # define getppid() current->real_parent->tgid35 # elif defined(STRUCT_TASK_STRUCT_HAS_PARENT)36 # define getppid() current->parent->tgid37 # else38 # define getppid() current->p_opptr->tgid39 # endif32 # 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 40 40 #else /* !STRUCT_TASK_STRUCT_HAS_TGID */ 41 # define getpid() current->pid42 # ifdef STRUCT_TASK_STRUCT_HAS_REAL_PARENT43 # define getppid() current->real_parent->pid44 # elif defined(STRUCT_TASK_STRUCT_HAS_PARENT)45 # define getppid() current->parent->pid46 # else47 # define getppid() current->p_opptr->pid48 # endif41 # 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 49 49 #endif /* STRUCT_TASK_STRUCT_HAS_TGID */ 50 50 51 51 #ifdef RECALC_SIGPENDING_TAKES_VOID 52 # define RECALC_SIGPENDING(X) recalc_sigpending()52 # define RECALC_SIGPENDING(X) recalc_sigpending() 53 53 #else 54 # define RECALC_SIGPENDING(X) recalc_sigpending(X)54 # define RECALC_SIGPENDING(X) recalc_sigpending(X) 55 55 #endif 56 56 57 57 #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) 60 60 #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) 63 63 #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) 66 66 #endif 67 67 68 68 #if defined (STRUCT_TASK_STRUCT_HAS_RLIM) 69 # define TASK_STRUCT_RLIM rlim69 # define TASK_STRUCT_RLIM rlim 70 70 #elif defined (STRUCT_TASK_STRUCT_HAS_SIGNAL_RLIM) 71 # define TASK_STRUCT_RLIM signal->rlim71 # define TASK_STRUCT_RLIM signal->rlim 72 72 #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....) 74 74 #endif 75 75 76 76 … … static inline time_t osi_Time(void) { 83 83 return xtime.tv_sec; 84 84 } 85 85 #else 86 # define osi_Time() (xtime.tv_sec)86 # define osi_Time() (xtime.tv_sec) 87 87 #endif 88 88 89 89 90 90 91 91 #ifdef AFS_LINUX_64BIT_KERNEL 92 # define osi_GetTime(V) \92 # define osi_GetTime(V) \ 93 93 do { \ 94 94 struct timeval __afs_tv; \ 95 95 do_gettimeofday(&__afs_tv); \ … … static inline time_t osi_Time(void) { 97 97 (V)->tv_usec = (afs_int32)__afs_tv.tv_usec; \ 98 98 } while (0) 99 99 #else 100 # define osi_GetTime(V) do_gettimeofday((V))100 # define osi_GetTime(V) do_gettimeofday((V)) 101 101 #endif 102 102 103 103 #undef gop_lookupname … … typedef struct task_struct afs_proc_t; 149 149 typedef struct cred afs_ucred_t; 150 150 typedef struct cred cred_t; 151 151 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)) 158 158 static inline void 159 159 afs_set_cr_uid(cred_t *cred, uid_t uid) { 160 160 cred->fsuid = uid; … … afs_set_cr_group_info(cred_t *cred, struct group_info *group_info) { 176 176 cred->group_info = group_info; 177 177 } 178 178 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) 184 184 185 185 #else 186 186 … … typedef struct afs_cred { 194 194 } cred_t; 195 195 196 196 typedef 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) 198 198 static inline void 199 199 afs_set_cr_group_info(cred_t *cred, struct group_info *group_info) { 200 200 cred->cr_group_info = group_info; 201 201 } 202 202 203 # define current_group_info() (current->group_info)204 # if !defined(task_gid)205 # define task_gid(task) (task->gid)206 # endif207 # if !defined(task_uid)208 # define task_uid(task) (task->uid)209 # endif210 # 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) 214 214 215 215 #endif /* defined(STRUCT_TASK_STRUCT_HAS_CRED) */ 216 216 217 217 #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) 222 222 #endif 223 223 224 224 /* UIO manipulation */ … … struct uio { 245 245 #define OSIFILE_INODE(a) FILE_INODE((a)->filp) 246 246 247 247 #if defined(AFS_LINUX_64BIT_KERNEL) && !defined(AFS_ALPHA_LINUX20_ENV) && !defined(AFS_IA64_LINUX20_ENV) 248 # define NEED_IOCTL32248 # define NEED_IOCTL32 249 249 #endif 250 250 251 251 #include <linux/version.h> … … struct uio { 256 256 extern struct mutex afs_global_lock; 257 257 #else 258 258 extern 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) 261 261 #endif 262 262 extern int afs_global_owner; 263 263 … … do { \ 285 285 #ifdef AFS_AMD64_LINUX20_ENV 286 286 /* RHEL5 beta's kernel doesn't define these. They aren't gonna change, so... */ 287 287 288 # ifndef __NR_ia32_afs_syscall289 # define __NR_ia32_afs_syscall 137290 # endif291 # ifndef __NR_ia32_setgroups292 # define __NR_ia32_setgroups 81293 # endif294 # ifndef __NR_ia32_setgroups32295 # define __NR_ia32_setgroups32 206296 # endif297 # ifndef __NR_ia32_close298 # define __NR_ia32_close 6299 # endif300 # ifndef __NR_ia32_chdir301 # define __NR_ia32_chdir 12302 # endif303 # ifndef __NR_ia32_break304 # define __NR_ia32_break 17305 # endif306 # ifndef __NR_ia32_stty307 # define __NR_ia32_stty 31308 # endif309 # ifndef __NR_ia32_gtty310 # define __NR_ia32_gtty 32311 # endif312 # ifndef __NR_ia32_ftime313 # define __NR_ia32_ftime 35314 # endif315 # ifndef __NR_ia32_prof316 # define __NR_ia32_prof 44317 # endif318 # ifndef __NR_ia32_lock319 # define __NR_ia32_lock 53320 # endif321 # ifndef __NR_ia32_mpx322 # define __NR_ia32_mpx 56323 # endif324 # ifndef __NR_ia32_exit325 # define __NR_ia32_exit 1326 # endif327 # ifndef __NR_ia32_mount328 # define __NR_ia32_mount 21329 # endif330 # ifndef __NR_ia32_read331 # define __NR_ia32_read 3332 # endif333 # ifndef __NR_ia32_write334 # define __NR_ia32_write 4335 # endif336 # ifndef __NR_ia32_open337 # define __NR_ia32_open 5338 # endif339 # ifndef __NR_ia32_close340 # define __NR_ia32_close 6341 # endif342 # ifndef __NR_ia32_unlink343 # define __NR_ia32_unlink 10344 # endif288 # 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 345 345 #endif 346 346 347 347 #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*) 812 812 [write_begin], [fs.h]) 813 813 AC_CHECK_LINUX_STRUCT([backing_dev_info], [name], 814 814 [backing-dev.h]) 815 AC_CHECK_LINUX_STRUCT([cred], [session_keyring], [cred.h]) 815 816 AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h]) 816 817 AC_CHECK_LINUX_STRUCT([dentry_operations], [d_automount], [dcache.h]) 817 818 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, 186 186 } 187 187 188 188 # if defined(STRUCT_TASK_STRUCT_HAS_CRED) 189 static inline struct key * 190 afs_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 189 199 static inline struct key* 190 200 afs_linux_search_keyring(afs_ucred_t *cred, struct key_type *type) 191 201 { 192 202 key_ref_t key_ref; 193 203 194 if ( cred->tgcred->session_keyring) {204 if (afs_session_keyring(cred)) { 195 205 key_ref = keyring_search( 196 make_key_ref( cred->tgcred->session_keyring, 1),206 make_key_ref(afs_session_keyring(cred), 1), 197 207 type, "_pag"); 198 208 if (IS_ERR(key_ref)) 199 209 return ERR_CAST(key_ref); … … afs_set_name(afs_name_t aname, char *string) { 507 517 } 508 518 #endif 509 519 520 static_inline struct key * 521 afs_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(¤t->sighand->siglock); 532 old = task_session_keyring(current); 533 smp_wmb(); 534 task_session_keyring(current) = keyring; 535 spin_unlock_irq(¤t->sighand->siglock); 536 #endif 537 return old; 538 } 539 510 540 #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) 214 214 } 215 215 216 216 /* install the keyring */ 217 spin_lock_irq(¤t->sighand->siglock); 218 old = task_session_keyring(current); 219 smp_wmb(); 220 task_session_keyring(current) = keyring; 221 spin_unlock_irq(¤t->sighand->siglock); 222 217 old = afs_set_session_keyring(keyring); 223 218 if (old) 224 219 key_put(old); 225 220 226 221 out: 227 222 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) { 179 179 # define current_group_info() (current->cred->group_info) 180 180 # define task_gid(task) (task->cred->gid) 181 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) 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 184 189 185 190 #else 186 191 -
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*) 824 824 AC_CHECK_LINUX_STRUCT([file_operations], [sendfile], [fs.h]) 825 825 AC_CHECK_LINUX_STRUCT([file_system_type], [mount], [fs.h]) 826 826 AC_CHECK_LINUX_STRUCT([filename], [name], [fs.h]) 827 AC_CHECK_LINUX_STRUCT([inode_operations], [truncate], [fs.h]) 827 828 AC_CHECK_LINUX_STRUCT([key_type], [preparse], [key-type.h]) 828 829 AC_CHECK_LINUX_STRUCT([nameidata], [path], [namei.h]) 829 830 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) 537 537 return old; 538 538 } 539 539 540 static inline int 541 afs_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 540 554 #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) 51 51 if (avc->opens != 0) 52 52 return EBUSY; 53 53 54 return vmtruncate(ip, 0); 55 return 0; 54 return afs_truncate(ip, 0); 56 55 } 57 56 58 57 /* Try to invalidate pages, for "fs flush" or "fs flushv"; or … … osi_VM_FlushPages(struct vcache *avc, afs_ucred_t *credp) 132 131 void 133 132 osi_VM_Truncate(struct vcache *avc, int alen, afs_ucred_t *acred) 134 133 { 135 vmtruncate(AFSTOV(avc), alen);134 afs_truncate(AFSTOV(avc), alen); 136 135 } -
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) 1859 1859 afs_PutCell(tcell, READ_LOCK); 1860 1860 if (set_parent_pag) { 1861 1861 afs_uint32 pag; 1862 #if defined(AFS_LINUX26_ENV) 1863 afs_ucred_t *old_cred = *acred; 1864 #endif 1862 1865 #if defined(AFS_DARWIN_ENV) || defined(AFS_XBSD_ENV) 1863 1866 char procname[256]; 1864 1867 osi_procname(procname, 256); … … DECL_PIOCTL(PSetTokens) 1868 1871 #else 1869 1872 if (!setpag(acred, -1, &pag, 1)) { 1870 1873 #endif 1874 #if defined(AFS_LINUX26_ENV) 1875 /* setpag() may have changed our credentials */ 1876 *acred = crref(); 1877 crfree(old_cred); 1878 #endif 1871 1879 afs_InitReq(&treq, *acred); 1872 1880 areq = &treq; 1873 1881 }
Note: See TracBrowser
for help on using the repository browser.