Whamcloud - gitweb
LU-8066 libcfs: test for both __kernel_param_[un]lock and kernel_param_[un]lock 98/28498/3
authorJames Simmons <uja.ornl@yahoo.com>
Fri, 11 Aug 2017 19:47:19 +0000 (15:47 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Mon, 28 Aug 2017 06:27:03 +0000 (06:27 +0000)
In earlier kernels like RHEL6 no locking is available. Later the
function __kernel_param_[un]lock() we introduced. In most recent
kernels per module locking was introduced with the functions
kernel_param_[un]lock() and __kernel_param_[un]lock() is no longer
visible to modules. Since this is the case we need to make sure
both HAVE_MODULE_PARAM_LOCKING and HAVE_KERNEL_PARAM_LOCK are not
set in the case of RHEL6.

Change-Id: I0957a16352c4fb49fb5d96c0ff4d331a8be9703a
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-on: https://review.whamcloud.com/28498
Tested-by: Jenkins
Reviewed-by: Bob Glossman <bob.glossman@intel.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Olaf Weber <olaf.weber@hpe.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
libcfs/libcfs/debug.c

index f923842..02af6fa 100644 (file)
@@ -68,7 +68,7 @@ static int libcfs_param_debug_mb_set(const char *val,
  * RHEL6 does not support any kind of locking so we have to provide
  * our own
  */
-#ifndef HAVE_MODULE_PARAM_LOCKING
+#if !defined(HAVE_MODULE_PARAM_LOCKING) && !defined(HAVE_KERNEL_PARAM_LOCK)
        kernel_param_lock(THIS_MODULE);
 #endif
        if (!*((unsigned int *)kp->arg)) {
@@ -81,7 +81,7 @@ static int libcfs_param_debug_mb_set(const char *val,
        if (!rc)
                *((unsigned int *)kp->arg) = cfs_trace_get_debug_mb();
 
-#ifndef HAVE_MODULE_PARAM_LOCKING
+#if !defined(HAVE_MODULE_PARAM_LOCKING) && !defined(HAVE_KERNEL_PARAM_LOCK)
        kernel_param_unlock(THIS_MODULE);
 #endif
        return rc;