From a3426080b810723f1bed95b8d08146738126d324 Mon Sep 17 00:00:00 2001 From: John Stultz Date: Mon, 22 Feb 2010 18:41:36 -0800 Subject: Fixup get_cpu_var holds over spinlock() calls. In Nick's patches, there's a few spots that use get_cpu_var to access a per-cpu spinlock. However, the put_cpu_var isn't called until after the lock is aquired and released. This causes mightsleep warnings with -rt. Move the put_cpu_var above the spin_lock/unlock call to avoid this. Not sure if this is 100% right, but seems to work. Not sure what holding the get does on the lock, since once we have the lock, the reference shouldn't change. Other users of the same lock don't bother with the get_cpu_var method and just use per_cpu. Signed-off-by: John Stultz Signed-off-by: Thomas Gleixner --- fs/file_table.c | 2 +- fs/inode.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/file_table.c b/fs/file_table.c index 15accf30daa2..a7c231786a9a 100644 --- a/fs/file_table.c +++ b/fs/file_table.c @@ -345,11 +345,11 @@ void file_sb_list_add(struct file *file, struct super_block *sb) #else list = &sb->s_files; #endif + put_cpu_var(files_cpulock); spin_lock(lock); BUG_ON(!list_empty(&file->f_u.fu_list)); list_add(&file->f_u.fu_list, list); spin_unlock(lock); - put_cpu_var(files_cpulock); } void file_sb_list_del(struct file *file) diff --git a/fs/inode.c b/fs/inode.c index fc9973a57afc..7406301297ab 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -691,10 +691,10 @@ static void inode_sb_list_add(struct inode *inode, struct super_block *sb) #else list = &sb->s_files; #endif + put_cpu_var(inode_cpulock); spin_lock(lock); list_add_rcu(&inode->i_sb_list, list); spin_unlock(lock); - put_cpu_var(inode_cpulock); } void inode_sb_list_del(struct inode *inode) -- cgit v1.2.3