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>

+8 -3
+8 -3
drivers/infiniband/core/ucma.c
··· 38 #include <linux/in.h> 39 #include <linux/in6.h> 40 #include <linux/miscdevice.h> 41 - #include <linux/smp_lock.h> 42 43 #include <rdma/rdma_user_cm.h> 44 #include <rdma/ib_marshall.h> ··· 1148 return mask; 1149 } 1150 1151 static int ucma_open(struct inode *inode, struct file *filp) 1152 { 1153 struct ucma_file *file; ··· 1164 if (!file) 1165 return -ENOMEM; 1166 1167 - lock_kernel(); 1168 INIT_LIST_HEAD(&file->event_list); 1169 INIT_LIST_HEAD(&file->ctx_list); 1170 init_waitqueue_head(&file->poll_wait); ··· 1171 1172 filp->private_data = file; 1173 file->filp = filp; 1174 - unlock_kernel(); 1175 return 0; 1176 } 1177
··· 38 #include <linux/in.h> 39 #include <linux/in6.h> 40 #include <linux/miscdevice.h> 41 42 #include <rdma/rdma_user_cm.h> 43 #include <rdma/ib_marshall.h> ··· 1149 return mask; 1150 } 1151 1152 + /* 1153 + * ucma_open() does not need the BKL: 1154 + * 1155 + * - no global state is referred to; 1156 + * - there is no ioctl method to race against; 1157 + * - no further module initialization is required for open to work 1158 + * after the device is registered. 1159 + */ 1160 static int ucma_open(struct inode *inode, struct file *filp) 1161 { 1162 struct ucma_file *file; ··· 1157 if (!file) 1158 return -ENOMEM; 1159 1160 INIT_LIST_HEAD(&file->event_list); 1161 INIT_LIST_HEAD(&file->ctx_list); 1162 init_waitqueue_head(&file->poll_wait); ··· 1165 1166 filp->private_data = file; 1167 file->filp = filp; 1168 return 0; 1169 } 1170