From 8946ce958c123ba05576d792e8af22ea899a43c8 Mon Sep 17 00:00:00 2001 From: Chris Horn Date: Tue, 2 May 2017 16:42:31 -0500 Subject: [PATCH] LU-9447 o2iblnd: Check for 2 arg ib_alloc_pd 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 Change-Id: Iecde347e9f18149cac63e243082a2686de260ba7 Reviewed-on: https://review.whamcloud.com/26934 Reviewed-by: Doug Oucharek Tested-by: Jenkins Reviewed-by: James Simmons Tested-by: Maloo Reviewed-by: Oleg Drokin --- lnet/autoconf/lustre-lnet.m4 | 21 +++++++++++++++++++++ lnet/klnds/o2iblnd/o2iblnd.c | 6 +++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4 index 32167d5..b0fb2ee 100644 --- a/lnet/autoconf/lustre-lnet.m4 +++ b/lnet/autoconf/lustre-lnet.m4 @@ -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 + #endif + #include + ],[ + 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 diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c index db6012c..91e3a38 100644 --- a/lnet/klnds/o2iblnd/o2iblnd.c +++ b/lnet/klnds/o2iblnd/o2iblnd.c @@ -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); -- 1.8.3.1