Whamcloud - gitweb
LU-506 kernel: some other minor cleanup of BKL
authorLiu Xuezhao <xuezhao.liu@emc.com>
Wed, 30 May 2012 12:44:05 +0000 (20:44 +0800)
committerOleg Drokin <green@whamcloud.com>
Tue, 12 Jun 2012 15:46:51 +0000 (11:46 -0400)
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 <xuezhao.liu@emc.com>
Change-Id: I6e41c0c3fa76c33dae4f820a63bd3ba62ff704ec
Reviewed-on: http://review.whamcloud.com/2950
Tested-by: Hudson
Reviewed-by: Lai Siyao <laisiyao@whamcloud.com>
Reviewed-by: Andreas Dilger <adilger@whamcloud.com>
Tested-by: Maloo <whamcloud.maloo@gmail.com>
Reviewed-by: Oleg Drokin <green@whamcloud.com>
libcfs/libcfs/linux/linux-debug.c
libcfs/libcfs/linux/linux-module.c
libcfs/libcfs/linux/linux-prim.c
libcfs/libcfs/linux/linux-tcpip.c
lustre/obdclass/linux/linux-module.c

index 0f61f2e..bfee25d 100644 (file)
@@ -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
index 5b0b2d3..c45d358 100644 (file)
@@ -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 = {
index e5c56b5..ae7df19 100644 (file)
@@ -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(&current->blocked);
         RECALC_SIGPENDING;
         SIGNAL_MASK_UNLOCK(current, flags);
-        unlock_kernel();
 }
 
 int cfs_daemonize_ctxt(char *str) {
index 5b31423..43b2496 100644 (file)
@@ -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);
 
index a0f2761..5c85087 100644 (file)
@@ -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 */