diff options
Diffstat (limited to 'fs/coda/cache.c')
-rw-r--r-- | fs/coda/cache.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/fs/coda/cache.c b/fs/coda/cache.c index a5bf5771a22a..9060f08e70cf 100644 --- a/fs/coda/cache.c +++ b/fs/coda/cache.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/string.h> | 17 | #include <linux/string.h> |
18 | #include <linux/list.h> | 18 | #include <linux/list.h> |
19 | #include <linux/sched.h> | 19 | #include <linux/sched.h> |
20 | #include <linux/spinlock.h> | ||
20 | 21 | ||
21 | #include <linux/coda.h> | 22 | #include <linux/coda.h> |
22 | #include <linux/coda_linux.h> | 23 | #include <linux/coda_linux.h> |
@@ -31,19 +32,23 @@ void coda_cache_enter(struct inode *inode, int mask) | |||
31 | { | 32 | { |
32 | struct coda_inode_info *cii = ITOC(inode); | 33 | struct coda_inode_info *cii = ITOC(inode); |
33 | 34 | ||
35 | spin_lock(&cii->c_lock); | ||
34 | cii->c_cached_epoch = atomic_read(&permission_epoch); | 36 | cii->c_cached_epoch = atomic_read(&permission_epoch); |
35 | if (cii->c_uid != current_fsuid()) { | 37 | if (cii->c_uid != current_fsuid()) { |
36 | cii->c_uid = current_fsuid(); | 38 | cii->c_uid = current_fsuid(); |
37 | cii->c_cached_perm = mask; | 39 | cii->c_cached_perm = mask; |
38 | } else | 40 | } else |
39 | cii->c_cached_perm |= mask; | 41 | cii->c_cached_perm |= mask; |
42 | spin_unlock(&cii->c_lock); | ||
40 | } | 43 | } |
41 | 44 | ||
42 | /* remove cached acl from an inode */ | 45 | /* remove cached acl from an inode */ |
43 | void coda_cache_clear_inode(struct inode *inode) | 46 | void coda_cache_clear_inode(struct inode *inode) |
44 | { | 47 | { |
45 | struct coda_inode_info *cii = ITOC(inode); | 48 | struct coda_inode_info *cii = ITOC(inode); |
49 | spin_lock(&cii->c_lock); | ||
46 | cii->c_cached_epoch = atomic_read(&permission_epoch) - 1; | 50 | cii->c_cached_epoch = atomic_read(&permission_epoch) - 1; |
51 | spin_unlock(&cii->c_lock); | ||
47 | } | 52 | } |
48 | 53 | ||
49 | /* remove all acl caches */ | 54 | /* remove all acl caches */ |
@@ -57,13 +62,15 @@ void coda_cache_clear_all(struct super_block *sb) | |||
57 | int coda_cache_check(struct inode *inode, int mask) | 62 | int coda_cache_check(struct inode *inode, int mask) |
58 | { | 63 | { |
59 | struct coda_inode_info *cii = ITOC(inode); | 64 | struct coda_inode_info *cii = ITOC(inode); |
60 | int hit; | 65 | int hit; |
61 | 66 | ||
62 | hit = (mask & cii->c_cached_perm) == mask && | 67 | spin_lock(&cii->c_lock); |
63 | cii->c_uid == current_fsuid() && | 68 | hit = (mask & cii->c_cached_perm) == mask && |
64 | cii->c_cached_epoch == atomic_read(&permission_epoch); | 69 | cii->c_uid == current_fsuid() && |
70 | cii->c_cached_epoch == atomic_read(&permission_epoch); | ||
71 | spin_unlock(&cii->c_lock); | ||
65 | 72 | ||
66 | return hit; | 73 | return hit; |
67 | } | 74 | } |
68 | 75 | ||
69 | 76 | ||