aboutsummaryrefslogtreecommitdiffstats
path: root/fs/coda/dir.c
diff options
context:
space:
mode:
authorYoshihisa Abe <yoshiabe@cs.cmu.edu>2010-10-25 02:03:44 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 11:02:40 -0400
commitb5ce1d83a62fc109d8e815b1fc71dcdb0d26bc49 (patch)
treeea537c1b6436c36bee3b33d8b4f750124fd7d661 /fs/coda/dir.c
parent3a99c6319064af3f2e18eb929f638d555dbf7a62 (diff)
Coda: add spin lock to protect accesses to struct coda_inode_info.
We mostly need it to protect cached user permissions. The c_flags field is advisory, reading the wrong value is harmless and in the worst case we hit a slow path where we have to make an extra upcall to the userspace cache manager when revalidating a dentry or inode. Signed-off-by: Yoshihisa Abe <yoshiabe@cs.cmu.edu> Signed-off-by: Jan Harkes <jaharkes@cs.cmu.edu> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/coda/dir.c')
-rw-r--r--fs/coda/dir.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/fs/coda/dir.c b/fs/coda/dir.c
index ccd98b0f2b0..69fbbea75f1 100644
--- a/fs/coda/dir.c
+++ b/fs/coda/dir.c
@@ -18,6 +18,7 @@
18#include <linux/errno.h> 18#include <linux/errno.h>
19#include <linux/string.h> 19#include <linux/string.h>
20#include <linux/smp_lock.h> 20#include <linux/smp_lock.h>
21#include <linux/spinlock.h>
21 22
22#include <asm/uaccess.h> 23#include <asm/uaccess.h>
23 24
@@ -617,7 +618,9 @@ static int coda_dentry_revalidate(struct dentry *de, struct nameidata *nd)
617 goto out; 618 goto out;
618 619
619 /* clear the flags. */ 620 /* clear the flags. */
621 spin_lock(&cii->c_lock);
620 cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH); 622 cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH);
623 spin_unlock(&cii->c_lock);
621 624
622bad: 625bad:
623 unlock_kernel(); 626 unlock_kernel();
@@ -691,7 +694,10 @@ int coda_revalidate_inode(struct dentry *dentry)
691 goto return_bad; 694 goto return_bad;
692 695
693 coda_flag_inode_children(inode, C_FLUSH); 696 coda_flag_inode_children(inode, C_FLUSH);
697
698 spin_lock(&cii->c_lock);
694 cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH); 699 cii->c_flags &= ~(C_VATTR | C_PURGE | C_FLUSH);
700 spin_unlock(&cii->c_lock);
695 } 701 }
696 702
697ok: 703ok: