[Pkg-lustre-svn-commit] r491 - in /trunk/debian: changelog patches/00list patches/patchless_support_2.6.24.dpatch

winnie at users.alioth.debian.org winnie at users.alioth.debian.org
Fri Sep 12 12:28:47 UTC 2008


Author: winnie
Date: Fri Sep 12 12:28:47 2008
New Revision: 491

URL: http://svn.debian.org/wsvn/pkg-lustre/?sc=1&rev=491
Log:
Add patchless support for 2.6.24

Added:
    trunk/debian/patches/patchless_support_2.6.24.dpatch
Modified:
    trunk/debian/changelog
    trunk/debian/patches/00list

Modified: trunk/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/changelog?rev=491&op=diff
==============================================================================
--- trunk/debian/changelog (original)
+++ trunk/debian/changelog Fri Sep 12 12:28:47 2008
@@ -5,8 +5,9 @@
     (Or vice versa)
   * Added patch from bugzilla to prevent kernel oops when 
     ost disk is ~70% full. - Doesn't work yet
-
- -- Patrick Winnertz <winnie at debian.org>  Mon, 08 Sep 2008 20:51:21 +0200
+  * Add patch to support patchless clients <=2.6.24 
+
+ -- Patrick Winnertz <winnie at debian.org>  Fri, 12 Sep 2008 14:25:46 +0200
 
 lustre (1.6.5.1-1) unstable; urgency=low
 

Modified: trunk/debian/patches/00list
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/patches/00list?rev=491&op=diff
==============================================================================
--- trunk/debian/patches/00list (original)
+++ trunk/debian/patches/00list Fri Sep 12 12:28:47 2008
@@ -13,7 +13,7 @@
 bug12769-ql-fix.dpatch
 operation_101_unconnected_mgs.dpatch
 fix_late_release_pa_structure.dpatch
-
+patchless_support_2.6.24.dpatch
 # Debian patches
 bash_completion.dpatch
 lustre_manpage.dpatch

