[Pkg-lustre-svn-commit] updated: [ecc9bad] Add new patches from patchless client bug.
Patrick Winnertz
winnie at debian.org
Tue Dec 23 08:46:30 UTC 2008
The following commit has been merged in the master branch:
commit ecc9bad9bd55b49ac99accd96c0bfc105ae3ad92
Author: Patrick Winnertz <winnie at debian.org>
Date: Mon Dec 22 09:56:29 2008 +0100
Add new patches from patchless client bug.
To make this a bit clearly.
diff --git a/debian/patches/00list b/debian/patches/00list
index e091d6d..c34d41d 100644
--- a/debian/patches/00list
+++ b/debian/patches/00list
@@ -10,8 +10,21 @@ no-darwin.dpatch
remove-set_tunables.dpatch
libsysio.dpatch
bug12769-ql-fix.dpatch
-patchless_support_2.6.24_lnet_part.dpatch
-patchless_support_2.6.24_configure_part.dpatch
+patchless_support/configure_for_HEAD.dpatch
+patchless_support/fix_configure_RO_cache.dpatch
+patchless_support/fix_nfs_fid_type.dpatch
+patchless_support/fix_request_module_calls.dpatch
+patchless_support/lustre_loop_devices_adaption.dpatch
+patchless_support/nfs_changes_new_API.dpatch
+patchless_support/sysctl_update.dpatch
+patchless_support/configure_tests_2.6.27.dpatch
+patchless_support/fix_mmap.dpatch
+patchless_support/fix_path_API_changes.dpatch
+patchless_support/lprocfs_changes.dpatch
+patchless_support/new_page_fault_method.dpatch
+patchless_support/splice_read_support.dpatch
+#patchless_support_2.6.24_lnet_part.dpatch
+#patchless_support_2.6.24_configure_part.dpatch
#server_support_2.6.27.dpatch
# Debian patches
bash_completion.dpatch
diff --git a/debian/patches/patchless_support_2.6.24_configure_part.dpatch b/debian/patches/patchless_support/configure_for_HEAD.dpatch
similarity index 60%
copy from debian/patches/patchless_support_2.6.24_configure_part.dpatch
copy to debian/patches/patchless_support/configure_for_HEAD.dpatch
index 8cce361..f67204b 100755
--- a/debian/patches/patchless_support_2.6.24_configure_part.dpatch
+++ b/debian/patches/patchless_support/configure_for_HEAD.dpatch
@@ -5,27 +5,29 @@
## DP: Patch which will enable 2.6.24 patchless support for lustre, taken from #14250
@DPATCH@
-diff -urNad lustre-1.6.6~/lustre/autoconf/lustre-core.m4 lustre-1.6.6/lustre/autoconf/lustre-core.m4
---- lustre-1.6.6~/lustre/autoconf/lustre-core.m4 2008-11-26 12:46:12.000000000 +0100
-+++ lustre-1.6.6/lustre/autoconf/lustre-core.m4 2008-11-26 12:46:28.000000000 +0100
-@@ -1109,15 +1109,20 @@
+Index: HEAD/lustre/autoconf/lustre-core.m4
+===================================================================
+--- HEAD.orig/lustre/autoconf/lustre-core.m4 2008-12-03 06:46:48.000000000 +0300
++++ HEAD/lustre/autoconf/lustre-core.m4 2008-12-05 20:38:37.000000000 +0300
+@@ -1211,15 +1211,20 @@
AC_DEFUN([LC_PAGE_CHECKED],
[AC_MSG_CHECKING([kernel has PageChecked and SetPageChecked])
LB_LINUX_TRY_COMPILE([
- #include <linux/mm.h>
- #include <linux/page-flags.h>
-+ #include <linux/autoconf.h>
-+#ifdef HAVE_LINUX_MMTYPES_H
-+ #include <linux/mm_types.h>
-+#endif
-+ #include <linux/page-flags.h>
- ],[
+-],[
- #ifndef PageChecked
- #error PageChecked not defined in kernel
- #endif
- #ifndef SetPageChecked
- #error SetPageChecked not defined in kernel
- #endif
++ #include <linux/autoconf.h>
++#ifdef HAVE_LINUX_MMTYPES_H
++ #include <linux/mm_types.h>
++#endif
++ #include <linux/page-flags.h>
++],[
+ struct page *p;
+
+ /* before 2.6.26 this define*/
@@ -37,7 +39,7 @@ diff -urNad lustre-1.6.6~/lustre/autoconf/lustre-core.m4 lustre-1.6.6/lustre/aut
],[
AC_MSG_RESULT(yes)
AC_DEFINE(HAVE_PAGE_CHECKED, 1,
-@@ -1271,11 +1276,149 @@
+@@ -1380,11 +1385,149 @@
# 2.6.23 extract nfs export related data into exportfs.h
AC_DEFUN([LC_HAVE_EXPORTFS_H],
@@ -192,37 +194,38 @@ diff -urNad lustre-1.6.6~/lustre/autoconf/lustre-core.m4 lustre-1.6.6/lustre/aut
])
#
-@@ -1377,6 +1520,19 @@
- LC_UNREGISTER_BLKDEV_RETURN_INT
- LC_KERNEL_SPLICE_READ
- LC_HAVE_EXPORTFS_H
-+ LC_VM_OP_FAULT
-+ LC_REGISTER_SHRINKER
-+
-+ # 2.6.24
-+ LC_HAVE_MMTYPES_H
-+ 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
+@@ -1661,6 +1804,19 @@
+ LC_UNREGISTER_BLKDEV_RETURN_INT
+ LC_KERNEL_SPLICE_READ
+ LC_HAVE_EXPORTFS_H
++ LC_VM_OP_FAULT
++ LC_REGISTER_SHRINKER
++
++ # 2.6.24
++ LC_HAVE_MMTYPES_H
++ 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
])
#
-@@ -1609,6 +1765,7 @@
+@@ -1898,6 +2054,7 @@
],[
- AC_MSG_RESULT([no])
+ AC_MSG_RESULT([no])
])
+
],[
AC_MSG_RESULT([no])
])
-diff -urNad lustre-1.6.6~/lustre/include/linux/lustre_compat25.h lustre-1.6.6/lustre/include/linux/lustre_compat25.h
---- lustre-1.6.6~/lustre/include/linux/lustre_compat25.h 2008-11-26 12:46:12.000000000 +0100
-+++ lustre-1.6.6/lustre/include/linux/lustre_compat25.h 2008-11-26 12:50:19.000000000 +0100
+Index: HEAD/lustre/include/linux/lustre_compat25.h
+===================================================================
+--- HEAD.orig/lustre/include/linux/lustre_compat25.h 2008-11-17 12:36:18.000000000 +0300
++++ HEAD/lustre/include/linux/lustre_compat25.h 2008-12-05 20:36:56.000000000 +0300
@@ -57,6 +57,28 @@
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,14) */
@@ -260,11 +263,10 @@ diff -urNad lustre-1.6.6~/lustre/include/linux/lustre_compat25.h lustre-1.6.6/lu
#else
#define ll_set_fs_pwd set_fs_pwd
#endif /* HAVE_SET_FS_PWD */
-@@ -554,6 +577,59 @@
- }
+@@ -634,6 +657,57 @@
+ #define cpu_to_node(cpu) 0
#endif
-+//Not Sure if this part is really needed .... patch from HEAD
+#ifdef HAVE_REGISTER_SHRINKER
+typedef int (*shrinker_t)(int nr_to_scan, gfp_t gfp_mask);
+
@@ -315,80 +317,7 @@ diff -urNad lustre-1.6.6~/lustre/include/linux/lustre_compat25.h lustre-1.6.6/lu
+#ifndef list_for_each_safe_rcu
+#define list_for_each_safe_rcu(a,b,c) list_for_each_rcu(b, c)
+#endif
-+//Unsure Part ends here :)
+
- #ifdef HAVE_INVALIDATE_BDEV_2ARG
- #define ll_invalidate_bdev(a,b) invalidate_bdev((a),(b))
- #else
-diff -urNad lustre-1.6.6~/lustre/llite/symlink.c lustre-1.6.6/lustre/llite/symlink.c
---- lustre-1.6.6~/lustre/llite/symlink.c 2008-11-26 12:46:12.000000000 +0100
-+++ lustre-1.6.6/lustre/llite/symlink.c 2008-11-26 12:46:28.000000000 +0100
-@@ -171,8 +171,12 @@
- 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 -urNad lustre-1.6.6~/lustre/lvfs/lvfs_linux.c lustre-1.6.6/lustre/lvfs/lvfs_linux.c
---- lustre-1.6.6~/lustre/lvfs/lvfs_linux.c 2008-11-26 12:46:12.000000000 +0100
-+++ lustre-1.6.6/lustre/lvfs/lvfs_linux.c 2008-11-26 12:46:28.000000000 +0100
-@@ -148,10 +148,10 @@
- */
-
- save->fs = get_fs();
-- LASSERT(atomic_read(¤t->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);
-@@ -205,10 +205,10 @@
- atomic_read(¤t->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);
-diff -urNad lustre-1.6.6~/lustre/mgc/mgc_request.c lustre-1.6.6/lustre/mgc/mgc_request.c
---- lustre-1.6.6~/lustre/mgc/mgc_request.c 2008-11-26 12:46:12.000000000 +0100
-+++ lustre-1.6.6/lustre/mgc/mgc_request.c 2008-11-26 12:46:28.000000000 +0100
-@@ -410,7 +410,7 @@
- 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 -urNad lustre-1.6.6~/lustre/ptlrpc/service.c lustre-1.6.6/lustre/ptlrpc/service.c
---- lustre-1.6.6~/lustre/ptlrpc/service.c 2008-11-26 12:46:12.000000000 +0100
-+++ lustre-1.6.6/lustre/ptlrpc/service.c 2008-11-26 12:46:28.000000000 +0100
-@@ -1268,7 +1268,7 @@
- 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
+ #ifndef abs
+ static inline int abs(int x)
+ {
diff --git a/debian/patches/patchless_support/configure_tests_2.6.27.dpatch b/debian/patches/patchless_support/configure_tests_2.6.27.dpatch
new file mode 100755
index 0000000..ab89906
--- /dev/null
+++ b/debian/patches/patchless_support/configure_tests_2.6.27.dpatch
@@ -0,0 +1,461 @@
+#! /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@
+Index: HEAD/libcfs/autoconf/lustre-libcfs.m4
+===================================================================
+--- HEAD.orig/libcfs/autoconf/lustre-libcfs.m4 2008-11-20 14:33:51.000000000 +0200
++++ HEAD/libcfs/autoconf/lustre-libcfs.m4 2008-12-17 17:15:38.000000000 +0200
+@@ -364,7 +364,7 @@
+ ])
+
+ # 2.6.24 request not use real numbers for ctl_name
+-AC_DEFUN([LN_SYSCTL_UNNUMBERED],
++AC_DEFUN([LIBCFS_SYSCTL_UNNUMBERED],
+ [AC_MSG_CHECKING([for CTL_UNNUMBERED])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/sysctl.h>
+@@ -382,7 +382,7 @@
+ ])
+
+ # 2.6.24 lost scatterlist->page
+-AC_DEFUN([LN_SCATTERLIST_SETPAGE],
++AC_DEFUN([LIBCFS_SCATTERLIST_SETPAGE],
+ [AC_MSG_CHECKING([for exist sg_set_page])
+ LB_LINUX_TRY_COMPILE([
+ #include <linux/scatterlist.h>
+@@ -398,7 +398,7 @@
+ ])
+
+ # 2.6.26 use int instead of atomic for sem.count
+-AC_DEFUN([LN_SEM_COUNT],
++AC_DEFUN([LIBCFS_SEM_COUNT],
+ [AC_MSG_CHECKING([atomic sem.count])
+ LB_LINUX_TRY_COMPILE([
+ #include <asm/semaphore.h>
+@@ -415,6 +415,21 @@
+ ])
+ ])
+
++# 2.6.27 have second argument to sock_map_fd
++AC_DEFUN([LIBCFS_SOCK_MAP_FD_2ARG],
++[AC_MSG_CHECKING([sock_map_fd have second argument])
++LB_LINUX_TRY_COMPILE([
++ #include <linux/net.h>
++],[
++ sock_map_fd(NULL, 0);
++],[
++ AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_SOCK_MAP_FD_2ARG, 1,
++ [sock_map_fd have second argument])
++],[
++ AC_MSG_RESULT(NO)
++])
++])
+
+ #
+ # LIBCFS_PROG_LINUX
+@@ -447,10 +462,12 @@
+ # 2.6.23
+ LIBCFS_KMEM_CACHE_CREATE_DTOR
+ # 2.6.24
+-LN_SYSCTL_UNNUMBERED
+-LN_SCATTERLIST_SETPAGE
++LIBCFS_SYSCTL_UNNUMBERED
++LIBCFS_SCATTERLIST_SETPAGE
+ # 2.6.26
+-LN_SEM_COUNT
++LIBCFS_SEM_COUNT
++# 2.6.27
++LIBCFS_SOCK_MAP_FD_2ARG
+ ])
+
+ #
+Index: HEAD/libcfs/libcfs/linux/linux-tcpip.c
+===================================================================
+--- HEAD.orig/libcfs/libcfs/linux/linux-tcpip.c 2008-08-07 20:22:50.000000000 +0300
++++ HEAD/libcfs/libcfs/linux/linux-tcpip.c 2008-12-17 17:15:38.000000000 +0200
+@@ -63,7 +63,11 @@
+ return rc;
+ }
+
++#ifdef HAVE_SOCK_MAP_FD_2ARG
++ fd = sock_map_fd(sock,0);
++#else
+ fd = sock_map_fd(sock);
++#endif
+ if (fd < 0) {
+ rc = fd;
+ sock_release(sock);
+Index: HEAD/lustre/autoconf/lustre-core.m4
+===================================================================
+--- HEAD.orig/lustre/autoconf/lustre-core.m4 2008-12-17 17:15:38.000000000 +0200
++++ HEAD/lustre/autoconf/lustre-core.m4 2008-12-17 17:15:38.000000000 +0200
+@@ -1727,6 +1727,56 @@
+ ])
+ ])
+
++#2.6.27
++AC_DEFUN([LC_INODE_PERMISION_2ARGS],
++[AC_MSG_CHECKING([inode_operations->permission have two args])
++LB_LINUX_TRY_COMPILE([
++ #include <linux/fs.h>
++],[
++ struct inode *inode;
++
++ inode->i_op->permission(NULL,0);
++],[
++ AC_DEFINE(HAVE_INODE_PERMISION_2ARGS, 1,
++ [inode_operations->permission have two args])
++ AC_MSG_RESULT([yes])
++],[
++ AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.27 have file_remove_suid instead of remove_suid
++AC_DEFUN([LC_FILE_REMOVE_SUID],
++[AC_MSG_CHECKING([kernel have file_remove_suid])
++LB_LINUX_TRY_COMPILE([
++ #include <linux/fs.h>
++],[
++ file_remove_suid(NULL);
++],[
++ AC_DEFINE(HAVE_FILE_REMOVE_SUID, 1,
++ [kernel have file_remove_suid])
++ AC_MSG_RESULT([yes])
++],[
++ AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.27 have new page locking API
++AC_DEFUN([LC_TRYLOCKPAGE],
++[AC_MSG_CHECKING([kernel use trylock_page for page lock])
++LB_LINUX_TRY_COMPILE([
++ #include <linux/pagemap.h>
++],[
++ trylock_page(NULL);
++],[
++ AC_DEFINE(HAVE_TRYLOCK_PAGE, 1,
++ [kernel use trylock_page for page lock])
++ AC_MSG_RESULT([yes])
++],[
++ AC_MSG_RESULT([no])
++])
++])
++
+ #
+ # LC_PROG_LINUX
+ #
+@@ -1818,9 +1868,9 @@
+ LC_INVALIDATEPAGE_RETURN_INT
+ LC_UMOUNTBEGIN_HAS_VFSMOUNT
+ LC_SEQ_LOCK
++ LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
+ if test x$enable_server = xyes ; then
+- LC_EXPORT_INVALIDATE_MAPPING_PAGES
+- LC_EXPORT_FILEMAP_FDATAWRITE_RANGE
++ LC_EXPORT_INVALIDATE_MAPPING_PAGES
+ fi
+
+ #2.6.18 + RHEL5 (fc6)
+@@ -1863,6 +1913,11 @@
+ LC_FS_STRUCT_USE_PATH
+ LC_RCU_LIST_SAFE
+ LC_PATH_RELEASE
++
++ # 2.6.27
++ LC_INODE_PERMISION_2ARGS
++ LC_FILE_REMOVE_SUID
++ LC_TRYLOCKPAGE
+ ])
+
+ #
+Index: HEAD/lustre/obdclass/lustre_handles.c
+===================================================================
+--- HEAD.orig/lustre/obdclass/lustre_handles.c 2008-08-07 20:23:44.000000000 +0300
++++ HEAD/lustre/obdclass/lustre_handles.c 2008-12-17 17:15:38.000000000 +0200
+@@ -246,7 +246,7 @@
+ int i;
+
+ for (i = 0; i < HANDLE_HASH_SIZE; i++) {
+- struct list_head *tmp, *pos;
++ struct list_head *tmp = NULL , *pos;
+ spin_lock(&handle_hash[i].lock);
+ list_for_each_safe_rcu(tmp, pos, &(handle_hash[i].head)) {
+ struct portals_handle *h;
+Index: HEAD/lustre/obdclass/capa.c
+===================================================================
+--- HEAD.orig/lustre/obdclass/capa.c 2008-11-17 11:36:44.000000000 +0200
++++ HEAD/lustre/obdclass/capa.c 2008-12-17 17:15:38.000000000 +0200
+@@ -246,11 +246,7 @@
+ struct ll_crypto_hash *tfm;
+ struct capa_hmac_alg *alg;
+ int keylen;
+- struct scatterlist sl = {
+- .page = virt_to_page(capa),
+- .offset = (unsigned long)(capa) % CFS_PAGE_SIZE,
+- .length = offsetof(struct lustre_capa, lc_hmac),
+- };
++ struct scatterlist sl;
+
+ if (capa_alg(capa) != CAPA_HMAC_ALG_SHA1) {
+ CERROR("unknown capability hmac algorithm!\n");
+@@ -267,6 +263,10 @@
+ }
+ keylen = alg->ha_keylen;
+
++ sg_set_page(&sl, virt_to_page(capa),
++ offsetof(struct lustre_capa, lc_hmac),
++ (unsigned long)(capa) % CFS_PAGE_SIZE);
++
+ ll_crypto_hmac(tfm, key, &keylen, &sl, sl.length, hmac);
+ ll_crypto_free_hash(tfm);
+
+@@ -276,16 +276,8 @@
+ int capa_encrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
+ {
+ struct ll_crypto_cipher *tfm;
+- struct scatterlist sd = {
+- .page = virt_to_page(d),
+- .offset = (unsigned long)(d) % CFS_PAGE_SIZE,
+- .length = 16,
+- };
+- struct scatterlist ss = {
+- .page = virt_to_page(s),
+- .offset = (unsigned long)(s) % CFS_PAGE_SIZE,
+- .length = 16,
+- };
++ struct scatterlist sd;
++ struct scatterlist ss;
+ struct blkcipher_desc desc;
+ unsigned int min;
+ int rc;
+@@ -309,6 +301,11 @@
+ GOTO(out, rc);
+ }
+
++ sg_set_page(&sd, virt_to_page(d), 16,
++ (unsigned long)(d) % CFS_PAGE_SIZE);
++
++ sg_set_page(&ss, virt_to_page(s), 16,
++ (unsigned long)(s) % CFS_PAGE_SIZE);
+ desc.tfm = tfm;
+ desc.info = NULL;
+ desc.flags = 0;
+@@ -328,16 +325,8 @@
+ int capa_decrypt_id(__u32 *d, __u32 *s, __u8 *key, int keylen)
+ {
+ struct ll_crypto_cipher *tfm;
+- struct scatterlist sd = {
+- .page = virt_to_page(d),
+- .offset = (unsigned long)(d) % CFS_PAGE_SIZE,
+- .length = 16,
+- };
+- struct scatterlist ss = {
+- .page = virt_to_page(s),
+- .offset = (unsigned long)(s) % CFS_PAGE_SIZE,
+- .length = 16,
+- };
++ struct scatterlist sd;
++ struct scatterlist ss;
+ struct blkcipher_desc desc;
+ unsigned int min;
+ int rc;
+@@ -361,6 +350,12 @@
+ GOTO(out, rc);
+ }
+
++ sg_set_page(&sd, virt_to_page(d), 16,
++ (unsigned long)(d) % CFS_PAGE_SIZE);
++
++ sg_set_page(&ss, virt_to_page(s), 16,
++ (unsigned long)(s) % CFS_PAGE_SIZE);
++
+ desc.tfm = tfm;
+ desc.info = NULL;
+ desc.flags = 0;
+Index: HEAD/lustre/ptlrpc/sec_bulk.c
+===================================================================
+--- HEAD.orig/lustre/ptlrpc/sec_bulk.c 2008-08-14 23:55:36.000000000 +0300
++++ HEAD/lustre/ptlrpc/sec_bulk.c 2008-12-17 17:15:38.000000000 +0200
+@@ -992,9 +992,9 @@
+ }
+
+ for (i = 0; i < desc->bd_iov_count; i++) {
+- sl[i].page = desc->bd_iov[i].kiov_page;
+- sl[i].offset = desc->bd_iov[i].kiov_offset & ~CFS_PAGE_MASK;
+- sl[i].length = desc->bd_iov[i].kiov_len;
++ sg_set_page(&sl[i], desc->bd_iov[i].kiov_page,
++ desc->bd_iov[i].kiov_len,
++ desc->bd_iov[i].kiov_offset & ~CFS_PAGE_MASK);
+ bytes += desc->bd_iov[i].kiov_len;
+ }
+
+Index: HEAD/lustre/ptlrpc/sec_config.c
+===================================================================
+--- HEAD.orig/lustre/ptlrpc/sec_config.c 2008-12-03 05:47:20.000000000 +0200
++++ HEAD/lustre/ptlrpc/sec_config.c 2008-12-15 17:19:13.000000000 +0200
+@@ -1170,7 +1170,7 @@
+
+ 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));
+ if (IS_ERR(dentry)) {
+ rc = PTR_ERR(dentry);
+Index: HEAD/lustre/include/linux/lustre_patchless_compat.h
+===================================================================
+--- HEAD.orig/lustre/include/linux/lustre_patchless_compat.h 2008-08-07 20:23:18.000000000 +0300
++++ HEAD/lustre/include/linux/lustre_patchless_compat.h 2008-12-17 17:15:38.000000000 +0200
+@@ -52,7 +52,7 @@
+
+ BUG_ON(!PageLocked(page));
+
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))
++#ifdef HAVE_RW_TREE_LOCK
+ write_lock_irq(&mapping->tree_lock);
+ #else
+ spin_lock_irq(&mapping->tree_lock);
+@@ -66,7 +66,7 @@
+ __dec_zone_page_state(page, NR_FILE_PAGES);
+ #endif
+
+-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,15))
++#ifdef HAVE_RW_TREE_LOCK
+ write_unlock_irq(&mapping->tree_lock);
+ #else
+ spin_unlock_irq(&mapping->tree_lock);
+Index: HEAD/lustre/include/linux/lustre_compat25.h
+===================================================================
+--- HEAD.orig/lustre/include/linux/lustre_compat25.h 2008-12-17 17:15:38.000000000 +0200
++++ HEAD/lustre/include/linux/lustre_compat25.h 2008-12-17 17:15:38.000000000 +0200
+@@ -170,7 +170,12 @@
+ #endif
+
+ /* XXX our code should be using the 2.6 calls, not the other way around */
++#ifndef HAVE_TRYLOCK_PAGE
+ #define TryLockPage(page) TestSetPageLocked(page)
++#else
++#define TryLockPage(page) (!trylock_page(page))
++#endif
++
+ #define Page_Uptodate(page) PageUptodate(page)
+ #define ll_redirty_page(page) set_page_dirty(page)
+
+@@ -623,8 +628,17 @@
+ #define ll_crypto_free_blkcipher(tfm) crypto_free_tfm(tfm)
+ #endif /* HAVE_ASYNC_BLOCK_CIPHER */
+
++#ifdef HAVE_FILE_REMOVE_SUID
++#define ll_remove_suid(file, mnt) file_remove_suid(file)
++#else
++ #ifdef HAVE_SECURITY_PLUG
++ #define ll_remove_suid(file,mnt) remove_suid(file->f_dentry,mnt)
++ #else
++ #define ll_remove_suid(file,mnt) remove_suid(file->f_dentry)
++ #endif
++#endif
++
+ #ifdef HAVE_SECURITY_PLUG
+-#define ll_remove_suid(inode,mnt) remove_suid(inode,mnt)
+ #define ll_vfs_rmdir(dir,entry,mnt) vfs_rmdir(dir,entry,mnt)
+ #define ll_vfs_mkdir(inode,dir,mnt,mode) vfs_mkdir(inode,dir,mnt,mode)
+ #define ll_vfs_link(old,mnt,dir,new,mnt1) vfs_link(old,mnt,dir,new,mnt1)
+@@ -636,7 +650,6 @@
+ #define ll_vfs_rename(old,old_dir,mnt,new,new_dir,mnt1) \
+ vfs_rename(old,old_dir,mnt,new,new_dir,mnt1)
+ #else
+-#define ll_remove_suid(inode,mnt) remove_suid(inode)
+ #define ll_vfs_rmdir(dir,entry,mnt) vfs_rmdir(dir,entry)
+ #define ll_vfs_mkdir(inode,dir,mnt,mode) vfs_mkdir(inode,dir,mode)
+ #define ll_vfs_link(old,mnt,dir,new,mnt1) vfs_link(old,dir,new)
+Index: HEAD/lustre/include/linux/lustre_lib.h
+===================================================================
+--- HEAD.orig/lustre/include/linux/lustre_lib.h 2008-08-07 20:23:18.000000000 +0300
++++ HEAD/lustre/include/linux/lustre_lib.h 2008-12-17 17:15:38.000000000 +0200
+@@ -49,7 +49,6 @@
+ # include <string.h>
+ # include <sys/types.h>
+ #else
+-# include <asm/semaphore.h>
+ # include <linux/rwsem.h>
+ # include <linux/sched.h>
+ # include <linux/signal.h>
+Index: HEAD/lustre/llite/llite_internal.h
+===================================================================
+--- HEAD.orig/lustre/llite/llite_internal.h 2008-12-17 17:15:38.000000000 +0200
++++ HEAD/lustre/llite/llite_internal.h 2008-12-17 17:15:38.000000000 +0200
+@@ -661,7 +661,11 @@
+ struct lookup_intent *it, struct kstat *stat);
+ int ll_getattr(struct vfsmount *mnt, struct dentry *de, struct kstat *stat);
+ struct ll_file_data *ll_file_data_get(void);
++#ifndef HAVE_INODE_PERMISION_2ARGS
+ int ll_inode_permission(struct inode *inode, int mask, struct nameidata *nd);
++#else
++int ll_inode_permission(struct inode *inode, int mask);
++#endif
+ int ll_lov_setstripe_ea_info(struct inode *inode, struct file *file,
+ int flags, struct lov_user_md *lum,
+ int lum_size);
+Index: HEAD/lustre/llite/file.c
+===================================================================
+--- HEAD.orig/lustre/llite/file.c 2008-11-20 14:34:31.000000000 +0200
++++ HEAD/lustre/llite/file.c 2008-12-17 17:15:38.000000000 +0200
+@@ -2305,7 +2305,11 @@
+ }
+
+ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,10))
++#ifndef HAVE_INODE_PERMISION_2ARGS
+ int ll_inode_permission(struct inode *inode, int mask, struct nameidata *nd)
++#else
++int ll_inode_permission(struct inode *inode, int mask)
++#endif
+ {
+ CDEBUG(D_VFSTRACE, "VFS Op:inode=%lu/%u(%p), mask %o\n",
+ inode->i_ino, inode->i_generation, inode, mask);
+Index: HEAD/lustre/llite/vvp_page.c
+===================================================================
+--- HEAD.orig/lustre/llite/vvp_page.c 2008-11-10 20:27:54.000000000 +0200
++++ HEAD/lustre/llite/vvp_page.c 2008-12-17 17:15:38.000000000 +0200
+@@ -341,7 +341,7 @@
+
+ result = -EAGAIN;
+ /* we're trying to write, but the page is locked.. come back later */
+- if (!TestSetPageLocked(vmpage)) {
++ if (!TryLockPage(vmpage)) {
+ if (pg->cp_state == CPS_CACHED) {
+ /*
+ * We can cancel IO if page wasn't dirty after all.
+Index: HEAD/lnet/autoconf/lustre-lnet.m4
+===================================================================
+--- HEAD.orig/lnet/autoconf/lustre-lnet.m4 2008-09-25 07:44:45.000000000 +0300
++++ HEAD/lnet/autoconf/lustre-lnet.m4 2008-12-17 17:15:38.000000000 +0200
+@@ -1098,6 +1098,22 @@
+ AM_CONDITIONAL(BUILD_USOCKLND, test x$USOCKLND = "xusocklnd")
+ ])
+
++# 2.6.27 have second argument to sock_map_fd
++AC_DEFUN([LN_SOCK_MAP_FD_2ARG],
++[AC_MSG_CHECKING([sock_map_fd have second argument])
++LB_LINUX_TRY_COMPILE([
++ #include <linux/net.h>
++],[
++ sock_map_fd(NULL, 0);
++],[
++ AC_MSG_RESULT(yes)
++ AC_DEFINE(HAVE_SOCK_MAP_FD_2ARG, 1,
++ [sock_map_fd have second argument])
++],[
++ AC_MSG_RESULT(NO)
++])
++])
++
+ #
+ # LN_CONFIG_FILES
+ #
diff --git a/debian/patches/patchless_support/fix_configure_RO_cache.dpatch b/debian/patches/patchless_support/fix_configure_RO_cache.dpatch
new file mode 100755
index 0000000..8e79f46
--- /dev/null
+++ b/debian/patches/patchless_support/fix_configure_RO_cache.dpatch
@@ -0,0 +1,71 @@
+#! /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@
+Index: HEAD/lustre/autoconf/lustre-core.m4
+===================================================================
+--- HEAD.orig/lustre/autoconf/lustre-core.m4 2008-12-05 20:38:37.000000000 +0300
++++ HEAD/lustre/autoconf/lustre-core.m4 2008-12-05 21:22:40.000000000 +0300
+@@ -1349,6 +1349,9 @@
+ ])
+ ])
+
++# 2.6.18
++
++
+ # 2.6.23 have return type 'void' for unregister_blkdev
+ AC_DEFUN([LC_UNREGISTER_BLKDEV_RETURN_INT],
+ [AC_MSG_CHECKING([if unregister_blkdev return int])
+@@ -1493,6 +1496,26 @@
+ ])
+ ])
+
++# 2.6.25 change define to inline
++AC_DEFUN([LC_MAPPING_CAP_WRITEBACK_DIRTY],
++[AC_MSG_CHECKING([if kernel have mapping_cap_writeback_dirty])
++LB_LINUX_TRY_COMPILE([
++ #include <linux/backing-dev.h>
++],[
++ #ifndef mapping_cap_writeback_dirty
++ mapping_cap_writeback_dirty(NULL);
++ #endif
++],[
++ AC_MSG_RESULT([yes])
++ AC_DEFINE(HAVE_MAPPING_CAP_WRITEBACK_DIRTY, 1,
++ [kernel have mapping_cap_writeback_dirty])
++],[
++ 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])
+@@ -1812,6 +1835,9 @@
+ LC_BIO_ENDIO_2ARG
+ LC_FH_TO_DENTRY
+ LC_PROCFS_DELETED
++
++ #2.6.25
++ LC_MAPPING_CAP_WRITEBACK_DIRTY
+
+ # 2.6.26
+ LC_FS_STRUCT_USE_PATH
+Index: HEAD/lustre/include/linux/lustre_compat25.h
+===================================================================
+--- HEAD.orig/lustre/include/linux/lustre_compat25.h 2008-12-05 20:36:56.000000000 +0300
++++ HEAD/lustre/include/linux/lustre_compat25.h 2008-12-05 21:19:27.000000000 +0300
+@@ -342,7 +342,7 @@
+ wbc.end = end;
+ #endif
+
+-#ifdef mapping_cap_writeback_dirty
++#ifdef HAVE_MAPPING_CAP_WRITEBACK_DIRTY
+ if (!mapping_cap_writeback_dirty(mapping))
+ rc = 0;
+ #else
diff --git a/debian/patches/patchless_support/fix_mmap.dpatch b/debian/patches/patchless_support/fix_mmap.dpatch
new file mode 100755
index 0000000..4b05ac7
--- /dev/null
+++ b/debian/patches/patchless_support/fix_mmap.dpatch
@@ -0,0 +1,308 @@
+#! /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@
+Index: b1_8_gate/lustre/llite/llite_mmap.c
+===================================================================
+--- b1_8_gate.orig/lustre/llite/llite_mmap.c 2008-11-11 18:23:11.000000000 +0300
++++ b1_8_gate/lustre/llite/llite_mmap.c 2008-12-03 13:25:37.000000000 +0300
+@@ -81,8 +81,7 @@
+ int lt_get_mmap_locks(struct ll_lock_tree *tree,
+ unsigned long addr, size_t count);
+
+-struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
+- int *type);
++static struct vm_operations_struct ll_file_vm_ops;
+
+ struct ll_lock_tree_node * ll_node_from_inode(struct inode *inode, __u64 start,
+ __u64 end, ldlm_mode_t mode)
+@@ -285,9 +284,19 @@
+ return LCK_PR;
+ }
+
++static void policy_from_vma_pgoff(ldlm_policy_data_t *policy,
++ struct vm_area_struct *vma,
++ __u64 pgoff, size_t count)
++{
++ policy->l_extent.start = pgoff << CFS_PAGE_SHIFT;
++ policy->l_extent.end = (policy->l_extent.start + count - 1) |
++ ~CFS_PAGE_MASK;
++}
++
+ static void policy_from_vma(ldlm_policy_data_t *policy,
+ struct vm_area_struct *vma, unsigned long addr,
+ size_t count)
++
+ {
+ policy->l_extent.start = ((addr - vma->vm_start) & CFS_PAGE_MASK) +
+ ((__u64)vma->vm_pgoff << CFS_PAGE_SHIFT);
+@@ -308,7 +317,7 @@
+ 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;
+@@ -360,44 +369,30 @@
+ }
+ RETURN(0);
+ }
+-/**
+- * Page fault handler.
+- *
+- * \param vma - is virtiual area struct related to page fault
+- * \param address - address when hit fault
+- * \param type - of fault
+- *
+- * \return allocated and filled page for address
+- * \retval NOPAGE_SIGBUS if page not exist on this address
+- * \retval NOPAGE_OOM not have memory for allocate new page
+- */
+-struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
+- int *type)
++
++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;
++ unsigned long size;
+ ENTRY;
+
+ if (lli->lli_smd == NULL) {
+ CERROR("No lsm on fault?\n");
+- RETURN(NOPAGE_SIGBUS);
++ 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_pgoff(&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);
+@@ -405,26 +400,28 @@
+ 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(NOPAGE_SIGBUS);
++ if(ll_extent_lock(fd, inode, lli->lli_smd, mode, &policy,
++ lockh, LDLM_FL_CBPENDING | LDLM_FL_NO_LRU) != 0)
++ 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);
++ if(obd_merge_lvb(ll_i2obdexp(inode), lli->lli_smd, &lvb, 1)) {
++ lov_stripe_unlock(lli->lli_smd);
++ RETURN(0);
++ }
+ kms = lvb.lvb_size;
+
+- pgoff = ((address - vma->vm_start) >> CFS_PAGE_SHIFT) + vma->vm_pgoff;
+ size = (kms + CFS_PAGE_SIZE - 1) >> CFS_PAGE_SHIFT;
++ CDEBUG(D_INFO, "Kms %lu - %lu\n", size, pgoff);
+
+ 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
+@@ -446,29 +443,69 @@
+ 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
++/**
++ * Page fault handler.
++ *
++ * \param vma - is virtiual area struct related to page fault
++ * \param address - address when hit fault
++ * \param type - of fault
++ *
++ * \return allocated and filled page for address
++ * \retval NOPAGE_SIGBUS if page not exist on this address
++ * \retval NOPAGE_OOM not have memory for allocate new page
++ */
++struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
++ int *type)
++{
++ struct lustre_handle lockh = { 0 };
++ int save_fags = 0;
++ unsigned long pgoff;
++ struct page *page;
++ ENTRY;
++
++ pgoff = ((address - vma->vm_start) >> CFS_PAGE_SHIFT) + vma->vm_pgoff;
++ if(!ll_get_extent_lock(vma, pgoff, &save_fags, &lockh))
++ RETURN(NOPAGE_SIGBUS);
++
+ page = filemap_nopage(vma, address, type);
+ if (page != NOPAGE_SIGBUS && page != NOPAGE_OOM)
+ LL_CDEBUG_PAGE(D_PAGE, page, "got addr %lu type %lx\n", address,
+@@ -477,13 +514,48 @@
+ CDEBUG(D_PAGE, "got addr %lu type %lx - SIGBUS\n", address,
+ (long)type);
+
+- vma->vm_flags &= ~VM_RAND_READ;
+- vma->vm_flags |= (rand_read | seq_read);
++ ll_put_extent_lock(vma, save_fags, &lockh);
+
+- ll_extent_unlock(fd, inode, ll_i2info(inode)->lli_smd, mode, &lockh);
+ RETURN(page);
+ }
+
++#else
++/* New fault() API*/
++/**
++ * Page fault handler.
++ *
++ * \param vma - is virtiual area struct related to page fault
++ * \param address - address when hit fault
++ * \param type - of fault
++ *
++ * \return allocated and filled page for address
++ * \retval NOPAGE_SIGBUS if page not exist on this address
++ * \retval NOPAGE_OOM not have memory for allocate new page
++ */
++int ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
++{
++ struct lustre_handle lockh = { 0 };
++ int save_fags = 0;
++ int rc;
++ ENTRY;
++
++ if(!ll_get_extent_lock(vma, vmf->pgoff, &save_fags, &lockh))
++ RETURN(VM_FAULT_SIGBUS);
++
++ rc = filemap_fault(vma, vmf);
++ if (vmf->page)
++ LL_CDEBUG_PAGE(D_PAGE, vmf->page, "got addr %p type NOPAGE\n",
++ vmf->virtual_address);
++ else
++ CDEBUG(D_PAGE, "got addr %p - SIGBUS\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.
+ * ll_vm_open(): when first vma is linked, split locks from lru.
+@@ -548,6 +620,7 @@
+ }
+ }
+
++#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);
+ #endif
+@@ -562,6 +635,7 @@
+ rc = filemap_populate(area, address, len, prot, pgoff, 1);
+ RETURN(rc);
+ }
++#endif
+
+ /* return the user space pointer that maps to a file offset via a vma */
+ static inline unsigned long file_to_user(struct vm_area_struct *vma, __u64 byte)
+@@ -588,10 +662,14 @@
+ }
+
+ static struct vm_operations_struct ll_file_vm_ops = {
+- .nopage = ll_nopage,
+ .open = ll_vm_open,
+ .close = ll_vm_close,
++#ifdef HAVE_VM_OP_FAULT
++ .fault = ll_fault,
++#else
++ .nopage = ll_nopage,
+ .populate = ll_populate,
++#endif
+ };
+
+ int ll_file_mmap(struct file * file, struct vm_area_struct * vma)
+@@ -602,7 +680,7 @@
+ ll_stats_ops_tally(ll_i2sbi(file->f_dentry->d_inode), LPROC_LL_MAP, 1);
+ rc = generic_file_mmap(file, vma);
+ if (rc == 0) {
+-#ifndef HAVE_FILEMAP_POPULATE
++#if !defined(HAVE_FILEMAP_POPULATE) && !defined(HAVE_VM_OP_FAULT)
+ if (!filemap_populate)
+ filemap_populate = vma->vm_ops->populate;
+ #endif
diff --git a/debian/patches/patchless_support/fix_nfs_fid_type.dpatch b/debian/patches/patchless_support/fix_nfs_fid_type.dpatch
new file mode 100755
index 0000000..ab5f1f9
--- /dev/null
+++ b/debian/patches/patchless_support/fix_nfs_fid_type.dpatch
@@ -0,0 +1,306 @@
+#! /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@
+Index: b1_8_gate/lustre/llite/llite_internal.h
+===================================================================
+--- b1_8_gate.orig/lustre/llite/llite_internal.h 2008-11-20 12:05:35.000000000 +0300
++++ b1_8_gate/lustre/llite/llite_internal.h 2008-11-27 15:38:16.000000000 +0300
+@@ -861,9 +861,6 @@
+ /* 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;
+Index: b1_8_gate/lustre/llite/llite_nfs.c
+===================================================================
+--- b1_8_gate.orig/lustre/llite/llite_nfs.c 2008-11-24 13:50:31.000000000 +0300
++++ b1_8_gate/lustre/llite/llite_nfs.c 2008-11-27 15:39:24.000000000 +0300
+@@ -68,36 +68,30 @@
+ }
+
+ static struct inode * search_inode_for_lustre(struct super_block *sb,
+- unsigned long ino,
+- unsigned long generation,
+- int mode)
++ struct ll_fid *iid)
+ {
+ 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;
+- struct ll_fid iid = { .id = ino, .generation = generation };
+ ENTRY;
+
+- inode = ILOOKUP(sb, ino, ll_nfs_test_inode, &iid);
++ inode = ILOOKUP(sb, iid->id, ll_nfs_test_inode, iid);
+
+ 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 is ignore f_type */
++ rc = mdc_getattr(sbi->ll_mdc_exp, iid, valid, eadatalen, &req);
+ if (rc) {
+- CERROR("failure %d inode %lu\n", rc, ino);
++ CERROR("failure %d inode "LPU64"\n", rc, iid->id);
+ RETURN(ERR_PTR(rc));
+ }
+
+@@ -111,27 +105,27 @@
+ RETURN(inode);
+ }
+
+-static struct dentry *ll_iget_for_nfs(struct super_block *sb, unsigned long ino,
+- __u32 generation, umode_t mode)
++static struct dentry *ll_iget_for_nfs(struct super_block *sb,
++ struct ll_fid *iid)
+ {
+ struct inode *inode;
+ struct dentry *result;
+ ENTRY;
+
+- if (ino == 0)
++ if (iid->id == 0)
+ RETURN(ERR_PTR(-ESTALE));
+
+- inode = search_inode_for_lustre(sb, ino, generation, mode);
+- if (IS_ERR(inode)) {
++ inode = search_inode_for_lustre(sb, iid);
++ if (IS_ERR(inode))
+ RETURN(ERR_PTR(PTR_ERR(inode)));
+- }
++
+ if (is_bad_inode(inode) ||
+- (generation && inode->i_generation != generation)){
++ (iid->generation && inode->i_generation != iid->generation)) {
+ /* we didn't find the right inode.. */
+ CERROR("Inode %lu, Bad count: %lu %d or version %u %u\n",
+ inode->i_ino, (unsigned long)inode->i_nlink,
+ atomic_read(&inode->i_count), inode->i_generation,
+- generation);
++ iid->generation);
+ iput(inode);
+ RETURN(ERR_PTR(-ESTALE));
+ }
+@@ -146,57 +140,102 @@
+ RETURN(result);
+ }
+
+-struct dentry *ll_fh_to_dentry(struct super_block *sb, __u32 *data, int len,
+- int fhtype, int parent)
++#define LUSTRE_NFS_FID 0x94
++
++struct lustre_nfs_fid {
++ struct ll_fid child;
++ struct ll_fid parent;
++ umode_t mode;
++};
++
++/* The return value is file handle type:
++ * 1 -- contains child file handle;
++ * 2 -- contains child file handle and parent file handle;
++ * 255 -- error.
++ */
++static int ll_encode_fh(struct dentry *de, __u32 *fh, int *plen,
++ int connectable)
++{
++ struct inode *inode = de->d_inode;
++ struct inode *parent = de->d_parent->d_inode;
++ struct lustre_nfs_fid *nfs_fid = (void *)fh;
++ ENTRY;
++
++ CDEBUG(D_INFO, "encoding for (%lu) maxlen=%d minlen=%lu\n",
++ inode->i_ino, *plen,
++ sizeof(struct lustre_nfs_fid));
++
++ if (*plen < sizeof(struct lustre_nfs_fid))
++ RETURN(255);
++
++ ll_inode2fid(&nfs_fid->child, inode);
++ ll_inode2fid(&nfs_fid->parent, parent);
++
++ nfs_fid->mode = (S_IFMT & inode->i_mode);
++ *plen = sizeof(struct lustre_nfs_fid);
++
++ RETURN(LUSTRE_NFS_FID);
++}
++
++#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;
+- }
+- return ERR_PTR(-EINVAL);
++ struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid *)fid;
++
++ if (fh_type != LUSTRE_NFS_FID)
++ RETURN(ERR_PTR(-EINVAL));
++
++ RETURN(ll_iget_for_nfs(sb, &nfs_fid->child));
++}
++static struct dentry *ll_fh_to_parent(struct super_block *sb, struct fid *fid,
++ int fh_len, int fh_type)
++{
++ struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid *)fid;
++
++ if (fh_type != LUSTRE_NFS_FID)
++ RETURN(ERR_PTR(-EINVAL));
++ RETURN(ll_iget_for_nfs(sb, &nfs_fid->parent));
+ }
+
+-int ll_dentry_to_fh(struct dentry *dentry, __u32 *datap, int *lenp,
+- int need_parent)
++#else
++/*
++ * This length is counted as amount of __u32,
++ * It is composed of a fid and a mode
++ */
++static struct dentry *ll_decode_fh(struct super_block *sb, __u32 *fh, int fh_len,
++ int fh_type,
++ int (*acceptable)(void *, struct dentry *),
++ void *context)
+ {
+- 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 lustre_nfs_fid *nfs_fid = (void *)fh;
++ struct dentry *entry;
++ ENTRY;
+
+- if (*lenp == 3 || S_ISDIR(dentry->d_inode->i_mode)) {
+- *lenp = 3;
+- return 1;
+- }
+- if (dentry->d_parent) {
+- *datap++ = dentry->d_parent->d_inode->i_ino;
+- *datap++ = (__u32)(S_IFMT & dentry->d_parent->d_inode->i_mode);
++ CDEBUG(D_INFO, "decoding for "LPU64" fh_len=%d fh_type=%x\n",
++ nfs_fid->child.id, fh_len, fh_type);
+
+- *lenp = 5;
+- return 2;
+- }
+- *lenp = 3;
+- return 1;
++ if (fh_type != LUSTRE_NFS_FID)
++ RETURN(ERR_PTR(-ESTALE));
++
++ entry = sb->s_export_op->find_exported_dentry(sb, &nfs_fid->child,
++ &nfs_fid->parent,
++ acceptable, context);
++ RETURN(entry);
+ }
+
+-#if THREAD_SIZE >= 8192
++
+ 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);
++ struct lustre_nfs_fid *fid = data;
++ ENTRY;
++
++ RETURN(ll_iget_for_nfs(sb, &fid->child));
++
+ }
+
++#endif
++
+ struct dentry *ll_get_parent(struct dentry *dchild)
+ {
+ struct ptlrpc_request *req = NULL;
+@@ -208,11 +247,11 @@
+ char dotdot[] = "..";
+ int rc = 0;
+ ENTRY;
+-
++
+ LASSERT(dir && S_ISDIR(dir->i_mode));
+-
+- sbi = ll_s2sbi(dir->i_sb);
+-
++
++ sbi = ll_s2sbi(dir->i_sb);
++
+ fid.id = (__u64)dir->i_ino;
+ fid.generation = dir->i_generation;
+ fid.f_type = S_IFDIR;
+@@ -223,11 +262,12 @@
+ CERROR("failure %d inode %lu get parent\n", rc, dir->i_ino);
+ return ERR_PTR(rc);
+ }
+- body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof (*body));
+-
++ body = lustre_msg_buf(req->rq_repmsg, REPLY_REC_OFF, sizeof (*body));
++
+ 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);
++ fid.id = body->ino;
++ fid.generation = body->generation;
++ result = ll_iget_for_nfs(dir->i_sb, &fid);
+
+ if (IS_ERR(result))
+ rc = PTR_ERR(result);
+@@ -236,10 +276,18 @@
+ if (rc)
+ return ERR_PTR(rc);
+ RETURN(result);
+-}
++}
++
+
++#if THREAD_SIZE >= 8192
+ struct export_operations lustre_export_operations = {
+- .get_parent = ll_get_parent,
+- .get_dentry = ll_get_dentry,
++ .encode_fh = ll_encode_fh,
++#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,
++ .decode_fh = ll_decode_fh,
++#endif
+ };
+ #endif
diff --git a/debian/patches/patchless_support/fix_path_API_changes.dpatch b/debian/patches/patchless_support/fix_path_API_changes.dpatch
new file mode 100755
index 0000000..291bf83
--- /dev/null
+++ b/debian/patches/patchless_support/fix_path_API_changes.dpatch
@@ -0,0 +1,83 @@
+#! /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@
+Index: b1_8_gate/lustre/llite/symlink.c
+===================================================================
+--- b1_8_gate.orig/lustre/llite/symlink.c 2008-11-27 07:36:47.000000000 +0300
++++ b1_8_gate/lustre/llite/symlink.c 2008-11-27 07:37:23.000000000 +0300
+@@ -177,8 +177,12 @@
+ 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);
+ }
+
+Index: b1_8_gate/lustre/mgc/mgc_request.c
+===================================================================
+--- b1_8_gate.orig/lustre/mgc/mgc_request.c 2008-11-27 07:36:47.000000000 +0300
++++ b1_8_gate/lustre/mgc/mgc_request.c 2008-11-27 07:37:23.000000000 +0300
+@@ -415,7 +415,7 @@
+ 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)) {
+Index: b1_8_gate/lustre/ptlrpc/service.c
+===================================================================
+--- b1_8_gate.orig/lustre/ptlrpc/service.c 2008-11-27 07:36:47.000000000 +0300
++++ b1_8_gate/lustre/ptlrpc/service.c 2008-11-27 07:37:23.000000000 +0300
+@@ -1501,7 +1501,7 @@
+ 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
+Index: b1_8_gate/lustre/lvfs/lvfs_linux.c
+===================================================================
+--- b1_8_gate.orig/lustre/lvfs/lvfs_linux.c 2008-11-27 07:36:47.000000000 +0300
++++ b1_8_gate/lustre/lvfs/lvfs_linux.c 2008-11-27 07:37:23.000000000 +0300
+@@ -148,10 +148,10 @@
+ */
+
+ save->fs = get_fs();
+- LASSERT(atomic_read(¤t->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);
+@@ -205,10 +205,10 @@
+ atomic_read(¤t->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);
diff --git a/debian/patches/patchless_support/fix_request_module_calls.dpatch b/debian/patches/patchless_support/fix_request_module_calls.dpatch
new file mode 100755
index 0000000..e01c88f
--- /dev/null
+++ b/debian/patches/patchless_support/fix_request_module_calls.dpatch
@@ -0,0 +1,20 @@
+#! /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@
+Index: b1_8_gate/lnet/lnet/api-ni.c
+===================================================================
+--- b1_8_gate.orig/lnet/lnet/api-ni.c 2008-10-21 19:12:50.000000000 +0400
++++ b1_8_gate/lnet/lnet/api-ni.c 2008-11-27 16:06:07.000000000 +0300
+@@ -1032,7 +1032,7 @@
+ #ifdef __KERNEL__
+ if (lnd == NULL) {
+ LNET_MUTEX_UP(&the_lnet.ln_lnd_mutex);
+- rc = request_module(libcfs_lnd2modname(lnd_type));
++ rc = request_module("%s", libcfs_lnd2modname(lnd_type));
+ LNET_MUTEX_DOWN(&the_lnet.ln_lnd_mutex);
+
+ lnd = lnet_find_lnd_by_type(lnd_type);
diff --git a/debian/patches/patchless_support/lprocfs_changes.dpatch b/debian/patches/patchless_support/lprocfs_changes.dpatch
new file mode 100755
index 0000000..91819bc
--- /dev/null
+++ b/debian/patches/patchless_support/lprocfs_changes.dpatch
@@ -0,0 +1,78 @@
+#! /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@
+Index: HEAD/lustre/include/lprocfs_status.h
+===================================================================
+--- HEAD.orig/lustre/include/lprocfs_status.h 2008-12-08 05:48:08.000000000 +0200
++++ HEAD/lustre/include/lprocfs_status.h 2008-12-08 13:42:28.000000000 +0200
+@@ -563,6 +563,8 @@
+ #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(); \
+@@ -571,6 +573,14 @@
+ 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
++
+ #define LPROCFS_WRITE_ENTRY() do { \
+ down_write(&_lprocfs_lock); \
+ } while(0)
+@@ -578,6 +588,7 @@
+ up_write(&_lprocfs_lock); \
+ } while(0)
+
++
+ /* You must use these macros when you want to refer to
+ * the import in a client obd_device for a lprocfs entry */
+ #define LPROCFS_CLIMP_CHECK(obd) do { \
+Index: HEAD/lustre/obdclass/linux/linux-module.c
+===================================================================
+--- HEAD.orig/lustre/obdclass/linux/linux-module.c 2008-12-08 05:48:20.000000000 +0200
++++ HEAD/lustre/obdclass/linux/linux-module.c 2008-12-08 13:50:36.000000000 +0200
+@@ -418,7 +418,7 @@
+ ENTRY;
+
+ obd_sysctl_init();
+- proc_lustre_root = lprocfs_register("lustre", proc_root_fs,
++ proc_lustre_root = lprocfs_register("fs/lustre", NULL,
+ lprocfs_base, NULL);
+ rc = lprocfs_seq_create(proc_lustre_root, "devices", 0444,
+ &obd_device_list_fops, NULL);
+Index: HEAD/lustre/obdclass/lprocfs_status.c
+===================================================================
+--- HEAD.orig/lustre/obdclass/lprocfs_status.c 2008-12-08 05:48:20.000000000 +0200
++++ HEAD/lustre/obdclass/lprocfs_status.c 2008-12-08 13:42:28.000000000 +0200
+@@ -173,7 +173,7 @@
+
+ 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, CFS_PAGE_SIZE,
+ &eof, dp->data);
+ LPROCFS_EXIT();
+@@ -213,7 +213,7 @@
+ 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/debian/patches/patchless_support/lustre_loop_devices_adaption.dpatch b/debian/patches/patchless_support/lustre_loop_devices_adaption.dpatch
new file mode 100755
index 0000000..bc3b884
--- /dev/null
+++ b/debian/patches/patchless_support/lustre_loop_devices_adaption.dpatch
@@ -0,0 +1,84 @@
+#! /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@
+Index: HEAD/lustre/llite/lloop.c
+===================================================================
+--- HEAD.orig/lustre/llite/lloop.c 2008-11-17 11:36:35.000000000 +0200
++++ HEAD/lustre/llite/lloop.c 2008-12-17 23:29:17.000000000 +0200
+@@ -152,7 +152,7 @@
+ struct semaphore lo_bh_mutex;
+ atomic_t lo_pending;
+
+- request_queue_t *lo_queue;
++ struct request_queue *lo_queue;
+
+ /* data to handle bio for lustre. */
+ struct lo_request_data {
+@@ -288,7 +288,7 @@
+ return bio;
+ }
+
+-static int loop_make_request(request_queue_t *q, struct bio *old_bio)
++static int loop_make_request(struct request_queue *q, struct bio *old_bio)
+ {
+ struct lloop_device *lo = q->queuedata;
+ int rw = bio_rw(old_bio);
+@@ -317,7 +317,7 @@
+ 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);
+@@ -327,7 +327,7 @@
+ /*
+ * kick off io on the underlying address space
+ */
+-static void loop_unplug(request_queue_t *q)
++static void loop_unplug(struct request_queue *q)
+ {
+ struct lloop_device *lo = q->queuedata;
+
+@@ -339,7 +339,7 @@
+ {
+ int ret;
+ ret = do_bio_filebacked(lo, bio);
+- bio_endio(bio, bio->bi_size, ret);
++ cfs_bio_endio(bio, bio->bi_size, ret);
+ }
+
+ /*
+@@ -366,7 +366,8 @@
+ up(&lo->lo_sem);
+
+ for (;;) {
+- down_interruptible(&lo->lo_bh_mutex);
++ if(!down_interruptible(&lo->lo_bh_mutex))
++ continue;
+ /*
+ * could be upped because of tear-down, not because of
+ * pending work
+@@ -743,7 +744,7 @@
+
+ out_mem4:
+ while (i--)
+- blk_put_queue(loop_dev[i].lo_queue);
++ blk_cleanup_queue(loop_dev[i].lo_queue);
+ i = max_loop;
+ out_mem3:
+ while (i--)
+@@ -765,7 +766,7 @@
+ ll_iocontrol_unregister(ll_iocontrol_magic);
+ for (i = 0; i < max_loop; i++) {
+ del_gendisk(disks[i]);
+- blk_put_queue(loop_dev[i].lo_queue);
++ blk_cleanup_queue(loop_dev[i].lo_queue);
+ put_disk(disks[i]);
+ }
+ if (ll_unregister_blkdev(lloop_major, "lloop"))
diff --git a/debian/patches/patchless_support/new_page_fault_method.dpatch b/debian/patches/patchless_support/new_page_fault_method.dpatch
new file mode 100755
index 0000000..26f84d6
--- /dev/null
+++ b/debian/patches/patchless_support/new_page_fault_method.dpatch
@@ -0,0 +1,442 @@
+#! /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@
+Index: HEAD/lustre/llite/vvp_io.c
+===================================================================
+--- HEAD.orig/lustre/llite/vvp_io.c 2008-12-17 17:15:38.000000000 +0200
++++ HEAD/lustre/llite/vvp_io.c 2008-12-17 17:15:38.000000000 +0200
+@@ -559,6 +559,61 @@
+ RETURN(result);
+ }
+
++#ifndef HAVE_VM_OP_FAULT
++static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
++{
++ cfs_page_t *result;
++
++ result = filemap_nopage(cfio->ft_vma, cfio->ft_address, cfio->ft_type);
++ if (result != NOPAGE_SIGBUS && result != NOPAGE_OOM)
++ LL_CDEBUG_PAGE(D_PAGE, result,
++ "got addr %lu type %lx\n",
++ cfio->ft_address, (long)cfio->ft_type);
++ else
++ CDEBUG(D_PAGE, "got addr %lu type %lx - SIGBUS\n",
++ cfio->ft_address, (long)cfio->ft_type);
++
++ if (result == NOPAGE_SIGBUS)
++ return -EFAULT;
++ else if (result == NOPAGE_OOM)
++ return -ENOMEM;
++
++ /* new fault API can return page locked already */
++ lock_page(result);
++ cfio->ft_page = result;
++
++ return 0;
++}
++#else
++static int vvp_io_kernel_fault(struct vvp_fault_io *cfio)
++{
++ cfio->ft_flags = filemap_fault(cfio->ft_vma, cfio->ft_vmf);
++ if (cfio->ft_vmf->page)
++ LL_CDEBUG_PAGE(D_PAGE, cfio->ft_vmf->page,
++ "got addr %p type NOPAGE\n",
++ cfio->ft_vmf->virtual_address);
++ else
++ CDEBUG(D_PAGE, "got addr %p - SIGBUS\n",
++ cfio->ft_vmf->virtual_address);
++
++ if (unlikely (cfio->ft_flags & VM_FAULT_ERROR))
++ return -EFAULT;
++
++ if (unlikely (cfio->ft_flags & VM_FAULT_NOPAGE))
++ return -ENOMEM;
++
++ if (unlikely(!(cfio->ft_flags & VM_FAULT_LOCKED))) {
++ lock_page(cfio->ft_vmf->page);
++ cfio->ft_flags |= VM_FAULT_LOCKED;
++ }
++
++ cfio->ft_page = cfio->ft_vmf->page;
++
++ return 0;
++}
++
++#endif
++
+ static int vvp_io_fault_start(const struct lu_env *env,
+ const struct cl_io_slice *ios)
+ {
+@@ -568,9 +623,12 @@
+ struct inode *inode = ccc_object_inode(obj);
+ struct cl_fault_io *fio = &io->u.ci_fault;
+ struct vvp_fault_io *cfio = &vio->u.fault;
+- cfs_page_t *vmpage;
+ loff_t offset;
++ int kernel_result = 0;
+ int result = 0;
++ struct cl_page *page;
++ loff_t size;
++ pgoff_t last; /* last page in a file data region */
+
+ LASSERT(vio->cui_oneshot == 0);
+
+@@ -587,55 +645,43 @@
+ if (result != 0)
+ return result;
+
+- vmpage = filemap_nopage(cfio->ft_vma, cfio->ft_address, cfio->ft_type);
+- if (vmpage != NOPAGE_SIGBUS && vmpage != NOPAGE_OOM)
+- LL_CDEBUG_PAGE(D_PAGE, vmpage,
+- "got addr %lu type %lx\n",
+- cfio->ft_address, (long)cfio->ft_type);
+- else
+- CDEBUG(D_PAGE, "got addr %lu type %lx - SIGBUS\n",
+- cfio->ft_address, (long)cfio->ft_type);
+-
+- if (vmpage == NOPAGE_SIGBUS)
+- result = -EFAULT;
+- else if (vmpage == NOPAGE_OOM)
+- result = -ENOMEM;
+- else {
+- struct cl_page *page;
+- loff_t size;
+- pgoff_t last; /* last page in a file data region */
+-
+- /* Temporarily lock vmpage to keep cl_page_find() happy. */
+- lock_page(vmpage);
+- page = cl_page_find(env, obj, fio->ft_index, vmpage,
+- CPT_CACHEABLE);
+- unlock_page(vmpage);
+- if (!IS_ERR(page)) {
+- size = i_size_read(inode);
+- last = cl_index(obj, size - 1);
+- if (fio->ft_index == last)
+- /*
+- * Last page is mapped partially.
+- */
+- fio->ft_nob = size - cl_offset(obj,
+- fio->ft_index);
+- else
+- fio->ft_nob = cl_page_size(obj);
+- lu_ref_add(&page->cp_reference, "fault", io);
+- fio->ft_page = page;
+- /*
+- * Certain 2.6 kernels return not-NULL from
+- * filemap_nopage() when page is beyond the file size,
+- * on the grounds that "An external ptracer can access
+- * pages that normally aren't accessible.." Don't
+- * propagate such page fault to the lower layers to
+- * avoid side-effects like KMS updates.
+- */
+- if (fio->ft_index > last)
+- result = +1;
+- } else
+- result = PTR_ERR(page);
++ /* must return locked page */
++ kernel_result = vvp_io_kernel_fault(cfio);
++ if (kernel_result != 0)
++ return kernel_result;
++
++ page = cl_page_find(env, obj, fio->ft_index, cfio->ft_page,
++ CPT_CACHEABLE);
++ if (IS_ERR(page)) {
++ unlock_page(cfio->ft_page);
++ page_cache_release(cfio->ft_page);
++ cfio->ft_page = NULL;
++ return PTR_ERR(page);
+ }
++
++ size = i_size_read(inode);
++ last = cl_index(obj, size - 1);
++ if (fio->ft_index == last)
++ /*
++ * Last page is mapped partially.
++ */
++ fio->ft_nob = size - cl_offset(obj, fio->ft_index);
++ else
++ fio->ft_nob = cl_page_size(obj);
++
++ lu_ref_add(&page->cp_reference, "fault", io);
++ fio->ft_page = page;
++ /*
++ * Certain 2.6 kernels return not-NULL from
++ * filemap_nopage() when page is beyond the file size,
++ * on the grounds that "An external ptracer can access
++ * pages that normally aren't accessible.." Don't
++ * propagate such page fault to the lower layers to
++ * avoid side-effects like KMS updates.
++ */
++ if (fio->ft_index > last)
++ result = +1;
++
+ return result;
+ }
+
+Index: HEAD/lustre/llite/llite_mmap.c
+===================================================================
+--- HEAD.orig/lustre/llite/llite_mmap.c 2008-11-17 11:36:34.000000000 +0200
++++ HEAD/lustre/llite/llite_mmap.c 2008-12-17 17:15:38.000000000 +0200
+@@ -72,6 +72,8 @@
+ struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
+ int *type);
+
++static struct vm_operations_struct ll_file_vm_ops;
++
+ void policy_from_vma(ldlm_policy_data_t *policy,
+ struct vm_area_struct *vma, unsigned long addr,
+ size_t count)
+@@ -95,7 +97,7 @@
+ 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;
+@@ -105,6 +107,7 @@
+ RETURN(ret);
+ }
+
++#ifndef HAVE_VM_OP_FAULT
+ /**
+ * Lustre implementation of a vm_operations_struct::nopage() method, called by
+ * VM to server page fault (both in kernel and user space).
+@@ -125,11 +128,12 @@
+ struct page *ll_nopage(struct vm_area_struct *vma, unsigned long address,
+ int *type)
+ {
++
+ struct file *file = vma->vm_file;
+ struct inode *inode = file->f_dentry->d_inode;
+ struct lu_env *env;
+ struct cl_io *io;
+- struct page *page = NULL;
++ struct page *page = NOPAGE_SIGBUS;
+ struct cl_env_nest nest;
+ int result;
+
+@@ -143,7 +147,7 @@
+ * one.
+ */
+ env = cl_env_nested_get(&nest);
+- if (!IS_ERR(env)) {
++ if (IS_ERR(env)) {
+ pgoff_t pg_offset;
+ const unsigned long writable = VM_SHARED|VM_WRITE;
+ unsigned long ra_flags;
+@@ -183,16 +187,25 @@
+ cio->cui_fd = LUSTRE_FPRIVATE(file);
+
+ result = cl_io_loop(env, io);
+- if (result == 0) {
+- LASSERT(fio->ft_page != NULL);
+- page = cl_page_vmpage(env, fio->ft_page);
+- } else if (result == -EFAULT) {
+- page = NOPAGE_SIGBUS;
+- } else if (result == -ENOMEM) {
+- page = NOPAGE_OOM;
+- }
+- } else
++ } else {
+ result = io->ci_result;
++ }
++
++ switch (result) {
++ case 0:
++ LASSERT(fio->ft_page != NULL);
++ page = vio->u.fault.ft_page;
++ page_unlock(page);
++ break;
++ case -EFAULT:
++ page = NOPAGE_SIGBUS;
++ break;
++ case -ENOMEM:
++ page = NOPAGE_OOM;
++ break;
++ default:
++ LBUG();
++ }
+
+ vma->vm_flags &= ~VM_RAND_READ;
+ vma->vm_flags |= ra_flags;
+@@ -200,8 +213,99 @@
+ cl_io_fini(env, io);
+ cl_env_nested_put(&nest, env);
+ }
++
+ RETURN(page);
+ }
++#else
++/* New fault() API*/
++/**
++ * Page fault handler.
++ *
++ * \param vma - is virtiual area struct related to page fault
++ * \param address - address when hit fault
++ * \param type - of fault
++ *
++ * \return allocated and filled page for address
++ * \retval NOPAGE_SIGBUS if page not exist on this address
++ * \retval NOPAGE_OOM not have memory for allocate new page
++ */
++int ll_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
++{
++ struct file *file = vma->vm_file;
++ struct inode *inode = file->f_dentry->d_inode;
++ struct lu_env *env;
++ struct cl_io *io;
++ const unsigned long writable = VM_SHARED|VM_WRITE;
++ unsigned long ra_flags;
++ struct cl_fault_io *fio;
++ struct cl_env_nest nest;
++ int result;
++ int fault_ret = 0;
++
++ ENTRY;
++
++ /*
++ * vm_operations_struct::nopage() can be called when lustre IO is
++ * already active for the current thread, e.g., when doing read/write
++ * against user level buffer mapped from Lustre buffer. To avoid
++ * stomping on existing context, optionally force an allocation of a new
++ * one.
++ */
++ env = cl_env_nested_get(&nest);
++ if (IS_ERR(env))
++ RETURN(VM_FAULT_ERROR);
++
++ io = &ccc_env_info(env)->cti_io;
++ io->ci_obj = ll_i2info(inode)->lli_clob;
++ LASSERT(io->ci_obj != NULL);
++
++ fio = &io->u.ci_fault;
++ fio->ft_index = vmf->pgoff + vma->vm_pgoff;
++ fio->ft_writable = (vma->vm_flags&writable) == writable;
++ fio->ft_executable = vma->vm_flags&VM_EXEC;
++
++ /*
++ * 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.
++ */
++ ra_flags = vma->vm_flags & (VM_RAND_READ|VM_SEQ_READ);
++ vma->vm_flags &= ~VM_SEQ_READ;
++ vma->vm_flags |= VM_RAND_READ;
++
++ CDEBUG(D_INFO, "vm_flags: %lx (%lu %i %i)\n", vma->vm_flags,
++ fio->ft_index, fio->ft_writable, fio->ft_executable);
++
++ if (cl_io_init(env, io, CIT_FAULT, io->ci_obj) == 0) {
++ struct vvp_io *vio = vvp_env_io(env);
++ struct ccc_io *cio = ccc_env_io(env);
++
++ LASSERT(cio->cui_cl.cis_io == io);
++
++ vio->u.fault.ft_vma = vma;
++ vio->u.fault.ft_vmf = vmf;
++ cio->cui_fd = LUSTRE_FPRIVATE(file);
++
++ result = cl_io_loop(env, io);
++ fault_ret = vio->u.fault.ft_flags;
++ if (result != 0)
++ fault_ret |= VM_FAULT_ERROR;
++ } else {
++ if(io->ci_result)
++ fault_ret = VM_FAULT_ERROR;
++ }
++
++ vma->vm_flags |= ra_flags;
++
++ cl_io_fini(env, io);
++ cl_env_nested_put(&nest, env);
++
++ RETURN(fault_ret);
++}
++
++
++
++#endif
+
+ /**
+ * To avoid cancel the locks covering mmapped region for lock cache pressure,
+@@ -234,6 +338,7 @@
+ EXIT;
+ }
+
++#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);
+ #endif
+@@ -248,6 +353,7 @@
+ rc = filemap_populate(area, address, len, prot, pgoff, 1);
+ RETURN(rc);
+ }
++#endif
+
+ /* return the user space pointer that maps to a file offset via a vma */
+ static inline unsigned long file_to_user(struct vm_area_struct *vma, __u64 byte)
+@@ -274,10 +380,15 @@
+ }
+
+ static struct vm_operations_struct ll_file_vm_ops = {
++#ifndef HAVE_VM_OP_FAULT
+ .nopage = ll_nopage,
++ .populate = ll_populate,
++
++#else
++ .fault = ll_fault,
++#endif
+ .open = ll_vm_open,
+ .close = ll_vm_close,
+- .populate = ll_populate,
+ };
+
+ int ll_file_mmap(struct file * file, struct vm_area_struct * vma)
+@@ -288,7 +399,7 @@
+ 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)
++#if !defined(HAVE_FILEMAP_POPULATE) && !defined(HAVE_VM_OP_FAULT)
+ if (!filemap_populate)
+ filemap_populate = vma->vm_ops->populate;
+ #endif
+Index: HEAD/lustre/llite/llite_internal.h
+===================================================================
+--- HEAD.orig/lustre/llite/llite_internal.h 2008-12-17 17:15:38.000000000 +0200
++++ HEAD/lustre/llite/llite_internal.h 2008-12-17 17:35:56.000000000 +0200
+@@ -819,6 +819,11 @@
+ time_t ft_mtime;
+ struct vm_area_struct *ft_vma;
+ /**
++ * locked page returned from vvp_io
++ */
++ cfs_page_t *ft_page;
++#ifndef HAVE_VM_OP_FAULT
++ /**
+ * Virtual address at which fault occurred.
+ */
+ unsigned long ft_address;
+@@ -826,6 +831,16 @@
+ * Fault type, as to be supplied to filemap_nopage().
+ */
+ int *ft_type;
++#else
++ /**
++ * kernel fault info
++ */
++ struct vm_fault *ft_vmf;
++ /**
++ * fault API used bitflags for return code save it.
++ */
++ unsigned int ft_flags;
++#endif
+ } fault;
+ } u;
+ /**
diff --git a/debian/patches/patchless_support/nfs_changes_new_API.dpatch b/debian/patches/patchless_support/nfs_changes_new_API.dpatch
new file mode 100755
index 0000000..15b2602
--- /dev/null
+++ b/debian/patches/patchless_support/nfs_changes_new_API.dpatch
@@ -0,0 +1,277 @@
+#! /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@
+Index: HEAD/lustre/llite/llite_internal.h
+===================================================================
+--- HEAD.orig/lustre/llite/llite_internal.h 2008-11-20 14:34:31.000000000 +0200
++++ HEAD/lustre/llite/llite_internal.h 2008-12-17 17:15:38.000000000 +0200
+@@ -744,9 +744,6 @@
+ /* 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;
+Index: HEAD/lustre/llite/llite_nfs.c
+===================================================================
+--- HEAD.orig/lustre/llite/llite_nfs.c 2008-11-17 11:36:34.000000000 +0200
++++ HEAD/lustre/llite/llite_nfs.c 2008-12-17 17:40:22.000000000 +0200
+@@ -67,14 +67,13 @@
+ }
+
+ static struct inode *search_inode_for_lustre(struct super_block *sb,
+- struct lu_fid *fid,
+- int mode)
++ struct lu_fid *fid)
+ {
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+ struct ptlrpc_request *req = NULL;
+ struct inode *inode = NULL;
+ unsigned long valid = 0;
+- int eadatalen = 0;
++ int eadatalen;
+ ino_t ino = ll_fid_build_ino(sbi, fid);
+ int rc;
+ ENTRY;
+@@ -85,13 +84,13 @@
+ 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;
+- }
++ rc = ll_get_max_mdsize(sbi, &eadatalen);
++ if (rc)
++ RETURN(ERR_PTR(rc));
++
++ valid |= OBD_MD_FLEASIZE;
+
++ /* mds_fid2dentry ignore f_type */
+ rc = md_getattr(sbi->ll_md_exp, fid, NULL, valid, eadatalen, &req);
+ if (rc) {
+ CERROR("can't get object attrs, fid "DFID", rc %d\n",
+@@ -107,9 +106,7 @@
+ RETURN(inode);
+ }
+
+-static struct dentry *ll_iget_for_nfs(struct super_block *sb,
+- struct lu_fid *fid,
+- umode_t mode)
++static struct dentry *ll_iget_for_nfs(struct super_block *sb, struct lu_fid *fid, __u32 mode)
+ {
+ struct inode *inode;
+ struct dentry *result;
+@@ -119,7 +116,7 @@
+ if (!fid_is_sane(fid))
+ RETURN(ERR_PTR(-ESTALE));
+
+- inode = search_inode_for_lustre(sb, fid, mode);
++ inode = search_inode_for_lustre(sb, fid);
+ if (IS_ERR(inode))
+ RETURN(ERR_PTR(PTR_ERR(inode)));
+
+@@ -142,85 +139,103 @@
+ RETURN(result);
+ }
+
++#define LUSTRE_NFS_FID 0x97
++
++struct lustre_nfs_fid {
++ struct lu_fid child;
++ struct lu_fid parent;
++ umode_t mode;
++};
++
++/* The return value is file handle type:
++ * 1 -- contains child file handle;
++ * 2 -- contains child file handle and parent file handle;
++ * 255 -- error.
++ */
++static int ll_encode_fh(struct dentry *de, __u32 *fh, int *plen,
++ int connectable)
++{
++ struct inode *inode = de->d_inode;
++ struct inode *parent = de->d_parent->d_inode;
++ struct lustre_nfs_fid *nfs_fid = (void *)fh;
++ ENTRY;
++
++ CDEBUG(D_INFO, "encoding for (%lu,"DFID") maxlen=%d minlen=%u\n",
++ inode->i_ino, PFID(ll_inode2fid(inode)), *plen,
++ sizeof(struct lustre_nfs_fid));
++
++ if (*plen < sizeof(struct lustre_nfs_fid))
++ RETURN(255);
++
++ nfs_fid->child = *ll_inode2fid(inode);
++ nfs_fid->parent = *ll_inode2fid(parent);
++ nfs_fid->mode = (S_IFMT & inode->i_mode);
++ *plen = sizeof(struct lustre_nfs_fid);
++
++ RETURN(LUSTRE_NFS_FID);
++}
++
++#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)
++{
++ struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid *)fid;
++
++ if (fh_type != LUSTRE_NFS_FID)
++ RETURN(ERR_PTR(-EINVAL));
++
++ RETURN(ll_iget_for_nfs(sb, &nfs_fid->child, nfs_fid->mode));
++}
++
++static struct dentry *ll_fh_to_parent(struct super_block *sb, struct fid *fid,
++ int fh_len, int fh_type)
++{
++ struct lustre_nfs_fid *nfs_fid = (struct lustre_nfs_fid *)fid;
++
++ if (fh_type != LUSTRE_NFS_FID)
++ RETURN(ERR_PTR(-EINVAL));
++
++
++ RETURN(ll_iget_for_nfs(sb, &nfs_fid->parent, S_IFDIR));
++}
++
++#else
++
+ /*
+ * This length is counted as amount of __u32,
+ * It is composed of a fid and a mode
+ */
+-#define ONE_FH_LEN (sizeof(struct lu_fid)/4 + 1)
+-
+ static struct dentry *ll_decode_fh(struct super_block *sb, __u32 *fh, int fh_len,
+ int fh_type,
+ int (*acceptable)(void *, struct dentry *),
+ void *context)
+ {
+- struct lu_fid *parent = NULL;
+- struct lu_fid *child;
++ struct lustre_nfs_fid *nfs_fid = (void *)fh;
+ struct dentry *entry;
+ ENTRY;
+
+- CDEBUG(D_INFO, "decoding for "DFID" fh_len=%d fh_type=%d\n",
+- PFID((struct lu_fid*)fh), fh_len, fh_type);
++ CDEBUG(D_INFO, "decoding for "DFID" fh_len=%d fh_type=%x\n",
++ PFID(&nfs_fid->child), fh_len, fh_type);
+
+- if (fh_type != 1 && fh_type != 2)
+- RETURN(ERR_PTR(-ESTALE));
+- if (fh_len < ONE_FH_LEN * fh_type)
++ if (fh_type != LUSTRE_NFS_FID)
+ RETURN(ERR_PTR(-ESTALE));
+
+- child = (struct lu_fid*)fh;
+- if (fh_type == 2)
+- parent = (struct lu_fid*)(fh + ONE_FH_LEN);
+-
+- entry = sb->s_export_op->find_exported_dentry(sb, child, parent,
++ entry = sb->s_export_op->find_exported_dentry(sb, &nfs_fid->child,
++ &nfs_fid->parent,
+ acceptable, context);
+ RETURN(entry);
+ }
+
+-/* The return value is file handle type:
+- * 1 -- contains child file handle;
+- * 2 -- contains child file handle and parent file handle;
+- * 255 -- error.
+- */
+-static int ll_encode_fh(struct dentry *de, __u32 *fh, int *plen, int connectable)
+-{
+- struct inode *inode = de->d_inode;
+- struct lu_fid *fid = ll_inode2fid(inode);
+- ENTRY;
+-
+- CDEBUG(D_INFO, "encoding for (%lu,"DFID") maxlen=%d minlen=%d\n",
+- inode->i_ino, PFID(fid), *plen, (int)ONE_FH_LEN);
+-
+- if (*plen < ONE_FH_LEN)
+- RETURN(255);
+-
+- memcpy((char*)fh, fid, sizeof(*fid));
+- *(fh + ONE_FH_LEN - 1) = (__u32)(S_IFMT & inode->i_mode);
+-
+- if (de->d_parent && *plen >= ONE_FH_LEN * 2) {
+- struct inode *parent = de->d_parent->d_inode;
+- fh += ONE_FH_LEN;
+- memcpy((char*)fh, &ll_i2info(parent)->lli_fid, sizeof(*fid));
+- *(fh + ONE_FH_LEN - 1) = (__u32)(S_IFMT & parent->i_mode);
+- *plen = ONE_FH_LEN * 2;
+- RETURN(2);
+- } else {
+- *plen = ONE_FH_LEN;
+- RETURN(1);
+- }
+-}
+-
+ static struct dentry *ll_get_dentry(struct super_block *sb, void *data)
+ {
+- struct lu_fid *fid;
++ struct lustre_nfs_fid *fid = data;
+ struct dentry *entry;
+- __u32 mode;
+ ENTRY;
+
+- fid = (struct lu_fid *)data;
+- mode = *((__u32*)data + ONE_FH_LEN - 1);
+-
+- entry = ll_iget_for_nfs(sb, fid, mode);
++ entry = ll_iget_for_nfs(sb, &fid->child, fid->mode);
+ RETURN(entry);
+ }
++#endif
+
+ static struct dentry *ll_get_parent(struct dentry *dchild)
+ {
+@@ -232,11 +247,11 @@
+ static char dotdot[] = "..";
+ int rc;
+ ENTRY;
+-
++
+ LASSERT(dir && S_ISDIR(dir->i_mode));
+-
++
+ sbi = ll_s2sbi(dir->i_sb);
+-
++
+ CDEBUG(D_INFO, "getting parent for (%lu,"DFID")\n",
+ dir->i_ino, PFID(ll_inode2fid(dir)));
+
+@@ -249,7 +264,7 @@
+ }
+ body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY);
+ LASSERT(body->valid & OBD_MD_FLID);
+-
++
+ CDEBUG(D_INFO, "parent for "DFID" is "DFID"\n",
+ PFID(ll_inode2fid(dir)), PFID(&body->fid1));
+
+@@ -261,7 +276,12 @@
+
+ struct export_operations lustre_export_operations = {
+ .get_parent = ll_get_parent,
+- .get_dentry = ll_get_dentry,
+ .encode_fh = ll_encode_fh,
++#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,
+ .decode_fh = ll_decode_fh,
++#endif
+ };
diff --git a/debian/patches/patchless_support/splice_read_support.dpatch b/debian/patches/patchless_support/splice_read_support.dpatch
new file mode 100755
index 0000000..9384817
--- /dev/null
+++ b/debian/patches/patchless_support/splice_read_support.dpatch
@@ -0,0 +1,423 @@
+#! /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@
+Index: HEAD/lustre/autoconf/lustre-core.m4
+===================================================================
+--- HEAD.orig/lustre/autoconf/lustre-core.m4 2008-12-17 16:21:23.000000000 +0200
++++ HEAD/lustre/autoconf/lustre-core.m4 2008-12-17 16:21:40.000000000 +0200
+@@ -1388,6 +1388,25 @@
+ ])
+
+ # 2.6.23 change .sendfile to .splice_read
++# RHEL4 (-92 kernel) have both sendfile and .splice_read API
++AC_DEFUN([LC_KERNEL_SENDFILE],
++[AC_MSG_CHECKING([if kernel has .sendfile])
++LB_LINUX_TRY_COMPILE([
++ #include <linux/fs.h>
++],[
++ struct file_operations file;
++
++ file.sendfile = NULL;
++], [
++ AC_MSG_RESULT([yes])
++ AC_DEFINE(HAVE_KERNEL_SENDFILE, 1,
++ [kernel has .sendfile])
++],[
++ AC_MSG_RESULT([no])
++])
++])
++
++# 2.6.23 change .sendfile to .splice_read
+ AC_DEFUN([LC_KERNEL_SPLICE_READ],
+ [AC_MSG_CHECKING([if kernel has .splice_read])
+ LB_LINUX_TRY_COMPILE([
+@@ -1846,6 +1865,7 @@
+ # 2.6.23
+ LC_UNREGISTER_BLKDEV_RETURN_INT
+ LC_KERNEL_SPLICE_READ
++ LC_KERNEL_SENDFILE
+ LC_HAVE_EXPORTFS_H
+ LC_VM_OP_FAULT
+ LC_REGISTER_SHRINKER
+Index: HEAD/lustre/obdclass/cl_io.c
+===================================================================
+--- HEAD.orig/lustre/obdclass/cl_io.c 2008-11-12 22:58:06.000000000 +0200
++++ HEAD/lustre/obdclass/cl_io.c 2008-12-17 16:21:40.000000000 +0200
+@@ -75,15 +75,6 @@
+ }
+
+ /**
+- * True, iff \a io is a sendfile().
+- */
+-int cl_io_is_sendfile(const struct cl_io *io)
+-{
+- return io->ci_type == CIT_READ && io->u.ci_rd.rd_is_sendfile;
+-}
+-EXPORT_SYMBOL(cl_io_is_sendfile);
+-
+-/**
+ * Returns true iff there is an IO ongoing in the given environment.
+ */
+ int cl_io_is_going(const struct lu_env *env)
+Index: HEAD/lustre/include/cl_object.h
+===================================================================
+--- HEAD.orig/lustre/include/cl_object.h 2008-11-08 01:52:38.000000000 +0200
++++ HEAD/lustre/include/cl_object.h 2008-12-17 16:21:40.000000000 +0200
+@@ -2177,6 +2177,16 @@
+ int crw_nonblock;
+ };
+
++/* IO subtypes */
++enum cl_io_subtype {
++ /** normal IO */
++ IO_NORMAL,
++ /** io called from .sendfile */
++ IO_SENDFILE,
++ /** io started from splice_{read|write} */
++ IO_SPLICE
++};
++
+ /**
+ * State for io.
+ *
+@@ -2207,7 +2217,6 @@
+ union {
+ struct cl_rd_io {
+ struct cl_io_rw_common rd;
+- int rd_is_sendfile;
+ } ci_rd;
+ struct cl_wr_io {
+ struct cl_io_rw_common wr;
+@@ -2860,8 +2869,6 @@
+ return io->ci_type == CIT_WRITE && io->u.ci_wr.wr_append;
+ }
+
+-int cl_io_is_sendfile(const struct cl_io *io);
+-
+ struct cl_io *cl_io_top(struct cl_io *io);
+
+ void cl_io_print(const struct lu_env *env, void *cookie,
+Index: HEAD/lustre/include/lclient.h
+===================================================================
+--- HEAD.orig/lustre/include/lclient.h 2008-12-11 06:02:39.000000000 +0200
++++ HEAD/lustre/include/lclient.h 2008-12-17 16:21:40.000000000 +0200
+@@ -51,14 +51,19 @@
+ * Common IO arguments for various VFS I/O interfaces.
+ */
+ struct ccc_io_args {
+- int cia_is_sendfile;
++ /** normal/sendfile/splice */
++ enum cl_io_subtype cia_io_subtype;
+ #ifndef HAVE_FILE_WRITEV
+- struct kiocb *cia_iocb;
++ struct kiocb *cia_iocb;
+ #endif
+- struct iovec *cia_iov;
+- unsigned long cia_nrsegs;
+- read_actor_t cia_actor;
+- void *cia_target;
++ struct iovec *cia_iov;
++ unsigned long cia_nrsegs;
++ /* sendfile */
++ read_actor_t cia_actor;
++ void *cia_target;
++ /* splice */
++ struct pipe_inode_info *cia_pipe;
++ unsigned int cia_flags;
+ };
+
+ /**
+Index: HEAD/lustre/llite/vvp_io.c
+===================================================================
+--- HEAD.orig/lustre/llite/vvp_io.c 2008-11-12 23:00:37.000000000 +0200
++++ HEAD/lustre/llite/vvp_io.c 2008-12-17 16:21:40.000000000 +0200
+@@ -52,6 +52,16 @@
+ static struct vvp_io *cl2vvp_io(const struct lu_env *env,
+ const struct cl_io_slice *slice);
+
++/**
++ * True, if \a io is a normal io, False for sendfile() / splice_{read|write}
++ */
++static int vvp_io_is_normalio(const struct lu_env *env, const struct cl_io *io)
++{
++ struct vvp_io *vio = vvp_env_io(env);
++
++ return vio->ci_io_subtype == IO_NORMAL;
++}
++
+ /*****************************************************************************
+ *
+ * io operations.
+@@ -132,7 +142,7 @@
+
+ LASSERT(io->ci_type == CIT_READ || io->ci_type == CIT_WRITE);
+
+- if (cl_io_is_sendfile(io))
++ if (!vvp_io_is_normalio(env, io))
+ RETURN(0);
+
+ for (seg = 0; seg < vio->cui_nrsegs; seg++) {
+@@ -180,7 +190,7 @@
+ size_t size = io->u.ci_rw.crw_count;
+
+ vio->cui_iov_olen = 0;
+- if (cl_io_is_sendfile(io) || size == vio->cui_tot_count)
++ if (!vvp_io_is_normalio(env, io) || size == vio->cui_tot_count)
+ return;
+
+ if (vio->cui_tot_nrsegs == 0)
+@@ -476,11 +486,27 @@
+
+ /* BUG: 5972 */
+ file_accessed(file);
+- if (cl_io_is_sendfile(io)) {
++ switch(vio->ci_io_subtype) {
++ case IO_NORMAL:
++ result = lustre_generic_file_read(file, cio, &pos);
++ break;
++#ifdef HAVE_KERNEL_SENDFILE
++ case IO_SENDFILE:
+ result = generic_file_sendfile(file, &pos, cnt,
+- vio->u.read.cui_actor, vio->u.read.cui_target);
+- } else {
+- result = lustre_generic_file_read(file, cio, &pos);
++ vio->u.sendfile.cui_actor,
++ vio->u.sendfile.cui_target);
++ break;
++#endif
++#ifdef HAVE_KERNEL_SPLICE_READ
++ case IO_SPLICE:
++ result = generic_file_splice_read(file, &pos,
++ vio->u.splice.pipe, cnt,
++ vio->u.splice.flags);
++ break;
++#endif
++ default:
++ CERROR("Wrong IO type %u\n", vio->ci_io_subtype);
++ LBUG();
+ }
+
+ if (result >= 0) {
+@@ -622,7 +648,7 @@
+
+ CLOBINVRNT(env, obj, ccc_object_invariant(obj));
+
+- if (!cl_io_is_sendfile(io) && io->ci_continue) {
++ if (vvp_io_is_normalio(env, io) && io->ci_continue) {
+ /* update the iov */
+ LASSERT(vio->cui_tot_nrsegs >= vio->cui_nrsegs);
+ LASSERT(vio->cui_tot_count >= nob);
+Index: HEAD/lustre/llite/llite_internal.h
+===================================================================
+--- HEAD.orig/lustre/llite/llite_internal.h 2008-12-17 16:21:24.000000000 +0200
++++ HEAD/lustre/llite/llite_internal.h 2008-12-17 16:21:40.000000000 +0200
+@@ -791,11 +791,22 @@
+ void vvp_write_complete(struct ccc_object *club, struct ccc_page *page);
+
+ struct vvp_io {
++ /** io subtype */
++ enum cl_io_subtype ci_io_subtype;
++
+ union {
++#ifdef HAVE_KERNEL_SENDFILE
+ struct {
+ read_actor_t cui_actor;
+ void *cui_target;
+- } read;
++ } sendfile;
++#endif
++#ifdef HAVE_KERNEL_SPLICE_READ
++ struct {
++ struct pipe_inode_info *pipe;
++ unsigned int flags;
++ } splice;
++#endif
+ struct vvp_fault_io {
+ /**
+ * Inode modification time that is checked across DLM
+Index: HEAD/lustre/llite/file.c
+===================================================================
+--- HEAD.orig/lustre/llite/file.c 2008-11-20 14:34:31.000000000 +0200
++++ HEAD/lustre/llite/file.c 2008-12-17 16:26:49.000000000 +0200
+@@ -807,27 +807,43 @@
+ io = &ccc_env_info(env)->cti_io;
+ ll_io_init(io, file, iot == CIT_WRITE);
+
+- if (iot == CIT_READ)
+- io->u.ci_rd.rd_is_sendfile = args->cia_is_sendfile;
+-
+ if (cl_io_rw_init(env, io, iot, *ppos, count) == 0) {
+ struct vvp_io *vio = vvp_env_io(env);
+ struct ccc_io *cio = ccc_env_io(env);
+- if (cl_io_is_sendfile(io)) {
+- vio->u.read.cui_actor = args->cia_actor;
+- vio->u.read.cui_target = args->cia_target;
+- } else {
++
++ vio->ci_io_subtype = args->cia_io_subtype;
++
++ switch(vio->ci_io_subtype) {
++ case IO_NORMAL:
+ cio->cui_iov = args->cia_iov;
+ cio->cui_nrsegs = args->cia_nrsegs;
+ #ifndef HAVE_FILE_WRITEV
+ cio->cui_iocb = args->cia_iocb;
+ #endif
++ break;
++#ifdef HAVE_KERNEL_SENDFILE
++ case IO_SENDFILE:
++ vio->u.sendfile.cui_actor = args->cia_actor;
++ vio->u.sendfile.cui_target = args->cia_target;
++ break;
++#endif
++#ifdef HAVE_KERNEL_SPLICE_READ
++ case IO_SPLICE:
++ vio->u.splice.pipe = args->cia_pipe;
++ vio->u.splice.flags = args->cia_flags;
++ break;
++#endif
++ default:
++ CERROR("Unknow IO type - %u\n", vio->ci_io_subtype);
++ LBUG();
+ }
+ cio->cui_fd = LUSTRE_FPRIVATE(file);
+ result = cl_io_loop(env, io);
+- } else
++ } else {
+ /* cl_io_rw_init() handled IO */
+ result = io->ci_result;
++ }
++
+ if (io->ci_nob > 0) {
+ result = io->ci_nob;
+ *ppos = io->u.ci_wr.wr.crw_pos;
+@@ -888,7 +904,7 @@
+ RETURN(PTR_ERR(env));
+
+ args = &vvp_env_info(env)->vti_args;
+- args->cia_is_sendfile = 0;
++ args->cia_io_subtype = IO_NORMAL;
+ args->cia_iov = (struct iovec *)iov;
+ args->cia_nrsegs = nr_segs;
+ result = ll_file_io_generic(env, args, file, CIT_READ, ppos, count);
+@@ -937,7 +953,7 @@
+ RETURN(PTR_ERR(env));
+
+ args = &vvp_env_info(env)->vti_args;
+- args->cia_is_sendfile = 0;
++ args->cia_io_subtype = IO_NORMAL;
+ args->cia_iov = (struct iovec *)iov;
+ args->cia_nrsegs = nr_segs;
+ args->cia_iocb = iocb;
+@@ -1002,6 +1018,7 @@
+ args = &vvp_env_info(env)->vti_args;
+ args->cia_iov = (struct iovec *)iov;
+ args->cia_nrsegs = nr_segs;
++ args->cia_io_subtype = IO_NORMAL;
+ result = ll_file_io_generic(env, args, file, CIT_WRITE, ppos, count);
+ cl_env_put(env, &refcheck);
+ RETURN(result);
+@@ -1052,6 +1069,7 @@
+ args->cia_iov = (struct iovec *)iov;
+ args->cia_nrsegs = nr_segs;
+ args->cia_iocb = iocb;
++ args->cia_io_subtype = IO_NORMAL;
+ result = ll_file_io_generic(env, args, iocb->ki_filp, CIT_WRITE,
+ &iocb->ki_pos, count);
+ cl_env_put(env, &refcheck);
+@@ -1089,6 +1107,7 @@
+ #endif
+
+
++#ifdef HAVE_KERNEL_SENDFILE
+ /*
+ * Send file content (through pagecache) somewhere with helper
+ */
+@@ -1106,13 +1125,43 @@
+ RETURN(PTR_ERR(env));
+
+ args = &vvp_env_info(env)->vti_args;
+- args->cia_is_sendfile = 1;
++ args->cia_io_subtype = IO_SENDFILE;
+ args->cia_target = target;
+ args->cia_actor = actor;
+ result = ll_file_io_generic(env, args, in_file, CIT_READ, ppos, count);
+ cl_env_put(env, &refcheck);
+ RETURN(result);
+ }
++#endif
++
++#ifdef HAVE_KERNEL_SPLICE_READ
++/*
++ * Send file content (through pagecache) somewhere with helper
++ */
++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)
++{
++ struct lu_env *env;
++ struct ccc_io_args *args;
++ ssize_t result;
++ int refcheck;
++ ENTRY;
++
++ env = cl_env_get(&refcheck);
++ if (IS_ERR(env))
++ RETURN(PTR_ERR(env));
++
++ args = &vvp_env_info(env)->vti_args;
++ args->cia_io_subtype = IO_SPLICE;
++ args->cia_pipe = pipe;
++ args->cia_flags = flags;
++
++ result = ll_file_io_generic(env, args, in_file, CIT_READ, ppos, count);
++ cl_env_put(env, &refcheck);
++ RETURN(result);
++}
++#endif
+
+ static int ll_lov_recreate_obj(struct inode *inode, struct file *file,
+ unsigned long arg)
+@@ -2390,7 +2439,12 @@
+ .release = ll_file_release,
+ .mmap = ll_file_mmap,
+ .llseek = ll_file_seek,
++#ifdef HAVE_KERNEL_SENDFILE
+ .sendfile = ll_file_sendfile,
++#endif
++#ifdef HAVE_KERNEL_SPLICE_READ
++ .splice_read = ll_file_splice_read,
++#endif
+ .fsync = ll_fsync,
+ };
+
+@@ -2404,7 +2458,12 @@
+ .release = ll_file_release,
+ .mmap = ll_file_mmap,
+ .llseek = ll_file_seek,
++#ifdef HAVE_KERNEL_SENDFILE
+ .sendfile = ll_file_sendfile,
++#endif
++#ifdef HAVE_KERNEL_SPLICE_READ
++ .splice_read = ll_file_splice_read,
++#endif
+ .fsync = ll_fsync,
+ #ifdef HAVE_F_OP_FLOCK
+ .flock = ll_file_flock,
+@@ -2423,7 +2482,12 @@
+ .release = ll_file_release,
+ .mmap = ll_file_mmap,
+ .llseek = ll_file_seek,
++#ifdef HAVE_KERNEL_SENDFILE
+ .sendfile = ll_file_sendfile,
++#endif
++#ifdef HAVE_KERNEL_SPLICE_READ
++ .splice_read = ll_file_splice_read,
++#endif
+ .fsync = ll_fsync,
+ #ifdef HAVE_F_OP_FLOCK
+ .flock = ll_file_noflock,
diff --git a/debian/patches/patchless_support/sysctl_update.dpatch b/debian/patches/patchless_support/sysctl_update.dpatch
new file mode 100755
index 0000000..23078a7
--- /dev/null
+++ b/debian/patches/patchless_support/sysctl_update.dpatch
@@ -0,0 +1,278 @@
+#! /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@
+Index: HEAD/lustre/obdclass/linux/linux-sysctl.c
+===================================================================
+--- HEAD.orig/lustre/obdclass/linux/linux-sysctl.c 2008-08-12 11:40:23.000000000 +0400
++++ HEAD/lustre/obdclass/linux/linux-sysctl.c 2008-12-05 21:13:18.000000000 +0300
+@@ -56,7 +56,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 */
+@@ -74,6 +76,23 @@
+ OBD_ALLOC_FAIL_RATE, /* memory allocation random failure rate */
+ OBD_MAX_DIRTY_PAGES, /* maximum dirty pages */
+ };
++#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
++#define OBD_MAX_DIRTY_PAGES CTL_UNNUMBERED
++#endif
+
+ int LL_PROC_PROTO(proc_fail_loc)
+ {
+@@ -100,6 +119,7 @@
+ {
+ char buf[22];
+ int len;
++ struct ctl_table dummy;
+ DECLARE_LL_PROC_PPOS_DECL;
+
+ if (!*lenp || (*ppos && !write)) {
+@@ -113,17 +133,19 @@
+ if (len > *lenp)
+ len = *lenp;
+ buf[len] = '\0';
+- if (copy_to_user(buffer, buf, len))
+- return -EFAULT;
+- *lenp = len;
+- *ppos += *lenp;
+- return 0;
++
++ dummy = *table;
++ dummy.data = buf;
++ dummy.maxlen = sizeof(buf);
++
++ return ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
+ }
+
+ int LL_PROC_PROTO(proc_pages_alloc)
+ {
+ char buf[22];
+ int len;
++ struct ctl_table dummy;
+ DECLARE_LL_PROC_PPOS_DECL;
+
+ if (!*lenp || (*ppos && !write)) {
+@@ -137,17 +159,19 @@
+ if (len > *lenp)
+ len = *lenp;
+ buf[len] = '\0';
+- if (copy_to_user(buffer, buf, len))
+- return -EFAULT;
+- *lenp = len;
+- *ppos += *lenp;
+- return 0;
++
++ dummy = *table;
++ dummy.data = buf;
++ dummy.maxlen = sizeof(buf);
++
++ return ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
+ }
+
+ int LL_PROC_PROTO(proc_mem_max)
+ {
+ char buf[22];
+ int len;
++ struct ctl_table dummy;
+ DECLARE_LL_PROC_PPOS_DECL;
+
+ if (!*lenp || (*ppos && !write)) {
+@@ -161,17 +185,19 @@
+ if (len > *lenp)
+ len = *lenp;
+ buf[len] = '\0';
+- if (copy_to_user(buffer, buf, len))
+- return -EFAULT;
+- *lenp = len;
+- *ppos += *lenp;
+- return 0;
++
++ dummy = *table;
++ dummy.data = buf;
++ dummy.maxlen = sizeof(buf);
++
++ return ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
+ }
+
+ int LL_PROC_PROTO(proc_pages_max)
+ {
+ char buf[22];
+ int len;
++ struct ctl_table dummy;
+ DECLARE_LL_PROC_PPOS_DECL;
+
+ if (!*lenp || (*ppos && !write)) {
+@@ -185,11 +211,12 @@
+ if (len > *lenp)
+ len = *lenp;
+ buf[len] = '\0';
+- if (copy_to_user(buffer, buf, len))
+- return -EFAULT;
+- *lenp = len;
+- *ppos += *lenp;
+- return 0;
++
++ dummy = *table;
++ dummy.data = buf;
++ dummy.maxlen = sizeof(buf);
++
++ return ll_proc_dostring(&dummy,write,filp,buffer,lenp, ppos);
+ }
+
+ int LL_PROC_PROTO(proc_max_dirty_pages_in_mb)
+@@ -216,7 +243,8 @@
+ obd_max_dirty_pages = 4 << (20 - CFS_PAGE_SHIFT);
+ }
+ } else {
+- char buf[21];
++ char buf[22];
++ struct ctl_table dummy;
+ int len;
+
+ len = lprocfs_read_frac_helper(buf, sizeof(buf),
+@@ -225,7 +253,13 @@
+ 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;
+ }
+@@ -248,7 +282,8 @@
+ (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, 21,
+@@ -257,7 +292,12 @@
+ 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;
+ }
+@@ -281,7 +321,8 @@
+ .data = &obd_fail_val,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+- .proc_handler = &proc_dointvec
++ .proc_handler = &proc_dointvec,
++ .strategy = &sysctl_intvec,
+ },
+ {
+ .ctl_name = OBD_TIMEOUT,
+@@ -297,7 +338,7 @@
+ .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,
+@@ -305,7 +346,7 @@
+ .data = &obd_dump_on_timeout,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+- .proc_handler = &proc_dointvec
++ .proc_handler = &proc_dointvec,
+ },
+ {
+ .ctl_name = OBD_DUMP_ON_EVICTION,
+@@ -313,7 +354,7 @@
+ .data = &obd_dump_on_eviction,
+ .maxlen = sizeof(int),
+ .mode = 0644,
+- .proc_handler = &proc_dointvec
++ .proc_handler = &proc_dointvec,
+ },
+ {
+ .ctl_name = OBD_MEMUSED,
+@@ -321,7 +362,7 @@
+ .data = NULL,
+ .maxlen = 0,
+ .mode = 0444,
+- .proc_handler = &proc_memory_alloc
++ .proc_handler = &proc_memory_alloc,
+ },
+ {
+ .ctl_name = OBD_PAGESUSED,
+@@ -329,7 +370,7 @@
+ .data = NULL,
+ .maxlen = 0,
+ .mode = 0444,
+- .proc_handler = &proc_pages_alloc
++ .proc_handler = &proc_pages_alloc,
+ },
+ {
+ .ctl_name = OBD_MAXMEMUSED,
+@@ -337,7 +378,7 @@
+ .data = NULL,
+ .maxlen = 0,
+ .mode = 0444,
+- .proc_handler = &proc_mem_max
++ .proc_handler = &proc_mem_max,
+ },
+ {
+ .ctl_name = OBD_MAXPAGESUSED,
+@@ -345,7 +386,7 @@
+ .data = NULL,
+ .maxlen = 0,
+ .mode = 0444,
+- .proc_handler = &proc_pages_max
++ .proc_handler = &proc_pages_max,
+ },
+ {
+ .ctl_name = OBD_LDLM_TIMEOUT,
+@@ -378,7 +419,7 @@
+
+ static cfs_sysctl_table_t parent_table[] = {
+ {
+- .ctl_name = OBD_SYSCTL,
++ .ctl_name = CTL_LUSTRE,
+ .procname = "lustre",
+ .data = NULL,
+ .maxlen = 0,
--
Lustre Debian Packaging
More information about the Pkg-lustre-svn-commit
mailing list