summaryrefslogtreecommitdiff
path: root/security
diff options
context:
space:
mode:
authorJohn Stultz <johnstul@us.ibm.com>2010-02-22 16:48:26 -0800
committerThomas Gleixner <tglx@linutronix.de>2010-04-27 17:32:58 +0200
commit23695896abe0d1c813c2c88f0dd165d435d08689 (patch)
treebc676786565c37a9dce4a8ca07d0a393e753f43c /security
parent3f2ef0d48b33d3423f99077a6efd6f4eea3ac090 (diff)
downloadlwn-23695896abe0d1c813c2c88f0dd165d435d08689.tar.gz
lwn-23695896abe0d1c813c2c88f0dd165d435d08689.zip
Fix vfsmount_read_lock to work with -rt
Because vfsmount_read_lock aquires the vfsmount spinlock for the current cpu, it causes problems wiht -rt, as you might migrate between cpus between a lock and unlock. This patch fixes the issue by having the caller pick a cpu, then consistently use that cpu between the lock and unlock. We may migrate inbetween lock and unlock, but that's ok because we're not doing anything cpu specific, other then avoiding contention on the read side across the cpus. Its not pretty, but it works and statistically shouldn't hurt performance. Signed-off-by: John Stultz <johnstul@us.ibm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'security')
-rw-r--r--security/tomoyo/realpath.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/security/tomoyo/realpath.c b/security/tomoyo/realpath.c
index f976358e6d4c..4346c48964c3 100644
--- a/security/tomoyo/realpath.c
+++ b/security/tomoyo/realpath.c
@@ -93,19 +93,21 @@ int tomoyo_realpath_from_path2(struct path *path, char *newname,
struct path root;
struct path ns_root = { };
struct path tmp;
+ int cpu = get_cpu();
+ put_cpu();
read_lock(&current->fs->lock);
root = current->fs->root;
path_get(&root);
read_unlock(&current->fs->lock);
- vfsmount_read_lock();
+ vfsmount_read_lock(cpu);
if (root.mnt && root.mnt->mnt_ns)
ns_root.mnt = mntget(root.mnt->mnt_ns->root);
if (ns_root.mnt)
ns_root.dentry = dget(ns_root.mnt->mnt_root);
tmp = ns_root;
sp = __d_path(path, &tmp, newname, newname_len);
- vfsmount_read_unlock();
+ vfsmount_read_unlock(cpu);
path_put(&root);
path_put(&ns_root);
/* Prepend "/proc" prefix if using internal proc vfs mount. */