Added: trunk/debian/patches/patchless_support_2.6.24.dpatch
URL: http://svn.debian.org/wsvn/pkg-lustre/trunk/debian/patches/patchless_support_2.6.24.dpatch?rev=491&op=file
==============================================================================
--- trunk/debian/patches/patchless_support_2.6.24.dpatch (added)
+++ trunk/debian/patches/patchless_support_2.6.24.dpatch Fri Sep 12 12:28:47 2008
@@ -1,0 +1,4144 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## posix_acl.patch by Patrick Winnertz <winnie at debian.org>
+##
+## All lines beginning with `## DP:' are a description of the patch.
+## DP: Patch which will enable 2.6.24 patchless support for lustre, taken from #14250
+
+ at DPATCH@
+diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4
+--- a/lnet/autoconf/lustre-lnet.m4
++++ b/lnet/autoconf/lustre-lnet.m4
+@@ -1263,6 +1263,41 @@ LB_LINUX_TRY_COMPILE([
+ ])
+ ])
+ 
++# 2.6.24 request not use real numbers for ctl_name
++AC_DEFUN([LN_SYSCTL_UNNUMBERED],
++[AC_MSG_CHECKING([for CTL_UNNUMBERED])
++LB_LINUX_TRY_COMPILE([
++        #include <linux/sysctl.h>
++],[
++	#ifndef CTL_UNNUMBERED
++	#error CTL_UNNUMBERED not exist in kernel
++	#endif
++],[
++        AC_MSG_RESULT(yes)
++        AC_DEFINE(HAVE_SYSCTL_UNNUMBERED, 1,
++                  [sysctl has CTL_UNNUMBERED])
++],[
++        AC_MSG_RESULT(NO)
++])
++])
++
++# 2.6.24 lost scatterlist->page
++AC_DEFUN([LN_SCATTERLIST_SETPAGE],
++[AC_MSG_CHECKING([for exist sg_set_page])
++LB_LINUX_TRY_COMPILE([
++        #include <linux/scatterlist.h>
++],[
++	sg_set_page(NULL,NULL,0,0);
++],[
++        AC_MSG_RESULT(yes)
++        AC_DEFINE(HAVE_SCATTERLIST_SETPAGE, 1,
++                  [struct scatterlist has page member])
++],[
++        AC_MSG_RESULT(NO)
++])
++])
++
++
+ #
+ # LN_PROG_LINUX
+ #
+@@ -1305,6 +1340,9 @@ LN_KMEM_CACHE
+ LN_KMEM_CACHE
+ # 2.6.23
+ LN_KMEM_CACHE_CREATE_DTOR
++# 2.6.24
++LN_SYSCTL_UNNUMBERED
++LN_SCATTERLIST_SETPAGE
+ ])
+ 
+ #
+diff --git a/lnet/include/libcfs/curproc.h b/lnet/include/libcfs/curproc.h
+--- a/lnet/include/libcfs/curproc.h
++++ b/lnet/include/libcfs/curproc.h
+@@ -49,6 +49,11 @@ char  *cfs_curproc_comm(void);
+  */
+ cfs_kernel_cap_t cfs_curproc_cap_get(void);
+ void cfs_curproc_cap_set(cfs_kernel_cap_t cap);
++
++typedef __u32 cfs_cap_t;
++
++cfs_cap_t cfs_cap_convert_from_kernel(cfs_kernel_cap_t cap);
++
+ #endif
+ 
+ /* __LIBCFS_CURPROC_H__ */
+diff --git a/lnet/include/libcfs/linux/linux-prim.h b/lnet/include/libcfs/linux/linux-prim.h
+--- a/lnet/include/libcfs/linux/linux-prim.h
++++ b/lnet/include/libcfs/linux/linux-prim.h
+@@ -67,6 +67,17 @@ typedef struct ctl_table_header		cfs_sys
+ #define cfs_register_sysctl_table(t, a) register_sysctl_table(t)
+ #endif
+ #define cfs_unregister_sysctl_table(t)	unregister_sysctl_table(t)
++
++#define DECLARE_PROC_HANDLER(name)                      \
++static int                                              \
++LL_PROC_PROTO(name)                                     \
++{                                                       \
++        DECLARE_LL_PROC_PPOS_DECL;                      \
++                                                        \
++        return proc_call_handler(table->data, write,    \
++                                 ppos, buffer, lenp,    \
++                                 __##name);             \
++}
+ 
+ /*
+  * Symbol register
+diff --git a/lnet/klnds/gmlnd/gmlnd_module.c b/lnet/klnds/gmlnd/gmlnd_module.c
+--- a/lnet/klnds/gmlnd/gmlnd_module.c
++++ b/lnet/klnds/gmlnd/gmlnd_module.c
+@@ -62,9 +62,37 @@ gmnal_tunables_t gmnal_tunables = {
+ };
+ 
+ #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
++
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_GMLND       202
++
++enum {
++        GMLND_PORT = 1,
++        GMLND_NTX,
++        GMLND_CREDITS,
++        GMLND_PEERCREDITS,
++        GMLND_NLARGE_TX_BUFS,
++        GMLND_NRX_SMALL,
++        GMLND_NRX_LARGE
++};
++
++#else
++#define CTL_GMLND       CTL_UNNUMBERED
++
++#define GMLND_PORT              CTL_UNNUMBERED
++#define GMLND_NTX               CTL_UNNUMBERED
++#define GMLND_CREDITS           CTL_UNNUMBERED
++#define GMLND_PEERCREDITS       CTL_UNNUMBERED
++#define GMLND_NLARGE_TX_BUFS    CTL_UNNUMBERED
++#define GMLND_NRX_SMALL         CTL_UNNUMBERED
++#define GMLND_NRX_LARGE         CTL_UNNUMBERED
++
++#endif
++
+ static cfs_sysctl_table_t gmnal_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = GMLND_PORT,
+                 .procname = "port",
+                 .data     = &port,
+                 .maxlen   = sizeof (int),
+@@ -72,7 +100,7 @@ static cfs_sysctl_table_t gmnal_ctl_tabl
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = GMLND_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof (int),
+@@ -80,7 +108,7 @@ static cfs_sysctl_table_t gmnal_ctl_tabl
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = GMLND_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof (int),
+@@ -88,7 +116,7 @@ static cfs_sysctl_table_t gmnal_ctl_tabl
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = GMLND_PEERCREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof (int),
+@@ -96,7 +124,7 @@ static cfs_sysctl_table_t gmnal_ctl_tabl
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = GMLND_NLARGE_TX_BUFS,
+                 .procname = "nlarge_tx_bufs",
+                 .data     = &nlarge_tx_bufs,
+                 .maxlen   = sizeof (int),
+@@ -104,7 +132,7 @@ static cfs_sysctl_table_t gmnal_ctl_tabl
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = GMLND_NRX_SMALL,
+                 .procname = "nrx_small",
+                 .data     = &nrx_small,
+                 .maxlen   = sizeof (int),
+@@ -112,7 +140,7 @@ static cfs_sysctl_table_t gmnal_ctl_tabl
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = GMLND_NRX_LARGE,
+                 .procname = "nrx_large",
+                 .data     = &nrx_large,
+                 .maxlen   = sizeof (int),
+@@ -124,7 +152,7 @@ static cfs_sysctl_table_t gmnal_ctl_tabl
+ 
+ static cfs_sysctl_table_t gmnal_top_ctl_table[] = {
+         {
+-                .ctl_name = 207,
++                .ctl_name = CTL_GMLND,
+                 .procname = "gmnal",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff --git a/lnet/klnds/iiblnd/iiblnd_modparams.c b/lnet/klnds/iiblnd/iiblnd_modparams.c
+--- a/lnet/klnds/iiblnd/iiblnd_modparams.c
++++ b/lnet/klnds/iiblnd/iiblnd_modparams.c
+@@ -102,9 +102,50 @@ kib_tunables_t kibnal_tunables = {
+  * not to truncate the printout; it only needs to be the actual size of the
+  * string buffer if we allow writes (and we don't) */
+ 
++#ifdef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_IIBLND      203
++
++enum {
++        IIBLND_IPIF_BASENAME = 1,
++        IIBLND_SERVICE_NAME,
++        IIBLND_SERVICE_NUMBER,
++        IIBLND_RECONNECT_MIN,
++        IIBLND_RECONNECT_MAX,
++        IIBLND_CONCURRENT_PEERS,
++        IIBLND_CKSUM,
++        IIBLND_TIMEOUT,
++        IIBLND_NTX,
++        IIBLND_CREDITS,
++        IIBLND_PEER_CREDITS,
++        IIBLND_SD_RETRIES,
++        IIBLND_KEEPALIVE,
++        IIBLND_CONCURRENT_SENDS
++};
++
++#else
++#define CTL_IIBLND      CTL_UNNUMBERED
++
++#define IIBLND_IPIF_BASENAME    CTL_UNNUMBERED
++#define IIBLND_SERVICE_NAME     CTL_UNNUMBERED
++#define IIBLND_SERVICE_NUMBER   CTL_UNNUMBERED
++#define IIBLND_RECONNECT_MIN    CTL_UNNUMBERED
++#define IIBLND_RECONNECT_MAX    CTL_UNNUMBERED
++#define IIBLND_CONCURRENT_PEERS CTL_UNNUMBERED
++#define IIBLND_CKSUM            CTL_UNNUMBERED
++#define IIBLND_TIMEOUT          CTL_UNNUMBERED
++#define IIBLND_NTX              CTL_UNNUMBERED
++#define IIBLND_CREDITS          CTL_UNNUMBERED
++#define IIBLND_PEER_CREDITS     CTL_UNNUMBERED
++#define IIBLND_SD_RETRIES       CTL_UNNUMBERED
++#define IIBLND_KEEPALIVE        CTL_UNNUMBERED
++#define IIBLND_CONCURRENT_SENDS CTL_UNNUMBERED
++
++#endif
++
+ static cfs_sysctl_table_t kibnal_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = IBLND_IPIF_BASENAME,
+                 .procname = "ipif_basename",
+                 .data     = &ipif_basename,
+                 .maxlen   = 1024,
+@@ -112,7 +153,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dostring
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = IIBLND_SERVICE_NAME,
+                 .procname = "service_name",
+                 .data     = &service_name,
+                 .maxlen   = 1024,
+@@ -120,7 +161,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dostring
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = IIBLND_SERVICE_NUMBER,
+                 .procname = "service_number",
+                 .data     = &service_number,
+                 .maxlen   = sizeof(int),
+@@ -128,7 +169,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = IIBLND_RECONNECT_MIN,
+                 .procname = "min_reconnect_interval",
+                 .data     = &min_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -136,7 +177,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = IIBLND_RECONNECT_MAX,
+                 .procname = "max_reconnect_interval",
+                 .data     = &max_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -144,7 +185,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = IIBLND_CONCURRENT_PEERS,
+                 .procname = "concurrent_peers",
+                 .data     = &concurrent_peers,
+                 .maxlen   = sizeof(int),
+@@ -152,7 +193,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = IIBLND_CKSUM,
+                 .procname = "cksum",
+                 .data     = &cksum,
+                 .maxlen   = sizeof(int),
+@@ -160,7 +201,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = IIBLND_TIMEOUT,
+                 .procname = "timeout",
+                 .data     = &timeout,
+                 .maxlen   = sizeof(int),
+@@ -168,7 +209,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = IIBLND_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof(int),
+@@ -176,7 +217,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 10,
++                .ctl_name = IIBLND_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof(int),
+@@ -184,7 +225,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 11,
++                .ctl_name = IIBLND_PEER_CREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof(int),
+@@ -192,7 +233,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 12,
++                .ctl_name = IIBLND_SD_RETRIES,
+                 .procname = "sd_retries",
+                 .data     = &sd_retries,
+                 .maxlen   = sizeof(int),
+@@ -200,7 +241,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 13,
++                .ctl_name = IIBLND_KEEPALIVE,
+                 .procname = "keepalive",
+                 .data     = &keepalive,
+                 .maxlen   = sizeof(int),
+@@ -208,7 +249,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 14,
++                .ctl_name = IIBLND_CONCURRENT_SENDS,
+                 .procname = "concurrent_sends",
+                 .data     = &concurrent_sends,
+                 .maxlen   = sizeof(int),
+@@ -220,7 +261,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+ 
+ static cfs_sysctl_table_t kibnal_top_ctl_table[] = {
+         {
+-                .ctl_name = 203,
++                .ctl_name = CTL_IIBLND,
+                 .procname = "openibnal",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h
+--- a/lnet/klnds/o2iblnd/o2iblnd.h
++++ b/lnet/klnds/o2iblnd/o2iblnd.h
+@@ -759,3 +759,13 @@ int  kiblnd_recv(lnet_ni_t *ni, void *pr
+ 
+ 
+ 
++/* compat macros */
++#ifndef HAVE_SCATTERLIST_SETPAGE
++static inline void sg_set_page(struct scatterlist *sg, struct page *page,
++                                               unsigned int len, unsigned int offset)
++{
++        sg->page = page;
++        sg->offset = offset;
++        sg->length = len;
++}
++#endif
+diff --git a/lnet/klnds/o2iblnd/o2iblnd_cb.c b/lnet/klnds/o2iblnd/o2iblnd_cb.c
+--- a/lnet/klnds/o2iblnd/o2iblnd_cb.c
++++ b/lnet/klnds/o2iblnd/o2iblnd_cb.c
+@@ -626,9 +626,7 @@ kiblnd_setup_rd_iov(lnet_ni_t *ni, kib_t
+                 fragnob = min((int)(iov->iov_len - offset), nob);
+                 fragnob = min(fragnob, (int)PAGE_SIZE - page_offset);
+ 
+-                sg->page = page;
+-                sg->offset = page_offset;
+-                sg->length = fragnob;
++                sg_set_page(sg, page, fragnob, page_offset);
+                 sg++;
+ 
+                 if (offset + fragnob < iov->iov_len) {
+@@ -691,11 +689,10 @@ kiblnd_setup_rd_kiov (lnet_ni_t *ni, kib
+                 fragnob = min((int)(kiov->kiov_len - offset), nob);
+ 
+                 memset(sg, 0, sizeof(*sg));
+-                sg->page = kiov->kiov_page;
+-                sg->offset = kiov->kiov_offset + offset;
+-                sg->length = fragnob;
++                sg_set_page(sg, kiov->kiov_page, fragnob,
++                            kiov->kiov_offset + offset);
+                 sg++;
+-                
++ 
+                 offset = 0;
+                 kiov++;
+                 nkiov--;
+diff --git a/lnet/klnds/o2iblnd/o2iblnd_modparams.c b/lnet/klnds/o2iblnd/o2iblnd_modparams.c
+--- a/lnet/klnds/o2iblnd/o2iblnd_modparams.c
++++ b/lnet/klnds/o2iblnd/o2iblnd_modparams.c
+@@ -113,9 +113,51 @@ kib_tunables_t kiblnd_tunables = {
+ 
+ static char ipif_basename_space[32];
+ 
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_O2IBLND      205
++
++enum {
++        O2IBLND_SERVICE  = 1,
++        O2IBLND_CKSUM,
++        O2IBLND_TIMEOUT,
++        O2IBLND_NTX,
++        O2IBLND_CREDITS,
++        O2IBLND_PEER_CREDITS,
++        O2IBLND_IPIF_BASENAME,
++        O2IBLND_RETRY_COUNT,
++        O2IBLND_RNR_RETRY_COUNT,
++        O2IBLND_KEEPALIVE,
++        O2IBLND_CONCURRENT_SENDS,
++        O2IBLND_IB_MTU,
++        O2IBLND_FMR_POOL_SIZE,
++        O2IBLND_FMR_FLUSH_TRIGGER,
++        O2IBLND_FMR_CACHE
++};
++#else
++#define CTL_O2IBLND              CTL_UNNUMBERED
++
++#define O2IBLND_SERVICE          CTL_UNNUMBERED
++#define O2IBLND_CKSUM            CTL_UNNUMBERED
++#define O2IBLND_TIMEOUT          CTL_UNNUMBERED
++#define O2IBLND_NTX              CTL_UNNUMBERED
++#define O2IBLND_CREDITS          CTL_UNNUMBERED
++#define O2IBLND_PEER_CREDITS     CTL_UNNUMBERED
++#define O2IBLND_IPIF_BASENAME    CTL_UNNUMBERED
++#define O2IBLND_RETRY_COUNT      CTL_UNNUMBERED
++#define O2IBLND_RNR_RETRY_COUNT  CTL_UNNUMBERED
++#define O2IBLND_KEEPALIVE        CTL_UNNUMBERED
++#define O2IBLND_CONCURRENT_SENDS CTL_UNNUMBERED
++#define O2IBLND_IB_MTU           CTL_UNNUMBERED
++#define O2IBLND_FMR_POOL_SIZE    CTL_UNNUMBERED
++#define O2IBLND_FMR_FLUSH_TRIGGER CTL_UNNUMBERED
++#define O2IBLND_FMR_CACHE        CTL_UNNUMBERED
++
++#endif
++
+ static cfs_sysctl_table_t kiblnd_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = O2IBLND_SERVICE,
+                 .procname = "service",
+                 .data     = &service,
+                 .maxlen   = sizeof(int),
+@@ -123,7 +165,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = O2IBLND_CKSUM,
+                 .procname = "cksum",
+                 .data     = &cksum,
+                 .maxlen   = sizeof(int),
+@@ -131,7 +173,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = O2IBLND_TIMEOUT,
+                 .procname = "timeout",
+                 .data     = &timeout,
+                 .maxlen   = sizeof(int),
+@@ -139,7 +181,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = O2IBLND_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof(int),
+@@ -147,7 +189,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = O2IBLND_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof(int),
+@@ -155,7 +197,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = O2IBLND_PEER_CREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof(int),
+@@ -163,7 +205,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = O2IBLND_IPIF_BASENAME,
+                 .procname = "ipif_name",
+                 .data     = ipif_basename_space,
+                 .maxlen   = sizeof(ipif_basename_space),
+@@ -171,7 +213,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+                 .proc_handler = &proc_dostring
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = O2IBLND_RETRY_COUNT,
+                 .procname = "retry_count",
+                 .data     = &retry_count,
+                 .maxlen   = sizeof(int),
+@@ -179,7 +221,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = O2IBLND_RNR_RETRY_COUNT,
+                 .procname = "rnr_retry_count",
+                 .data     = &rnr_retry_count,
+                 .maxlen   = sizeof(int),
+@@ -187,7 +229,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 10,
++                .ctl_name = O2IBLND_KEEPALIVE,
+                 .procname = "keepalive",
+                 .data     = &keepalive,
+                 .maxlen   = sizeof(int),
+@@ -195,7 +237,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 11,
++                .ctl_name = O2IBLND_CONCURRENT_SENDS,
+                 .procname = "concurrent_sends",
+                 .data     = &concurrent_sends,
+                 .maxlen   = sizeof(int),
+@@ -203,7 +245,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 12,
++                .ctl_name = O2IBLND_IB_MTU,
+                 .procname = "ib_mtu",
+                 .data     = &ib_mtu,
+                 .maxlen   = sizeof(int),
+@@ -212,7 +254,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+         },
+ #if IBLND_MAP_ON_DEMAND
+         {
+-                .ctl_name = 13,
++                .ctl_name = O2IBLND_FMR_POOL_SIZE,
+                 .procname = "fmr_pool_size",
+                 .data     = &fmr_pool_size,
+                 .maxlen   = sizeof(int),
+@@ -220,7 +262,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 14,
++                .ctl_name = O2IBLND_FMR_FLUSH_TRIGGER,
+                 .procname = "fmr_flush_trigger",
+                 .data     = &fmr_flush_trigger,
+                 .maxlen   = sizeof(int),
+@@ -228,7 +270,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 15,
++                .ctl_name = O2IBLND_FMR_CACHE,
+                 .procname = "fmr_cache",
+                 .data     = &fmr_cache,
+                 .maxlen   = sizeof(int),
+@@ -241,7 +283,7 @@ static cfs_sysctl_table_t kiblnd_ctl_tab
+ 
+ static cfs_sysctl_table_t kiblnd_top_ctl_table[] = {
+         {
+-                .ctl_name = 203,
++                .ctl_name = CTL_O2IBLND,
+                 .procname = "o2iblnd",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff --git a/lnet/klnds/openiblnd/openiblnd_modparams.c b/lnet/klnds/openiblnd/openiblnd_modparams.c
+--- a/lnet/klnds/openiblnd/openiblnd_modparams.c
++++ b/lnet/klnds/openiblnd/openiblnd_modparams.c
+@@ -83,9 +83,42 @@ kib_tunables_t kibnal_tunables = {
+ 
+ #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
+ 
++#ifndef HAVE_SYSCTL_UNNUMBERED
++#define CTL_KIBNAL      203
++enum {
++        KIBNAL_IPIF_BASENAME = 1,
++        KIBNAL_N_CONND,
++        KIBNAL_RECONNECT_MIN,
++        KIBNAL_RECONNECT_MAX,
++        KIBNAL_CONCURRENT_PEERS,
++        KIBNAL_CKSUM,
++        KIBNAL_TIMEOUT,
++        KIBNAL_NTX,
++        KIBNAL_CREDITS,
++        KIBNAL_PEER_CREDITS,
++        KIBNAL_KEEPALIVE
++};
++#else
++
++#define CTL_KIBNAL      CTL_UNNUMBERED
++
++#define KIBNAL_IPIF_BASENAME    CTL_UNNUMBERED
++#define KIBNAL_N_CONND          CTL_UNNUMBERED
++#define KIBNAL_RECONNECT_MIN    CTL_UNNUMBERED
++#define KIBNAL_RECONNECT_MAX    CTL_UNNUMBERED
++#define KIBNAL_CONCURRENT_PEERS CTL_UNNUMBERED
++#define KIBNAL_CKSUM            CTL_UNNUMBERED
++#define KIBNAL_TIMEOUT          CTL_UNNUMBERED
++#define kiBNAL_NTX              CTL_UNNUMBERED
++#define KIBNAL_CREDITS          CTL_UNNUMBERED
++#define KIBNAL_PEER_CREDITS     CTL_UNNUMBERED
++#define KIBNAL_KEEPALIVE        CTL_UNNUMBERED
++
++#endif
++
+ static cfs_sysctl_table_t kibnal_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = KIBNAL_IPIF_BASENAME,
+                 .procname = "ipif_basename",
+                 .data     = &ipif_basename,
+                 .maxlen   = 1024,
+@@ -93,7 +126,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dostring
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = KIBNAL_N_CONND,
+                 .procname = "n_connd",
+                 .data     = &n_connd,
+                 .maxlen   = sizeof(int),
+@@ -101,7 +134,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = KIBNAL_RECONNECT_MIN,
+                 .procname = "min_reconnect_interval",
+                 .data     = &min_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -109,7 +142,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = KIBNAL_RECONNECT_MAX,
+                 .procname = "max_reconnect_interval",
+                 .data     = &max_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -117,7 +150,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = KIBNAL_CONCURRENT_PEERS,
+                 .procname = "concurrent_peers",
+                 .data     = &concurrent_peers,
+                 .maxlen   = sizeof(int),
+@@ -125,7 +158,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = KIBNAL_CKSUM,
+                 .procname = "cksum",
+                 .data     = &cksum,
+                 .maxlen   = sizeof(int),
+@@ -133,7 +166,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = KIBNAL_TIMEOUT,
+                 .procname = "timeout",
+                 .data     = &timeout,
+                 .maxlen   = sizeof(int),
+@@ -141,7 +174,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = KIBNAL_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof(int),
+@@ -149,7 +182,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = KIBNAL_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof(int),
+@@ -157,7 +190,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 10,
++                .ctl_name = KIBNAL_PEER_CREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof(int),
+@@ -165,7 +198,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 11,
++                .ctl_name = KIBNAL_KEEPALIVE,
+                 .procname = "keepalive",
+                 .data     = &keepalive,
+                 .maxlen   = sizeof(int),
+@@ -177,7 +210,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+ 
+ static cfs_sysctl_table_t kibnal_top_ctl_table[] = {
+         {
+-                .ctl_name = 203,
++                .ctl_name = CTL_KIBNAL,
+                 .procname = "openibnal",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff --git a/lnet/klnds/ptllnd/ptllnd_modparams.c b/lnet/klnds/ptllnd/ptllnd_modparams.c
+--- a/lnet/klnds/ptllnd/ptllnd_modparams.c
++++ b/lnet/klnds/ptllnd/ptllnd_modparams.c
+@@ -134,9 +134,54 @@ kptllnd_init_strtunable(char **str_param
+ }
+ #endif
+ 
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_PTLLND       207
++
++enum {
++        KPTLLND_NTX     = 1,
++        KPTLLND_MAX_NODES,
++        KPTLLND_MAX_PROC_PER_NODE,
++        KPTLLND_CHECKSUM,
++        KPTLLND_TIMEOUT,
++        KPTLLND_PORTAL,
++        KPTLLND_PID,
++        KPTLLND_RXB_PAGES,
++        KPTLLND_CREDITS,
++        KPTLLND_PEERCREDITS,
++        KPTLLND_MAX_MSG_SIZE,
++        KPTLLND_PEER_HASH_SIZE,
++        KPTLLND_RESHEDULE_LOOPS,
++        KPTLLND_ACK_PUTS,
++        KPTLLND_TRACETIMEOUT,
++        KPTLLND_TRACEBASENAME,
++        KPTLLND_SIMULATION_BITMAP
++};
++#else
++#define CTL_PTLLND              CTL_UNNUMBERED
++
++#define KPTLLND_NTX             CTL_UNNUMBERED
++#define KPTLLND_MAX_NODES       CTL_UNNUMBERED
++#define KPTLLND_MAX_PROC_PER_NODE CTL_UNNUMBERED
++#define KPTLLND_CHECKSUM        CTL_UNNUMBERED
++#define KPTLLND_TIMEOUT         CTL_UNNUMBERED
++#define KPTLLND_PORTAL          CTL_UNNUMBERED
++#define KPTLLND_PID             CTL_UNNUMBERED
++#define KPTLLND_RXB_PAGES       CTL_UNNUMBERED
++#define KPTLLND_CREDITS         CTL_UNNUMBERED
++#define KPTLLND_PEERCREDITS     CTL_UNNUMBERED
++#define KPTLLND_MAX_MSG_SIZE    CTL_UNNUMBERED
++#define KPTLLND_PEER_HASH_SIZE  CTL_UNNUMBERED
++#define KPTLLND_RESHEDULE_LOOPS CTL_UNNUMBERED
++#define KPTLLND_ACK_PUTS        CTL_UNNUMBERED
++#define KPTLLND_TRACETIMEOUT    CTL_UNNUMBERED
++#define KPTLLND_TRACEBASENAME   CTL_UNNUMBERED
++#define KPTLLND_SIMULATION_BITMAP CTL_UNNUMBERED
++#endif
++
+ static cfs_sysctl_table_t kptllnd_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = KPTLLND_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof(int),
+@@ -144,15 +189,15 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = KPTLLND_MAX_NODES,
+                 .procname = "max_nodes",
+                 .data     = &max_nodes,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0444,
+-                .proc_handler = &proc_dointvec
++               
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = KPTLLND_MAX_PROC_PER_NODE,
+                 .procname = "max_procs_per_node",
+                 .data     = &max_procs_per_node,
+                 .maxlen   = sizeof(int),
+@@ -160,7 +205,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = KPTLLND_CHECKSUM,
+                 .procname = "checksum",
+                 .data     = &checksum,
+                 .maxlen   = sizeof(int),
+@@ -168,7 +213,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = KPTLLND_TIMEOUT,
+                 .procname = "timeout",
+                 .data     = &timeout,
+                 .maxlen   = sizeof(int),
+@@ -176,7 +221,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = KPTLLND_PORTAL,
+                 .procname = "portal",
+                 .data     = &portal,
+                 .maxlen   = sizeof(int),
+@@ -184,7 +229,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = KPTLLND_PID,
+                 .procname = "pid",
+                 .data     = &pid,
+                 .maxlen   = sizeof(int),
+@@ -192,7 +237,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = KPTLLND_RXB_PAGES,
+                 .procname = "rxb_npages",
+                 .data     = &rxb_npages,
+                 .maxlen   = sizeof(int),
+@@ -200,7 +245,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = KPTLLND_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof(int),
+@@ -208,7 +253,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 10,
++                .ctl_name = KPTLLND_PEERCREDITS,
+                 .procname = "peercredits",
+                 .data     = &peercredits,
+                 .maxlen   = sizeof(int),
+@@ -216,7 +261,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 11,
++                .ctl_name = KPTLLND_MAX_MSG_SIZE,
+                 .procname = "max_msg_size",
+                 .data     = &max_msg_size,
+                 .maxlen   = sizeof(int),
+@@ -224,7 +269,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 12,
++                .ctl_name = KPTLLND_PEER_HASH_SIZE,
+                 .procname = "peer_hash_table_size",
+                 .data     = &peer_hash_table_size,
+                 .maxlen   = sizeof(int),
+@@ -232,7 +277,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 13,
++                .ctl_name = KPTLLND_RESHEDULE_LOOPS,
+                 .procname = "reschedule_loops",
+                 .data     = &reschedule_loops,
+                 .maxlen   = sizeof(int),
+@@ -240,7 +285,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 14,
++                .ctl_name = KPTLLND_ACK_PUTS,
+                 .procname = "ack_puts",
+                 .data     = &ack_puts,
+                 .maxlen   = sizeof(int),
+@@ -249,7 +294,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+         },
+ #ifdef CRAY_XT3
+         {
+-                .ctl_name = 15,
++                .ctl_name = KPTLLND_TRACETIMEOUT,
+                 .procname = "ptltrace_on_timeout",
+                 .data     = &ptltrace_on_timeout,
+                 .maxlen   = sizeof(int),
+@@ -257,7 +302,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 16,
++                .ctl_name = KPTLLND_TRACEBASENAME,
+                 .procname = "ptltrace_basename",
+                 .data     = ptltrace_basename_space,
+                 .maxlen   = sizeof(ptltrace_basename_space),
+@@ -268,7 +313,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+ #endif
+ #ifdef PJK_DEBUGGING
+         {
+-                .ctl_name = 17,
++                .ctl_name = KPTLLND_SIMULATION_BITMAP,
+                 .procname = "simulation_bitmap",
+                 .data     = &simulation_bitmap,
+                 .maxlen   = sizeof(int),
+@@ -282,7 +327,7 @@ static cfs_sysctl_table_t kptllnd_ctl_ta
+ 
+ static cfs_sysctl_table_t kptllnd_top_ctl_table[] = {
+         {
+-                .ctl_name = 203,
++                .ctl_name = CTL_PTLLND,
+                 .procname = "ptllnd",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff --git a/lnet/klnds/qswlnd/qswlnd_modparams.c b/lnet/klnds/qswlnd/qswlnd_modparams.c
+--- a/lnet/klnds/qswlnd/qswlnd_modparams.c
++++ b/lnet/klnds/qswlnd/qswlnd_modparams.c
+@@ -1,4 +1,7 @@
+ /*
++ * -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
++ * vim:expandtab:shiftwidth=8:tabstop=8:
++ *
+  * Copyright (C) 2002-2004 Cluster File Systems, Inc.
+  *   Author: Eric Barton <eric at bartonsoftware.com>
+  *
+@@ -84,9 +87,45 @@ kqswnal_tunables_t kqswnal_tunables = {
+ };
+ 
+ #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
++
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_KQSWNAL	207
++
++enum
++	KQSWNAL_TX_MAXCONTIG = 1,
++	KQSWNAL_NTXMSG,
++	KQSWNAL_CREDITS,
++	KQSWNAL_PEERCREDITS,
++	KQSWNAL_NRXMSGS_LARGE,
++	KQSWNAL_EP_ENVELOPES_LARGE,
++	KQSWNAL_NRXMSGS_SMALL,
++	KQSWNAL_EP_ENVELOPES_SMALL,
++	KQSWNAL_OPTIMIZED_PUTS,
++	KQSWNAL_OPTIMIZED_GETS,
++	KQSWNAL_INJECT_CSUM_ERROR
++};
++#else
++
++#define CTL_KQSWNAL             CTL_UNNUMBERED
++
++#define KQSWNAL_TX_MAXCONTIG    CTL_UNNUMBERED
++#define KQSWNAL_NTXMSG          CTL_UNNUMBERED
++#define KQSWNAL_CREDITS         CTL_UNNUMBERED
++#define KQSWNAL_PEERCREDITS     CTL_UNNUMBERED
++#define KQSWNAL_NRXMSGS_LARGE   CTL_UNNUMBERED
++#define KQSWNAL_EP_ENVELOPES_LARGE CTL_UNNUMBERED
++#define KQSWNAL_NRXMSGS_SMALL   CTL_UNNUMBERED
++#define KQSWNAL_EP_ENVELOPES_SMALL CTL_UNNUMBERED
++#define KQSWNAL_OPTIMIZED_PUTS  CTL_UNNUMBERED
++#define KQSWNAL_OPTIMIZED_GETS  CTL_UNNUMBERED
++#define KQSWNAL_INJECT_CSUM_ERROR CTL_UNNUMBERED
++
++#endif
++
+ static cfs_sysctl_table_t kqswnal_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = KQSWNAL_TX_MAXCONTIG,
+                 .procname = "tx_maxcontig",
+                 .data     = &tx_maxcontig,
+                 .maxlen   = sizeof (int),
+@@ -94,7 +133,7 @@ static cfs_sysctl_table_t kqswnal_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = KQSWNAL_NTXMSG,
+                 .procname = "ntxmsgs",
+                 .data     = &ntxmsgs,
+                 .maxlen   = sizeof (int),
+@@ -102,7 +141,7 @@ static cfs_sysctl_table_t kqswnal_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = KQSWNAL_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof (int),
+@@ -110,7 +149,7 @@ static cfs_sysctl_table_t kqswnal_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = KQSWNAL_PEERCREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof (int),
+@@ -118,7 +157,7 @@ static cfs_sysctl_table_t kqswnal_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = KQSWNAL_NRXMSGS_LARGE,
+                 .procname = "nrxmsgs_large",
+                 .data     = &nrxmsgs_large,
+                 .maxlen   = sizeof (int),
+@@ -126,7 +165,7 @@ static cfs_sysctl_table_t kqswnal_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = KQSWNAL_EP_ENVELOPES_LARGE,
+                 .procname = "ep_envelopes_large",
+                 .data     = &ep_envelopes_large,
+                 .maxlen   = sizeof (int),
+@@ -134,7 +173,7 @@ static cfs_sysctl_table_t kqswnal_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = KQSWNAL_NRXMSGS_SMALL,
+                 .procname = "nrxmsgs_small",
+                 .data     = &nrxmsgs_small,
+                 .maxlen   = sizeof (int),
+@@ -142,7 +181,7 @@ static cfs_sysctl_table_t kqswnal_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = KQSWNAL_EP_ENVELOPES_SMALL,
+                 .procname = "ep_envelopes_small",
+                 .data     = &ep_envelopes_small,
+                 .maxlen   = sizeof (int),
+@@ -150,7 +189,7 @@ static cfs_sysctl_table_t kqswnal_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = KQSWNAL_OPTIMIZED_PUTS,
+                 .procname = "optimized_puts",
+                 .data     = &optimized_puts,
+                 .maxlen   = sizeof (int),
+@@ -158,7 +197,7 @@ static cfs_sysctl_table_t kqswnal_ctl_ta
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 10,
++                .ctl_name = KQSWNAL_OPTIMIZED_GETS,
+                 .procname = "optimized_gets",
+                 .data     = &optimized_gets,
+                 .maxlen   = sizeof (int),
+@@ -167,7 +206,7 @@ static cfs_sysctl_table_t kqswnal_ctl_ta
+         },
+ #if KQSW_CKSUM
+         {
+-                .ctl_name = 11,
++                .ctl_name = KQSWNAL_INJECT_CSUM_ERROR,
+                 .procname = "inject_csum_error",
+                 .data     = &inject_csum_error,
+                 .maxlen   = sizeof (int),
+@@ -180,7 +219,7 @@ static cfs_sysctl_table_t kqswnal_ctl_ta
+ 
+ static cfs_sysctl_table_t kqswnal_top_ctl_table[] = {
+         {
+-                .ctl_name = 201,
++                .ctl_name = CTL_KQSWNAL,
+                 .procname = "qswnal",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff --git a/lnet/klnds/ralnd/ralnd_modparams.c b/lnet/klnds/ralnd/ralnd_modparams.c
+--- a/lnet/klnds/ralnd/ralnd_modparams.c
++++ b/lnet/klnds/ralnd/ralnd_modparams.c
+@@ -72,9 +72,37 @@ kra_tunables_t kranal_tunables = {
+ };
+ 
+ #if CONFIG_SYSCTL && !CFS_SYSFS_MODULE_PARM
++
++#ifndef HAVE_SYSCTL_UNNUMBERED
++#define CTL_KRANAL      202
++enum {
++        KRANAL_N_CONND = 1,
++        KRANAL_RECONNECT_MIN,
++        KRANAL_RECONNECT_MAX,
++        KRANAL_NTX,
++        KRANAL_CREDITS,
++        KRANAL_PEERCREDITS,
++        KRANAL_FMA_CQ_SIZE,
++        KRANAL_TIMEOUT,
++        KRANAL_IMMEDIATE_MAX
++};
++#else
++#define CTL_KRANAL              CTL_UNNUMBERED
++
++#define KRANAL_N_CONND          CTL_UNNUMBERED
++#define KRANAL_RECONNECT_MIN    CTL_UNNUMBERED
++#define KRANAL_RECONNECT_MAX    CTL_UNNUMBERED
++#define KRANAL_NTX              CTL_UNNUMBERED
++#define KRANAL_CREDITS          CTL_UNNUMBERED
++#define KRANAL_PEERCREDITS      CTL_UNNUMBERED
++#define KRANAL_FMA_CQ_SIZE      CTL_UNNUMBERED
++#define KRANAL_TIMEOUT          CTL_UNNUMBERED
++#define KRANAL_IMMEDIATE_MAX    CTL_UNNUMBERED
++#endif
++
+ static cfs_sysctl_table_t kranal_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = KRANAL_N_CONND,
+                 .procname = "n_connd",
+                 .data     = &n_connd,
+                 .maxlen   = sizeof(int),
+@@ -82,7 +110,7 @@ static cfs_sysctl_table_t kranal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = KRANAL_RECONNECT_MIN,
+                 .procname = "min_reconnect_interval",
+                 .data     = &min_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -90,7 +118,7 @@ static cfs_sysctl_table_t kranal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = KRANAL_RECONNECT_MAX,
+                 .procname = "max_reconnect_interval",
+                 .data     = &max_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -98,7 +126,7 @@ static cfs_sysctl_table_t kranal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = KRANAL_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof(int),
+@@ -106,7 +134,7 @@ static cfs_sysctl_table_t kranal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = KRANAL_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof(int),
+@@ -114,7 +142,7 @@ static cfs_sysctl_table_t kranal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = KRANAL_PEERCREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof(int),
+@@ -122,7 +150,7 @@ static cfs_sysctl_table_t kranal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = KRANAL_FMA_CQ_SIZE,
+                 .procname = "fma_cq_size",
+                 .data     = &fma_cq_size,
+                 .maxlen   = sizeof(int),
+@@ -130,7 +158,7 @@ static cfs_sysctl_table_t kranal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = KRANAL_TIMEOUT,
+                 .procname = "timeout",
+                 .data     = &timeout,
+                 .maxlen   = sizeof(int),
+@@ -138,7 +166,7 @@ static cfs_sysctl_table_t kranal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = KRANAL_IMMEDIATE_MAX,
+                 .procname = "max_immediate",
+                 .data     = &max_immediate,
+                 .maxlen   = sizeof(int),
+@@ -150,7 +178,7 @@ static cfs_sysctl_table_t kranal_ctl_tab
+ 
+ static cfs_sysctl_table_t kranal_top_ctl_table[] = {
+         {
+-                .ctl_name = 202,
++                .ctl_name = CTL_KRANAL,
+                 .procname = "ranal",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff --git a/lnet/klnds/socklnd/socklnd_lib-linux.c b/lnet/klnds/socklnd/socklnd_lib-linux.c
+--- a/lnet/klnds/socklnd/socklnd_lib-linux.c
++++ b/lnet/klnds/socklnd/socklnd_lib-linux.c
+@@ -5,11 +5,232 @@
+ #include "socklnd.h"
+ 
+ # if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
+-static cfs_sysctl_table_t ksocknal_ctl_table[21];
++
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_SOCKLND     209
++
++enum {
++        SOCKLND_TIMEOUT = 1,
++        SOCKLND_CREDITS,
++        SOCKLND_PEER_CREDITS,
++        SOCKLND_NCONNDS,
++        SOCKLND_RECONNECTS_MIN,
++        SOCKLND_RECONNECTS_MAX,
++        SOCKLND_EAGER_ACK,
++        SOCKLND_ZERO_COPY,
++        SOCKLND_TYPED,
++        SOCKLND_BULK_MIN,
++        SOCKLND_RX_BUFFER_SIZE,
++        SOCKLND_TX_BUFFER_SIZE,
++        SOCKLND_NAGLE,
++        SOCKLND_IRQ_AFFINITY,
++        SOCKLND_KEEPALIVE_IDLE,
++        SOCKLND_KEEPALIVE_COUNT,
++        SOCKLND_KEEPALIVE_INTVL,
++        SOCKLND_BACKOFF_INIT,
++        SOCKLND_BACKOFF_MAX,
++        SOCKLND_PROTOCOL
++};
++#else
++#define CTL_SOCKLND             CTL_UNNUMBERED
++
++#define SOCKLND_TIMEOUT         CTL_UNNUMBERED
++#define SOCKLND_CREDITS         CTL_UNNUMBERED
++#define SOCKLND_PEER_CREDITS    CTL_UNNUMBERED
++#define SOCKLND_NCONNDS         CTL_UNNUMBERED
++#define SOCKLND_RECONNECTS_MIN  CTL_UNNUMBERED
++#define SOCKLND_RECONNECTS_MAX  CTL_UNNUMBERED
++#define SOCKLND_EAGER_ACK       CTL_UNNUMBERED
++#define SOCKLND_ZERO_COPY       CTL_UNNUMBERED
++#define SOCKLND_TYPED           CTL_UNNUMBERED
++#define SOCKLND_BULK_MIN        CTL_UNNUMBERED
++#define SOCKLND_RX_BUFFER_SIZE  CTL_UNNUMBERED
++#define SOCKLND_TX_BUFFER_SIZE  CTL_UNNUMBERED
++#define SOCKLND_NAGLE           CTL_UNNUMBERED
++#define SOCKLND_IRQ_AFFINITY    CTL_UNNUMBERED
++#define SOCKLND_KEEPALIVE_IDLE  CTL_UNNUMBERED
++#define SOCKLND_KEEPALIVE_COUNT CTL_UNNUMBERED
++#define SOCKLND_KEEPALIVE_INTVL CTL_UNNUMBERED
++#define SOCKLND_BACKOFF_INIT    CTL_UNNUMBERED
++#define SOCKLND_BACKOFF_MAX     CTL_UNNUMBERED
++#define SOCKLND_PROTOCOL        CTL_UNNUMBERED
++#endif
++
++static cfs_sysctl_table_t ksocknal_ctl_table[] = {
++        {
++                .ctl_name = SOCKLND_TIMEOUT,
++                .procname = "timeout",
++                .data     = ksocknal_tunables.ksnd_timeout,
++                .maxlen   = sizeof (int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_CREDITS,
++                .procname = "credits",
++                .data     = ksocknal_tunables.ksnd_credits,
++                .maxlen   = sizeof (int),
++                .mode     = 0444,
++                .proc_handler = &proc_dointvec
++        },
++         {
++                .ctl_name = SOCKLND_PEER_CREDITS,
++                .procname = "peer_credits",
++                .data     = ksocknal_tunables.ksnd_peercredits,
++                .maxlen   = sizeof (int),
++                .mode     = 0444,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_NCONNDS,
++                .procname = "nconnds",
++                .data     = ksocknal_tunables.ksnd_nconnds,
++                .maxlen   = sizeof (int),
++                .mode     = 0444,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_RECONNECTS_MIN,
++                .procname = "min_reconnectms",
++                .data     = ksocknal_tunables.ksnd_min_reconnectms,
++                .maxlen   = sizeof (int),
++                .mode     = 0444,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_RECONNECTS_MAX,
++                .procname = "max_reconnectms",
++                .data     = ksocknal_tunables.ksnd_max_reconnectms,
++                .maxlen   = sizeof (int),
++                .mode     = 0444,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_EAGER_ACK,
++                .procname = "eager_ack",
++                .data     = ksocknal_tunables.ksnd_eager_ack,
++                .maxlen   = sizeof (int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_ZERO_COPY,
++                .procname = "zero_copy",
++                .data     = ksocknal_tunables.ksnd_zc_min_frag,
++                .maxlen   = sizeof (int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_TYPED,
++                .procname = "typed",
++                .data     = ksocknal_tunables.ksnd_typed_conns,
++                .maxlen   = sizeof (int),
++                .mode     = 0444,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_BULK_MIN,
++                .procname = "min_bulk",
++                .data     = ksocknal_tunables.ksnd_min_bulk,
++                .maxlen   = sizeof (int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_RX_BUFFER_SIZE,
++                .procname = "rx_buffer_size",
++                .data     = ksocknal_tunables.ksnd_rx_buffer_size,
++                .maxlen   = sizeof(int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_TX_BUFFER_SIZE,
++                .procname = "tx_buffer_size",
++                .data     = ksocknal_tunables.ksnd_tx_buffer_size,
++                .maxlen   = sizeof(int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_NAGLE,
++                .procname = "nagle",
++                .data     = ksocknal_tunables.ksnd_nagle,
++                .maxlen   = sizeof(int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        },
++#ifdef CPU_AFFINITY
++        {
++                .ctl_name = SOCKLND_IRQ_AFFINITY,
++                .procname = "irq_affinity",
++                .data     = ksocknal_tunables.ksnd_irq_affinity,
++                .maxlen   = sizeof(int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        },
++#endif
++        {
++                .ctl_name = SOCKLND_KEEPALIVE_IDLE,
++                .procname = "keepalive_idle",
++                .data     = ksocknal_tunables.ksnd_keepalive_idle,
++                .maxlen   = sizeof(int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_KEEPALIVE_COUNT,
++                .procname = "keepalive_count",
++                .data     = ksocknal_tunables.ksnd_keepalive_count,
++                .maxlen   = sizeof(int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_KEEPALIVE_INTVL,
++                .procname = "keepalive_intvl",
++                .data     = ksocknal_tunables.ksnd_keepalive_intvl,
++                .maxlen   = sizeof(int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        },
++#ifdef SOCKNAL_BACKOFF
++        {
++                .ctl_name = SOCKLND_BACKOFF_INIT,
++                .procname = "backoff_init",
++                .data     = ksocknal_tunables.ksnd_backoff_init,
++                .maxlen   = sizeof(int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        },
++        {
++                .ctl_name = SOCKLND_BACKOFF_MAX,
++                .procname = "backoff_max",
++                .data     = ksocknal_tunables.ksnd_backoff_max,
++                .maxlen   = sizeof(int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        }
++#endif
++#if SOCKNAL_VERSION_DEBUG
++        {
++                .ctl_name = SOCKLND_PROTOCOL,
++                .procname = "protocol",
++                .data     = ksocknal_tunables.ksnd_protocol,
++                .maxlen   = sizeof(int),
++                .mode     = 0644,
++                .proc_handler = &proc_dointvec
++        },
++#endif
++        {0}
++};
++
+ 
+ cfs_sysctl_table_t ksocknal_top_ctl_table[] = {
+         {
+-                .ctl_name = 200,
++                .ctl_name = CTL_SOCKLND,
+                 .procname = "socknal",
+                 .data     = NULL,
+                 .maxlen   = 0,
+@@ -22,180 +243,6 @@ int
+ int
+ ksocknal_lib_tunables_init ()
+ {
+-        int    i = 0;
+-        int    j = 1;
+-
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "timeout",
+-                .data     = ksocknal_tunables.ksnd_timeout,
+-                .maxlen   = sizeof (int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "credits",
+-                .data     = ksocknal_tunables.ksnd_credits,
+-                .maxlen   = sizeof (int),
+-                .mode     = 0444,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "peer_credits",
+-                .data     = ksocknal_tunables.ksnd_peercredits,
+-                .maxlen   = sizeof (int),
+-                .mode     = 0444,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "nconnds",
+-                .data     = ksocknal_tunables.ksnd_nconnds,
+-                .maxlen   = sizeof (int),
+-                .mode     = 0444,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "min_reconnectms",
+-                .data     = ksocknal_tunables.ksnd_min_reconnectms,
+-                .maxlen   = sizeof (int),
+-                .mode     = 0444,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "max_reconnectms",
+-                .data     = ksocknal_tunables.ksnd_max_reconnectms,
+-                .maxlen   = sizeof (int),
+-                .mode     = 0444,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "eager_ack",
+-                .data     = ksocknal_tunables.ksnd_eager_ack,
+-                .maxlen   = sizeof (int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "zero_copy",
+-                .data     = ksocknal_tunables.ksnd_zc_min_frag,
+-                .maxlen   = sizeof (int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "typed",
+-                .data     = ksocknal_tunables.ksnd_typed_conns,
+-                .maxlen   = sizeof (int),
+-                .mode     = 0444,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "min_bulk",
+-                .data     = ksocknal_tunables.ksnd_min_bulk,
+-                .maxlen   = sizeof (int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "rx_buffer_size",
+-                .data     = ksocknal_tunables.ksnd_rx_buffer_size,
+-                .maxlen   = sizeof(int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "tx_buffer_size",
+-                .data     = ksocknal_tunables.ksnd_tx_buffer_size,
+-                .maxlen   = sizeof(int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "nagle",
+-                .data     = ksocknal_tunables.ksnd_nagle,
+-                .maxlen   = sizeof(int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-#ifdef CPU_AFFINITY
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "irq_affinity",
+-                .data     = ksocknal_tunables.ksnd_irq_affinity,
+-                .maxlen   = sizeof(int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-#endif
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "keepalive_idle",
+-                .data     = ksocknal_tunables.ksnd_keepalive_idle,
+-                .maxlen   = sizeof(int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "keepalive_count",
+-                .data     = ksocknal_tunables.ksnd_keepalive_count,
+-                .maxlen   = sizeof(int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "keepalive_intvl",
+-                .data     = ksocknal_tunables.ksnd_keepalive_intvl,
+-                .maxlen   = sizeof(int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-#ifdef SOCKNAL_BACKOFF
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "backoff_init",
+-                .data     = ksocknal_tunables.ksnd_backoff_init,
+-                .maxlen   = sizeof(int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "backoff_max",
+-                .data     = ksocknal_tunables.ksnd_backoff_max,
+-                .maxlen   = sizeof(int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-#endif
+-#if SOCKNAL_VERSION_DEBUG
+-        ksocknal_ctl_table[i++] = (cfs_sysctl_table_t) {
+-                .ctl_name = j++,
+-                .procname = "protocol",
+-                .data     = ksocknal_tunables.ksnd_protocol,
+-                .maxlen   = sizeof(int),
+-                .mode     = 0644,
+-                .proc_handler = &proc_dointvec
+-        };
+-#endif
+-        ksocknal_ctl_table[i++] =  (cfs_sysctl_table_t) { 0 };
+-
+-        LASSERT (j == i);
+-        LASSERT (i <= sizeof(ksocknal_ctl_table)/sizeof(ksocknal_ctl_table[0]));
+-
+         ksocknal_tunables.ksnd_sysctl =
+                 cfs_register_sysctl_table(ksocknal_top_ctl_table, 0);
+ 
+diff --git a/lnet/klnds/viblnd/viblnd_modparams.c b/lnet/klnds/viblnd/viblnd_modparams.c
+--- a/lnet/klnds/viblnd/viblnd_modparams.c
++++ b/lnet/klnds/viblnd/viblnd_modparams.c
+@@ -125,6 +125,56 @@ kib_tunables_t kibnal_tunables = {
+ #endif
+ };
+ 
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_VIBLND       209
++
++enum {
++        VIBLND_SERVICE = 1,
++        VIBLND_RECONNECT_MIN,
++        VIBLND_RECONNECT_MAX,
++        VIBLND_CONCURRENT_PEERS,
++        VIBLND_CHKSUM,
++        VIBLND_TIMEOUT,
++        VIBLND_NTX,
++        VIBLND_CREDITS,
++        VIBLND_PEER_CREDITS,
++        VIBLND_ARP_RETRIES,
++        VIBLND_HCA_BASENAME,
++        VIBLND_IPIF_BASENAME,
++        VIBLND_LOCAL_ACK_TIMEOUT,
++        VIBLND_RETRY_CNT
++        VIBLND_RNR_CNT,
++        VIBLND_RNR_NAK_TIMER,
++        VIBLND_KEEPALIVE,
++        VIBLND_CONCURRENT_SENDS,
++        VIBLND_FMR_REMAPS
++};        
++#else
++#define CTL_VIBLND              CTL_UNNUMBERED
++
++#define VIBLND_SERVICE          CTL_UNNUMBERED
++#define VIBLND_RECONNECT_MIN    CTL_UNNUMBERED
++#define VIBLND_RECONNECT_MAX    CTL_UNNUMBERED
++#define VIBLND_CONCURRENT_PEERS CTL_UNNUMBERED
++#define VIBLND_CHKSUM           CTL_UNNUMBERED
++#define VIBLND_TIMEOUT          CTL_UNNUMBERED
++#define VIBLND_NTX              CTL_UNNUMBERED
++#define VIBLND_CREDITS          CTL_UNNUMBERED
++#define VIBLND_PEER_CREDITS     CTL_UNNUMBERED
++#define VIBLND_ARP_RETRIES      CTL_UNNUMBERED
++#define VIBLND_HCA_BASENAME     CTL_UNNUMBERED
++#define VIBLND_IPIF_BASENAME    CTL_UNNUMBERED
++#define VIBLND_LOCAL_ACK_TIMEOUT CTL_UNNUMBERED
++#define VIBLND_RETRY_CNT        CTL_UNNUMBERED
++#define VIBLND_RNR_CNT          CTL_UNNUMBERED
++#define VIBLND_RNR_NAK_TIMER    CTL_UNNUMBERED
++#define VIBLND_KEEPALIVE        CTL_UNNUMBERED
++#define VIBLND_CONCURRENT_SENDS CTL_UNNUMBERED
++#define VIBLND_FMR_REMAPS       CTL_UNNUMBERED
++
++#endif
++
+ #if defined(CONFIG_SYSCTL) && !CFS_SYSFS_MODULE_PARM
+ 
+ static char hca_basename_space[32];
+@@ -132,7 +182,7 @@ static char ipif_basename_space[32];
+ 
+ static cfs_sysctl_table_t kibnal_ctl_table[] = {
+         {
+-                .ctl_name = 1,
++                .ctl_name = VIBLND_SERVICE,
+                 .procname = "service_number",
+                 .data     = &service_number,
+                 .maxlen   = sizeof(int),
+@@ -140,7 +190,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 2,
++                .ctl_name = VIBLND_RECONNECT_MIN,
+                 .procname = "min_reconnect_interval",
+                 .data     = &min_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -148,7 +198,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 3,
++                .ctl_name = VIBLND_RECONNECT_MAX,
+                 .procname = "max_reconnect_interval",
+                 .data     = &max_reconnect_interval,
+                 .maxlen   = sizeof(int),
+@@ -156,7 +206,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 4,
++                .ctl_name = VIBLND_CONCURRENT_PEERS,
+                 .procname = "concurrent_peers",
+                 .data     = &concurrent_peers,
+                 .maxlen   = sizeof(int),
+@@ -164,7 +214,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 5,
++                .ctl_name = VIBLND_CHKSUM,
+                 .procname = "cksum",
+                 .data     = &cksum,
+                 .maxlen   = sizeof(int),
+@@ -172,7 +222,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 6,
++                .ctl_name = VIBLND_TIMEOUT,
+                 .procname = "timeout",
+                 .data     = &timeout,
+                 .maxlen   = sizeof(int),
+@@ -180,7 +230,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 7,
++                .ctl_name = VIBLND_NTX,
+                 .procname = "ntx",
+                 .data     = &ntx,
+                 .maxlen   = sizeof(int),
+@@ -188,7 +238,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 8,
++                .ctl_name = VIBLND_CREDITS,
+                 .procname = "credits",
+                 .data     = &credits,
+                 .maxlen   = sizeof(int),
+@@ -196,7 +246,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 9,
++                .ctl_name = VIBLND_PEER_CREDITS,
+                 .procname = "peer_credits",
+                 .data     = &peer_credits,
+                 .maxlen   = sizeof(int),
+@@ -204,7 +254,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 10,
++                .ctl_name = VIBLND_ARP_RETRIES,
+                 .procname = "arp_retries",
+                 .data     = &arp_retries,
+                 .maxlen   = sizeof(int),
+@@ -212,7 +262,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 11,
++                .ctl_name = VIBLND_HCA_BASENAME,
+                 .procname = "hca_basename",
+                 .data     = hca_basename_space,
+                 .maxlen   = sizeof(hca_basename_space),
+@@ -220,7 +270,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dostring
+         },
+         {
+-                .ctl_name = 12,
++                .ctl_name = VIBLND_IPIF_BASENAME,
+                 .procname = "ipif_basename",
+                 .data     = ipif_basename_space,
+                 .maxlen   = sizeof(ipif_basename_space),
+@@ -228,7 +278,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dostring
+         },
+         {
+-                .ctl_name = 13,
++                .ctl_name = VIBLND_LOCAL_ACK_TIMEOUT,
+                 .procname = "local_ack_timeout",
+                 .data     = &local_ack_timeout,
+                 .maxlen   = sizeof(int),
+@@ -236,7 +286,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 14,
++                .ctl_name = VIBLND_RETRY_CNT,
+                 .procname = "retry_cnt",
+                 .data     = &retry_cnt,
+                 .maxlen   = sizeof(int),
+@@ -244,7 +294,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 15,
++                .ctl_name = VIBLND_RNR_CNT,
+                 .procname = "rnr_cnt",
+                 .data     = &rnr_cnt,
+                 .maxlen   = sizeof(int),
+@@ -252,7 +302,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 16,
++                .ctl_name = VIBLND_RNR_NAK_TIMER,
+                 .procname = "rnr_nak_timer",
+                 .data     = &rnr_nak_timer,
+                 .maxlen   = sizeof(int),
+@@ -260,7 +310,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 17,
++                .ctl_name = VIBLND_KEEPALIVE,
+                 .procname = "keepalive",
+                 .data     = &keepalive,
+                 .maxlen   = sizeof(int),
+@@ -268,7 +318,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+                 .proc_handler = &proc_dointvec
+         },
+         {
+-                .ctl_name = 18,
++                .ctl_name = VIBLND_CONCURRENT_SENDS,
+                 .procname = "concurrent_sends",
+                 .data     = &concurrent_sends,
+                 .maxlen   = sizeof(int),
+@@ -277,7 +327,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+         },
+ #if IBNAL_USE_FMR
+         {
+-                .ctl_name = 19,
++                .ctl_name = VIBLND_FMR_REMAPS,
+                 .procname = "fmr_remaps",
+                 .data     = &fmr_remaps,
+                 .maxlen   = sizeof(int),
+@@ -290,7 +340,7 @@ static cfs_sysctl_table_t kibnal_ctl_tab
+ 
+ static cfs_sysctl_table_t kibnal_top_ctl_table[] = {
+         {
+-                .ctl_name = 203,
++                .ctl_name = CTL_VIBLND,
+                 .procname = "vibnal",
+                 .data     = NULL,
+                 .maxlen   = 0,
+diff --git a/lnet/libcfs/linux/linux-curproc.c b/lnet/libcfs/linux/linux-curproc.c
+--- a/lnet/libcfs/linux/linux-curproc.c
++++ b/lnet/libcfs/linux/linux-curproc.c
+@@ -109,6 +109,19 @@ void cfs_curproc_cap_set(cfs_kernel_cap_
+         current->cap_effective = cap;
+ }
+ 
++cfs_cap_t cfs_cap_convert_from_kernel(cfs_kernel_cap_t cap)
++{
++#if _LINUX_CAPABILITY_VERSION == 0x19980330
++        return cap;
++#elif _LINUX_CAPABILITY_VERSION == 0x20071026
++        /* XXX lost high byte */
++        return cap.cap[0];
++#else
++        #error "need correct _LINUX_CAPABILITY_VERSION "
++#endif
++}
++
++
+ EXPORT_SYMBOL(cfs_curproc_uid);
+ EXPORT_SYMBOL(cfs_curproc_pid);
+ EXPORT_SYMBOL(cfs_curproc_gid);
+@@ -121,7 +134,7 @@ EXPORT_SYMBOL(cfs_curproc_is_in_groups);
+ EXPORT_SYMBOL(cfs_curproc_is_in_groups);
+ EXPORT_SYMBOL(cfs_curproc_cap_get);
+ EXPORT_SYMBOL(cfs_curproc_cap_set);
+-
++EXPORT_SYMBOL(cfs_cap_convert_from_kernel);
+ /*
+  * Local variables:
+  * c-indentation-style: "K&R"
+diff --git a/lnet/libcfs/linux/linux-proc.c b/lnet/libcfs/linux/linux-proc.c
+--- a/lnet/libcfs/linux/linux-proc.c
++++ b/lnet/libcfs/linux/linux-proc.c
+@@ -61,7 +61,8 @@ static cfs_sysctl_table_header_t *lnet_t
+ static cfs_sysctl_table_header_t *lnet_table_header = NULL;
+ extern char lnet_upcall[1024];
+ 
+-#define PSDEV_LNET  (0x100)
++#ifndef HAVE_SYSCTL_UNNUMBERED
++#define CTL_LNET        (0x100)
+ enum {
+         PSDEV_DEBUG = 1,          /* control debugging */
+         PSDEV_SUBSYSTEM_DEBUG,    /* control debugging */
+@@ -80,8 +81,27 @@ enum {
+         PSDEV_LNET_DAEMON_FILE,   /* spool kernel debug buffer to file */
+         PSDEV_LNET_DEBUG_MB,      /* size of debug buffer */
+ };
++#else
++#define CTL_LNET                        CTL_UNNUMBERED
++#define PSDEV_DEBUG                     CTL_UNNUMBERED
++#define PSDEV_SUBSYSTEM_DEBUG           CTL_UNNUMBERED
++#define PSDEV_PRINTK                    CTL_UNNUMBERED
++#define PSDEV_CONSOLE_RATELIMIT         CTL_UNNUMBERED
++#define PSDEV_CONSOLE_MAX_DELAY_CS      CTL_UNNUMBERED
++#define PSDEV_CONSOLE_MIN_DELAY_CS      CTL_UNNUMBERED
++#define PSDEV_CONSOLE_BACKOFF           CTL_UNNUMBERED
++#define PSDEV_DEBUG_PATH                CTL_UNNUMBERED
++#define PSDEV_DEBUG_DUMP_PATH           CTL_UNNUMBERED
++#define PSDEV_LNET_UPCALL               CTL_UNNUMBERED
++#define PSDEV_LNET_MEMUSED              CTL_UNNUMBERED
++#define PSDEV_LNET_CATASTROPHE          CTL_UNNUMBERED
++#define PSDEV_LNET_PANIC_ON_LBUG        CTL_UNNUMBERED
++#define PSDEV_LNET_DUMP_KERNEL          CTL_UNNUMBERED
++#define PSDEV_LNET_DAEMON_FILE          CTL_UNNUMBERED
++#define PSDEV_LNET_DEBUG_MB             CTL_UNNUMBERED
++#endif
+ 
+-static int 
++int 
+ proc_call_handler(void *data, int write, 
+                   loff_t *ppos, void *buffer, size_t *lenp, 
+                   int (*handler)(void *data, int write,
+@@ -100,17 +120,7 @@ proc_call_handler(void *data, int write,
+         }
+         return 0;
+ }
+-
+-#define DECLARE_PROC_HANDLER(name)                      \
+-static int                                              \
+-LL_PROC_PROTO(name)                                     \
+-{                                                       \
+-        DECLARE_LL_PROC_PPOS_DECL;                      \
+-                                                        \
+-        return proc_call_handler(table->data, write,    \
+-                                 ppos, buffer, lenp,    \
+-                                 __##name);             \
+-}
++EXPORT_SYMBOL(proc_call_handler);
+ 
+ static int __proc_dobitmasks(void *data, int write, 
+                              loff_t pos, void *buffer, int nob)
+@@ -182,11 +192,12 @@ static int __proc_daemon_file(void *data
+ 
+ DECLARE_PROC_HANDLER(proc_daemon_file)
+ 
++char tmpstr[32];
++
+ static int __proc_debug_mb(void *data, int write,
+                            loff_t pos, void *buffer, int nob)
+ {
+         if (!write) {
+-                char tmpstr[32];
+                 int  len = snprintf(tmpstr, sizeof(tmpstr), "%d",
+                                     trace_get_debug_mb());
+ 
+@@ -301,7 +312,8 @@ static cfs_sysctl_table_t lnet_table[] =
+                 .data     = &libcfs_debug,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dobitmasks
++                .proc_handler = &proc_dobitmasks,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_SUBSYSTEM_DEBUG,
+@@ -309,7 +321,8 @@ static cfs_sysctl_table_t lnet_table[] =
+                 .data     = &libcfs_subsystem_debug,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dobitmasks
++                .proc_handler = &proc_dobitmasks,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_PRINTK,
+@@ -317,7 +330,8 @@ static cfs_sysctl_table_t lnet_table[] =
+                 .data     = &libcfs_printk,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dobitmasks
++                .proc_handler = &proc_dobitmasks,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_CONSOLE_RATELIMIT,
+@@ -325,30 +339,36 @@ static cfs_sysctl_table_t lnet_table[] =
+                 .data     = &libcfs_console_ratelimit,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_CONSOLE_MAX_DELAY_CS,
+                 .procname = "console_max_delay_centisecs",
++                .data     = &libcfs_console_max_delay,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_console_max_delay_cs
++                .proc_handler = &proc_console_max_delay_cs,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_CONSOLE_MIN_DELAY_CS,
+                 .procname = "console_min_delay_centisecs",
+                 .maxlen   = sizeof(int),
++                .data     = &libcfs_console_min_delay,
+                 .mode     = 0644,
+-                .proc_handler = &proc_console_min_delay_cs
++                .proc_handler = &proc_console_min_delay_cs,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_CONSOLE_BACKOFF,
+                 .procname = "console_backoff",
+                 .maxlen   = sizeof(int),
++                .data     = &libcfs_console_backoff,
+                 .mode     = 0644,
+-                .proc_handler = &proc_console_backoff
++                .proc_handler = &proc_console_backoff,
++                .strategy = &sysctl_intvec,
+         },
+-
+         {
+                 .ctl_name = PSDEV_DEBUG_PATH,
+                 .procname = "debug_path",
+@@ -356,8 +376,8 @@ static cfs_sysctl_table_t lnet_table[] =
+                 .maxlen   = sizeof(debug_file_path),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dostring,
++                .strategy = &sysctl_string,
+         },
+-
+         {
+                 .ctl_name = PSDEV_LNET_UPCALL,
+                 .procname = "upcall",
+@@ -365,6 +385,7 @@ static cfs_sysctl_table_t lnet_table[] =
+                 .maxlen   = sizeof(lnet_upcall),
+                 .mode     = 0644,
+                 .proc_handler = &proc_dostring,
++                .strategy = &sysctl_string,
+         },
+         {
+                 .ctl_name = PSDEV_LNET_MEMUSED,
+@@ -372,7 +393,8 @@ static cfs_sysctl_table_t lnet_table[] =
+                 .data     = (int *)&libcfs_kmemory.counter,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0444,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_LNET_CATASTROPHE,
+@@ -380,7 +402,8 @@ static cfs_sysctl_table_t lnet_table[] =
+                 .data     = &libcfs_catastrophe,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0444,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_LNET_PANIC_ON_LBUG,
+@@ -388,39 +411,50 @@ static cfs_sysctl_table_t lnet_table[] =
+                 .data     = &libcfs_panic_on_lbug,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = PSDEV_LNET_DUMP_KERNEL,
+                 .procname = "dump_kernel",
++                .data     = tmpstr,
++                .maxlen   = 256,
+                 .mode     = 0200,
+                 .proc_handler = &proc_dump_kernel,
++                .strategy = &sysctl_string,
+         },
+         {
+                 .ctl_name = PSDEV_LNET_DAEMON_FILE,
+                 .procname = "daemon_file",
++                .data     = tmpstr,
+                 .mode     = 0644,
++                .maxlen   = 256,
+                 .proc_handler = &proc_daemon_file,
++                .strategy = &sysctl_string,
+         },
+         {
+                 .ctl_name = PSDEV_LNET_DEBUG_MB,
+                 .procname = "debug_mb",
++                .data     = tmpstr,
++                .maxlen   = sizeof(tmpstr),
+                 .mode     = 0644,
+                 .proc_handler = &proc_debug_mb,
++                .strategy = &sysctl_string,
+         },
+         {0}
+ };
+ 
+-static cfs_sysctl_table_t top_table[2] = {
++static cfs_sysctl_table_t top_table[] = {
+         {
+-                .ctl_name = PSDEV_LNET,
++                .ctl_name = CTL_LNET,
+                 .procname = "lnet",
+-                .data     = NULL,
+-                .maxlen   = 0,
+                 .mode     = 0555,
+-                .child    = lnet_table
++                .child    = lnet_table,
++                .parent   = NULL,
+         },
+-        {0}
++        {
++                .ctl_name = 0
++        }
+ };
+ 
+ int insert_proc(void)
+diff --git a/lnet/lnet/router_proc.c b/lnet/lnet/router_proc.c
+--- a/lnet/lnet/router_proc.c
++++ b/lnet/lnet/router_proc.c
+@@ -32,12 +32,13 @@
+ 
+ /* this is really lnet_proc.c */
+ 
+-#define LNET_PROC_STATS   "sys/lnet/stats"
+-#define LNET_PROC_ROUTES  "sys/lnet/routes"
+-#define LNET_PROC_ROUTERS "sys/lnet/routers"
+-#define LNET_PROC_PEERS   "sys/lnet/peers"
+-#define LNET_PROC_BUFFERS "sys/lnet/buffers"
+-#define LNET_PROC_NIS     "sys/lnet/nis"
++#define LNET_PROC_ROOT    "sys/lnet"
++#define LNET_PROC_STATS   LNET_PROC_ROOT"/stats"
++#define LNET_PROC_ROUTES  LNET_PROC_ROOT"/routes"
++#define LNET_PROC_ROUTERS LNET_PROC_ROOT"/routers"
++#define LNET_PROC_PEERS   LNET_PROC_ROOT"/peers"
++#define LNET_PROC_BUFFERS LNET_PROC_ROOT"/buffers"
++#define LNET_PROC_NIS     LNET_PROC_ROOT"/nis"
+ 
+ static int
+ lnet_router_proc_stats_read (char *page, char **start, off_t off,
+@@ -1007,6 +1008,12 @@ lnet_proc_init(void)
+ {
+         struct proc_dir_entry *pde;
+ 
++        pde = proc_mkdir(LNET_PROC_ROOT, NULL);
++        if (pde == NULL) {
++                CERROR("couldn't create "LNET_PROC_ROOT"\n");
++                return; 
++        }
++
+         /* Initialize LNET_PROC_STATS */
+         pde = create_proc_entry (LNET_PROC_STATS, 0644, NULL);
+         if (pde == NULL) {
+@@ -1078,6 +1085,7 @@ lnet_proc_fini(void)
+         remove_proc_entry(LNET_PROC_PEERS, 0);
+         remove_proc_entry(LNET_PROC_BUFFERS, 0);
+         remove_proc_entry(LNET_PROC_NIS, 0);
++        remove_proc_entry(LNET_PROC_ROOT, 0);
+ }
+ 
+ #else
+diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
+--- a/lustre/autoconf/lustre-core.m4
++++ b/lustre/autoconf/lustre-core.m4
+@@ -1068,14 +1068,15 @@ AC_DEFUN([LC_PAGE_CHECKED],
+ AC_DEFUN([LC_PAGE_CHECKED],
+ [AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
+ LB_LINUX_TRY_COMPILE([
++        #include <linux/autoconf.h>
++        #include <linux/mm_types.h>
+         #include <linux/page-flags.h>
+ ],[
+-        #ifndef PageChecked
+-        #error PageChecked not defined in kernel
+-        #endif
+-        #ifndef SetPageChecked
+-        #error SetPageChecked not defined in kernel
+-        #endif
++	struct page *p;
++	
++	/* 2.6.26 use function instead of define for it */
++	SetPageChecked(p);
++	PageChecked(p);
+ ],[
+         AC_MSG_RESULT(yes)
+         AC_DEFINE(HAVE_PAGE_CHECKED, 1,
+@@ -1230,11 +1231,155 @@ LB_LINUX_TRY_COMPILE([
+ 
+ # 2.6.23 extract nfs export related data into exportfs.h
+ AC_DEFUN([LC_HAVE_EXPORTFS_H],
+-[
+-tmpfl="$CFLAGS"
+-CFLAGS="$CFLAGS -I$LINUX_OBJ/include"
+-AC_CHECK_HEADERS([linux/exportfs.h])
+-CFLAGS="$tmpfl"
++[LB_CHECK_FILE([$LINUX/include/linux/exportfs.h], [
++        AC_DEFINE(HAVE_LINUX_EXPORTFS_H, 1,
++                [kernel has include/exportfs.h])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.23 have new page fault handling API
++AC_DEFUN([LC_VM_OP_FAULT],
++[AC_MSG_CHECKING([if kernel has .fault in vm_operation_struct])
++LB_LINUX_TRY_COMPILE([
++        #include <linux/mm.h>
++],[
++        struct vm_operations_struct op;
++
++        op.fault = NULL;
++], [
++        AC_MSG_RESULT([yes])
++        AC_DEFINE(HAVE_VM_OP_FAULT, 1,
++                [if kernel has .fault in vm_operation_struct])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++#2.6.23 has new shrinker API
++AC_DEFUN([LC_REGISTER_SHRINKER],
++[AC_MSG_CHECKING([if kernel has register_shrinker])
++LB_LINUX_TRY_COMPILE([
++        #include <linux/mm.h>
++],[
++        register_shrinker(NULL);
++], [
++        AC_MSG_RESULT([yes])
++        AC_DEFINE(HAVE_REGISTER_SHRINKER, 1,
++                [if kernel has register_shrinker])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.24 has bio_endio with 2 args
++AC_DEFUN([LC_BIO_ENDIO_2ARG],
++[AC_MSG_CHECKING([if kernel has bio_endio with 2 args])
++LB_LINUX_TRY_COMPILE([
++        #include <linux/bio.h>
++],[
++        bio_endio(NULL, 0);
++], [
++        AC_MSG_RESULT([yes])
++        AC_DEFINE(HAVE_BIO_ENDIO_2ARG, 1,
++                [if kernel has bio_endio with 2 args])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.24 has new members in exports struct.
++AC_DEFUN([LC_FH_TO_DENTRY],
++[AC_MSG_CHECKING([if kernel has .fh_to_dentry member in export_operations struct])
++LB_LINUX_TRY_COMPILE([
++#ifdef HAVE_LINUX_EXPORTFS_H
++        #include <linux/exportfs.h>
++#else
++        #include <linux/fs.h>
++#endif
++],[
++        struct export_operations exp;
++
++        exp.fh_to_dentry   = NULL;
++], [
++        AC_MSG_RESULT([yes])
++        AC_DEFINE(HAVE_FH_TO_DENTRY, 1,
++                [kernel has .fh_to_dentry member in export_operations struct])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.24 remove long aged procfs entry -> deleted member
++AC_DEFUN([LC_PROCFS_DELETED],
++[AC_MSG_CHECKING([if kernel has deleted member in procfs entry struct])
++LB_LINUX_TRY_COMPILE([
++	#include <linux/proc_fs.h>
++],[
++        struct proc_dir_entry pde;
++
++        pde.deleted   = NULL;
++], [
++        AC_MSG_RESULT([yes])
++        AC_DEFINE(HAVE_PROCFS_DELETED, 1,
++                [kernel has deleted member in procfs entry struct])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.26 isn't export set_fs_pwd and change paramter in fs struct
++AC_DEFUN([LC_FS_STRUCT_USE_PATH],
++[AC_MSG_CHECKING([fs_struct use path structure])
++LB_LINUX_TRY_COMPILE([
++        #include <asm/atomic.h>
++        #include <linux/spinlock.h>
++        #include <linux/fs_struct.h>
++],[
++        struct path path;
++        struct fs_struct fs;
++
++        fs.pwd = path;
++], [
++        AC_MSG_RESULT([yes])
++        AC_DEFINE(HAVE_FS_STRUCT_USE_PATH, 1,
++                [fs_struct use path structure])
++],[
++        AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.26 drop list_for_each_safe_rcu
++AC_DEFUN([LC_RCU_LIST_SAFE],
++[AC_MSG_CHECKING([if list_for_each_safe_rcu exist])
++LB_LINUX_TRY_COMPILE([
++    #include <linux/list.h>
++],[
++    #ifndef list_for_each_safe_rcu
++    #error list_for_each_safe not exist
++    #endif
++],[
++    AC_DEFINE(HAVE_RCU_LIST_SAFE, 1, [list_for_each_safe_rcu exist])
++    AC_MSG_RESULT([yes])
++],[
++    AC_MSG_RESULT([no]) 
++])
++])
++
++# 2.6.26 remove path_release and use path_put instead
++AC_DEFUN([LC_PATH_RELEASE],
++[AC_MSG_CHECKING([if path_release exist])
++LB_LINUX_TRY_COMPILE([
++    #include <linux/namei.h>
++],[
++    path_release(NULL);
++],[
++    AC_DEFINE(HAVE_PATH_RELEASE, 1, [path_release exist])
++    AC_MSG_RESULT([yes])
++],[
++    AC_MSG_RESULT([no]) 
++])
+ ])
+ 
+ #
+@@ -1327,10 +1472,23 @@ AC_DEFUN([LC_PROG_LINUX],
+ 	  
+ 	  # 2.6.22
+           LC_INVALIDATE_BDEV_2ARG
++
+           # 2.6.23
+           LC_UNREGISTER_BLKDEV_RETURN_INT
+           LC_KERNEL_SPLICE_READ
+           LC_HAVE_EXPORTFS_H
++          LC_VM_OP_FAULT
++          LC_REGISTER_SHRINKER
++	  
++	  # 2.6.24
++          LC_BIO_ENDIO_2ARG
++          LC_FH_TO_DENTRY
++	  LC_PROCFS_DELETED
++
++          # 2.6.26
++          LC_FS_STRUCT_USE_PATH
++          LC_RCU_LIST_SAFE
++	  LC_PATH_RELEASE
+ ])
+ 
+ #
+@@ -1508,6 +1666,7 @@ LB_LINUX_TRY_COMPILE([
+         ],[
+                 AC_MSG_RESULT([no]) 
+         ])
++
+ ],[
+         AC_MSG_RESULT([no])
+ ])
+diff --git a/lustre/include/liblustre.h b/lustre/include/liblustre.h
+--- a/lustre/include/liblustre.h
++++ b/lustre/include/liblustre.h
+@@ -718,11 +718,13 @@ struct _cap_struct;
+ struct _cap_struct;
+ typedef struct _cap_struct *cap_t;
+ typedef int cap_value_t;
++
+ typedef enum {
+     CAP_EFFECTIVE=0,
+     CAP_PERMITTED=1,
+     CAP_INHERITABLE=2
+ } cap_flag_t;
++
+ typedef enum {
+     CAP_CLEAR=0,
+     CAP_SET=1
+@@ -732,10 +734,32 @@ typedef enum {
+ #define CAP_DAC_READ_SEARCH     2
+ #define CAP_FOWNER              3
+ #define CAP_FSETID              4
+-#define CAP_SYS_ADMIN          21
++#define CAP_SYS_ADMIN           21
++#define CAP_SYS_RESOURCE        24
++
++#define cap_raise(c, flag) do {} while(0)
++
+ 
+ cap_t   cap_get_proc(void);
+ int     cap_get_flag(cap_t, cap_value_t, cap_flag_t, cap_flag_value_t *);
++
++/* XXX should be move into licfs */
++typedef __u32 cfs_cap_t;
++
++static inline cfs_kernel_cap_t cfs_curproc_cap_get(void)
++{
++        return current->cap_effective;
++}
++
++static inline void cfs_curproc_cap_set(cfs_kernel_cap_t cap)
++{
++        current->cap_effective = cap;
++}
++
++static inline cfs_cap_t cfs_cap_convert_from_kernel(cfs_kernel_cap_t data)
++{
++        return (cfs_cap_t)data;
++}
+ 
+ static inline void libcfs_run_lbug_upcall(char *file, const char *fn,
+                                            const int l){}
+diff --git a/lustre/include/linux/lustre_compat25.h b/lustre/include/linux/lustre_compat25.h
+--- a/lustre/include/linux/lustre_compat25.h
++++ b/lustre/include/linux/lustre_compat25.h
+@@ -43,6 +43,28 @@ struct ll_iattr_struct {
+ #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) */
+ 
+ #ifndef HAVE_SET_FS_PWD
++
++#ifdef HAVE_FS_STRUCT_USE_PATH
++static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
++                struct dentry *dentry)
++{
++        struct path path;
++	struct path old_pwd;
++
++        path.mnt = mnt;
++        path.dentry = dentry;
++        write_lock(&fs->lock);
++        old_pwd = fs->pwd;
++        path_get(&path);
++        fs->pwd = path;
++        write_unlock(&fs->lock);
++
++	if (old_pwd.dentry)
++		path_put(&old_pwd);
++}
++
++#else
++
+ static inline void ll_set_fs_pwd(struct fs_struct *fs, struct vfsmount *mnt,
+                 struct dentry *dentry)
+ {
+@@ -61,6 +83,7 @@ static inline void ll_set_fs_pwd(struct 
+                 mntput(old_pwdmnt);
+         }
+ }
++#endif
+ #else
+ #define ll_set_fs_pwd set_fs_pwd
+ #endif /* HAVE_SET_FS_PWD */
+@@ -538,5 +561,56 @@ int ll_unregister_blkdev(unsigned int de
+ #define ll_invalidate_bdev(a,b)         invalidate_bdev((a))
+ #endif
+ 
++#ifdef HAVE_REGISTER_SHRINKER
++typedef int (*shrinker_t)(int nr_to_scan, gfp_t gfp_mask);
++
++static inline
++struct shrinker *set_shrinker(int seek, shrinker_t func)
++{
++        struct shrinker *s;
++
++        s = kmalloc(sizeof(*s), GFP_KERNEL);
++        if (s == NULL)
++                return (NULL);
++
++        s->shrink = func;
++        s->seeks = seek;
++
++        register_shrinker(s);
++
++        return s;
++}
++
++static inline
++void remove_shrinker(struct shrinker *shrinker) 
++{
++        if (shrinker == NULL)
++                return;
++
++        unregister_shrinker(shrinker);
++        kfree(shrinker);
++}
++#endif
++
++#ifdef HAVE_BIO_ENDIO_2ARG
++#define cfs_bio_io_error(a,b)   bio_io_error((a))
++#define cfs_bio_endio(a,b,c)    bio_endio((a),(c))
++#else
++#define cfs_bio_io_error(a,b)   bio_io_error((a),(b))
++#define cfs_bio_endio(a,b,c)    bio_endio((a),(b),(c))
++#endif
++
++#ifdef HAVE_FS_STRUCT_USE_PATH
++#define cfs_fs_pwd(fs)       ((fs)->pwd.dentry)
++#define cfs_fs_mnt(fs)       ((fs)->pwd.mnt)
++#else
++#define cfs_fs_pwd(fs)       ((fs)->pwd)
++#define cfs_fs_mnt(fs)       ((fs)->pwdmnt)
++#endif
++
++#ifndef HAVE_RCU_LIST_SAFE
++#define list_for_each_safe_rcu(a,b,c) list_for_each_rcu(b, c)
++#endif
++
+ #endif /* __KERNEL__ */
+ #endif /* _COMPAT25_H */
+diff --git a/lustre/include/linux/lvfs.h b/lustre/include/linux/lvfs.h
+--- a/lustre/include/linux/lvfs.h
++++ b/lustre/include/linux/lvfs.h
+@@ -47,7 +47,7 @@ struct lvfs_ucred {
+         struct upcall_cache_entry *luc_uce;
+         __u32 luc_fsuid;
+         __u32 luc_fsgid;
+-        __u32 luc_cap;
++        cfs_kernel_cap_t luc_cap;
+         __u32 luc_suppgid1;
+         __u32 luc_suppgid2;
+         __u32 luc_umask;
+diff --git a/lustre/include/lprocfs_status.h b/lustre/include/lprocfs_status.h
+--- a/lustre/include/lprocfs_status.h
++++ b/lustre/include/lprocfs_status.h
+@@ -481,6 +481,8 @@ extern struct rw_semaphore _lprocfs_lock
+ #define LPROCFS_EXIT()            do {  \
+         up_read(&_lprocfs_lock);        \
+ } while(0)
++
++#ifdef HAVE_PROCFS_DELETED
+ #define LPROCFS_ENTRY_AND_CHECK(dp) do {        \
+         typecheck(struct proc_dir_entry *, dp); \
+         LPROCFS_ENTRY();                        \
+@@ -489,6 +491,13 @@ extern struct rw_semaphore _lprocfs_lock
+                 return -ENODEV;                 \
+         }                                       \
+ } while(0)
++#define LPROCFS_CHECK_DELETED(dp) ((dp)->deleted)
++#else
++#define LPROCFS_ENTRY_AND_CHECK(dp) \
++        LPROCFS_ENTRY();
++#define LPROCFS_CHECK_DELETED(dp) (0)
++#endif
++
+ 
+ /* You must use these macros when you want to refer to 
+  * the import in a client obd_device for a lprocfs entry */
+diff --git a/lustre/include/lustre_log.h b/lustre/include/lustre_log.h
+--- a/lustre/include/lustre_log.h
++++ b/lustre/include/lustre_log.h
+@@ -218,14 +218,6 @@ struct llog_ctxt {
+         void                    *llog_proc_cb;
+ };
+ 
+-#ifndef __KERNEL__
+-
+-#define cap_raise(c, flag) do {} while(0)
+-
+-#define CAP_SYS_RESOURCE 24
+-
+-#endif   /* !__KERNEL__ */
+-
+ static inline void llog_gen_init(struct llog_ctxt *ctxt)
+ {
+         struct obd_device *obd = ctxt->loc_exp->exp_obd;
+@@ -329,7 +321,7 @@ static inline int llog_write_rec(struct 
+                                  int numcookies, void *buf, int idx)
+ {
+         struct llog_operations *lop;
+-        __u32 cap;
++        cfs_kernel_cap_t cap;
+         int rc, buflen;
+         ENTRY;
+ 
+@@ -346,10 +338,10 @@ static inline int llog_write_rec(struct 
+                 buflen = rec->lrh_len;
+         LASSERT(size_round(buflen) == buflen);
+ 
+-        cap = current->cap_effective;             
+-        cap_raise(current->cap_effective, CAP_SYS_RESOURCE); 
++        cap = current->cap_effective;
++        cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
+         rc = lop->lop_write_rec(handle, rec, logcookies, numcookies, buf, idx);
+-        current->cap_effective = cap; 
++        current->cap_effective = cap;
+         RETURN(rc);
+ }
+ 
+@@ -445,7 +437,7 @@ static inline int llog_create(struct llo
+                               struct llog_logid *logid, char *name)
+ {
+         struct llog_operations *lop;
+-        __u32 cap;
++        cfs_kernel_cap_t cap;
+         int rc;
+         ENTRY;
+ 
+@@ -455,10 +447,10 @@ static inline int llog_create(struct llo
+         if (lop->lop_create == NULL)
+                 RETURN(-EOPNOTSUPP);
+ 
+-        cap = current->cap_effective;             
++        cap = current->cap_effective;
+         cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
+         rc = lop->lop_create(ctxt, res, logid, name);
+-        current->cap_effective = cap; 
++        current->cap_effective = cap;
+         RETURN(rc);
+ }
+ 
+diff --git a/lustre/include/lustre_mds.h b/lustre/include/lustre_mds.h
+--- a/lustre/include/lustre_mds.h
++++ b/lustre/include/lustre_mds.h
+@@ -177,7 +177,7 @@ int mdc_readpage(struct obd_export *exp,
+                  struct page *, struct ptlrpc_request **);
+ int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
+                const void *data, int datalen, int mode, __u32 uid, __u32 gid,
+-               __u32 cap_effective, __u64 rdev,struct ptlrpc_request **request);
++               cfs_kernel_cap_t cap_effective, __u64 rdev,struct ptlrpc_request **request);
+ int mdc_unlink(struct obd_export *exp, struct mdc_op_data *data,
+                struct ptlrpc_request **request);
+ int mdc_link(struct obd_export *exp, struct mdc_op_data *data,
+diff --git a/lustre/llite/file.c b/lustre/llite/file.c
+--- a/lustre/llite/file.c
++++ b/lustre/llite/file.c
+@@ -1680,9 +1680,17 @@ static ssize_t ll_file_write(struct file
+ /*
+  * Send file content (through pagecache) somewhere with helper
+  */
+-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+-static ssize_t ll_file_sendfile(struct file *in_file, loff_t *ppos,size_t count,
+-                                read_actor_t actor, void *target)
++/* change based on 
++ * http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f0930fffa99e7fe0a0c4b6c7d9a244dc88288c27
++ */
++#ifdef HAVE_KERNEL_SPLICE_READ
++static ssize_t ll_file_splice_read(struct file *in_file, loff_t *ppos,
++                                   struct pipe_inode_info *pipe, size_t count,
++                                   unsigned int flags)
++#else
++static ssize_t ll_file_sendfile(struct file *in_file, loff_t *ppos,
++                                size_t count, read_actor_t actor, void *target)
++#endif
+ {
+         struct inode *inode = in_file->f_dentry->d_inode;
+         struct ll_inode_info *lli = ll_i2info(inode);
+@@ -1691,8 +1699,7 @@ static ssize_t ll_file_sendfile(struct f
+         struct ll_lock_tree_node *node;
+         struct ost_lvb lvb;
+         struct ll_ra_read bead;
+-        int rc;
+-        ssize_t retval;
++        ssize_t rc;
+         __u64 kms;
+         ENTRY;
+         CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p),size="LPSZ",offset=%Ld\n",
+@@ -1708,8 +1715,14 @@ static ssize_t ll_file_sendfile(struct f
+         in_file->f_ra.ra_pages = 0;
+ 
+         /* File with no objects, nothing to lock */
+-        if (!lsm)
+-                RETURN(generic_file_sendfile(in_file, ppos, count, actor, target));
++        if (!lsm) {
++#ifdef HAVE_KERNEL_SPLICE_READ
++                rc = generic_file_splice_read(in_file, ppos, pipe, count, flags);
++#else
++                rc = generic_file_sendfile(in_file, ppos, count, actor, target);
++#endif
++                RETURN(rc);
++        }
+ 
+         node = ll_node_from_inode(inode, *ppos, *ppos + count - 1, LCK_PR);
+         if (IS_ERR(node))
+@@ -1749,8 +1762,8 @@ static ssize_t ll_file_sendfile(struct f
+                 /* A glimpse is necessary to determine whether we return a
+                  * short read (B) or some zeroes at the end of the buffer (C) */
+                 ll_inode_size_unlock(inode, 1);
+-                retval = ll_glimpse_size(inode, LDLM_FL_BLOCK_GRANTED);
+-                if (retval)
++                rc = ll_glimpse_size(inode, LDLM_FL_BLOCK_GRANTED);
++                if (rc)
+                         goto out;
+         } else {
+                 /* region is within kms and, hence, within real file size (A) */
+@@ -1766,14 +1779,17 @@ static ssize_t ll_file_sendfile(struct f
+         ll_ra_read_in(in_file, &bead);
+         /* BUG: 5972 */
+         file_accessed(in_file);
+-        retval = generic_file_sendfile(in_file, ppos, count, actor, target);
++#ifdef HAVE_KERNEL_SPLICE_READ
++        rc = generic_file_splice_read(in_file, ppos, pipe, count, flags);
++#else
++        rc = generic_file_sendfile(in_file, ppos, count, actor, target);
++#endif
+         ll_ra_read_ex(in_file, &bead);
+ 
+  out:
+         ll_tree_unlock(&tree);
+-        RETURN(retval);
++        RETURN(rc);
+ }
+-#endif
+ 
+ static int ll_lov_recreate_obj(struct inode *inode, struct file *file,
+                                unsigned long arg)
+@@ -2915,7 +2931,9 @@ struct file_operations ll_file_operation
+         .release        = ll_file_release,
+         .mmap           = ll_file_mmap,
+         .llseek         = ll_file_seek,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
++#ifdef HAVE_KERNEL_SPLICE_READ
++        .splice_read    = ll_file_splice_read,
++#else
+         .sendfile       = ll_file_sendfile,
+ #endif
+         .fsync          = ll_fsync,
+@@ -2931,7 +2949,7 @@ struct file_operations ll_file_operation
+         .write          = ll_file_write,
+ #ifdef HAVE_FILE_WRITEV
+         .writev         = ll_file_writev,
+-#else   
++#else
+         .aio_write      = ll_file_aio_write,
+ #endif
+         .ioctl          = ll_file_ioctl,
+@@ -2939,7 +2957,9 @@ struct file_operations ll_file_operation
+         .release        = ll_file_release,
+         .mmap           = ll_file_mmap,
+         .llseek         = ll_file_seek,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
++#ifdef HAVE_KERNEL_SPLICE_READ
++        .splice_read    = ll_file_splice_read,
++#else
+         .sendfile       = ll_file_sendfile,
+ #endif
+         .fsync          = ll_fsync,
+@@ -2960,7 +2980,7 @@ struct file_operations ll_file_operation
+         .write          = ll_file_write,
+ #ifdef HAVE_FILE_WRITEV
+         .writev         = ll_file_writev,
+-#else   
++#else
+         .aio_write      = ll_file_aio_write,
+ #endif
+         .ioctl          = ll_file_ioctl,
+@@ -2968,7 +2988,9 @@ struct file_operations ll_file_operation
+         .release        = ll_file_release,
+         .mmap           = ll_file_mmap,
+         .llseek         = ll_file_seek,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
++#ifdef HAVE_KERNEL_SPLICE_READ
++        .splice_read    = ll_file_splice_read,
++#else
+         .sendfile       = ll_file_sendfile,
+ #endif
+         .fsync          = ll_fsync,
+diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
+--- a/lustre/llite/llite_internal.h
++++ b/lustre/llite/llite_internal.h
+@@ -681,9 +681,6 @@ int ll_process_config(struct lustre_cfg 
+ /* llite/llite_nfs.c */
+ extern struct export_operations lustre_export_operations;
+ __u32 get_uuid2int(const char *name, int len);
+-struct dentry *ll_fh_to_dentry(struct super_block *sb, __u32 *data, int len,
+-                               int fhtype, int parent);
+-int ll_dentry_to_fh(struct dentry *, __u32 *datap, int *lenp, int need_parent);
+ 
+ /* llite/special.c */
+ extern struct inode_operations ll_special_inode_operations;
+diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
+--- a/lustre/llite/llite_lib.c
++++ b/lustre/llite/llite_lib.c
+@@ -1347,7 +1347,7 @@ static int ll_setattr_do_truncate(struct
+                 rc = vmtruncate(inode, new_size);
+                 clear_bit(LLI_F_SRVLOCK, &lli->lli_flags);
+                 if (rc != 0) {
+-                        LASSERT(atomic_read(&lli->lli_size_sem.count) <= 0);
++//                        LASSERT(atomic_read(&lli->lli_size_sem.count) <= 0);
+                         ll_inode_size_unlock(inode, 0);
+                 }
+         }
+diff --git a/lustre/llite/llite_mmap.c b/lustre/llite/llite_mmap.c
+--- a/lustre/llite/llite_mmap.c
++++ b/lustre/llite/llite_mmap.c
+@@ -38,9 +38,6 @@
+ #include <linux/mm.h>
+ #include <linux/pagemap.h>
+ #include <linux/smp_lock.h>
+-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+-#include <linux/iobuf.h>
+-#endif
+ 
+ #define DEBUG_SUBSYSTEM S_LLITE
+ 
+@@ -66,17 +63,10 @@ struct ll_lock_tree_node {
+         struct inode           *lt_inode;
+ };
+ 
++static struct vm_operations_struct ll_file_vm_ops;
++
+ int lt_get_mmap_locks(struct ll_lock_tree *tree,
+                       unsigned long addr, size_t count);
+-
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+-struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
+-                       int *type);
+-#else
+-
+-struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
+-                       int unused);
+-#endif
+ 
+ struct ll_lock_tree_node * ll_node_from_inode(struct inode *inode, __u64 start,
+                                               __u64 end, ldlm_mode_t mode)
+@@ -302,7 +292,7 @@ static struct vm_area_struct * our_vma(u
+         spin_lock(&mm->page_table_lock);
+         for(vma = find_vma(mm, addr);
+             vma != NULL && vma->vm_start < (addr + count); vma = vma->vm_next) {
+-                if (vma->vm_ops && vma->vm_ops->nopage == ll_nopage &&
++                if (vma->vm_ops && vma->vm_ops == &ll_file_vm_ops &&
+                     vma->vm_flags & VM_SHARED) {
+                         ret = vma;
+                         break;
+@@ -350,53 +340,28 @@ int lt_get_mmap_locks(struct ll_lock_tre
+         RETURN(0);
+ }
+ 
+-/* FIXME: there is a pagefault race goes as follow (only 2.4):
+- * 1. A user process on node A accesses a portion of a mapped file,
+- *    resulting in a page fault.  The pagefault handler invokes the
+- *    ll_nopage function, which reads the page into memory.
+- * 2. A user process on node B writes to the same portion of the file
+- *    (either via mmap or write()), that cause node A to cancel the
+- *    lock and truncate the page.
+- * 3. Node A then executes the rest of do_no_page(), entering the
+- *    now-invalid page into the PTEs.
+- *
+- * Make the whole do_no_page as a hook to cover both the page cache
+- * and page mapping installing with dlm lock would eliminate this race.
+- *
+- * In 2.6, the truncate_count of address_space can cover this race.
+- */
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+-struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
+-                       int *type)
+-#else
+-struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
+-                       int type /* unused */)
+-#endif
++static int ll_get_extent_lock(struct vm_area_struct *vma, unsigned long pgoff,
++                             int *save_flags, struct lustre_handle *lockh)
+ {
+         struct file *filp = vma->vm_file;
+         struct ll_file_data *fd = LUSTRE_FPRIVATE(filp);
+         struct inode *inode = filp->f_dentry->d_inode;
+-        struct lustre_handle lockh = { 0 };
+         ldlm_policy_data_t policy;
+         ldlm_mode_t mode;
+-        struct page *page = NULL;
+         struct ll_inode_info *lli = ll_i2info(inode);
+-        struct lov_stripe_md *lsm;
+         struct ost_lvb lvb;
+         __u64 kms, old_mtime;
+-        unsigned long pgoff, size, rand_read, seq_read;
+-        int rc = 0;
+-        ENTRY;
++        unsigned long size;
++
+ 
+         if (lli->lli_smd == NULL) {
+                 CERROR("No lsm on fault?\n");
+-                RETURN(NULL);
++                RETURN(0);
+         }
+-
+         ll_clear_file_contended(inode);
+ 
+         /* start and end the lock on the first and last bytes in the page */
+-        policy_from_vma(&policy, vma, address, CFS_PAGE_SIZE);
++        policy_from_vma(&policy, vma, pgoff, CFS_PAGE_SIZE);
+ 
+         CDEBUG(D_MMAP, "nopage vma %p inode %lu, locking ["LPU64", "LPU64"]\n",
+                vma, inode->i_ino, policy.l_extent.start, policy.l_extent.end);
+@@ -404,26 +369,23 @@ struct page *ll_nopage(struct vm_area_st
+         mode = mode_from_vma(vma);
+         old_mtime = LTIME_S(inode->i_mtime);
+ 
+-        lsm = lli->lli_smd;
+-        rc = ll_extent_lock(fd, inode, lsm, mode, &policy,
+-                            &lockh, LDLM_FL_CBPENDING | LDLM_FL_NO_LRU);
+-        if (rc != 0)
+-                RETURN(NULL);
++        if(ll_extent_lock(fd, inode, lli->lli_smd, mode, &policy,
++                           lockh, LDLM_FL_CBPENDING | LDLM_FL_NO_LRU))
++                RETURN(0);
+ 
+         if (vma->vm_flags & VM_EXEC && LTIME_S(inode->i_mtime) != old_mtime)
+                 CWARN("binary changed. inode %lu\n", inode->i_ino);
+ 
+-        lov_stripe_lock(lsm);
++        lov_stripe_lock(lli->lli_smd);
+         inode_init_lvb(inode, &lvb);
+-        obd_merge_lvb(ll_i2obdexp(inode), lsm, &lvb, 1);
++        obd_merge_lvb(ll_i2obdexp(inode), lli->lli_smd, &lvb, 1);
+         kms = lvb.lvb_size;
+ 
+-        pgoff = ((address - vma->vm_start) >> CFS_PAGE_SHIFT) + vma->vm_pgoff;
+         size = (kms + CFS_PAGE_SIZE - 1) >> CFS_PAGE_SHIFT;
+-
+         if (pgoff >= size) {
+-                lov_stripe_unlock(lsm);
++                lov_stripe_unlock(lli->lli_smd);
+                 ll_glimpse_size(inode, LDLM_FL_BLOCK_GRANTED);
++                lov_stripe_lock(lli->lli_smd);
+         } else {
+                 /* XXX change inode size without ll_inode_size_lock() held!
+                  *     there is a race condition with truncate path. (see
+@@ -445,38 +407,85 @@ struct page *ll_nopage(struct vm_area_st
+                         CDEBUG(D_INODE, "ino=%lu, updating i_size %llu\n",
+                                inode->i_ino, i_size_read(inode));
+                 }
+-                lov_stripe_unlock(lsm);
+         }
+ 
+         /* If mapping is writeable, adjust kms to cover this page,
+          * but do not extend kms beyond actual file size.
+          * policy.l_extent.end is set to the end of the page by policy_from_vma
+          * bug 10919 */
+-        lov_stripe_lock(lsm);
+         if (mode == LCK_PW)
+-                obd_adjust_kms(ll_i2obdexp(inode), lsm,
++                obd_adjust_kms(ll_i2obdexp(inode), lli->lli_smd,
+                                min_t(loff_t, policy.l_extent.end + 1,
+                                i_size_read(inode)), 0);
+-        lov_stripe_unlock(lsm);
++        lov_stripe_unlock(lli->lli_smd);
+ 
+         /* disable VM_SEQ_READ and use VM_RAND_READ to make sure that
+          * the kernel will not read other pages not covered by ldlm in
+          * filemap_nopage. we do our readahead in ll_readpage.
+          */
+-        rand_read = vma->vm_flags & VM_RAND_READ;
+-        seq_read = vma->vm_flags & VM_SEQ_READ;
++       *save_flags = vma->vm_flags & (VM_RAND_READ | VM_SEQ_READ);
+         vma->vm_flags &= ~ VM_SEQ_READ;
+         vma->vm_flags |= VM_RAND_READ;
++
++        RETURN(1);
++}
++
++static void ll_put_extent_lock(struct vm_area_struct *vma, int save_flags,
++                             struct lustre_handle *lockh)
++{
++        struct file *filp = vma->vm_file;
++        struct ll_file_data *fd = LUSTRE_FPRIVATE(filp);
++        struct inode *inode = filp->f_dentry->d_inode;
++        ldlm_mode_t mode;
++
++        mode = mode_from_vma(vma);
++        vma->vm_flags &= ~(VM_RAND_READ | VM_SEQ_READ);
++        vma->vm_flags |= save_flags;
++
++        ll_extent_unlock(fd, inode, ll_i2info(inode)->lli_smd, mode, lockh);
++}
++
++#ifndef HAVE_VM_OP_FAULT
++struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
++                       int *type)
++        struct lustre_handle lockh = { 0 };
++        int save_fags;
++        unsigned long pgoff;
++        struct page *page;
++        ENTRY;
++
++        pgoff = ((address - vma->vm_start) >> CFS_PAGE_SHIFT) + vma->vm_pgoff;
++        if(!ll_extent_tree_lock(vma, pgoff, &save_fags, &lockh))
++                RETURN(NOPAGE_SIGBUS);
+ 
+         page = filemap_nopage(vma, address, type);
+         LL_CDEBUG_PAGE(D_PAGE, page, "got addr %lu type %lx\n", address,
+                        (long)type);
+-        vma->vm_flags &= ~VM_RAND_READ;
+-        vma->vm_flags |= (rand_read | seq_read);
+ 
+-        ll_extent_unlock(fd, inode, ll_i2info(inode)->lli_smd, mode, &lockh);
++        ll_put_tree_lock(vma, save_fags, &lockh);
++
+         RETURN(page);
+ }
++#else
++/* New fault() API*/
++int ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
++{
++        struct lustre_handle lockh = { 0 };
++        int save_fags;
++        int rc;
++        ENTRY;
++
++        if(!ll_get_extent_lock(vma, vmf->pgoff, &save_fags, &lockh))
++               RETURN(VM_FAULT_SIGBUS);
++
++        rc = filemap_fault(vma, vmf);
++        LL_CDEBUG_PAGE(D_PAGE, vmf->page, "got addr %p type NOPAGE\n",
++                       vmf->virtual_address);
++        ll_put_extent_lock(vma, save_fags, &lockh);
++
++        RETURN(rc);
++}
++#endif
+ 
+ /* To avoid cancel the locks covering mmapped region for lock cache pressure,
+  * we track the mapped vma count by lli_mmap_cnt.
+@@ -542,9 +551,12 @@ static void ll_vm_close(struct vm_area_s
+         }
+ }
+ 
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
++#ifndef HAVE_VM_OP_FAULT
+ #ifndef HAVE_FILEMAP_POPULATE
+-static int (*filemap_populate)(struct vm_area_struct * area, unsigned long address, unsigned long len, pgprot_t prot, unsigned long pgoff, int nonblock);
++static int (*filemap_populate)(struct vm_area_struct * area, 
++                               unsigned long address, unsigned long len, 
++                               pgprot_t prot, unsigned long pgoff, 
++                               int nonblock);
+ #endif
+ static int ll_populate(struct vm_area_struct *area, unsigned long address,
+                        unsigned long len, pgprot_t prot, unsigned long pgoff,
+@@ -566,47 +578,6 @@ static inline unsigned long file_to_user
+ 
+ }
+ 
+-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+-/* [first, last] are the byte offsets affected.
+- * vm_{start, end} are user addresses of the first byte of the mapping and
+- *      the next byte beyond it
+- * vm_pgoff is the page index of the first byte in the mapping */
+-static void teardown_vmas(struct vm_area_struct *vma, __u64 first,
+-                          __u64 last)
+-{
+-        unsigned long address, len;
+-        for (; vma ; vma = vma->vm_next_share) {
+-                if (last >> CFS_PAGE_SHIFT < vma->vm_pgoff)
+-                        continue;
+-                if (first >> CFS_PAGE_SHIFT >= (vma->vm_pgoff +
+-                    ((vma->vm_end - vma->vm_start) >> CFS_PAGE_SHIFT)))
+-                        continue;
+-
+-                /* XXX in case of unmap the cow pages of a running file,
+-                 * don't unmap these private writeable mapping here!
+-                 * though that will break private mappping a little.
+-                 *
+-                 * the clean way is to check the mapping of every page
+-                 * and just unmap the non-cow pages, just like
+-                 * unmap_mapping_range() with even_cow=0 in kernel 2.6.
+-                 */
+-                if (!(vma->vm_flags & VM_SHARED) &&
+-                    (vma->vm_flags & VM_WRITE))
+-                        continue;
+-
+-                address = max((unsigned long)vma->vm_start,
+-                              file_to_user(vma, first));
+-                len = min((unsigned long)vma->vm_end,
+-                          file_to_user(vma, last) + 1) - address;
+-
+-                VMA_DEBUG(vma, "zapping vma [first="LPU64" last="LPU64" "
+-                          "address=%ld len=%ld]\n", first, last, address, len);
+-                LASSERT(len > 0);
+-                ll_zap_page_range(vma, address, len);
+-        }
+-}
+-#endif
+-
+ /* XXX put nice comment here.  talk about __free_pte -> dirty pages and
+  * nopage's reference passing to the pte */
+ int ll_teardown_mmaps(struct address_space *mapping, __u64 first, __u64 last)
+@@ -615,32 +586,21 @@ int ll_teardown_mmaps(struct address_spa
+         ENTRY;
+ 
+         LASSERTF(last > first, "last "LPU64" first "LPU64"\n", last, first);
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
+         if (mapping_mapped(mapping)) {
+                 rc = 0;
+                 unmap_mapping_range(mapping, first + CFS_PAGE_SIZE - 1,
+                                     last - first + 1, 0);
+         }
+-#else
+-        spin_lock(&mapping->i_shared_lock);
+-        if (mapping->i_mmap != NULL) {
+-                rc = 0;
+-                teardown_vmas(mapping->i_mmap, first, last);
+-        }
+-        if (mapping->i_mmap_shared != NULL) {
+-                rc = 0;
+-                teardown_vmas(mapping->i_mmap_shared, first, last);
+-        }
+-        spin_unlock(&mapping->i_shared_lock);
+-#endif
+         RETURN(rc);
+ }
+ 
+ static struct vm_operations_struct ll_file_vm_ops = {
+-        .nopage         = ll_nopage,
+         .open           = ll_vm_open,
+         .close          = ll_vm_close,
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
++#ifdef HAVE_VM_OP_FAULT
++        .fault          = ll_fault,
++#else
++        .nopage         = ll_nopage,
+         .populate       = ll_populate,
+ #endif
+ };
+@@ -653,8 +613,7 @@ int ll_file_mmap(struct file * file, str
+         ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode), LPROC_LL_MAP, 1);
+         rc = generic_file_mmap(file, vma);
+         if (rc == 0) {
+-#if !defined(HAVE_FILEMAP_POPULATE) && \
+-    (LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0))
++#if !defined(HAVE_FILEMAP_POPULATE) && !defined(HAVE_VM_OP_FAULT)
+                 if (!filemap_populate)
+                         filemap_populate = vma->vm_ops->populate;
+ #endif
+diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c
+--- a/lustre/llite/llite_nfs.c
++++ b/lustre/llite/llite_nfs.c
+@@ -40,11 +40,7 @@ __u32 get_uuid2int(const char *name, int
+         return (key0 << 1);
+ }
+ 
+-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+-static int ll_nfs_test_inode(struct inode *inode, unsigned long ino, void *opaque)
+-#else
+ static int ll_nfs_test_inode(struct inode *inode, void *opaque)
+-#endif
+ {
+         struct ll_fid *iid = opaque;
+ 
+@@ -56,12 +52,10 @@ static int ll_nfs_test_inode(struct inod
+ 
+ static struct inode * search_inode_for_lustre(struct super_block *sb,
+                                               unsigned long ino,
+-                                              unsigned long generation,
+-                                              int mode)
++                                              unsigned long generation)
+ {
+         struct ptlrpc_request *req = NULL;
+         struct ll_sb_info *sbi = ll_s2sbi(sb);
+-        struct ll_fid fid;
+         unsigned long valid = 0;
+         int eadatalen = 0, rc;
+         struct inode *inode = NULL;
+@@ -72,17 +66,15 @@ static struct inode * search_inode_for_l
+ 
+         if (inode)
+                 RETURN(inode);
+-        if (S_ISREG(mode)) {
+-                rc = ll_get_max_mdsize(sbi, &eadatalen);
+-                if (rc) 
+-                        RETURN(ERR_PTR(rc));
+-                valid |= OBD_MD_FLEASIZE;
+-        }
+-        fid.id = (__u64)ino;
+-        fid.generation = generation;
+-        fid.f_type = mode;
+ 
+-        rc = mdc_getattr(sbi->ll_mdc_exp, &fid, valid, eadatalen, &req);
++        rc = ll_get_max_mdsize(sbi, &eadatalen);
++        if (rc) 
++                RETURN(ERR_PTR(rc));
++
++        valid |= OBD_MD_FLEASIZE;
++
++        /* mds_fid2dentry ignore f_type */
++        rc = mdc_getattr(sbi->ll_mdc_exp, &iid, valid, eadatalen, &req);
+         if (rc) {
+                 CERROR("failure %d inode %lu\n", rc, ino);
+                 RETURN(ERR_PTR(rc));
+@@ -98,20 +90,23 @@ static struct inode * search_inode_for_l
+         RETURN(inode);
+ }
+ 
+-static struct dentry *ll_iget_for_nfs(struct super_block *sb, unsigned long ino,
+-                                      __u32 generation, umode_t mode)
++extern struct dentry_operations ll_d_ops;
++
++#ifdef HAVE_FH_TO_DENTRY
++static struct inode *ll_iget_for_nfs(struct super_block *sb, __u64 ino,
++                                      __u32 generation)
++#else
++static struct inode *ll_iget_for_nfs(struct super_block *sb, unsigned long ino,
++                                      __u32 generation)
++#endif
+ {
+         struct inode *inode;
+-        struct dentry *result;
+-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+-        struct list_head *lp;
+-#endif
+         ENTRY;
+ 
+         if (ino == 0)
+                 RETURN(ERR_PTR(-ESTALE));
+ 
+-        inode = search_inode_for_lustre(sb, ino, generation, mode);
++        inode = search_inode_for_lustre(sb, ino, generation);
+         if (IS_ERR(inode)) {
+                 RETURN(ERR_PTR(PTR_ERR(inode)));
+         }
+@@ -125,40 +120,24 @@ static struct dentry *ll_iget_for_nfs(st
+                 iput(inode);
+                 RETURN(ERR_PTR(-ESTALE));
+         }
++        RETURN(inode);
++}
+ 
+-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
++static struct dentry *ll_nfs_get_dentry(struct super_block *sb, void *data)
++{
++        __u32 *inump = (__u32*)data;
++        struct inode *inode;
++        struct dentry *result;
++
++        inode = ll_iget_for_nfs(sb, inump[0], inump[1]);
++        if (IS_ERR(inode))
++                RETURN((struct dentry *)inode);
++
+         result = d_alloc_anon(inode);
+         if (!result) {
+                 iput(inode);
+                 RETURN(ERR_PTR(-ENOMEM));
+         }
+-#else
+-        /* now to find a dentry.
+-         * If possible, get a well-connected one
+-         */
+-        spin_lock(&dcache_lock);
+-        for (lp = inode->i_dentry.next; lp != &inode->i_dentry ; lp=lp->next) {
+-                result = list_entry(lp,struct dentry, d_alias);
+-                lock_dentry(result);
+-                if (!(result->d_flags & DCACHE_DISCONNECTED)) {
+-                        dget_locked(result);
+-                        ll_set_dflags(result, DCACHE_REFERENCED);
+-                        unlock_dentry(result);
+-                        spin_unlock(&dcache_lock);
+-                        iput(inode);
+-                        RETURN(result);
+-                }
+-                unlock_dentry(result);
+-        }
+-        spin_unlock(&dcache_lock);
+-        result = d_alloc_root(inode);
+-        if (result == NULL) {
+-                iput(inode);
+-                RETURN(ERR_PTR(-ENOMEM));
+-        }
+-        result->d_flags |= DCACHE_DISCONNECTED;
+-
+-#endif
+         ll_set_dd(result);
+ 
+         lock_dentry(result);
+@@ -173,80 +152,63 @@ static struct dentry *ll_iget_for_nfs(st
+         }
+ 
+         RETURN(result);
++
+ }
+ 
+-struct dentry *ll_fh_to_dentry(struct super_block *sb, __u32 *data, int len,
+-                               int fhtype, int parent)
++#ifdef HAVE_FH_TO_DENTRY
++
++static struct dentry *ll_fh_to_dentry(struct super_block *sb, struct fid *fid,
++                int fh_len, int fh_type)
+ {
+-        switch (fhtype) {
+-                case 2:
+-                        if (len < 5)
+-                                break;
+-                        if (parent)
+-                                return ll_iget_for_nfs(sb, data[3], 0, data[4]);
+-                case 1:
+-                        if (len < 3)
+-                                break;
+-                        if (parent)
+-                                break;
+-                        return ll_iget_for_nfs(sb, data[0], data[1], data[2]);
+-                default: break;
++        struct dentry *result;
++        
++        result = generic_fh_to_dentry(sb, fid, fh_len, fh_type,
++                                      ll_iget_for_nfs);
++        if(!IS_ERR(result)) {
++                ll_set_dd(result);
++                result->d_op = &ll_d_ops;
+         }
+-        return ERR_PTR(-EINVAL);
++        RETURN(result);
+ }
+ 
+-int ll_dentry_to_fh(struct dentry *dentry, __u32 *datap, int *lenp,
+-                    int need_parent)
++static struct dentry *ll_fh_to_parent(struct super_block *sb, struct fid *fid,
++                int fh_len, int fh_type)
+ {
+-        if (*lenp < 3)
+-                return 255;
+-        *datap++ = dentry->d_inode->i_ino;
+-        *datap++ = dentry->d_inode->i_generation;
+-        *datap++ = (__u32)(S_IFMT & dentry->d_inode->i_mode);
++        struct dentry *result;
+ 
+-        if (*lenp == 3 || S_ISDIR(dentry->d_inode->i_mode)) {
+-                *lenp = 3;
+-                return 1;
++        result = generic_fh_to_parent(sb, fid, fh_len, fh_type,
++                                      ll_iget_for_nfs);
++        if(!IS_ERR(result)) {
++                ll_set_dd(result);
++                result->d_op = &ll_d_ops;
+         }
+-        if (dentry->d_parent) {
+-                *datap++ = dentry->d_parent->d_inode->i_ino;
+-                *datap++ = (__u32)(S_IFMT & dentry->d_parent->d_inode->i_mode);
+-
+-                *lenp = 5;
+-                return 2;
+-        }
+-        *lenp = 3;
+-        return 1;
++        RETURN(result);
++}
++#else
++static struct dentry *ll_get_dentry(struct super_block *sb, void *data)
++{
++        return ll_nfs_get_dentry(sb, data);
+ }
+ 
+-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0))
+-struct dentry *ll_get_dentry(struct super_block *sb, void *data)
+-{
+-        __u32 *inump = (__u32*)data;
+-        return ll_iget_for_nfs(sb, inump[0], inump[1], S_IFREG);
+-}
++#endif
+ 
+-struct dentry *ll_get_parent(struct dentry *dchild)
++static struct dentry *ll_get_parent(struct dentry *dchild)
+ {
+         struct ptlrpc_request *req = NULL;
+         struct inode *dir = dchild->d_inode;
+-        struct ll_sb_info *sbi;
+         struct dentry *result = NULL;
+         struct ll_fid fid;
+         struct mds_body *body;
+         char dotdot[] = "..";
++        __u32 idata[2];
+         int  rc = 0;
+         ENTRY;
+         
+         LASSERT(dir && S_ISDIR(dir->i_mode));
+-        
+-        sbi = ll_s2sbi(dir->i_sb);       
+  
+         fid.id = (__u64)dir->i_ino;
+         fid.generation = dir->i_generation;
+-        fid.f_type = S_IFDIR;
+-
+-        rc = mdc_getattr_name(sbi->ll_mdc_exp, &fid, dotdot, strlen(dotdot) + 1,
++        rc = mdc_getattr_name(ll_s2sbi(dir->i_sb)->ll_mdc_exp, &fid, dotdot, sizeof(dotdot),
+                               0, 0, &req);
+         if (rc) {
+                 CERROR("failure %d inode %lu get parent\n", rc, dir->i_ino);
+@@ -256,8 +218,9 @@ struct dentry *ll_get_parent(struct dent
+        
+         LASSERT((body->valid & OBD_MD_FLGENER) && (body->valid & OBD_MD_FLID));
+         
+-        result = ll_iget_for_nfs(dir->i_sb, body->ino, body->generation, S_IFDIR);
+-
++        idata[0] = body->ino;
++        idata[1] = body->generation;
++        result = ll_nfs_get_dentry(dir->i_sb, &idata);
+         if (IS_ERR(result))
+                 rc = PTR_ERR(result);
+ 
+@@ -268,7 +231,11 @@ struct dentry *ll_get_parent(struct dent
+ } 
+ 
+ struct export_operations lustre_export_operations = {
+-       .get_parent = ll_get_parent,
+-       .get_dentry = ll_get_dentry, 
++#ifdef HAVE_FH_TO_DENTRY
++        .fh_to_dentry   = ll_fh_to_dentry,
++        .fh_to_parent   = ll_fh_to_parent,
++#else
++        .get_dentry = ll_get_dentry,
++#endif
++        .get_parent = ll_get_parent,
+ };
+-#endif
+diff --git a/lustre/llite/lloop.c b/lustre/llite/lloop.c
+--- a/lustre/llite/lloop.c
++++ b/lustre/llite/lloop.c
+@@ -299,7 +299,7 @@ err:
+         if (atomic_dec_and_test(&lo->lo_pending))
+                 up(&lo->lo_bh_mutex);
+ out:
+-        bio_io_error(old_bio, old_bio->bi_size);
++        cfs_bio_io_error(old_bio, old_bio->bi_size);
+         return 0;
+ inactive:
+         spin_unlock_irq(&lo->lo_lock);
+@@ -321,7 +321,7 @@ static inline void loop_handle_bio(struc
+ {
+         int ret;
+         ret = do_bio_filebacked(lo, bio);
+-        bio_endio(bio, bio->bi_size, ret);
++        cfs_bio_endio(bio, bio->bi_size, ret);
+ }
+ 
+ /*
+diff --git a/lustre/llite/namei.c b/lustre/llite/namei.c
+--- a/lustre/llite/namei.c
++++ b/lustre/llite/namei.c
+@@ -879,7 +879,7 @@ static int ll_new_node(struct inode *dir
+ 
+         err = mdc_create(sbi->ll_mdc_exp, &op_data, tgt, tgt_len,
+                          mode, current->fsuid, current->fsgid,
+-                         current->cap_effective, rdev, &request);
++                         cfs_curproc_cap_get(), rdev, &request);
+         if (err)
+                 GOTO(err_exit, err);
+ 
+diff --git a/lustre/llite/rw.c b/lustre/llite/rw.c
+--- a/lustre/llite/rw.c
++++ b/lustre/llite/rw.c
+@@ -161,7 +161,7 @@ void ll_truncate(struct inode *inode)
+                 GOTO(out_unlock, 0);
+         }
+ 
+-        LASSERT(atomic_read(&lli->lli_size_sem.count) <= 0);
++//        LASSERT(atomic_read(&lli->lli_size_sem.count) <= 0);
+ 
+         if (!srvlock) {
+                 struct ost_lvb lvb;
+diff --git a/lustre/llite/symlink.c b/lustre/llite/symlink.c
+--- a/lustre/llite/symlink.c
++++ b/lustre/llite/symlink.c
+@@ -156,8 +156,12 @@ static LL_FOLLOW_LINK_RETURN_TYPE ll_fol
+         rc = ll_readlink_internal(inode, &request, &symname);
+         up(&lli->lli_size_sem);
+         if (rc) {
++#ifdef HAVE_PATH_RELEASE
+                 path_release(nd); /* Kernel assumes that ->follow_link()
+                                      releases nameidata on error */
++#else
++                path_put(&nd->path);
++#endif
+                 GOTO(out, rc);
+         }
+ 
+diff --git a/lustre/lvfs/lvfs_linux.c b/lustre/lvfs/lvfs_linux.c
+--- a/lustre/lvfs/lvfs_linux.c
++++ b/lustre/lvfs/lvfs_linux.c
+@@ -133,10 +133,10 @@ void push_ctxt(struct lvfs_run_ctxt *sav
+         */
+ 
+         save->fs = get_fs();
+-        LASSERT(atomic_read(&current->fs->pwd->d_count));
++        LASSERT(atomic_read(&cfs_fs_pwd(current->fs)->d_count));
+         LASSERT(atomic_read(&new_ctx->pwd->d_count));
+-        save->pwd = dget(current->fs->pwd);
+-        save->pwdmnt = mntget(current->fs->pwdmnt);
++        save->pwd = dget(cfs_fs_pwd(current->fs));
++        save->pwdmnt = mntget(cfs_fs_mnt(current->fs));
+         save->luc.luc_umask = current->fs->umask;
+ 
+         LASSERT(save->pwd);
+@@ -147,11 +147,11 @@ void push_ctxt(struct lvfs_run_ctxt *sav
+         if (uc) {
+                 save->luc.luc_fsuid = current->fsuid;
+                 save->luc.luc_fsgid = current->fsgid;
+-                save->luc.luc_cap = current->cap_effective;
++                save->luc.luc_cap = cfs_curproc_cap_get();
+ 
+                 current->fsuid = uc->luc_fsuid;
+                 current->fsgid = uc->luc_fsgid;
+-                current->cap_effective = uc->luc_cap;
++                cfs_curproc_cap_set(uc->luc_cap);
+                 push_group_info(save, uc->luc_uce);
+         }
+         current->fs->umask = 0; /* umask already applied on client */
+@@ -190,10 +190,10 @@ void pop_ctxt(struct lvfs_run_ctxt *save
+                atomic_read(&current->fs->pwdmnt->mnt_count));
+         */
+ 
+-        LASSERTF(current->fs->pwd == new_ctx->pwd, "%p != %p\n",
+-                 current->fs->pwd, new_ctx->pwd);
+-        LASSERTF(current->fs->pwdmnt == new_ctx->pwdmnt, "%p != %p\n",
+-                 current->fs->pwdmnt, new_ctx->pwdmnt);
++        LASSERTF(cfs_fs_pwd(current->fs) == new_ctx->pwd, "%p != %p\n",
++                 cfs_fs_pwd(current->fs), new_ctx->pwd);
++        LASSERTF(cfs_fs_mnt(current->fs) == new_ctx->pwdmnt, "%p != %p\n",
++                 cfs_fs_mnt(current->fs), new_ctx->pwdmnt);
+ 
+         set_fs(saved->fs);
+         ll_set_fs_pwd(current->fs, saved->pwdmnt, saved->pwd);
+@@ -204,7 +204,7 @@ void pop_ctxt(struct lvfs_run_ctxt *save
+         if (uc) {
+                 current->fsuid = saved->luc.luc_fsuid;
+                 current->fsgid = saved->luc.luc_fsgid;
+-                current->cap_effective = saved->luc.luc_cap;
++                cfs_curproc_cap_set(saved->luc.luc_cap);
+                 pop_group_info(saved, uc->luc_uce);
+         }
+ 
+diff --git a/lustre/mdc/mdc_internal.h b/lustre/mdc/mdc_internal.h
+--- a/lustre/mdc/mdc_internal.h
++++ b/lustre/mdc/mdc_internal.h
+@@ -28,7 +28,7 @@ void mdc_setattr_pack(struct ptlrpc_requ
+                       void *ea2, int ea2len);
+ void mdc_create_pack(struct ptlrpc_request *req, int offset,
+                      struct mdc_op_data *op_data, const void *data, int datalen,
+-                     __u32 mode, __u32 uid, __u32 gid, __u32 cap_effective,
++                     __u32 mode, __u32 uid, __u32 gid, cfs_kernel_cap_t cap_effective,
+                      __u64 rdev);
+ void mdc_open_pack(struct ptlrpc_request *req, int offset,
+                    struct mdc_op_data *op_data, __u32 mode, __u64 rdev,
+diff --git a/lustre/mdc/mdc_lib.c b/lustre/mdc/mdc_lib.c
+--- a/lustre/mdc/mdc_lib.c
++++ b/lustre/mdc/mdc_lib.c
+@@ -46,7 +46,7 @@ void mdc_readdir_pack(struct ptlrpc_requ
+         b = lustre_msg_buf(req->rq_reqmsg, offset, sizeof(*b));
+         b->fsuid = current->fsuid;
+         b->fsgid = current->fsgid;
+-        b->capability = current->cap_effective;
++        b->capability = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         b->fid1 = *fid;
+         b->size = pg_off;                       /* !! */
+         b->suppgid = -1;
+@@ -59,7 +59,7 @@ static void mdc_pack_body(struct mds_bod
+ 
+         b->fsuid = current->fsuid;
+         b->fsgid = current->fsgid;
+-        b->capability = current->cap_effective;
++        b->capability = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+ }
+ 
+ void mdc_pack_req_body(struct ptlrpc_request *req, int offset,
+@@ -78,7 +78,7 @@ void mdc_pack_req_body(struct ptlrpc_req
+ /* packing of MDS records */
+ void mdc_create_pack(struct ptlrpc_request *req, int offset,
+                      struct mdc_op_data *op_data, const void *data, int datalen,
+-                     __u32 mode, __u32 uid, __u32 gid, __u32 cap_effective,
++                     __u32 mode, __u32 uid, __u32 gid, cfs_kernel_cap_t cap_effective,
+                      __u64 rdev)
+ {
+         struct mds_rec_create *rec;
+@@ -88,7 +88,7 @@ void mdc_create_pack(struct ptlrpc_reque
+         rec->cr_opcode = REINT_CREATE;
+         rec->cr_fsuid = uid;
+         rec->cr_fsgid = gid;
+-        rec->cr_cap = cap_effective;
++        rec->cr_cap = cfs_cap_convert_from_kernel(cap_effective);
+         rec->cr_fid = op_data->fid1;
+         memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid));
+         rec->cr_mode = mode;
+@@ -156,7 +156,7 @@ void mdc_open_pack(struct ptlrpc_request
+         rec->cr_opcode = REINT_OPEN;
+         rec->cr_fsuid = current->fsuid;
+         rec->cr_fsgid = current->fsgid;
+-        rec->cr_cap = current->cap_effective;
++        rec->cr_cap = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         rec->cr_fid = op_data->fid1;
+         memset(&rec->cr_replayfid, 0, sizeof(rec->cr_replayfid));
+         rec->cr_mode = mode;
+@@ -230,7 +230,7 @@ void mdc_setattr_pack(struct ptlrpc_requ
+         rec->sa_opcode = REINT_SETATTR;
+         rec->sa_fsuid = current->fsuid;
+         rec->sa_fsgid = current->fsgid;
+-        rec->sa_cap = current->cap_effective;
++        rec->sa_cap = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         rec->sa_fid = data->fid1;
+         rec->sa_suppgid = -1;
+ 
+@@ -274,7 +274,7 @@ void mdc_unlink_pack(struct ptlrpc_reque
+         rec->ul_opcode = REINT_UNLINK;
+         rec->ul_fsuid = current->fsuid;
+         rec->ul_fsgid = current->fsgid;
+-        rec->ul_cap = current->cap_effective;
++        rec->ul_cap = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         rec->ul_mode = data->create_mode;
+         rec->ul_suppgid = data->suppgids[0];
+         rec->ul_fid1 = data->fid1;
+@@ -297,7 +297,7 @@ void mdc_link_pack(struct ptlrpc_request
+         rec->lk_opcode = REINT_LINK;
+         rec->lk_fsuid = current->fsuid;
+         rec->lk_fsgid = current->fsgid;
+-        rec->lk_cap = current->cap_effective;
++        rec->lk_cap = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         rec->lk_suppgid1 = data->suppgids[0];
+         rec->lk_suppgid2 = data->suppgids[1];
+         rec->lk_fid1 = data->fid1;
+@@ -321,7 +321,7 @@ void mdc_rename_pack(struct ptlrpc_reque
+         rec->rn_opcode = REINT_RENAME;
+         rec->rn_fsuid = current->fsuid;
+         rec->rn_fsgid = current->fsgid;
+-        rec->rn_cap = current->cap_effective;
++        rec->rn_cap = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         rec->rn_suppgid1 = data->suppgids[0];
+         rec->rn_suppgid2 = data->suppgids[1];
+         rec->rn_fid1 = data->fid1;
+@@ -345,7 +345,7 @@ void mdc_getattr_pack(struct ptlrpc_requ
+ 
+         b->fsuid = current->fsuid;
+         b->fsgid = current->fsgid;
+-        b->capability = current->cap_effective;
++        b->capability = cfs_cap_convert_from_kernel(cfs_curproc_cap_get());
+         b->valid = valid;
+         b->flags = flags | MDS_BFLAG_EXT_FLAGS;
+         /* skip MDS_BFLAG_EXT_FLAGS to verify the "client < 1.4.7" case 
+diff --git a/lustre/mdc/mdc_reint.c b/lustre/mdc/mdc_reint.c
+--- a/lustre/mdc/mdc_reint.c
++++ b/lustre/mdc/mdc_reint.c
+@@ -164,7 +164,7 @@ int mdc_setattr(struct obd_export *exp, 
+ 
+ int mdc_create(struct obd_export *exp, struct mdc_op_data *op_data,
+                const void *data, int datalen, int mode, __u32 uid, __u32 gid,
+-               __u32 cap_effective, __u64 rdev, struct ptlrpc_request **request)
++               cfs_kernel_cap_t cap_effective, __u64 rdev, struct ptlrpc_request **request)
+ {
+         CFS_LIST_HEAD(cancels);
+         struct obd_device *obd = exp->exp_obd;
+diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c
+--- a/lustre/mgc/mgc_request.c
++++ b/lustre/mgc/mgc_request.c
+@@ -395,7 +395,7 @@ static int mgc_fs_setup(struct obd_devic
+         obd->obd_lvfs_ctxt.fs = get_ds();
+ 
+         push_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+-        dentry = lookup_one_len(MOUNT_CONFIGS_DIR, current->fs->pwd,
++        dentry = lookup_one_len(MOUNT_CONFIGS_DIR, cfs_fs_pwd(current->fs),
+                                 strlen(MOUNT_CONFIGS_DIR));
+         pop_ctxt(&saved, &obd->obd_lvfs_ctxt, NULL);
+         if (IS_ERR(dentry)) {
+diff --git a/lustre/obdclass/linux/linux-module.c b/lustre/obdclass/linux/linux-module.c
+--- a/lustre/obdclass/linux/linux-module.c
++++ b/lustre/obdclass/linux/linux-module.c
+@@ -386,7 +386,7 @@ int class_procfs_init(void)
+         ENTRY;
+ 
+         obd_sysctl_init();
+-        proc_lustre_root = proc_mkdir("lustre", proc_root_fs);
++        proc_lustre_root = proc_mkdir("fs/lustre", NULL);
+         if (!proc_lustre_root) {
+                 printk(KERN_ERR
+                        "LustreError: error registering /proc/fs/lustre\n");
+diff --git a/lustre/obdclass/linux/linux-sysctl.c b/lustre/obdclass/linux/linux-sysctl.c
+--- a/lustre/obdclass/linux/linux-sysctl.c
++++ b/lustre/obdclass/linux/linux-sysctl.c
+@@ -48,7 +48,9 @@
+ 
+ cfs_sysctl_table_header_t *obd_table_header = NULL;
+ 
+-#define OBD_SYSCTL 300
++#ifndef HAVE_SYSCTL_UNNUMBERED
++
++#define CTL_LUSTRE      300
+ 
+ enum {
+         OBD_FAIL_LOC = 1,       /* control test failures instrumentation */
+@@ -65,6 +67,22 @@ enum {
+         OBD_DEBUG_PEER_ON_TIMEOUT, /* dump peer debug when RPC times out */
+         OBD_ALLOC_FAIL_RATE,    /* memory allocation random failure rate */
+ };
++#else
++#define CTL_LUSTRE              CTL_UNNUMBERED
++#define OBD_FAIL_LOC            CTL_UNNUMBERED
++#define OBD_FAIL_VAL            CTL_UNNUMBERED
++#define OBD_TIMEOUT             CTL_UNNUMBERED
++#define OBD_DUMP_ON_TIMEOUT     CTL_UNNUMBERED
++#define OBD_MEMUSED             CTL_UNNUMBERED
++#define OBD_PAGESUSED           CTL_UNNUMBERED
++#define OBD_MAXMEMUSED          CTL_UNNUMBERED
++#define OBD_MAXPAGESUSED        CTL_UNNUMBERED
++#define OBD_SYNCFILTER          CTL_UNNUMBERED
++#define OBD_LDLM_TIMEOUT        CTL_UNNUMBERED
++#define OBD_DUMP_ON_EVICTION    CTL_UNNUMBERED
++#define OBD_DEBUG_PEER_ON_TIMEOUT CTL_UNNUMBERED
++#define OBD_ALLOC_FAIL_RATE     CTL_UNNUMBERED
++#endif
+ 
+ int LL_PROC_PROTO(proc_fail_loc)
+ {
+@@ -98,11 +116,12 @@ int LL_PROC_PROTO(proc_alloc_fail_rate)
+                 return 0;
+         }
+         if (write) {
+-                rc = lprocfs_write_frac_helper(buffer, *lenp, 
++                rc = lprocfs_write_frac_helper(buffer, *lenp,
+                                                (unsigned int*)table->data,
+                                                OBD_ALLOC_FAIL_MULT);
+         } else {
+-                char buf[21];
++                char buf[22];
++		struct ctl_table dummy;
+                 int  len;
+ 
+                 len = lprocfs_read_frac_helper(buf, sizeof(buf),
+@@ -111,7 +130,13 @@ int LL_PROC_PROTO(proc_alloc_fail_rate)
+                 if (len > *lenp)
+                         len = *lenp;
+                 buf[len] = '\0';
+-                if (copy_to_user(buffer, buf, len))
++
++                dummy = *table;
++                dummy.data = buf;
++                dummy.maxlen = sizeof(buf);
++
++                rc = ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
++                if (rc)
+                         return -EFAULT;
+                 *lenp = len;
+         }
+@@ -122,99 +147,116 @@ int LL_PROC_PROTO(proc_alloc_fail_rate)
+ 
+ int LL_PROC_PROTO(proc_memory_alloc)
+ {
++        int len;
+         char buf[22];
+-        int len;
++        struct ctl_table dummy;
+         DECLARE_LL_PROC_PPOS_DECL;
+ 
+-        if (!*lenp || (*ppos && !write)) {
++        if (write)
++                return -EINVAL;
++
++        if (!*lenp || *ppos) {
+                 *lenp = 0;
+                 return 0;
+         }
+-        if (write) 
+-                return -EINVAL;
+-        
+-        len = snprintf(buf, sizeof(buf), LPU64"\n", obd_memory_sum());
++
++        dummy = *table;
++        dummy.data = buf;
++        dummy.maxlen = sizeof(buf);
++
++        len = snprintf(buf, sizeof(buf), LPU64,
++                       obd_memory_sum());
++
+         if (len > *lenp)
+                 len = *lenp;
+         buf[len] = '\0';
+-        if (copy_to_user(buffer, buf, len))
+-                return -EFAULT;
+-        *lenp = len;
+-        *ppos += *lenp;
+-        return 0;
++
++        return ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
+ }
+ 
+ int LL_PROC_PROTO(proc_pages_alloc)
+ {
+-        char buf[22];
+         int len;
++	char buf[22];
++        struct ctl_table dummy;
+         DECLARE_LL_PROC_PPOS_DECL;
+ 
+-        if (!*lenp || (*ppos && !write)) {
++        if (write)
++                return -EINVAL;
++
++        if (!*lenp || *ppos) {
+                 *lenp = 0;
+                 return 0;
+         }
+-        if (write)
+-                return -EINVAL;
+ 
+-        len = snprintf(buf, sizeof(buf), LPU64"\n", obd_pages_sum());
++        dummy = *table;
++        dummy.data = buf;
++        dummy.maxlen = sizeof(buf);
++
++        len = snprintf(buf, sizeof(buf), LPU64,
++                       obd_pages_sum());
+         if (len > *lenp)
+                 len = *lenp;
+         buf[len] = '\0';
+-        if (copy_to_user(buffer, buf, len))
+-                return -EFAULT;
+-        *lenp = len;
+-        *ppos += *lenp;
+-        return 0;
++
++        return ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
+ }
+ 
+ int LL_PROC_PROTO(proc_mem_max)
+ {
++        int len;
+         char buf[22];
+-        int len;
++        struct ctl_table dummy;
+         DECLARE_LL_PROC_PPOS_DECL;
+ 
+-        if (!*lenp || (*ppos && !write)) {
++        if (write)
++                return -EINVAL;
++
++        if (!*lenp || *ppos) {
+                 *lenp = 0;
+                 return 0;
+         }
+-        if (write)
+-                return -EINVAL;
+ 
+-        len = snprintf(buf, sizeof(buf), LPU64"\n", obd_memory_max());
++        dummy = *table;
++        dummy.data = buf;
++        dummy.maxlen = sizeof(buf);
++
++        len = snprintf(buf, sizeof(buf), LPU64,
++                       obd_memory_max());
+         if (len > *lenp)
+                 len = *lenp;
+         buf[len] = '\0';
+-        if (copy_to_user(buffer, buf, len))
+-                return -EFAULT;
+-        *lenp = len;
+-        *ppos += *lenp;
+-        return 0;
++
++        return ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
+ }
+ 
+ int LL_PROC_PROTO(proc_pages_max)
+ {
++        int len;
+         char buf[22];
+-        int len;
++        struct ctl_table dummy;
+         DECLARE_LL_PROC_PPOS_DECL;
+ 
+-        if (!*lenp || (*ppos && !write)) {
++        if (write)
++                return -EINVAL;
++
++        if (!*lenp || *ppos) {
+                 *lenp = 0;
+                 return 0;
+         }
+-        if (write)
+-                return -EINVAL;
++        dummy = *table;
++        dummy.data = buf;
++        dummy.maxlen = sizeof(buf);
++        len = snprintf(buf, sizeof(buf), LPU64,
++                       obd_pages_max());
+ 
+-        len = snprintf(buf, sizeof(buf), LPU64"\n", obd_pages_max());
+         if (len > *lenp)
+                 len = *lenp;
+         buf[len] = '\0';
+-        if (copy_to_user(buffer, buf, len))
+-                return -EFAULT;
+-        *lenp = len;
+-        *ppos += *lenp;
+-        return 0;
++
++        return ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
+ }
++
+ 
+ static cfs_sysctl_table_t obd_table[] = {
+         {
+@@ -231,7 +273,8 @@ static cfs_sysctl_table_t obd_table[] = 
+                 .data     = &obd_fail_val,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
++                .strategy = &sysctl_intvec,
+         },
+         {
+                 .ctl_name = OBD_TIMEOUT,
+@@ -247,7 +290,7 @@ static cfs_sysctl_table_t obd_table[] = 
+                 .data     = &obd_debug_peer_on_timeout,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
+         },
+         {
+                 .ctl_name = OBD_DUMP_ON_TIMEOUT,
+@@ -255,7 +298,7 @@ static cfs_sysctl_table_t obd_table[] = 
+                 .data     = &obd_dump_on_timeout,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
+         },
+         {
+                 .ctl_name = OBD_DUMP_ON_EVICTION,
+@@ -263,7 +306,7 @@ static cfs_sysctl_table_t obd_table[] = 
+                 .data     = &obd_dump_on_eviction,
+                 .maxlen   = sizeof(int),
+                 .mode     = 0644,
+-                .proc_handler = &proc_dointvec
++                .proc_handler = &proc_dointvec,
+         },
+         {
+                 .ctl_name = OBD_MEMUSED,
+@@ -271,7 +314,8 @@ static cfs_sysctl_table_t obd_table[] = 
+                 .data     = NULL,
+                 .maxlen   = 0,
+                 .mode     = 0444,
+-                .proc_handler = &proc_memory_alloc
++                .proc_handler = &proc_memory_alloc,
++//                .strategy  = &sysctl_memory_alloc,
+         },
+         {
+                 .ctl_name = OBD_PAGESUSED,
+@@ -279,7 +323,8 @@ static cfs_sysctl_table_t obd_table[] = 
+                 .data     = NULL,
+                 .maxlen   = 0,
+                 .mode     = 0444,
+-                .proc_handler = &proc_pages_alloc
++                .proc_handler = &proc_pages_alloc,
++//                .strategy  = &sysctl_pages_alloc,
+         },
+         {
+                 .ctl_name = OBD_MAXMEMUSED,
+@@ -287,7 +332,8 @@ static cfs_sysctl_table_t obd_table[] = 
+                 .data     = NULL,
+                 .maxlen   = 0,
+                 .mode     = 0444,
+-                .proc_handler = &proc_mem_max
++                .proc_handler = &proc_mem_max,
++//                .strategy  = &sysctl_mem_max,
+         },
+         {
+                 .ctl_name = OBD_MAXPAGESUSED,
+@@ -295,7 +341,8 @@ static cfs_sysctl_table_t obd_table[] = 
+                 .data     = NULL,
+                 .maxlen   = 0,
+                 .mode     = 0444,
+-                .proc_handler = &proc_pages_max
++                .proc_handler = &proc_pages_max,
++//                .strategy  = &sysctl_pages_max,
+         },
+         {
+                 .ctl_name = OBD_LDLM_TIMEOUT,
+@@ -319,15 +366,13 @@ static cfs_sysctl_table_t obd_table[] = 
+ };
+ 
+ static cfs_sysctl_table_t parent_table[] = {
+-       {
+-               .ctl_name = OBD_SYSCTL,
+-               .procname = "lustre",
+-               .data     = NULL,
+-               .maxlen   = 0,
+-               .mode     = 0555,
+-               .child    = obd_table
+-       },
+-       {0}
++        {
++                .ctl_name = CTL_LUSTRE,
++                .procname = "lustre",
++                .mode     = 0555,
++                .child    = obd_table
++        },
++        { 0 }
+ };
+ 
+ void obd_sysctl_init (void)
+diff --git a/lustre/obdclass/llog_obd.c b/lustre/obdclass/llog_obd.c
+--- a/lustre/obdclass/llog_obd.c
++++ b/lustre/obdclass/llog_obd.c
+@@ -178,7 +178,7 @@ int llog_add(struct llog_ctxt *ctxt, str
+                 struct lov_stripe_md *lsm, struct llog_cookie *logcookies,
+                 int numcookies)
+ {
+-        __u32 cap;
++        cfs_kernel_cap_t cap;
+         int rc;
+         ENTRY;
+ 
+@@ -188,10 +188,10 @@ int llog_add(struct llog_ctxt *ctxt, str
+         }
+         
+         CTXT_CHECK_OP(ctxt, add, -EOPNOTSUPP);
+-        cap = current->cap_effective;             
++        cap = current->cap_effective;
+         cap_raise(current->cap_effective, CAP_SYS_RESOURCE);
+         rc = CTXTP(ctxt, add)(ctxt, rec, lsm, logcookies, numcookies);
+-        current->cap_effective = cap; 
++        current->cap_effective = cap;
+         RETURN(rc);
+ }
+ EXPORT_SYMBOL(llog_add);
+diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c
+--- a/lustre/obdclass/lprocfs_status.c
++++ b/lustre/obdclass/lprocfs_status.c
+@@ -117,6 +117,8 @@ int lprocfs_add_simple(struct proc_dir_e
+         proc->read_proc = read_proc;
+         proc->write_proc = write_proc;
+         proc->data = data;
++        proc->owner = THIS_MODULE;
++
+         return 0;
+ }
+ 
+@@ -136,7 +138,7 @@ static ssize_t lprocfs_fops_read(struct 
+ 
+         LPROCFS_ENTRY();
+         OBD_FAIL_TIMEOUT(OBD_FAIL_LPROC_REMOVE, 10);
+-        if (!dp->deleted && dp->read_proc)
++        if (!LPROCFS_CHECK_DELETED(dp) && dp->read_proc)
+                 rc = dp->read_proc(page, &start, *ppos, PAGE_SIZE, 
+                         &eof, dp->data);
+         LPROCFS_EXIT();
+@@ -175,7 +177,7 @@ static ssize_t lprocfs_fops_write(struct
+         int rc = -EIO;
+ 
+         LPROCFS_ENTRY();
+-        if (!dp->deleted && dp->write_proc)
++        if (!LPROCFS_CHECK_DELETED(dp) && dp->write_proc)
+                 rc = dp->write_proc(f, buf, size, dp->data);
+         LPROCFS_EXIT();
+         return rc;
+diff --git a/lustre/ptlrpc/service.c b/lustre/ptlrpc/service.c
+--- a/lustre/ptlrpc/service.c
++++ b/lustre/ptlrpc/service.c
+@@ -1244,7 +1244,7 @@ void ptlrpc_daemonize(char *name)
+         cfs_daemonize(name);
+         exit_fs(cfs_current());
+         current->fs = fs;
+-        ll_set_fs_pwd(current->fs, init_task.fs->pwdmnt, init_task.fs->pwd);
++        ll_set_fs_pwd(current->fs, cfs_fs_mnt(init_task.fs), cfs_fs_pwd(init_task.fs));
+ }
+ 
+ static void




More information about the Pkg-lustre-svn-commit mailing list