From 5435309a480c317440e6c4537679bcfe90eb31d5 Mon Sep 17 00:00:00 2001
From: scjody <scjody>
Date: Fri, 24 Aug 2007 15:36:37 +0000
Subject: [PATCH] Branch b1_6

Add EXPORT_SYMBOL check for node_to_cpumask symbol.

b=12826
i=shadow
i=mjmac
---
 lustre/ChangeLog               |  7 +++++++
 lustre/autoconf/lustre-core.m4 | 26 +++++++++++++++++++++++++-
 lustre/ptlrpc/service.c        |  2 +-
 3 files changed, 33 insertions(+), 2 deletions(-)

diff --git a/lustre/ChangeLog b/lustre/ChangeLog
index 75474feeee..8e3a2738e2 100644
--- a/lustre/ChangeLog
+++ b/lustre/ChangeLog
@@ -79,6 +79,13 @@ Description: mds_obd_create error creating tmp object
 Details    : When the user sets quota on root, llog will be affected and can't 
              create files and write files.
 
+Severity   : normal
+Frequency  : Always on ia64 patchless client, and possibly others.
+Bugzilla   : 12826
+Description: Add EXPORT_SYMBOL check for node_to_cpumask symbol.
+Details    : This allows the patchless client to be loaded on architectures
+             without this export.
+
 --------------------------------------------------------------------------------
 
 2007-08-27         Cluster File Systems, Inc. <info@clusterfs.com>
diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
index 068a8acb05..c05b94a588 100644
--- a/lustre/autoconf/lustre-core.m4
+++ b/lustre/autoconf/lustre-core.m4
@@ -1074,6 +1074,29 @@ AC_DEFINE(HAVE___D_REHASH, 1,
 ])
 ])
 
+# The actual symbol exported varies among architectures, so we need
+# to check many symbols (but only in the current architecture.)  No
+# matter what symbol is exported, the kernel #defines node_to_cpumask
+# to the appropriate function and that's what we use.
+AC_DEFUN([LC_EXPORT_NODE_TO_CPUMASK],
+         [LB_LINUX_ARCH
+          LB_CHECK_SYMBOL_EXPORT([node_to_cpumask],
+                                 [arch/$LINUX_ARCH/mm/numa.c],
+                                 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
+                                            [node_to_cpumask is exported by
+                                             the kernel])]) # x86_64
+          LB_CHECK_SYMBOL_EXPORT([node_to_cpu_mask],
+                                 [arch/$LINUX_ARCH/kernel/smpboot.c],
+                                 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
+                                            [node_to_cpumask is exported by
+                                             the kernel])]) # ia64
+          LB_CHECK_SYMBOL_EXPORT([node_2_cpu_mask],
+                                 [arch/$LINUX_ARCH/kernel/smpboot.c],
+                                 [AC_DEFINE(HAVE_NODE_TO_CPUMASK, 1,
+                                            [node_to_cpumask is exported by
+                                             the kernel])]) # i386
+          ])
+
 #
 # LC_VFS_INTENT_PATCHES
 #
@@ -1115,10 +1138,11 @@ LC_CONFIG_QUOTA
 LC_CONFIG_HEALTH_CHECK_WRITE
 
 LC_TASK_PPTR
-# RHEL4 pachess
+# RHEL4 patches
 LC_EXPORT_TRUNCATE_COMPLETE
 LC_EXPORT_D_REHASH_COND
 LC_EXPORT___D_REHASH
+LC_EXPORT_NODE_TO_CPUMASK
 
 LC_STRUCT_KIOBUF
 LC_FUNC_COND_RESCHED
diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c
index 32380b3c60..af8ffbf327 100644
--- a/lustre/ptlrpc/service.c
+++ b/lustre/ptlrpc/service.c
@@ -887,7 +887,7 @@ static int ptlrpc_main(void *arg)
 
         ptlrpc_daemonize(data->name);
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,9) && defined(CONFIG_NUMA)
+#if defined(HAVE_NODE_TO_CPUMASK) && defined(CONFIG_NUMA)
         /* we need to do this before any per-thread allocation is done so that
          * we get the per-thread allocations on local node.  bug 7342 */
         if (svc->srv_cpu_affinity) {
-- 
GitLab