diff --git a/src/afs/LINUX/osi_file.c b/src/afs/LINUX/osi_file.c index 141fad0..0868962 100644 --- a/src/afs/LINUX/osi_file.c +++ b/src/afs/LINUX/osi_file.c @@ -32,6 +32,9 @@ extern struct osi_dev cacheDev; extern struct vfsmount *afs_cacheMnt; #endif extern struct super_block *afs_cacheSBp; +#if defined(STRUCT_TASK_HAS_CRED) +extern struct cred *cache_creds; +#endif #if defined(AFS_LINUX26_ENV) void * @@ -79,7 +82,7 @@ osi_UFSOpen(afs_int32 ainode) tip->i_flags |= MS_NOATIME; /* Disable updating access times. */ #if defined(STRUCT_TASK_HAS_CRED) - filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, current_cred()); + filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR, cache_creds); #else filp = dentry_open(dp, mntget(afs_cacheMnt), O_RDWR); #endif diff --git a/src/afs/afs_init.c b/src/afs/afs_init.c index b9f24e2..a8b7401 100644 --- a/src/afs/afs_init.c +++ b/src/afs/afs_init.c @@ -23,6 +23,9 @@ RCSID #include "afs/sysincludes.h" /* Standard vendor system headers */ #include "afsincludes.h" /* Afs-based standard headers */ #include "afs/afs_stats.h" /* afs statistics */ +#if defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_HAS_CRED) +#include +#endif /* Exported variables */ struct osi_dev cacheDev; /*Cache device */ @@ -44,6 +47,9 @@ int afs_memvolumes = 0; #if defined(AFS_XBSD_ENV) static struct vnode *volumeVnode; #endif +#if defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_HAS_CRED) +struct cred *cache_creds; +#endif /* This is the kernel side of the dynamic vcache setting */ int afsd_dynamic_vcaches = 0; /* Enable dynamic-vcache support */ @@ -140,6 +146,10 @@ afs_CacheInit(afs_int32 astatSize, afs_int32 afiles, afs_int32 ablocks, afs_cacheStats = astatSize; afs_vcacheInit(astatSize); afs_dcacheInit(afiles, ablocks, aDentries, achunk, aflags); +#if defined(AFS_LINUX_26_ENV) && defined(AFS_LINUX26_ENV) + /* Save current credentials for later access to cache files */ + cache_creds = get_current_cred(); +#endif #ifdef AFS_64BIT_CLIENT #ifdef AFS_VM_RDWR_ENV afs_vmMappingEnd = AFS_CHUNKBASE(0x7fffffff); @@ -820,7 +830,9 @@ shutdown_AFS(void) RWLOCK_INIT(&afs_xvolume, "afs_xvolume"); RWLOCK_INIT(&afs_xserver, "afs_xserver"); LOCK_INIT(&afs_puttofileLock, "afs_puttofileLock"); - +#if defined(AFS_LINUX26_ENV) && defined(STRUCT_TASK_HAS_CRED) + put_cred(cache_creds); +#endif shutdown_cell(); shutdown_server(); }