summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Stultz <johnstul@us.ibm.com>2010-02-22 18:41:36 -0800
committerThomas Gleixner <tglx@linutronix.de>2010-04-27 17:33:00 +0200
commita3426080b810723f1bed95b8d08146738126d324 (patch)
tree65c82707c5112b7fc98a49ded49e7e02b9daa46f
parent070976b5b038218900648ea4cc88786d5dfcd58d (diff)
downloadlwn-a3426080b810723f1bed95b8d08146738126d324.tar.gz
lwn-a3426080b810723f1bed95b8d08146738126d324.zip
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 <johnstul@us.ibm.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--fs/file_table.c2
-rw-r--r--fs/inode.c2
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)