commit:     4aaa26bb549388f3d1ef568a1f0b7bcfadf93536
Author:     Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
AuthorDate: Wed Jun 29 10:28:22 2016 +0000
Commit:     Alexey Shvetsov <alexxy <AT> gentoo <DOT> org>
CommitDate: Wed Jun 29 10:28:22 2016 +0000
URL:        https://gitweb.gentoo.org/proj/sci.git/commit/?id=4aaa26bb

sys-cluster/lustre: Add lustre 2.8.0

Client works with 4.1.x kernels (tested).
Also two init scripts added to load and start lnet
and load lustre modules

Package-Manager: portage-2.3.0_rc1

 ...8056-libcfs-Support-for-linux-4.2-kernels.patch |  80 -----
 ...56-o2iblnd-ib_query_device-removed-in-4.5.patch | 138 --------
 ...klnd-NETIF_F_ALL_CSUM-renamed-to-NETIF_F_.patch |  49 ---
 ...56-llite-use-inode_lock-to-access-i_mutex.patch | 354 ---------------------
 ...te-inode_operations-interface-changed-in-.patch | 165 ----------
 ...te-POSIX_ACL_XATTR_-ACCESS-DEFAULT-remove.patch |  53 ---
 ...op-fix-bio_for_each_segment_all-for-newer.patch |  64 ----
 .../files/0008-Fix-build-error-with-gcc-6.1.patch  |  31 --
 sys-cluster/lustre/files/lnet.initd                |  46 +++
 sys-cluster/lustre/files/lustre-client.initd       |  48 +++
 .../{lustre-2.8.54.ebuild => lustre-2.8.0.ebuild}  |  28 +-
 sys-cluster/lustre/lustre-9999.ebuild              |  21 +-
 12 files changed, 124 insertions(+), 953 deletions(-)

diff --git 
a/sys-cluster/lustre/files/0001-LU-8056-libcfs-Support-for-linux-4.2-kernels.patch
 
b/sys-cluster/lustre/files/0001-LU-8056-libcfs-Support-for-linux-4.2-kernels.patch
deleted file mode 100644
index 4e07906..0000000
--- 
a/sys-cluster/lustre/files/0001-LU-8056-libcfs-Support-for-linux-4.2-kernels.patch
+++ /dev/null
@@ -1,80 +0,0 @@
-From 9b478d607922c9683663f8e317d93b840e528884 Mon Sep 17 00:00:00 2001
-From: Dmitry Eremin <[email protected]>
-Date: Thu, 5 May 2016 22:08:05 +0300
-Subject: [PATCH 1/8] LU-8056 libcfs: Support for linux 4.2 kernels
-
-In kernel version 4.2 commit df6b35f409af0a8ff1ef62f552b8402f3fef8665
-header file i387.h was renamed to fpu/api.h
-
-Change-Id: Id4f5f6e73f3c2aeac67b5c87b9c1d310a0a50a50
-Signed-off-by: Dmitry Eremin <[email protected]>
----
- libcfs/autoconf/lustre-libcfs.m4                 | 11 +++++++++++
- libcfs/libcfs/linux/linux-crypto-crc32c-pclmul.c |  4 ++++
- libcfs/libcfs/linux/linux-crypto-crc32pclmul.c   |  4 ++++
- 3 files changed, 19 insertions(+)
-
-diff --git a/libcfs/autoconf/lustre-libcfs.m4 
b/libcfs/autoconf/lustre-libcfs.m4
-index 636d0ed..cc0e184 100644
---- a/libcfs/autoconf/lustre-libcfs.m4
-+++ b/libcfs/autoconf/lustre-libcfs.m4
-@@ -312,6 +312,16 @@ topology_sibling_cpumask, [
- ]) # LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
- 
- #
-+# Kernel version 4.2 commit df6b35f409af0a8ff1ef62f552b8402f3fef8665
-+# header file i387.h was renamed to fpu/api.h
-+#
-+AC_DEFUN([LIBCFS_FPU_API], [
-+LB_CHECK_LINUX_HEADER([asm/fpu/api.h], [
-+      AC_DEFINE(HAVE_FPU_API_HEADER, 1,
-+              [fpu/api.h is present])])
-+]) # LIBCFS_FPU_API
-+
-+#
- # LIBCFS_PROG_LINUX
- #
- # LibCFS linux kernel checks
-@@ -350,6 +360,7 @@ LIBCFS_SHRINKER_COUNT
- LIBCFS_HLIST_ADD_AFTER
- # 4.2
- LIBCFS_HAVE_TOPOLOGY_SIBLING_CPUMASK
-+LIBCFS_FPU_API
- ]) # LIBCFS_PROG_LINUX
- 
- #
-diff --git a/libcfs/libcfs/linux/linux-crypto-crc32c-pclmul.c 
b/libcfs/libcfs/linux/linux-crypto-crc32c-pclmul.c
-index 9858db4..fc55ad7 100644
---- a/libcfs/libcfs/linux/linux-crypto-crc32c-pclmul.c
-+++ b/libcfs/libcfs/linux/linux-crypto-crc32c-pclmul.c
-@@ -30,7 +30,11 @@
- #include <crypto/internal/hash.h>
- #include <linux/crc32.h>
- #include <asm/cpufeature.h>
-+#ifdef HAVE_FPU_API_HEADER
-+#include <asm/fpu/api.h>
-+#else
- #include <asm/i387.h>
-+#endif
- #include <libcfs/libcfs.h>
- 
- #define CHKSUM_BLOCK_SIZE     1
-diff --git a/libcfs/libcfs/linux/linux-crypto-crc32pclmul.c 
b/libcfs/libcfs/linux/linux-crypto-crc32pclmul.c
-index 1a609bf..0b3abaf 100644
---- a/libcfs/libcfs/linux/linux-crypto-crc32pclmul.c
-+++ b/libcfs/libcfs/linux/linux-crypto-crc32pclmul.c
-@@ -32,7 +32,11 @@
- #include <crypto/internal/hash.h>
- #include <linux/crc32.h>
- #include <asm/cpufeature.h>
-+#ifdef HAVE_FPU_API_HEADER
-+#include <asm/fpu/api.h>
-+#else
- #include <asm/i387.h>
-+#endif
- #include <libcfs/libcfs.h>
- 
- #define CHKSUM_BLOCK_SIZE     1
--- 
-2.8.2
-

diff --git 
a/sys-cluster/lustre/files/0002-LU-8056-o2iblnd-ib_query_device-removed-in-4.5.patch
 
