From: Liu Xuezhao Date: Wed, 30 May 2012 12:44:05 +0000 (+0800) Subject: LU-506 kernel: some other minor cleanup of BKL X-Git-Tag: 2.2.55~3 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=cdaeb287ec52b54aab62ff465518c9d98ee3736b LU-506 kernel: some other minor cleanup of BKL Remove lock_kernel/unlock_kernel from cfs_daemonize. Remove HAVE_UNLOCKED_IOCTL check as it is defined after 2.6.12. Signed-off-by: Liu Xuezhao Change-Id: I6e41c0c3fa76c33dae4f820a63bd3ba62ff704ec Reviewed-on: http://review.whamcloud.com/2950 Tested-by: Hudson Reviewed-by: Lai Siyao Reviewed-by: Andreas Dilger Tested-by: Maloo Reviewed-by: Oleg Drokin --- diff --git a/libcfs/libcfs/linux/linux-debug.c b/libcfs/libcfs/linux/linux-debug.c index 0f61f2e..bfee25d 100644 --- a/libcfs/libcfs/linux/linux-debug.c +++ b/libcfs/libcfs/linux/linux-debug.c @@ -313,9 +313,10 @@ static int panic_notifier(struct notifier_block *self, unsigned long unused1, if (in_interrupt()) { cfs_trace_debug_print(); } else { - while (current->lock_depth >= 0) - unlock_kernel(); - +# ifdef HAVE_KERNEL_LOCKED + while (kernel_locked()) + unlock_kernel(); +# endif libcfs_debug_dumplog_internal((void *)(long)cfs_curproc_pid()); } #endif diff --git a/libcfs/libcfs/linux/linux-module.c b/libcfs/libcfs/linux/linux-module.c index 5b0b2d3..c45d358 100644 --- a/libcfs/libcfs/linux/linux-module.c +++ b/libcfs/libcfs/linux/linux-module.c @@ -131,14 +131,8 @@ libcfs_psdev_release(struct inode * inode, struct file * file) return rc; } - -#ifdef HAVE_UNLOCKED_IOCTL static long libcfs_ioctl(struct file *file, - unsigned int cmd, unsigned long arg) -#else -static int libcfs_ioctl(struct inode *inode, struct file *file, - unsigned int cmd, unsigned long arg) -#endif + unsigned int cmd, unsigned long arg) { struct cfs_psdev_file pfile; int rc = 0; @@ -177,13 +171,9 @@ static int libcfs_ioctl(struct inode *inode, struct file *file, } static struct file_operations libcfs_fops = { -#ifdef HAVE_UNLOCKED_IOCTL - unlocked_ioctl: libcfs_ioctl, -#else - ioctl: libcfs_ioctl, -#endif - open : libcfs_psdev_open, - release : libcfs_psdev_release + unlocked_ioctl: libcfs_ioctl, + open : libcfs_psdev_open, + release : libcfs_psdev_release }; cfs_psdev_t libcfs_dev = { diff --git a/libcfs/libcfs/linux/linux-prim.c b/libcfs/libcfs/linux/linux-prim.c index e5c56b5..ae7df19 100644 --- a/libcfs/libcfs/linux/linux-prim.c +++ b/libcfs/libcfs/linux/linux-prim.c @@ -267,13 +267,11 @@ void cfs_enter_debugger(void) void cfs_daemonize(char *str) { unsigned long flags; - lock_kernel(); daemonize(str); SIGNAL_MASK_LOCK(current, flags); sigfillset(¤t->blocked); RECALC_SIGPENDING; SIGNAL_MASK_UNLOCK(current, flags); - unlock_kernel(); } int cfs_daemonize_ctxt(char *str) { diff --git a/libcfs/libcfs/linux/linux-tcpip.c b/libcfs/libcfs/linux/linux-tcpip.c index 5b31423..43b2496 100644 --- a/libcfs/libcfs/linux/linux-tcpip.c +++ b/libcfs/libcfs/linux/linux-tcpip.c @@ -76,17 +76,10 @@ libcfs_sock_ioctl(int cmd, unsigned long arg) goto out_fd; } - set_fs(KERNEL_DS); -#ifdef HAVE_UNLOCKED_IOCTL - if (sock_filp->f_op->unlocked_ioctl) - rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg); -#else - lock_kernel(); - rc = sock_filp->f_op->ioctl(sock_filp->f_dentry->d_inode, - sock_filp, cmd, arg); - unlock_kernel(); -#endif - set_fs(oldmm); + set_fs(KERNEL_DS); + if (sock_filp->f_op->unlocked_ioctl) + rc = sock_filp->f_op->unlocked_ioctl(sock_filp, cmd, arg); + set_fs(oldmm); fput(sock_filp); diff --git a/lustre/obdclass/linux/linux-module.c b/lustre/obdclass/linux/linux-module.c index a0f2761..5c85087 100644 --- a/lustre/obdclass/linux/linux-module.c +++ b/lustre/obdclass/linux/linux-module.c @@ -196,13 +196,8 @@ static int obd_class_release(struct inode * inode, struct file * file) } /* to control /dev/obd */ -#ifdef HAVE_UNLOCKED_IOCTL static long obd_class_ioctl(struct file *filp, unsigned int cmd, - unsigned long arg) -#else -static int obd_class_ioctl(struct inode *inode, struct file *filp, - unsigned int cmd, unsigned long arg) -#endif + unsigned long arg) { int err = 0; ENTRY; @@ -220,14 +215,10 @@ static int obd_class_ioctl(struct inode *inode, struct file *filp, /* declare character device */ static struct file_operations obd_psdev_fops = { - .owner = THIS_MODULE, -#if HAVE_UNLOCKED_IOCTL - .unlocked_ioctl = obd_class_ioctl, /* unlocked_ioctl */ -#else - .ioctl = obd_class_ioctl, /* ioctl */ -#endif - .open = obd_class_open, /* open */ - .release = obd_class_release, /* release */ + .owner = THIS_MODULE, + .unlocked_ioctl = obd_class_ioctl, /* unlocked_ioctl */ + .open = obd_class_open, /* open */ + .release = obd_class_release, /* release */ }; /* modules setup */