mirror of
https://github.com/ukui/kernel.git
synced 2026-03-09 10:07:04 -07:00
Merge branch 'bkl-removal' of git://git.lwn.net/linux-2.6
* 'bkl-removal' of git://git.lwn.net/linux-2.6: (146 commits) IB/umad: BKL is not needed for ib_umad_open() IB/uverbs: BKL is not needed for ib_uverbs_open() bf561-coreb: BKL unneeded for open() Call fasync() functions without the BKL snd/PCM: fasync BKL pushdown ipmi: fasync BKL pushdown ecryptfs: fasync BKL pushdown Bluetooth VHCI: fasync BKL pushdown tty_io: fasync BKL pushdown tun: fasync BKL pushdown i2o: fasync BKL pushdown mpt: fasync BKL pushdown Remove BKL from remote_llseek v2 Make FAT users happier by not deadlocking x86-mce: BKL pushdown vmwatchdog: BKL pushdown vmcp: BKL pushdown via-pmu: BKL pushdown uml-random: BKL pushdown uml-mmapper: BKL pushdown ...
This commit is contained in:
@@ -7,6 +7,7 @@
|
||||
#include <linux/hdreg.h>
|
||||
#include <linux/blkdev.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/smp_lock.h>
|
||||
#include "aoe.h"
|
||||
|
||||
enum {
|
||||
@@ -174,12 +175,16 @@ aoechr_open(struct inode *inode, struct file *filp)
|
||||
{
|
||||
int n, i;
|
||||
|
||||
lock_kernel();
|
||||
n = iminor(inode);
|
||||
filp->private_data = (void *) (unsigned long) n;
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(chardevs); ++i)
|
||||
if (chardevs[i].minor == n)
|
||||
if (chardevs[i].minor == n) {
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
}
|
||||
unlock_kernel();
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -162,6 +162,7 @@ enum {D_PRT, D_PRO, D_UNI, D_MOD, D_SLV, D_DLY};
|
||||
#include <linux/pg.h>
|
||||
#include <linux/device.h>
|
||||
#include <linux/sched.h> /* current, TASK_* */
|
||||
#include <linux/smp_lock.h>
|
||||
#include <linux/jiffies.h>
|
||||
|
||||
#include <asm/uaccess.h>
|
||||
@@ -515,12 +516,18 @@ static int pg_open(struct inode *inode, struct file *file)
|
||||
{
|
||||
int unit = iminor(inode) & 0x7f;
|
||||
struct pg *dev = &devices[unit];
|
||||
int ret = 0;
|
||||
|
||||
if ((unit >= PG_UNITS) || (!dev->present))
|
||||
return -ENODEV;
|
||||
lock_kernel();
|
||||
if ((unit >= PG_UNITS) || (!dev->present)) {
|
||||
ret = -ENODEV;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (test_and_set_bit(0, &dev->access))
|
||||
return -EBUSY;
|
||||
if (test_and_set_bit(0, &dev->access)) {
|
||||
ret = -EBUSY;
|
||||
goto out;
|
||||
}
|
||||
|
||||
if (dev->busy) {
|
||||
pg_reset(dev);
|
||||
@@ -533,12 +540,15 @@ static int pg_open(struct inode *inode, struct file *file)
|
||||
if (dev->bufptr == NULL) {
|
||||
clear_bit(0, &dev->access);
|
||||
printk("%s: buffer allocation failed\n", dev->name);
|
||||
return -ENOMEM;
|
||||
ret = -ENOMEM;
|
||||
goto out;
|
||||
}
|
||||
|
||||
file->private_data = dev;
|
||||
|
||||
return 0;
|
||||
out:
|
||||
unlock_kernel();
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int pg_release(struct inode *inode, struct file *file)
|
||||
|
||||
@@ -650,8 +650,11 @@ static int pt_open(struct inode *inode, struct file *file)
|
||||
struct pt_unit *tape = pt + unit;
|
||||
int err;
|
||||
|
||||
if (unit >= PT_UNITS || (!tape->present))
|
||||
lock_kernel();
|
||||
if (unit >= PT_UNITS || (!tape->present)) {
|
||||
unlock_kernel();
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
err = -EBUSY;
|
||||
if (!atomic_dec_and_test(&tape->available))
|
||||
@@ -678,10 +681,12 @@ static int pt_open(struct inode *inode, struct file *file)
|
||||
}
|
||||
|
||||
file->private_data = tape;
|
||||
unlock_kernel();
|
||||
return 0;
|
||||
|
||||
out:
|
||||
atomic_inc(&tape->available);
|
||||
unlock_kernel();
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user