b/sys-cluster/lustre/files/0002-LU-8056-o2iblnd-ib_query_device-removed-in-4.5.patch
deleted file mode 100644
index 5c0fcf9..0000000
--- 
a/sys-cluster/lustre/files/0002-LU-8056-o2iblnd-ib_query_device-removed-in-4.5.patch
+++ /dev/null
@@ -1,138 +0,0 @@
-From 0242d060692573dcb6f09750a62db1fa0f6d36df Mon Sep 17 00:00:00 2001
-From: Li Dongyang <[email protected]>
-Date: Mon, 16 May 2016 17:18:39 +1000
-Subject: [PATCH 2/8] LU-8056 o2iblnd: ib_query_device removed in 4.5
-
-We should use the cached attributes in ib_device instead of
-calling ib_query_device since kernel 4.5
-
-Linux-commit:182a2da0c768a9ec64abb0d6009667057f1c06af
-Linux-commit:cebfe5ca038e2a0f677b41e9682501708ffa2ff3
-
-Signed-off-by: Li Dongyang <[email protected]>
-Change-Id: Ie2ab681a3b508f0a1f89d3ff86bf2713b7257e62
----
- lnet/autoconf/lustre-lnet.m4 | 22 ++++++++++++++++++++++
- lnet/klnds/o2iblnd/o2iblnd.c | 20 ++++++++++++++++++--
- 2 files changed, 40 insertions(+), 2 deletions(-)
-
-diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4
-index 05b47db..30ad208 100644
---- a/lnet/autoconf/lustre-lnet.m4
-+++ b/lnet/autoconf/lustre-lnet.m4
-@@ -460,6 +460,28 @@ AS_IF([test $ENABLEO2IB != "no"], [
-               AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
-                       [ib_map_mr_sg exists])
-       ])
-+
-+      # ib_query_device() removed in 4.5
-+      LB_CHECK_COMPILE([if 'struct ib_device' has member 'attrs'],
-+      ib_device.attrs, [
-+              #ifdef HAVE_COMPAT_RDMA
-+              #undef PACKAGE_NAME
-+              #undef PACKAGE_TARNAME
-+              #undef PACKAGE_VERSION
-+              #undef PACKAGE_STRING
-+              #undef PACKAGE_BUGREPORT
-+              #undef PACKAGE_URL
-+              #include <linux/compat-2.6.h>
-+              #endif
-+              #include <rdma/ib_verbs.h>
-+      ],[
-+              struct ib_device dev;
-+              struct ib_device_attr dev_attr = {};
-+              dev.attrs = dev_attr;
-+      ],[
-+              AC_DEFINE(HAVE_IB_DEVICE_ATTRS, 1,
-+                      [struct ib_device.attrs is defined])
-+      ])
- ]) # ENABLEO2IB != "no"
- ]) # LN_CONFIG_O2IB
- 
-diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c
-index 92254b8..b174799 100644
---- a/lnet/klnds/o2iblnd/o2iblnd.c
-+++ b/lnet/klnds/o2iblnd/o2iblnd.c
-@@ -1579,9 +1579,11 @@ kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, 
kib_fmr_pool_t **pp_fpo)
-       kib_fmr_pool_t *fpo;
-       int rc;
- 
-+#ifndef HAVE_IB_DEVICE_ATTRS
-       dev_attr = kmalloc(sizeof(*dev_attr), GFP_KERNEL);
-       if (!dev_attr)
-               return -ENOMEM;
-+#endif
- 
-       LIBCFS_CPT_ALLOC(fpo, lnet_cpt_table(), fps->fps_cpt, sizeof(*fpo));
-       if (!fpo) {
-@@ -1591,12 +1593,16 @@ kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, 
kib_fmr_pool_t **pp_fpo)
- 
-       fpo->fpo_hdev = kiblnd_current_hdev(dev);
- 
-+#ifdef HAVE_IB_DEVICE_ATTRS
-+      dev_attr = &fpo->fpo_hdev->ibh_ibdev->attrs;
-+#else
-       rc = ib_query_device(fpo->fpo_hdev->ibh_ibdev, dev_attr);
-       if (rc) {
-               CERROR("Query device failed for %s: %d\n",
-                       fpo->fpo_hdev->ibh_ibdev->name, rc);
-               goto out_dev_attr;
-       }
-+#endif
- 
-       /* Check for FMR or FastReg support */
-       fpo->fpo_is_fmr = 0;
-@@ -1621,7 +1627,9 @@ kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, 
kib_fmr_pool_t **pp_fpo)
-       if (rc)
-               goto out_fpo;
- 
-+#ifndef HAVE_IB_DEVICE_ATTRS
-       kfree(dev_attr);
-+#endif
-       fpo->fpo_deadline = cfs_time_shift(IBLND_POOL_DEADLINE);
-       fpo->fpo_owner    = fps;
-       *pp_fpo = fpo;
-@@ -1633,7 +1641,9 @@ out_fpo:
-       LIBCFS_FREE(fpo, sizeof(*fpo));
- 
- out_dev_attr:
-+#ifndef HAVE_IB_DEVICE_ATTRS
-       kfree(dev_attr);
-+#endif
- 
-       return rc;
- }
-@@ -2462,8 +2472,10 @@ kiblnd_net_init_pools(kib_net_t *net, lnet_ni_t *ni, 
__u32 *cpts, int ncpts)
- static int
- kiblnd_hdev_get_attr(kib_hca_dev_t *hdev)
- {
--        struct ib_device_attr *attr;
--        int                    rc;
-+#ifndef HAVE_IB_DEVICE_ATTRS
-+      struct ib_device_attr *attr;
-+      int                    rc;
-+#endif
- 
-         /* It's safe to assume a HCA can handle a page size
-          * matching that of the native system */
-@@ -2471,6 +2483,9 @@ kiblnd_hdev_get_attr(kib_hca_dev_t *hdev)
-         hdev->ibh_page_size  = 1 << PAGE_SHIFT;
-         hdev->ibh_page_mask  = ~((__u64)hdev->ibh_page_size - 1);
- 
-+#ifdef HAVE_IB_DEVICE_ATTRS
-+      hdev->ibh_mr_size = hdev->ibh_ibdev->attrs.max_mr_size;
-+#else
-         LIBCFS_ALLOC(attr, sizeof(*attr));
-         if (attr == NULL) {
-                 CERROR("Out of memory\n");
-@@ -2487,6 +2502,7 @@ kiblnd_hdev_get_attr(kib_hca_dev_t *hdev)
-                 CERROR("Failed to query IB device: %d\n", rc);
-                 return rc;
-         }
-+#endif
- 
-         if (hdev->ibh_mr_size == ~0ULL) {
-                 hdev->ibh_mr_shift = 64;
--- 
-2.8.2
-

diff --git 
a/sys-cluster/lustre/files/0003-LU-8056-socklnd-NETIF_F_ALL_CSUM-renamed-to-NETIF_F_.patch
 
b/sys-cluster/lustre/files/0003-LU-8056-socklnd-NETIF_F_ALL_CSUM-renamed-to-NETIF_F_.patch
deleted file mode 100644
index 6101219..0000000
--- 
a/sys-cluster/lustre/files/0003-LU-8056-socklnd-NETIF_F_ALL_CSUM-renamed-to-NETIF_F_.patch
+++ /dev/null
@@ -1,49 +0,0 @@
-From 6c3f19ba5b6db287980241e4d20be9ac5d0c1293 Mon Sep 17 00:00:00 2001
-From: Li Dongyang <[email protected]>
-Date: Mon, 16 May 2016 17:27:23 +1000
-Subject: [PATCH 3/8] LU-8056 socklnd: NETIF_F_ALL_CSUM renamed to
- NETIF_F_CSUM_MASK
-
-In kernel 4.5 NETIF_F_CSUM_MASK got renamed to NETIF_F_CSUM_MASK.
-This patch handles the name change.
-
-Linux-commit:a188222b6ed29404ac2d4232d35d1fe0e77af370
-
-Signed-off-by: Li Dongyang <[email protected]>
-Change-Id: Id57505eeca613303c584d3cf74284920a837bb43
----
- lnet/klnds/socklnd/socklnd.h     | 4 ++++
- lnet/klnds/socklnd/socklnd_lib.c | 2 +-
- 2 files changed, 5 insertions(+), 1 deletion(-)
-
-diff --git a/lnet/klnds/socklnd/socklnd.h b/lnet/klnds/socklnd/socklnd.h
-index f02003a..54794c0 100644
---- a/lnet/klnds/socklnd/socklnd.h
-+++ b/lnet/klnds/socklnd/socklnd.h
-@@ -66,6 +66,10 @@
-       tcp_sendpage(sk, page, offset, size, flags)
- #endif /* HAVE_TCP_SENDPAGE_USE_SOCKET */
- 
-+#ifndef NETIF_F_CSUM_MASK
-+# define NETIF_F_CSUM_MASK NETIF_F_ALL_CSUM
-+#endif
-+
- /* assume one thread for each connection type */
- #define SOCKNAL_NSCHEDS               3
- #define SOCKNAL_NSCHEDS_HIGH  (SOCKNAL_NSCHEDS << 1)
-diff --git a/lnet/klnds/socklnd/socklnd_lib.c 
b/lnet/klnds/socklnd/socklnd_lib.c
-index 9dca0e4..e26db71 100644
---- a/lnet/klnds/socklnd/socklnd_lib.c
-+++ b/lnet/klnds/socklnd/socklnd_lib.c
-@@ -71,7 +71,7 @@ ksocknal_lib_zc_capable(ksock_conn_t *conn)
- 
-       /* ZC if the socket supports scatter/gather and doesn't need software
-        * checksums */
--      return ((caps & NETIF_F_SG) != 0 && (caps & NETIF_F_ALL_CSUM) != 0);
-+      return ((caps & NETIF_F_SG) != 0 && (caps & NETIF_F_CSUM_MASK) != 0);
- }
- 
- int
--- 
-2.8.2
-

diff --git 
a/sys-cluster/lustre/files/0004-LU-8056-llite-use-inode_lock-to-access-i_mutex.patch
 
b/sys-cluster/lustre/files/0004-LU-8056-llite-use-inode_lock-to-access-i_mutex.patch
deleted file mode 100644
index 361061f..0000000
--- 
a/sys-cluster/lustre/files/0004-LU-8056-llite-use-inode_lock-to-access-i_mutex.patch
+++ /dev/null
@@ -1,354 +0,0 @@
-From ab0006e3a3bf5b0ff63f0914a9e7246dfa1729f8 Mon Sep 17 00:00:00 2001
-From: Li Dongyang <[email protected]>
-Date: Mon, 16 May 2016 17:40:55 +1000
-Subject: [PATCH 4/8] LU-8056 llite: use inode_lock to access i_mutex
-
-Linux kernel 4.5 introduced wrappers for i_mutex as the type
-of i_mutex will be changed in the future.
-This patch prepares us for the upcoming type change. It also
-includes a patch from linux kernel removing unused declaration
-to make the room for the wrappers mentioned above.
-
-Note that this patch only touches the llite part. osd-ldiskfs still
-calls mutex_{lock,unlock} on i_mutex.
-
-Linux-commit:57b8f112cfe6622ddddb8c2641206bb5fa8a112d
-Linux-commit:5955102c9984fa081b2d570cfac75c97eecf8f3b
-
-Signed-off-by: Li Dongyang <[email protected]>
-Change-Id: Ia4c30443cddfaa5232e1dc1519c33c97dba2a271
----
- lustre/autoconf/lustre-core.m4 | 20 ++++++++++++++++++++
- lustre/include/lustre_compat.h |  6 ++++++
- lustre/include/lvfs.h          |  4 ++--
- lustre/llite/dir.c             |  4 ++--
- lustre/llite/file.c            | 20 ++++++++++----------
- lustre/llite/llite_internal.h  |  2 --
- lustre/llite/llite_lib.c       |  8 ++++----
- lustre/llite/llite_nfs.c       |  4 ++--
- lustre/llite/lloop.c           |  4 ++--
- lustre/llite/rw26.c            |  4 ++--
- lustre/llite/vvp_io.c          |  4 ++--
- lustre/llite/vvp_page.c        |  4 ++--
- 12 files changed, 54 insertions(+), 30 deletions(-)
-
-diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
-index 0d5c599..5554490 100644
---- a/lustre/autoconf/lustre-core.m4
-+++ b/lustre/autoconf/lustre-core.m4
-@@ -2087,6 +2087,23 @@ key_payload_data_array, [
- ]) #LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
- 
- #
-+# LC_HAVE_INODE_LOCK
-+#
-+# 4.5 introduced inode_lock
-+#
-+AC_DEFUN([LC_HAVE_INODE_LOCK], [
-+LB_CHECK_COMPILE([if 'inode_lock' is defined],
-+inode_lock, [
-+      #include <linux/fs.h>
-+],[
-+      inode_lock(NULL);
-+], [
-+      AC_DEFINE(HAVE_INODE_LOCK, 1,
-+                [inode_lock is defined])
-+])
-+]) # LC_HAVE_INODE_LOCK
-+
-+#
- # LC_PROG_LINUX
- #
- # Lustre linux kernel checks
-@@ -2259,6 +2276,9 @@ AC_DEFUN([LC_PROG_LINUX], [
-       LC_HAVE_QC_MAKE_REQUEST_FN
-       LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
- 
-+      # 4.5
-+      LC_HAVE_INODE_LOCK
-+
-       #
-       AS_IF([test "x$enable_server" != xno], [
-               LC_FUNC_DEV_SET_RDONLY
-diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h
-index d777993..0d303f2 100644
---- a/lustre/include/lustre_compat.h
-+++ b/lustre/include/lustre_compat.h
-@@ -371,6 +371,12 @@ static inline struct dentry *d_make_root(struct inode 
*root)
- #define ll_vfs_unlink(a, b) vfs_unlink(a, b)
- #endif
- 
-+#ifndef HAVE_INODE_LOCK
-+# define inode_lock(inode) mutex_lock(&(inode)->i_mutex)
-+# define inode_unlock(inode) mutex_unlock(&(inode)->i_mutex)
-+# define inode_trylock(inode) mutex_trylock(&(inode)->i_mutex)
-+#endif
-+
- #ifndef HAVE_RADIX_EXCEPTION_ENTRY
- static inline int radix_tree_exceptional_entry(void *arg)
- {
-diff --git a/lustre/include/lvfs.h b/lustre/include/lvfs.h
-index be4187f..2bdee77 100644
---- a/lustre/include/lvfs.h
-+++ b/lustre/include/lvfs.h
-@@ -86,9 +86,9 @@ ll_lookup_one_len(const char *fid_name, struct dentry 
*dparent,
- {
-       struct dentry *dchild;
- 
--      mutex_lock(&dparent->d_inode->i_mutex);
-+      inode_lock(dparent->d_inode);
-       dchild = lookup_one_len(fid_name, dparent, fid_namelen);
--      mutex_unlock(&dparent->d_inode->i_mutex);
-+      inode_unlock(dparent->d_inode);
- 
-       if (IS_ERR(dchild) || dchild->d_inode == NULL)
-               return dchild;
-diff --git a/lustre/llite/dir.c b/lustre/llite/dir.c
-index ec71a19..1f6e02c 100644
---- a/lustre/llite/dir.c
-+++ b/lustre/llite/dir.c
-@@ -1733,7 +1733,7 @@ static loff_t ll_dir_seek(struct file *file, loff_t 
offset, int origin)
-         loff_t ret = -EINVAL;
-         ENTRY;
- 
--      mutex_lock(&inode->i_mutex);
-+      inode_lock(inode);
-         switch (origin) {
-                 case SEEK_SET:
-                         break;
-@@ -1771,7 +1771,7 @@ static loff_t ll_dir_seek(struct file *file, loff_t 
offset, int origin)
-         GOTO(out, ret);
- 
- out:
--      mutex_unlock(&inode->i_mutex);
-+      inode_unlock(inode);
-         return ret;
- }
- 
-diff --git a/lustre/llite/file.c b/lustre/llite/file.c
-index cfc01f4..f381d26 100644
---- a/lustre/llite/file.c
-+++ b/lustre/llite/file.c
-@@ -2162,13 +2162,13 @@ static int ll_hsm_import(struct inode *inode, struct 
file *file,
-                        ATTR_MTIME | ATTR_MTIME_SET |
-                        ATTR_ATIME | ATTR_ATIME_SET;
- 
--      mutex_lock(&inode->i_mutex);
-+      inode_lock(inode);
- 
-       rc = ll_setattr_raw(file->f_path.dentry, attr, true);
-       if (rc == -ENODATA)
-               rc = 0;
- 
--      mutex_unlock(&inode->i_mutex);
-+      inode_unlock(inode);
- 
- out:
-       if (hss != NULL)
-@@ -2215,9 +2215,9 @@ static int ll_file_futimes_3(struct file *file, const 
struct ll_futimes_3 *lfu)
-       if (!S_ISREG(inode->i_mode))
-               RETURN(-EINVAL);
- 
--      mutex_lock(&inode->i_mutex);
-+      inode_lock(inode);
-       rc = ll_setattr_raw(file->f_path.dentry, &ia, false);
--      mutex_unlock(&inode->i_mutex);
-+      inode_unlock(inode);
- 
-       RETURN(rc);
- }
-@@ -2715,9 +2715,9 @@ generic_file_llseek_size(struct file *file, loff_t 
offset, int origin,
-                * SEEK_CURs. Note that parallel writes and reads behave
-                * like SEEK_SET.
-                */
--              mutex_lock(&inode->i_mutex);
-+              inode_lock(inode);
-               offset = llseek_execute(file, file->f_pos + offset, maxsize);
--              mutex_unlock(&inode->i_mutex);
-+              inode_unlock(inode);
-               return offset;
-       case SEEK_DATA:
-               /*
-@@ -2875,7 +2875,7 @@ int ll_fsync(struct file *file, struct dentry *dentry, 
int datasync)
- 
- #ifdef HAVE_FILE_FSYNC_4ARGS
-       rc = filemap_write_and_wait_range(inode->i_mapping, start, end);
--      mutex_lock(&inode->i_mutex);
-+      inode_lock(inode);
- #else
-       /* fsync's caller has already called _fdata{sync,write}, we want
-        * that IO to finish before calling the osc and mdc sync methods */
-@@ -2913,7 +2913,7 @@ int ll_fsync(struct file *file, struct dentry *dentry, 
int datasync)
-       }
- 
- #ifdef HAVE_FILE_FSYNC_4ARGS
--      mutex_unlock(&inode->i_mutex);
-+      inode_unlock(inode);
- #endif
-       RETURN(rc);
- }
-@@ -3146,7 +3146,7 @@ int ll_migrate(struct inode *parent, struct file *file, 
int mdtidx,
-       if (child_inode == parent->i_sb->s_root->d_inode)
-               GOTO(out_iput, rc = -EINVAL);
- 
--      mutex_lock(&child_inode->i_mutex);
-+      inode_lock(child_inode);
-       op_data->op_fid3 = *ll_inode2fid(child_inode);
-       if (!fid_is_sane(&op_data->op_fid3)) {
-               CERROR("%s: migrate %s, but FID "DFID" is insane\n",
-@@ -3224,7 +3224,7 @@ out_close:
-       if (rc == 0)
-               clear_nlink(child_inode);
- out_unlock:
--      mutex_unlock(&child_inode->i_mutex);
-+      inode_unlock(child_inode);
- out_iput:
-       iput(child_inode);
- out_free:
-diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
-index 20956f4..9c9979e 100644
---- a/lustre/llite/llite_internal.h
-+++ b/lustre/llite/llite_internal.h
-@@ -693,8 +693,6 @@ struct ll_file_data {
-       struct list_head fd_lccs; /* list of ll_cl_context */
- };
- 
--extern spinlock_t inode_lock;
--
- extern struct proc_dir_entry *proc_lustre_fs_root;
- 
- static inline struct inode *ll_info2i(struct ll_inode_info *lli)
-diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
-index c488fc2..9a8c69b 100644
---- a/lustre/llite/llite_lib.c
-+++ b/lustre/llite/llite_lib.c
-@@ -1545,10 +1545,10 @@ static int ll_md_setattr(struct dentry *dentry, struct 
md_op_data *op_data)
-        * cache is not cleared yet. */
-       op_data->op_attr.ia_valid &= ~(TIMES_SET_FLAGS | ATTR_SIZE);
-       if (S_ISREG(inode->i_mode))
--              mutex_lock(&inode->i_mutex);
-+              inode_lock(inode);
-       rc = simple_setattr(dentry, &op_data->op_attr);
-       if (S_ISREG(inode->i_mode))
--              mutex_unlock(&inode->i_mutex);
-+              inode_unlock(inode);
-       op_data->op_attr.ia_valid = ia_valid;
- 
-       rc = ll_update_inode(inode, &md);
-@@ -1637,7 +1637,7 @@ int ll_setattr_raw(struct dentry *dentry, struct iattr 
*attr, bool hsm_import)
-       if (S_ISREG(inode->i_mode)) {
-               if (attr->ia_valid & ATTR_SIZE)
-                       inode_dio_write_done(inode);
--              mutex_unlock(&inode->i_mutex);
-+              inode_unlock(inode);
-       }
- 
-       /* We always do an MDS RPC, even if we're only changing the size;
-@@ -1714,7 +1714,7 @@ out:
-               ll_finish_md_op_data(op_data);
- 
-       if (S_ISREG(inode->i_mode)) {
--              mutex_lock(&inode->i_mutex);
-+              inode_lock(inode);
-               if ((attr->ia_valid & ATTR_SIZE) && !hsm_import)
-                       inode_dio_wait(inode);
-       }
-diff --git a/lustre/llite/llite_nfs.c b/lustre/llite/llite_nfs.c
-index 9e19e78..bc238f5 100644
---- a/lustre/llite/llite_nfs.c
-+++ b/lustre/llite/llite_nfs.c
-@@ -247,13 +247,13 @@ static int ll_get_name(struct dentry *dentry, char *name,
-               GOTO(out, rc = PTR_ERR(op_data));
- 
-       op_data->op_max_pages = ll_i2sbi(dir)->ll_md_brw_pages;
--      mutex_lock(&dir->i_mutex);
-+      inode_lock(dir);
- #ifdef HAVE_DIR_CONTEXT
-       rc = ll_dir_read(dir, &pos, op_data, &lgd.ctx);
- #else
-       rc = ll_dir_read(dir, &pos, op_data, &lgd, ll_nfs_get_name_filldir);
- #endif
--      mutex_unlock(&dir->i_mutex);
-+      inode_unlock(dir);
-       ll_finish_md_op_data(op_data);
-       if (!rc && !lgd.lgd_found)
-               rc = -ENOENT;
-diff --git a/lustre/llite/lloop.c b/lustre/llite/lloop.c
-index b8ae0b5..64318ca 100644
---- a/lustre/llite/lloop.c
-+++ b/lustre/llite/lloop.c
-@@ -277,9 +277,9 @@ static int do_bio_lustrebacked(struct lloop_device *lo, 
struct bio *head)
-        *    be asked to write less pages once, this purely depends on
-        *    implementation. Anyway, we should be careful to avoid deadlocking.
-        */
--      mutex_lock(&inode->i_mutex);
-+      inode_lock(inode);
-       bytes = ll_direct_rw_pages(env, io, rw, inode, pvec);
--      mutex_unlock(&inode->i_mutex);
-+      inode_unlock(inode);
-       cl_io_fini(env, io);
-       return (bytes == pvec->ldp_size) ? 0 : (int)bytes;
- }
-diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c
-index d9482b2..3f02754 100644
---- a/lustre/llite/rw26.c
-+++ b/lustre/llite/rw26.c
-@@ -389,7 +389,7 @@ ll_direct_IO(
-        * 1. Need inode mutex to operate transient pages.
-        */
-       if (iov_iter_rw(iter) == READ)
--              mutex_lock(&inode->i_mutex);
-+              inode_lock(inode);
- 
-       while (iov_iter_count(iter)) {
-               struct page **pages;
-@@ -440,7 +440,7 @@ ll_direct_IO(
-       }
- out:
-       if (iov_iter_rw(iter) == READ)
--              mutex_unlock(&inode->i_mutex);
-+              inode_unlock(inode);
- 
-       if (tot_bytes > 0) {
-               struct vvp_io *vio = vvp_env_io(env);
-diff --git a/lustre/llite/vvp_io.c b/lustre/llite/vvp_io.c
-index 8a81b83..a48a0b0 100644
---- a/lustre/llite/vvp_io.c
-+++ b/lustre/llite/vvp_io.c
-@@ -661,7 +661,7 @@ static int vvp_io_setattr_start(const struct lu_env *env,
-       struct inode            *inode = vvp_object_inode(io->ci_obj);
-       struct ll_inode_info    *lli   = ll_i2info(inode);
- 
--      mutex_lock(&inode->i_mutex);
-+      inode_lock(inode);
-       if (cl_io_is_trunc(io)) {
-               down_write(&lli->lli_trunc_sem);
-               inode_dio_wait(inode);
-@@ -687,7 +687,7 @@ static void vvp_io_setattr_end(const struct lu_env *env,
-               inode_dio_write_done(inode);
-               up_write(&lli->lli_trunc_sem);
-       }
--      mutex_unlock(&inode->i_mutex);
-+      inode_unlock(inode);
- }
- 
- static void vvp_io_setattr_fini(const struct lu_env *env,
-diff --git a/lustre/llite/vvp_page.c b/lustre/llite/vvp_page.c
-index 39f093b..e2afea4 100644
---- a/lustre/llite/vvp_page.c
-+++ b/lustre/llite/vvp_page.c
-@@ -468,9 +468,9 @@ static int vvp_transient_page_is_vmlocked(const struct 
lu_env *env,
-       struct inode    *inode = vvp_object_inode(slice->cpl_obj);
-       int     locked;
- 
--      locked = !mutex_trylock(&inode->i_mutex);
-+      locked = !inode_trylock(inode);
-       if (!locked)
--              mutex_unlock(&inode->i_mutex);
-+              inode_unlock(inode);
-       return locked ? -EBUSY : -ENODATA;
- }
- 
--- 
-2.8.2
-

diff --git 
a/sys-cluster/lustre/files/0005-LU-8056-llite-inode_operations-interface-changed-in-.patch
 
b/sys-cluster/lustre/files/0005-LU-8056-llite-inode_operations-interface-changed-in-.patch
deleted file mode 100644
index 72af637..0000000
--- 
a/sys-cluster/lustre/files/0005-LU-8056-llite-inode_operations-interface-changed-in-.patch
+++ /dev/null
@@ -1,165 +0,0 @@
-From 0ec0c36d7a0ec5636e19eece4d5df7615f656c23 Mon Sep 17 00:00:00 2001
-From: Li Dongyang <[email protected]>
-Date: Mon, 16 May 2016 21:57:31 +1000
-Subject: [PATCH 5/8] LU-8056 llite: inode_operations interface changed in 4.5
-
-Linux kernel 4.5 replaced follow_link() with get_link()
-while put_link() is removed.
-This patch handles the API change.
-
-Linux-commit:6b2553918d8b4e6de9853fd6315bec7271a2e592
-Linux-commit:fceef393a538134f03b778c5d2519e670269342f
-
-Signed-off-by: Li Dongyang <[email protected]>
-Change-Id: Ia9b8c9b855ed5ab7a428a370074b8801e34d3f99
----
- lustre/autoconf/lustre-core.m4 | 20 +++++++++++++++
- lustre/llite/dcache.c          |  4 +++
- lustre/llite/symlink.c         | 56 +++++++++++++++++++++++++++++++++++-------
- 3 files changed, 71 insertions(+), 9 deletions(-)
-
-diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
-index 5554490..ec18055 100644
---- a/lustre/autoconf/lustre-core.m4
-+++ b/lustre/autoconf/lustre-core.m4
-@@ -2104,6 +2104,25 @@ inode_lock, [
- ]) # LC_HAVE_INODE_LOCK
- 
- #
-+# LC_HAVE_IOP_GET_LINK
-+#
-+# 4.5 vfs replaced iop->follow_link with
-+# iop->get_link
-+#
-+AC_DEFUN([LC_HAVE_IOP_GET_LINK], [
-+LB_CHECK_COMPILE([if 'iop' has 'get_link'],
-+inode_ops_get_link, [
-+      #include <linux/fs.h>
-+],[
-+      struct inode_operations iop;
-+      iop.get_link = NULL;
-+],[
-+      AC_DEFINE(HAVE_IOP_GET_LINK, 1,
-+              [have iop get_link])
-+])
-+]) # LC_HAVE_IOP_GET_LINK
-+
-+#
- # LC_PROG_LINUX
- #
- # Lustre linux kernel checks
-@@ -2278,6 +2297,7 @@ AC_DEFUN([LC_PROG_LINUX], [
- 
-       # 4.5
-       LC_HAVE_INODE_LOCK
-+      LC_HAVE_IOP_GET_LINK
- 
-       #
-       AS_IF([test "x$enable_server" != xno], [
-diff --git a/lustre/llite/dcache.c b/lustre/llite/dcache.c
-index 8c3db0a..3168ca8 100644
---- a/lustre/llite/dcache.c
-+++ b/lustre/llite/dcache.c
-@@ -331,7 +331,11 @@ static int ll_revalidate_dentry(struct dentry *dentry,
-               return 1;
- 
-       /* Symlink - always valid as long as the dentry was found */
-+#ifdef HAVE_IOP_GET_LINK
-+      if (dentry->d_inode && dentry->d_inode->i_op->get_link)
-+#else
-       if (dentry->d_inode && dentry->d_inode->i_op->follow_link)
-+#endif
-               return 1;
- 
-       /* Last path component lookup for open or create - we always
-diff --git a/lustre/llite/symlink.c b/lustre/llite/symlink.c
-index e635037..70577ce 100644
---- a/lustre/llite/symlink.c
-+++ b/lustre/llite/symlink.c
-@@ -122,6 +122,20 @@ failed:
- }
- 
- #ifdef HAVE_SYMLINK_OPS_USE_NAMEIDATA
-+static void ll_put_link(struct dentry *dentry,
-+                      struct nameidata *nd, void *cookie)
-+#else
-+# ifdef HAVE_IOP_GET_LINK
-+static void ll_put_link(void *cookie)
-+# else
-+static void ll_put_link(struct inode *unused, void *cookie)
-+# endif
-+#endif
-+{
-+      ptlrpc_req_finished(cookie);
-+}
-+
-+#ifdef HAVE_SYMLINK_OPS_USE_NAMEIDATA
- static void *ll_follow_link(struct dentry *dentry, struct nameidata *nd)
- {
-       struct inode *inode = dentry->d_inode;
-@@ -156,6 +170,34 @@ static void *ll_follow_link(struct dentry *dentry, struct 
nameidata *nd)
-       RETURN(request);
- }
- #else
-+# ifdef HAVE_IOP_GET_LINK
-+static const char *ll_get_link(struct dentry *dentry,
-+                             struct inode *inode,
-+                             struct delayed_call *done)
-+{
-+      struct ptlrpc_request *request;
-+      char *symname = NULL;
-+      int rc;
-+
-+      ENTRY;
-+      CDEBUG(D_VFSTRACE, "VFS Op\n");
-+      if (!dentry)
-+              RETURN(ERR_PTR(-ECHILD));
-+      ll_inode_size_lock(inode);
-+      rc = ll_readlink_internal(inode, &request, &symname);
-+      ll_inode_size_unlock(inode);
-+      if (rc < 0) {
-+              ptlrpc_req_finished(request);
-+              return ERR_PTR(rc);
-+      }
-+
-+      /* symname may contain a pointer to the request message buffer,
-+       * we delay request releasing then.
-+       */
-+      set_delayed_call(done, ll_put_link, request);
-+      RETURN(symname);
-+}
-+# else
- static const char *ll_follow_link(struct dentry *dentry, void **cookie)
- {
-       struct inode *inode = d_inode(dentry);
-@@ -179,22 +221,18 @@ static const char *ll_follow_link(struct dentry *dentry, 
void **cookie)
-       *cookie = request;
-       RETURN(symname);
- }
-+# endif /* HAVE_IOP_GET_LINK */
- #endif /* HAVE_SYMLINK_OPS_USE_NAMEIDATA */
- 
--#ifdef HAVE_SYMLINK_OPS_USE_NAMEIDATA
--static void ll_put_link(struct dentry *dentry, struct nameidata *nd, void 
*cookie)
--#else
--static void ll_put_link(struct inode *unused, void *cookie)
--#endif
--{
--      ptlrpc_req_finished(cookie);
--}
--
- struct inode_operations ll_fast_symlink_inode_operations = {
-       .readlink       = generic_readlink,
-       .setattr        = ll_setattr,
-+#ifdef HAVE_IOP_GET_LINK
-+      .get_link       = ll_get_link,
-+#else
-       .follow_link    = ll_follow_link,
-       .put_link       = ll_put_link,
-+#endif
-       .getattr        = ll_getattr,
-       .permission     = ll_inode_permission,
-       .setxattr       = ll_setxattr,
--- 
-2.8.2
-

diff --git 
a/sys-cluster/lustre/files/0006-LU-8056-llite-POSIX_ACL_XATTR_-ACCESS-DEFAULT-remove.patch
 
b/sys-cluster/lustre/files/0006-LU-8056-llite-POSIX_ACL_XATTR_-ACCESS-DEFAULT-remove.patch
deleted file mode 100644
index 6879248..0000000
--- 
a/sys-cluster/lustre/files/0006-LU-8056-llite-POSIX_ACL_XATTR_-ACCESS-DEFAULT-remove.patch
+++ /dev/null
@@ -1,53 +0,0 @@
-From 103a363fa53f691d2bdbb38280e44d1c830c7322 Mon Sep 17 00:00:00 2001
-From: Li Dongyang <[email protected]>
-Date: Mon, 16 May 2016 22:07:54 +1000
-Subject: [PATCH 6/8] LU-8056 llite: POSIX_ACL_XATTR_{ACCESS,DEFAULT} removed
- in 4.5
-
-POSIX_ACL_XATTR_{ACCESS,DEFAULT} are duplicate
-xattr name definitions and they are replaced by
-XATTR_NAME_POSIX_ACL_{ACCESS,DEFAULT} since Linux kernel 4.5
-
-Linux-commit:97d79299223baab330b194437e676d301f12d5f6
-
-Signed-off-by: Li Dongyang <[email protected]>
-Change-Id: I9e031d3ac77a4bf1832d932c1cab7032e4572445
----
- lustre/llite/xattr.c | 12 ++++++++++--
- 1 file changed, 10 insertions(+), 2 deletions(-)
-
-diff --git a/lustre/llite/xattr.c b/lustre/llite/xattr.c
-index 6e282af..d30cede 100644
---- a/lustre/llite/xattr.c
-+++ b/lustre/llite/xattr.c
-@@ -57,6 +57,14 @@
- #define XATTR_NAME_EVM                "security.evm"
- #endif
- 
-+#ifndef XATTR_NAME_POSIX_ACL_ACCESS
-+# define XATTR_NAME_POSIX_ACL_ACCESS POSIX_ACL_XATTR_ACCESS
-+#endif
-+
-+#ifndef XATTR_NAME_POSIX_ACL_DEFAULT
-+# define XATTR_NAME_POSIX_ACL_DEFAULT POSIX_ACL_XATTR_DEFAULT
-+#endif
-+
- #define XATTR_USER_T            (1)
- #define XATTR_TRUSTED_T         (2)
- #define XATTR_SECURITY_T        (3)
-@@ -68,10 +76,10 @@
- static
- int get_xattr_type(const char *name)
- {
--        if (!strcmp(name, POSIX_ACL_XATTR_ACCESS))
-+      if (!strcmp(name, XATTR_NAME_POSIX_ACL_ACCESS))
-                 return XATTR_ACL_ACCESS_T;
- 
--        if (!strcmp(name, POSIX_ACL_XATTR_DEFAULT))
-+      if (!strcmp(name, XATTR_NAME_POSIX_ACL_DEFAULT))
-                 return XATTR_ACL_DEFAULT_T;
- 
-         if (!strncmp(name, XATTR_USER_PREFIX,
--- 
-2.8.2
-

diff --git 
a/sys-cluster/lustre/files/0007-LU-8056-lloop-fix-bio_for_each_segment_all-for-newer.patch
 
b/sys-cluster/lustre/files/0007-LU-8056-lloop-fix-bio_for_each_segment_all-for-newer.patch
deleted file mode 100644
index be495b9..0000000
--- 
a/sys-cluster/lustre/files/0007-LU-8056-lloop-fix-bio_for_each_segment_all-for-newer.patch
+++ /dev/null
@@ -1,64 +0,0 @@
-From 028c4416216af21dcae53f7daa4f549d0c2bad4f Mon Sep 17 00:00:00 2001
-From: James Simmons <[email protected]>
-Date: Fri, 3 Jun 2016 14:09:54 -0400
-Subject: [PATCH 7/8] LU-8056 lloop: fix bio_for_each_segment_all for newer
- kernels
-
-Lustre patch http://review.whamcloud.com/20478 back ported
-bio_for_each_segment_all from newer kernels but support
-for newer kernels was done incorrectly. Update the code to
-work with newer kernels.
-
-Change-Id: I6a926320f80113169a13d2319190721c83d58b1d
-Signed-off-by: James Simmons <[email protected]>
----
- lustre/llite/lloop.c | 15 +--------------
- 1 file changed, 1 insertion(+), 14 deletions(-)
-
-diff --git a/lustre/llite/lloop.c b/lustre/llite/lloop.c
-index 64318ca..64da8c2 100644
---- a/lustre/llite/lloop.c
-+++ b/lustre/llite/lloop.c
-@@ -193,13 +193,8 @@ static int do_bio_lustrebacked(struct lloop_device *lo, 
struct bio *head)
-         struct cl_object     *obj = ll_i2info(inode)->lli_clob;
-         pgoff_t               offset;
-         int                   ret;
--#ifdef HAVE_BVEC_ITER
--      struct bvec_iter      iter;
--      struct bio_vec        bvec;
--#else
-       int                   iter;
-       struct bio_vec       *bvec;
--#endif
-         int                   rw;
-       size_t                page_count = 0;
-         struct bio           *bio;
-@@ -226,16 +221,9 @@ static int do_bio_lustrebacked(struct lloop_device *lo, 
struct bio *head)
- 
- #ifdef HAVE_BVEC_ITER
-               offset = (pgoff_t)(bio->bi_iter.bi_sector << 9) + lo->lo_offset;
--              bio_for_each_segment_all(bvec, bio, iter) {
--                      BUG_ON(bvec.bv_offset != 0);
--                      BUG_ON(bvec.bv_len != PAGE_CACHE_SIZE);
--
--                      pages[page_count] = bvec.bv_page;
--                      offsets[page_count] = offset;
--                      page_count++;
--                      offset += bvec.bv_len;
- #else
-               offset = (pgoff_t)(bio->bi_sector << 9) + lo->lo_offset;
-+#endif
-               bio_for_each_segment_all(bvec, bio, iter) {
-                       BUG_ON(bvec->bv_offset != 0);
-                       BUG_ON(bvec->bv_len != PAGE_CACHE_SIZE);
-@@ -244,7 +232,6 @@ static int do_bio_lustrebacked(struct lloop_device *lo, 
struct bio *head)
-                       offsets[page_count] = offset;
-                       page_count++;
-                       offset += bvec->bv_len;
--#endif
-               }
-               LASSERT(page_count <= LLOOP_MAX_SEGMENTS);
-       }
--- 
-2.8.2
-

diff --git a/sys-cluster/lustre/files/0008-Fix-build-error-with-gcc-6.1.patch 
b/sys-cluster/lustre/files/0008-Fix-build-error-with-gcc-6.1.patch
deleted file mode 100644
index a6e167f..0000000
--- a/sys-cluster/lustre/files/0008-Fix-build-error-with-gcc-6.1.patch
+++ /dev/null
@@ -1,31 +0,0 @@
-From 476bd7023e01ab844bcdb81ca2f43e3a07f91b3d Mon Sep 17 00:00:00 2001
-From: Alexey Shvetsov <[email protected]>
-Date: Mon, 13 Jun 2016 14:22:04 +0300
-Subject: [PATCH 8/8] Fix build error with gcc-6.1
-
-Signed-off-by: Alexey Shvetsov <[email protected]>
----
- lustre/utils/liblustreapi_hsm.c | 3 ++-
- 1 file changed, 2 insertions(+), 1 deletion(-)
-
-diff --git a/lustre/utils/liblustreapi_hsm.c b/lustre/utils/liblustreapi_hsm.c
-index 0b12f37..2f5b95d 100644
---- a/lustre/utils/liblustreapi_hsm.c
-+++ b/lustre/utils/liblustreapi_hsm.c
-@@ -429,11 +429,12 @@ static int llapi_hsm_log_ct_progress(struct 
hsm_copyaction_private **phcp,
-                       goto err;
-       }
- 
--      if (progress_type == CT_RUNNING)
-+      if (progress_type == CT_RUNNING) {
-               rc = llapi_json_add_item(&json_items, "current_bytes",
-                                        LLAPI_JSON_BIGNUM, &current);
-               if (rc < 0)
-                       goto err;
-+      }
- 
- cancel:
-       rc = llapi_json_add_item(&json_items, "event_type", LLAPI_JSON_STRING,
--- 
-2.8.2
-

diff --git a/sys-cluster/lustre/files/lnet.initd 
b/sys-cluster/lustre/files/lnet.initd
new file mode 100755
index 0000000..75bc4b1
--- /dev/null
+++ b/sys-cluster/lustre/files/lnet.initd
@@ -0,0 +1,46 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+description="Loads lnet module and configures network."
+
+depend() {
+        need net
+        after bootmisc
+}
+
+start() {
+        if [ "${RC_CMD}" = "restart" ];
+        then
+                einfo "Restarting..."
+        fi
+
+        ebegin "Loading LNet modules:"
+        modprobe lnet
+        eend $*
+
+        ebegin "Bringing up LNet"
+        lnetctl lnet configure --all
+        eend $*
+}
+
+stop() {
+        local LNETMODULES=( "ko2iblnd" "lnet" "libcfs" )
+        ebegin "Bringing down LNet"
+        lnetctl lnet unconfigure --all
+        eend $*
+
+        einfo "Unloading LNet modules:"
+        for mod in ${LNETMODULES[@]}; do
+                ebegin "... ${mod}"
+                modprobe -r ${mod}
+                eend $*
+        done
+}
+
+status()
+{
+        einfo "LNet status:"
+        lnetctl net show
+}

diff --git a/sys-cluster/lustre/files/lustre-client.initd 
b/sys-cluster/lustre/files/lustre-client.initd
new file mode 100755
index 0000000..1736597
--- /dev/null
+++ b/sys-cluster/lustre/files/lustre-client.initd
@@ -0,0 +1,48 @@
+#!/sbin/openrc-run
+# Copyright 1999-2016 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+description="Load lustre modules"
+
+extra_commands="checkmodule"
+
+depend() {
+        need lnet
+        before netmount
+}
+
+checkmodule() {
+        local LOADED="$(lctl modules | awk -F"/" /lustre/'{print $2F}')"
+        for mod in ${LOADED[@]}; do
+                ewarn "Module is still loaded: ${mod}"
+                eend $*
+        done
+}
+
+start() {
+        if [ "${RC_CMD}" = "restart" ];
+        then
+                einfo "Restarting Lustre..."
+                checkmodule
+        fi
+
+        ebegin "Loading Lustre modules..."
+        modprobe lustre
+        eend $*
+}
+
+stop() {
+        local LMODULES=( "lustre" "osc" "mgc" "lmv" "fld" "mdc" "fid" "lov" 
"ptlrpc" )
+        ebegin "Trying to unmount all Lustre fs"
+        umount -a -t lustre
+        eend $*
+        einfo "Unloading lustre modules:"
+        for mod in ${LMODULES[@]}; do
+                ebegin "... ${mod}"
+                modprobe -r ${mod}
+                eend $*
+        done
+
+        checkmodule
+}

diff --git a/sys-cluster/lustre/lustre-2.8.54.ebuild 
b/sys-cluster/lustre/lustre-2.8.0.ebuild
similarity index 73%
rename from sys-cluster/lustre/lustre-2.8.54.ebuild
rename to sys-cluster/lustre/lustre-2.8.0.ebuild
index 24b1bc2..47f4c15 100644
--- a/sys-cluster/lustre/lustre-2.8.54.ebuild
+++ b/sys-cluster/lustre/lustre-2.8.0.ebuild
@@ -13,10 +13,13 @@ if [[ $PV = *9999* ]]; then
        EGIT_BRANCH="master"
 else
        KEYWORDS="~amd64"
-       EGIT_TAG="${PV}"
+       EGIT_COMMIT="${PV}"
 fi
 
-inherit git-r3 autotools linux-mod toolchain-funcs udev flag-o-matic
+SUPPORTED_KV_MAJOR=4
+SUPPORTED_KV_MINOR=1
+
+inherit git-r3 autotools linux-info linux-mod toolchain-funcs udev flag-o-matic
 
 DESCRIPTION="Lustre is a parallel distributed file system"
 HOMEPAGE="http://wiki.whamcloud.com/";
@@ -44,16 +47,13 @@ REQUIRED_USE="
        client? ( modules )
        server? ( modules )"
 
-PATCHES=(
-       "${FILESDIR}/0001-LU-8056-libcfs-Support-for-linux-4.2-kernels.patch"
-       "${FILESDIR}/0002-LU-8056-o2iblnd-ib_query_device-removed-in-4.5.patch"
-       
"${FILESDIR}/0003-LU-8056-socklnd-NETIF_F_ALL_CSUM-renamed-to-NETIF_F_.patch"
-       "${FILESDIR}/0004-LU-8056-llite-use-inode_lock-to-access-i_mutex.patch"
-       
"${FILESDIR}/0005-LU-8056-llite-inode_operations-interface-changed-in-.patch"
-       
"${FILESDIR}/0006-LU-8056-llite-POSIX_ACL_XATTR_-ACCESS-DEFAULT-remove.patch"
-       
"${FILESDIR}/0007-LU-8056-lloop-fix-bio_for_each_segment_all-for-newer.patch"
-       "${FILESDIR}/0008-Fix-build-error-with-gcc-6.1.patch"
-       )
+pkg_pretend() {
+       KVSUPP=${SUPPORTED_KV_MAJOR}.${SUPPORTED_KV_MINOR}.x
+       if kernel_is gt ${SUPPORTED_KV_MAJOR} ${SUPPORTED_KV_MINOR}; then
+               eerror "Unsupported kernel version! Latest supported one is 
${KVSUPP}"
+               die
+       fi
+}
 
 pkg_setup() {
        filter-mfpmath sse
@@ -65,7 +65,7 @@ pkg_setup() {
 }
 
 src_prepare() {
-       if [ ! -z ${#PATCHES[0]} ]; then
+       if [ ${#PATCHES[0]} -ne 0 ]; then
                epatch ${PATCHES[@]}
        fi
        eapply_user
@@ -111,4 +111,6 @@ src_compile() {
 
 src_install() {
        default
+       newinitd "${FILESDIR}/lnet.initd" lnet
+       newinitd "${FILESDIR}/lustre-client.initd" lustre-client
 }

diff --git a/sys-cluster/lustre/lustre-9999.ebuild 
b/sys-cluster/lustre/lustre-9999.ebuild
index d928ee3..47f4c15 100644
--- a/sys-cluster/lustre/lustre-9999.ebuild
+++ b/sys-cluster/lustre/lustre-9999.ebuild
@@ -13,10 +13,13 @@ if [[ $PV = *9999* ]]; then
        EGIT_BRANCH="master"
 else
        KEYWORDS="~amd64"
-       EGIT_TAG="${PV}"
+       EGIT_COMMIT="${PV}"
 fi
 
-inherit git-r3 autotools linux-mod toolchain-funcs udev flag-o-matic
+SUPPORTED_KV_MAJOR=4
+SUPPORTED_KV_MINOR=1
+
+inherit git-r3 autotools linux-info linux-mod toolchain-funcs udev flag-o-matic
 
 DESCRIPTION="Lustre is a parallel distributed file system"
 HOMEPAGE="http://wiki.whamcloud.com/";
@@ -44,9 +47,13 @@ REQUIRED_USE="
        client? ( modules )
        server? ( modules )"
 
-PATCHES=(
-       "${FILESDIR}/0008-Fix-build-error-with-gcc-6.1.patch"
-       )
+pkg_pretend() {
+       KVSUPP=${SUPPORTED_KV_MAJOR}.${SUPPORTED_KV_MINOR}.x
+       if kernel_is gt ${SUPPORTED_KV_MAJOR} ${SUPPORTED_KV_MINOR}; then
+               eerror "Unsupported kernel version! Latest supported one is 
${KVSUPP}"
+               die
+       fi
+}
 
 pkg_setup() {
        filter-mfpmath sse
@@ -58,7 +65,7 @@ pkg_setup() {
 }
 
 src_prepare() {
-       if [ ! -z ${#PATCHES[0]} ]; then
+       if [ ${#PATCHES[0]} -ne 0 ]; then
                epatch ${PATCHES[@]}
        fi
        eapply_user
@@ -104,4 +111,6 @@ src_compile() {
 
 src_install() {
        default
+       newinitd "${FILESDIR}/lnet.initd" lnet
+       newinitd "${FILESDIR}/lustre-client.initd" lustre-client
 }

Reply via email to