Whamcloud - gitweb
LU-9447 o2iblnd: Check for 2 arg ib_alloc_pd 34/26934/3
authorChris Horn <hornc@cray.com>
Tue, 2 May 2017 21:42:31 +0000 (16:42 -0500)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 9 May 2017 03:47:37 +0000 (03:47 +0000)
A flags argument was added to ib_alloc_pd() in Linux 4.9 commit
ed082d36a7b2c27d1cda55fdfb28af18040c4a89. The fix for LU-9026, Lustre
commit e4297ef38561f1e788ba73ca0c8078a09dc8c303, accounted for this
change by checking for the removal of ib_get_dma_mr() (which happened
separately). However, SLES 12 SP3 beta 1 adopted the extra argument
to ib_alloc_pd(), but retains the ib_get_dma_mr() function. As a
result, we need an explicit check for the two argument version of
ib_alloc_pd().

Signed-off-by: Chris Horn <hornc@cray.com>
Change-Id: Iecde347e9f18149cac63e243082a2686de260ba7
Reviewed-on: https://review.whamcloud.com/26934
Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
Tested-by: Jenkins
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lnet/autoconf/lustre-lnet.m4
lnet/klnds/o2iblnd/o2iblnd.c

index 32167d5..b0fb2ee 100644 (file)
@@ -538,6 +538,27 @@ AS_IF([test $ENABLEO2IB != "no"], [
                        [struct ib_device.attrs is defined])
        ])
 
+       # A flags argument was added to ib_alloc_pd() in Linux 4.9,
+       # commit ed082d36a7b2c27d1cda55fdfb28af18040c4a89
+       LB_CHECK_COMPILE([if 2arg 'ib_alloc_pd' exists],
+       ib_alloc_pd, [
+               #ifdef HAVE_COMPAT_RDMA
+               #undef PACKAGE_NAME
+               #undef PACKAGE_TARNAME
+               #undef PACKAGE_VERSION
+               #undef PACKAGE_STRING
+               #undef PACKAGE_BUGREPORT
+               #undef PACKAGE_URL
+               #include <linux/compat-2.6.h>
+               #endif
+               #include <rdma/ib_verbs.h>
+       ],[
+               ib_alloc_pd(NULL, 0);
+       ],[
+               AC_DEFINE(HAVE_IB_ALLOC_PD_2ARGS, 1,
+                       [ib_alloc_pd has 2 arguments])
+       ])
+
        LB_CHECK_COMPILE([if function 'ib_inc_rkey' is defined],
        ib_inc_rkey, [
                #ifdef HAVE_COMPAT_RDMA
index db6012c..91e3a38 100644 (file)
@@ -2729,10 +2729,10 @@ kiblnd_dev_failover(kib_dev_t *dev)
         hdev->ibh_cmid  = cmid;
         hdev->ibh_ibdev = cmid->device;
 
-#ifdef HAVE_IB_GET_DMA_MR
-       pd = ib_alloc_pd(cmid->device);
-#else
+#ifdef HAVE_IB_ALLOC_PD_2ARGS
        pd = ib_alloc_pd(cmid->device, 0);
+#else
+       pd = ib_alloc_pd(cmid->device);
 #endif
        if (IS_ERR(pd)) {
                rc = PTR_ERR(pd);