source:
trunk/server/common/patches/openafs-d_u.d_alias.patch
@
2659
Last change on this file since 2659 was 2659, checked in by andersk, 8 years ago | |
---|---|
File size: 9.4 KB |
-
src/afs/LINUX/osi_prototypes.h
From 2c9bc3ec349ae550bf60d0c46f15bdabe2b0fd9e Mon Sep 17 00:00:00 2001 From: Marc Dionne <marc.dionne@your-file-system.com> Date: Thu, 18 Dec 2014 06:57:22 -0500 Subject: [PATCH 1/2] Linux: Move code to reset the root to afs/LINUX Move the Linux specific bit of code to reset the root to afs/LINUX platform specific files. Things that play with the Linux vfs internals should not be exposed here. No functional change, but this helps cleanup some ifdef mess. Change-Id: Ia27fca3d8052ead45783cb2332c04fe6e99e5d9f --- src/afs/LINUX/osi_prototypes.h | 3 ++ src/afs/LINUX/osi_vcache.c | 61 ++++++++++++++++++++++++++++++++++++ src/afs/LINUX24/osi_prototypes.h | 3 ++ src/afs/LINUX24/osi_vcache.c | 36 +++++++++++++++++++++ src/afs/afs_daemons.c | 67 +++------------------------------------- 5 files changed, 108 insertions(+), 62 deletions(-) diff --git a/src/afs/LINUX/osi_prototypes.h b/src/afs/LINUX/osi_prototypes.h index 277b50a..5002af1 100644
a b extern void osi_VM_FlushPages(struct vcache *avc, afs_ucred_t *credp); 82 82 extern void osi_VM_Truncate(struct vcache *avc, int alen, 83 83 afs_ucred_t *acred); 84 84 85 /* osi_vcache.c */ 86 extern void osi_ResetRootVCache(afs_uint32 volid); 87 85 88 /* osi_vfsops.c */ 86 89 extern void vattr2inode(struct inode *ip, struct vattr *vp); 87 90 extern int afs_init_inodecache(void); -
src/afs/LINUX/osi_vcache.c
diff --git a/src/afs/LINUX/osi_vcache.c b/src/afs/LINUX/osi_vcache.c index 1d0db82..391e7d4 100644
a b osi_PostPopulateVCache(struct vcache *avc) { 143 143 vSetType(avc, VREG); 144 144 } 145 145 146 /** 147 * osi_ResetRootVCache - Reset the root vcache 148 * Reset the dentry associated with the afs root. 149 * Called from afs_CheckRootVolume when we notice that 150 * the root volume ID has changed. 151 * 152 * @volid: volume ID for the afs root 153 */ 154 void 155 osi_ResetRootVCache(afs_uint32 volid) 156 { 157 struct vrequest *treq = NULL; 158 struct vattr vattr; 159 cred_t *credp; 160 struct dentry *dp; 161 struct vcache *vcp; 162 struct inode *root = AFSTOV(afs_globalVp); 163 164 afs_rootFid.Fid.Volume = volid; 165 afs_rootFid.Fid.Vnode = 1; 166 afs_rootFid.Fid.Unique = 1; 167 168 credp = crref(); 169 if (afs_CreateReq(&treq, credp)) 170 goto out; 171 vcp = afs_GetVCache(&afs_rootFid, treq, NULL, NULL); 172 if (!vcp) 173 goto out; 174 afs_getattr(vcp, &vattr, credp); 175 afs_fill_inode(AFSTOV(vcp), &vattr); 176 177 dp = d_find_alias(root); 178 179 #if defined(HAVE_DCACHE_LOCK) 180 spin_lock(&dcache_lock); 181 #else 182 spin_lock(&AFSTOV(vcp)->i_lock); 183 #endif 184 spin_lock(&dp->d_lock); 185 #if defined(D_ALIAS_IS_HLIST) 186 hlist_del_init(&dp->d_alias); 187 hlist_add_head(&dp->d_alias, &(AFSTOV(vcp)->i_dentry)); 188 #else 189 list_del_init(&dp->d_alias); 190 list_add(&dp->d_alias, &(AFSTOV(vcp)->i_dentry)); 191 #endif 192 dp->d_inode = AFSTOV(vcp); 193 spin_unlock(&dp->d_lock); 194 #if defined(HAVE_DCACHE_LOCK) 195 spin_unlock(&dcache_lock); 196 #else 197 spin_unlock(&AFSTOV(vcp)->i_lock); 198 #endif 199 dput(dp); 200 201 AFS_RELE(root); 202 afs_globalVp = vcp; 203 out: 204 crfree(credp); 205 afs_DestroyReq(treq); 206 } -
src/afs/LINUX24/osi_prototypes.h
diff --git a/src/afs/LINUX24/osi_prototypes.h b/src/afs/LINUX24/osi_prototypes.h index cb4bee1..cd748f1 100644
a b extern void osi_syscall_clean(void); 69 69 extern int osi_sysctl_init(void); 70 70 extern void osi_sysctl_clean(void); 71 71 72 /* osi_vcache.c */ 73 extern void osi_ResetRootVCache(afs_uint32 volid); 74 72 75 /* osi_vm.c */ 73 76 extern int osi_VM_FlushVCache(struct vcache *avc); 74 77 extern void osi_VM_TryToSmush(struct vcache *avc, afs_ucred_t *acred, -
src/afs/LINUX24/osi_vcache.c
diff --git a/src/afs/LINUX24/osi_vcache.c b/src/afs/LINUX24/osi_vcache.c index bbaf5ce..853a357 100644
a b osi_PostPopulateVCache(struct vcache *avc) { 119 119 vSetType(avc, VREG); 120 120 } 121 121 122 void 123 osi_ResetRootVCache(afs_uint32 volid) 124 { 125 struct vrequest *treq = NULL; 126 struct vattr vattr; 127 cred_t *credp; 128 struct dentry *dp; 129 struct vcache *vcp; 130 131 afs_rootFid.Fid.Volume = volid; 132 afs_rootFid.Fid.Vnode = 1; 133 afs_rootFid.Fid.Unique = 1; 134 135 credp = crref(); 136 if (afs_CreateReq(&treq, credp)) 137 goto out; 138 vcp = afs_GetVCache(&afs_rootFid, treq, NULL, NULL); 139 if (!vcp) 140 goto out; 141 afs_getattr(vcp, &vattr, credp); 142 afs_fill_inode(AFSTOV(vcp), &vattr); 143 144 dp = d_find_alias(AFSTOV(afs_globalVp)); 145 spin_lock(&dcache_lock); 146 list_del_init(&dp->d_alias); 147 list_add(&dp->d_alias, &(AFSTOV(vcp)->i_dentry)); 148 dp->d_inode = AFSTOV(vcp); 149 spin_unlock(&dcache_lock); 150 dput(dp); 151 152 AFS_FAST_RELE(afs_globalVp); 153 afs_globalVp = vcp; 154 out: 155 crfree(credp); 156 afs_DestroyReq(treq); 157 } -
src/afs/afs_daemons.c
diff --git a/src/afs/afs_daemons.c b/src/afs/afs_daemons.c index a78aaaa..dd943a7 100644
a b afs_CheckRootVolume(void) 351 351 * count to zero and fs checkv is executed when the current 352 352 * directory is /afs. 353 353 */ 354 #ifdef AFS_LINUX20_ENV 355 { 356 struct vrequest *treq = NULL; 357 struct vattr vattr; 358 cred_t *credp; 359 struct dentry *dp; 360 struct vcache *vcp; 361 362 afs_rootFid.Fid.Volume = volid; 363 afs_rootFid.Fid.Vnode = 1; 364 afs_rootFid.Fid.Unique = 1; 365 366 credp = crref(); 367 if (afs_CreateReq(&treq, credp)) 368 goto out; 369 vcp = afs_GetVCache(&afs_rootFid, treq, NULL, NULL); 370 if (!vcp) 371 goto out; 372 afs_getattr(vcp, &vattr, credp); 373 afs_fill_inode(AFSTOV(vcp), &vattr); 374 375 dp = d_find_alias(AFSTOV(afs_globalVp)); 376 377 #if defined(AFS_LINUX24_ENV) 378 #if defined(HAVE_DCACHE_LOCK) 379 spin_lock(&dcache_lock); 380 #else 381 spin_lock(&AFSTOV(vcp)->i_lock); 382 #endif 383 #if defined(AFS_LINUX26_ENV) 384 spin_lock(&dp->d_lock); 385 #endif 386 #endif 387 #if defined(D_ALIAS_IS_HLIST) 388 hlist_del_init(&dp->d_alias); 389 hlist_add_head(&dp->d_alias, &(AFSTOV(vcp)->i_dentry)); 390 #else 391 list_del_init(&dp->d_alias); 392 list_add(&dp->d_alias, &(AFSTOV(vcp)->i_dentry)); 393 #endif 394 dp->d_inode = AFSTOV(vcp); 395 #if defined(AFS_LINUX24_ENV) 396 #if defined(AFS_LINUX26_ENV) 397 spin_unlock(&dp->d_lock); 398 #endif 399 #if defined(HAVE_DCACHE_LOCK) 400 spin_unlock(&dcache_lock); 401 #else 402 spin_unlock(&AFSTOV(vcp)->i_lock); 403 #endif 404 #endif 405 dput(dp); 406 407 AFS_FAST_RELE(afs_globalVp); 408 afs_globalVp = vcp; 409 out: 410 crfree(credp); 411 afs_DestroyReq(treq); 412 } 354 #ifdef AFS_LINUX22_ENV 355 osi_ResetRootVCache(volid); 413 356 #else 414 # ifdef AFS_DARWIN80_ENV357 # ifdef AFS_DARWIN80_ENV 415 358 afs_PutVCache(afs_globalVp); 416 # else359 # else 417 360 AFS_FAST_RELE(afs_globalVp); 418 # endif361 # endif 419 362 afs_globalVp = 0; 420 363 #endif 421 364 } -
acinclude.m4
-- 2.2.1 From 4ba5cbd90e96edd63bd0178df8ce615c1efe1b2c Mon Sep 17 00:00:00 2001 From: Marc Dionne <marc.dionne@your-file-system.com> Date: Thu, 18 Dec 2014 07:13:46 -0500 Subject: [PATCH 2/2] Linux: d_alias becomes d_u.d_alias The fields in struct dentry are re-arranged so that d_alias shares space wth d_rcu inside the d_u union. Some references need to change from d_alias to d_u.d_alias. The kernel change was introduced for 3.19 but was also backported to the 3.18 stable series in 3.18.1, so this commit is required for 3.19 and current 3.18 kernels. Change-Id: I711a5a3a89af6e0055381dfd4474ddca2868bb9c --- acinclude.m4 | 1 + src/afs/LINUX/osi_compat.h | 4 ++++ src/cf/linux-test4.m4 | 9 ++++++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/acinclude.m4 b/acinclude.m4 index 96adde0..e8e238b 100644
a b case $AFS_SYSNAME in *_linux* | *_umlinux*) 899 899 [backing-dev.h]) 900 900 AC_CHECK_LINUX_STRUCT([cred], [session_keyring], [cred.h]) 901 901 AC_CHECK_LINUX_STRUCT([ctl_table], [ctl_name], [sysctl.h]) 902 AC_CHECK_LINUX_STRUCT([dentry], [d_u.d_alias], [dcache.h]) 902 903 AC_CHECK_LINUX_STRUCT([dentry_operations], [d_automount], [dcache.h]) 903 904 AC_CHECK_LINUX_STRUCT([inode], [i_alloc_sem], [fs.h]) 904 905 AC_CHECK_LINUX_STRUCT([inode], [i_blkbits], [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 57f6ea7..497b1ef 100644
a b typedef struct vfs_path afs_linux_path_t; 37 37 typedef struct path afs_linux_path_t; 38 38 #endif 39 39 40 #if defined(STRUCT_DENTRY_HAS_D_U_D_ALIAS) 41 # define d_alias d_u.d_alias 42 #endif 43 40 44 #ifndef HAVE_LINUX_DO_SYNC_READ 41 45 static inline int 42 46 do_sync_read(struct file *fp, char *buf, size_t count, loff_t *offp) { -
src/cf/linux-test4.m4
diff --git a/src/cf/linux-test4.m4 b/src/cf/linux-test4.m4 index f0269b3..9dd55b3 100644
a b AC_DEFUN([LINUX_D_ALIAS_IS_HLIST], [ 713 713 [#include <linux/fs.h>], 714 714 [struct dentry *d = NULL; 715 715 struct hlist_node *hn = NULL; 716 d->d_alias = *hn;], 716 #if defined(STRUCT_DENTRY_HAS_D_U_D_ALIAS) 717 d->d_u.d_alias = *hn; 718 #else 719 d->d_alias = *hn; 720 #endif], 717 721 [D_ALIAS_IS_HLIST], 718 722 [define if dentry->d_alias is an hlist], 719 723 []) … … AC_DEFUN([LINUX_HLIST_ITERATOR_NO_NODE], [ 727 731 #include <linux/fs.h>], 728 732 [struct dentry *d = NULL, *cur; 729 733 struct inode *ip; 734 #if defined(STRUCT_DENTRY_HAS_D_U_D_ALIAS) 735 # define d_alias d_u.d_alias 736 #endif 730 737 hlist_for_each_entry(cur, &ip->i_dentry, d_alias) { } 731 738 ], 732 739 [HLIST_ITERATOR_NO_NODE],
Note: See TracBrowser
for help on using the repository browser.