Instead of grabbing the BKL on seek, use the inode mutex in the style
of generic_file_llseek().
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
static loff_t cpuid_seek(struct file *file, loff_t offset, int orig)
{
loff_t ret;
static loff_t cpuid_seek(struct file *file, loff_t offset, int orig)
{
loff_t ret;
+ struct inode *inode = file->f_mapping->host;
+ mutex_lock(&inode->i_mutex);
switch (orig) {
case 0:
file->f_pos = offset;
switch (orig) {
case 0:
file->f_pos = offset;
default:
ret = -EINVAL;
}
default:
ret = -EINVAL;
}
+ mutex_unlock(&inode->i_mutex);
/* ----------------------------------------------------------------------- *
/* ----------------------------------------------------------------------- *
- *
- * Copyright 2000 H. Peter Anvin - All Rights Reserved
+ *
+ * Copyright 2000-2008 H. Peter Anvin - All Rights Reserved
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
static loff_t msr_seek(struct file *file, loff_t offset, int orig)
{
static loff_t msr_seek(struct file *file, loff_t offset, int orig)
{
+ loff_t ret;
+ struct inode *inode = file->f_mapping->host;
+ mutex_lock(&inode->i_mutex);
switch (orig) {
case 0:
file->f_pos = offset;
switch (orig) {
case 0:
file->f_pos = offset;
case 1:
file->f_pos += offset;
ret = file->f_pos;
case 1:
file->f_pos += offset;
ret = file->f_pos;
+ break;
+ default:
+ ret = -EINVAL;
+ mutex_unlock(&inode->i_mutex);