Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

coda: Cache permisions in struct coda_inode_info in a kuid_t.

- Change c_uid in struct coda_indoe_info from a vuid_t to a kuid_t.
- Initialize c_uid to GLOBAL_ROOT_UID instead of 0.
- Use uid_eq to compare cached kuids.

Cc: Jan Harkes <jaharkes@cs.cmu.edu>
Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>

+4 -4
+2 -2
fs/coda/cache.c
··· 33 33 34 34 spin_lock(&cii->c_lock); 35 35 cii->c_cached_epoch = atomic_read(&permission_epoch); 36 - if (cii->c_uid != current_fsuid()) { 36 + if (!uid_eq(cii->c_uid, current_fsuid())) { 37 37 cii->c_uid = current_fsuid(); 38 38 cii->c_cached_perm = mask; 39 39 } else ··· 65 65 66 66 spin_lock(&cii->c_lock); 67 67 hit = (mask & cii->c_cached_perm) == mask && 68 - cii->c_uid == current_fsuid() && 68 + uid_eq(cii->c_uid, current_fsuid()) && 69 69 cii->c_cached_epoch == atomic_read(&permission_epoch); 70 70 spin_unlock(&cii->c_lock); 71 71
+1 -1
fs/coda/coda_fs_i.h
··· 25 25 u_short c_flags; /* flags (see below) */ 26 26 unsigned int c_mapcount; /* nr of times this inode is mapped */ 27 27 unsigned int c_cached_epoch; /* epoch for cached permissions */ 28 - vuid_t c_uid; /* fsuid for cached permissions */ 28 + kuid_t c_uid; /* fsuid for cached permissions */ 29 29 unsigned int c_cached_perm; /* cached access permissions */ 30 30 spinlock_t c_lock; 31 31 struct inode vfs_inode;
+1 -1
fs/coda/inode.c
··· 49 49 return NULL; 50 50 memset(&ei->c_fid, 0, sizeof(struct CodaFid)); 51 51 ei->c_flags = 0; 52 - ei->c_uid = 0; 52 + ei->c_uid = GLOBAL_ROOT_UID; 53 53 ei->c_cached_perm = 0; 54 54 spin_lock_init(&ei->c_lock); 55 55 return &ei->vfs_inode;