RDMA/ucma: BKL is not needed for ucma_open()
Remove explicit lock_kernel() calls and document why the code is safe. Signed-off-by: Roland Dreier <rolandd@cisco.com>
This commit is contained in:
parent
fb2e405fc1
commit
f7a6117ee5
1 changed files with 8 additions and 3 deletions
|
@ -38,7 +38,6 @@
|
||||||
#include <linux/in.h>
|
#include <linux/in.h>
|
||||||
#include <linux/in6.h>
|
#include <linux/in6.h>
|
||||||
#include <linux/miscdevice.h>
|
#include <linux/miscdevice.h>
|
||||||
#include <linux/smp_lock.h>
|
|
||||||
|
|
||||||
#include <rdma/rdma_user_cm.h>
|
#include <rdma/rdma_user_cm.h>
|
||||||
#include <rdma/ib_marshall.h>
|
#include <rdma/ib_marshall.h>
|
||||||
|
@ -1149,6 +1148,14 @@ static unsigned int ucma_poll(struct file *filp, struct poll_table_struct *wait)
|
||||||
return mask;
|
return mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ucma_open() does not need the BKL:
|
||||||
|
*
|
||||||
|
* - no global state is referred to;
|
||||||
|
* - there is no ioctl method to race against;
|
||||||
|
* - no further module initialization is required for open to work
|
||||||
|
* after the device is registered.
|
||||||
|
*/
|
||||||
static int ucma_open(struct inode *inode, struct file *filp)
|
static int ucma_open(struct inode *inode, struct file *filp)
|
||||||
{
|
{
|
||||||
struct ucma_file *file;
|
struct ucma_file *file;
|
||||||
|
@ -1157,7 +1164,6 @@ static int ucma_open(struct inode *inode, struct file *filp)
|
||||||
if (!file)
|
if (!file)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
lock_kernel();
|
|
||||||
INIT_LIST_HEAD(&file->event_list);
|
INIT_LIST_HEAD(&file->event_list);
|
||||||
INIT_LIST_HEAD(&file->ctx_list);
|
INIT_LIST_HEAD(&file->ctx_list);
|
||||||
init_waitqueue_head(&file->poll_wait);
|
init_waitqueue_head(&file->poll_wait);
|
||||||
|
@ -1165,7 +1171,6 @@ static int ucma_open(struct inode *inode, struct file *filp)
|
||||||
|
|
||||||
filp->private_data = file;
|
filp->private_data = file;
|
||||||
file->filp = filp;
|
file->filp = filp;
|
||||||
unlock_kernel();
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue