aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexey Shvetsov <alexxy@gentoo.org>2016-06-13 13:12:44 +0300
committerAlexey Shvetsov <alexxy@gentoo.org>2016-06-13 13:12:44 +0300
commitd72cde5ebe5ae2a90e72d21653ff5f480a7a55ef (patch)
treebde2f03a78c13fb2f1373071061f54ba17c0ec89
parentsys-cluster/lustre: Fix install without modules (diff)
downloadsci-d72cde5ebe5ae2a90e72d21653ff5f480a7a55ef.tar.gz
sci-d72cde5ebe5ae2a90e72d21653ff5f480a7a55ef.tar.bz2
sci-d72cde5ebe5ae2a90e72d21653ff5f480a7a55ef.zip
sys-cluster/lustre: add patches for 4.5 kernel
Package-Manager: portage-2.3.0_rc1 RepoMan-Options: --force
-rw-r--r--sys-cluster/lustre/files/0001-LU-6215-lprocfs-handle-seq_printf-api-change.patch4126
-rw-r--r--sys-cluster/lustre/files/0002-LU-6215-gss-cache_head-is-now-on-a-hlist-in-4.3-kern.patch192
-rw-r--r--sys-cluster/lustre/files/0003-LU-6215-llite-handle-locks-API-change-in-4.4-kernels.patch90
-rw-r--r--sys-cluster/lustre/files/0004-LU-6215-llite-make_request_fn-returns-blk_qc_t-in-ke.patch95
-rw-r--r--sys-cluster/lustre/files/0005-LU-6215-gss-key-payload.data-is-an-array-in-4.4-kern.patch229
-rw-r--r--sys-cluster/lustre/files/0006-LU-6215-o2iblnd-rdma_create_id-takes-extra-parameter.patch106
-rw-r--r--sys-cluster/lustre/files/0007-LU-6215-lnet-split-struct-ib_send_wr.patch451
-rw-r--r--sys-cluster/lustre/files/0008-LU-6215-o2iblnd-ib_alloc_fast_reg_mr-removed-in-4.3.patch199
-rw-r--r--sys-cluster/lustre/files/0009-LU-6215-o2iblnd-port-to-new-fast-reg-API-introduced-.patch332
-rw-r--r--sys-cluster/lustre/files/0010-LU-6215-o2iblnd-rdma_create_id-takes-extra-parameter.patch46
-rw-r--r--sys-cluster/lustre/files/0011-LU-6215-llite-remove-obsolete-conditional-code.patch97
-rw-r--r--sys-cluster/lustre/files/0012-LU-6215-lnet-split-struct-ib_send_wr.patch169
-rw-r--r--sys-cluster/lustre/files/0013-LU-8056-libcfs-Support-for-linux-4.2-kernels.patch80
-rw-r--r--sys-cluster/lustre/files/0014-LU-8056-o2iblnd-ib_query_device-removed-in-4.5.patch167
-rw-r--r--sys-cluster/lustre/files/0015-LU-8056-socklnd-NETIF_F_ALL_CSUM-renamed-to-NETIF_F_.patch49
-rw-r--r--sys-cluster/lustre/files/0016-LU-8056-llite-use-inode_lock-to-access-i_mutex.patch363
-rw-r--r--sys-cluster/lustre/files/0017-LU-8056-llite-inode_operations-interface-changed-in-.patch166
-rw-r--r--sys-cluster/lustre/files/0018-LU-8056-llite-POSIX_ACL_XATTR_-ACCESS-DEFAULT-remove.patch53
-rw-r--r--sys-cluster/lustre/files/0019-LU-8056-lloop-fix-bio_for_each_segment_all-for-newer.patch66
-rw-r--r--sys-cluster/lustre/lustre-2.8.0.ebuild25
-rw-r--r--sys-cluster/lustre/lustre-9999.ebuild25
21 files changed, 7122 insertions, 4 deletions
diff --git a/sys-cluster/lustre/files/0001-LU-6215-lprocfs-handle-seq_printf-api-change.patch b/sys-cluster/lustre/files/0001-LU-6215-lprocfs-handle-seq_printf-api-change.patch
new file mode 100644
index 000000000..744b9d27c
--- /dev/null
+++ b/sys-cluster/lustre/files/0001-LU-6215-lprocfs-handle-seq_printf-api-change.patch
@@ -0,0 +1,4126 @@
+From cd60eb450f58589c39568507215e6366b41aa154 Mon Sep 17 00:00:00 2001
+From: James Simmons <uja.ornl@yahoo.com>
+Date: Wed, 23 Mar 2016 18:37:27 -0400
+Subject: [PATCH 01/19] LU-6215 lprocfs: handle seq_printf api change
+
+Starting with the 4.3 linux kernel seq_printf is a void
+function not returning the character count. This work
+updates lustre to treat seq_printf as a void function.
+Fixed alignment issues and ran this patch against the
+Linux kernels checkpatch to make it compliant to
+upstream standards.
+
+Change-Id: I0cfd71252322038c1b54da624fce48b37a6f30b6
+Signed-off-by: James Simmons <uja.ornl@yahoo.com>
+Reviewed-on: http://review.whamcloud.com/16933
+Tested-by: Jenkins
+Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: Bob Glossman <bob.glossman@intel.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+---
+ contrib/scripts/checkpatch.pl | 2 +
+ libcfs/include/libcfs/libcfs_hash.h | 4 +-
+ libcfs/libcfs/hash.c | 55 ++++----
+ lustre/fid/lproc_fid.c | 47 +++----
+ lustre/fld/lproc_fld.c | 2 +-
+ lustre/ldlm/ldlm_pool.c | 21 ++-
+ lustre/ldlm/ldlm_resource.c | 8 +-
+ lustre/lfsck/lfsck_internal.h | 14 +-
+ lustre/lfsck/lfsck_layout.c | 157 ++++++++++-----------
+ lustre/lfsck/lfsck_lib.c | 66 ++++-----
+ lustre/lfsck/lfsck_namespace.c | 234 +++++++++++++++-----------------
+ lustre/llite/lproc_llite.c | 147 ++++++++++----------
+ lustre/lmv/lproc_lmv.c | 17 ++-
+ lustre/lod/lproc_lod.c | 50 ++++---
+ lustre/lov/lproc_lov.c | 30 ++--
+ lustre/mdc/lproc_mdc.c | 15 +-
+ lustre/mdd/mdd_lproc.c | 6 +-
+ lustre/mdt/mdt_coordinator.c | 15 +-
+ lustre/mdt/mdt_hsm_cdt_actions.c | 54 ++++----
+ lustre/mdt/mdt_lproc.c | 45 +++---
+ lustre/mgc/mgc_request.c | 4 +-
+ lustre/obdclass/genops.c | 4 +-
+ lustre/obdclass/linux/linux-module.c | 29 ++--
+ lustre/obdclass/lprocfs_jobstats.c | 3 +-
+ lustre/obdclass/lprocfs_status.c | 176 ++++++++++++------------
+ lustre/obdclass/lprocfs_status_server.c | 36 ++---
+ lustre/obdclass/lu_object.c | 27 ++--
+ lustre/ofd/lproc_ofd.c | 65 +++++----
+ lustre/osc/lproc_osc.c | 95 +++++++------
+ lustre/osd-ldiskfs/osd_lproc.c | 35 +++--
+ lustre/osd-ldiskfs/osd_scrub.c | 160 +++++++++-------------
+ lustre/osd-zfs/osd_lproc.c | 9 +-
+ lustre/osp/lproc_osp.c | 60 +++++---
+ lustre/ptlrpc/gss/lproc_gss.c | 42 +++---
+ lustre/ptlrpc/lproc_ptlrpc.c | 47 ++++---
+ lustre/ptlrpc/nodemap_lproc.c | 36 +++--
+ lustre/ptlrpc/nrs_tbf.c | 6 +-
+ lustre/ptlrpc/sec_bulk.c | 84 ++++++------
+ lustre/quota/qsd_lib.c | 45 +++---
+ 39 files changed, 974 insertions(+), 978 deletions(-)
+
+diff --git a/contrib/scripts/checkpatch.pl b/contrib/scripts/checkpatch.pl
+index dc85c7c..372ed4c 100755
+--- a/contrib/scripts/checkpatch.pl
++++ b/contrib/scripts/checkpatch.pl
+@@ -472,6 +472,8 @@ my %dep_functions = (
+ 'strcat', 'strncat',
+ 'tempnam', 'mkstemp',
+ 'f_dentry', 'f_path.dentry',
++ '= seq_printf', 'seq_printf',
++ 'return seq_printf', 'seq_printf',
+ );
+
+ my @rawlines = ();
+diff --git a/libcfs/include/libcfs/libcfs_hash.h b/libcfs/include/libcfs/libcfs_hash.h
+index f076b37..6285c66 100644
+--- a/libcfs/include/libcfs/libcfs_hash.h
++++ b/libcfs/include/libcfs/libcfs_hash.h
+@@ -803,8 +803,8 @@ __cfs_hash_set_theta(struct cfs_hash *hs, int min, int max)
+
+ /* Generic debug formatting routines mainly for proc handler */
+ struct seq_file;
+-int cfs_hash_debug_header(struct seq_file *m);
+-int cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m);
++void cfs_hash_debug_header(struct seq_file *m);
++void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m);
+
+ /*
+ * Generic djb2 hash algorithm for character arrays.
+diff --git a/libcfs/libcfs/hash.c b/libcfs/libcfs/hash.c
+index 02575fb..7afa6cc 100644
+--- a/libcfs/libcfs/hash.c
++++ b/libcfs/libcfs/hash.c
+@@ -2043,13 +2043,10 @@ void cfs_hash_rehash_key(struct cfs_hash *hs, const void *old_key,
+ }
+ EXPORT_SYMBOL(cfs_hash_rehash_key);
+
+-int cfs_hash_debug_header(struct seq_file *m)
++void cfs_hash_debug_header(struct seq_file *m)
+ {
+- return seq_printf(m, "%-*s%6s%6s%6s%6s%6s%6s%6s%7s%8s%8s%8s%s\n",
+- CFS_HASH_BIGNAME_LEN,
+- "name", "cur", "min", "max", "theta", "t-min", "t-max",
+- "flags", "rehash", "count", "maxdep", "maxdepb",
+- " distribution");
++ seq_printf(m, "%-*s cur min max theta t-min t-max flags rehash count maxdep maxdepb distribution\n",
++ CFS_HASH_BIGNAME_LEN, "name");
+ }
+ EXPORT_SYMBOL(cfs_hash_debug_header);
+
+@@ -2077,31 +2074,28 @@ cfs_hash_full_nbkt(struct cfs_hash *hs)
+ CFS_HASH_RH_NBKT(hs) : CFS_HASH_NBKT(hs);
+ }
+
+-int cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m)
++void cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m)
+ {
+- int dist[8] = { 0, };
+- int maxdep = -1;
+- int maxdepb = -1;
+- int total = 0;
+- int c = 0;
+- int theta;
+- int i;
++ int dist[8] = { 0, };
++ int maxdep = -1;
++ int maxdepb = -1;
++ int total = 0;
++ int theta;
++ int i;
+
+ cfs_hash_lock(hs, 0);
+ theta = __cfs_hash_theta(hs);
+
+- c += seq_printf(m, "%-*s ", CFS_HASH_BIGNAME_LEN, hs->hs_name);
+- c += seq_printf(m, "%5d ", 1 << hs->hs_cur_bits);
+- c += seq_printf(m, "%5d ", 1 << hs->hs_min_bits);
+- c += seq_printf(m, "%5d ", 1 << hs->hs_max_bits);
+- c += seq_printf(m, "%d.%03d ", __cfs_hash_theta_int(theta),
+- __cfs_hash_theta_frac(theta));
+- c += seq_printf(m, "%d.%03d ", __cfs_hash_theta_int(hs->hs_min_theta),
+- __cfs_hash_theta_frac(hs->hs_min_theta));
+- c += seq_printf(m, "%d.%03d ", __cfs_hash_theta_int(hs->hs_max_theta),
+- __cfs_hash_theta_frac(hs->hs_max_theta));
+- c += seq_printf(m, " 0x%02x ", hs->hs_flags);
+- c += seq_printf(m, "%6d ", hs->hs_rehash_count);
++ seq_printf(m, "%-*s %5d %5d %5d %d.%03d %d.%03d %d.%03d 0x%02x %6d ",
++ CFS_HASH_BIGNAME_LEN, hs->hs_name,
++ 1 << hs->hs_cur_bits, 1 << hs->hs_min_bits,
++ 1 << hs->hs_max_bits,
++ __cfs_hash_theta_int(theta), __cfs_hash_theta_frac(theta),
++ __cfs_hash_theta_int(hs->hs_min_theta),
++ __cfs_hash_theta_frac(hs->hs_min_theta),
++ __cfs_hash_theta_int(hs->hs_max_theta),
++ __cfs_hash_theta_frac(hs->hs_max_theta),
++ hs->hs_flags, hs->hs_rehash_count);
+
+ /*
+ * The distribution is a summary of the chained hash depth in
+@@ -2126,17 +2120,14 @@ int cfs_hash_debug_str(struct cfs_hash *hs, struct seq_file *m)
+ maxdepb = ffz(~maxdep);
+ }
+ total += bd.bd_bucket->hsb_count;
+- dist[min(fls(bd.bd_bucket->hsb_count/max(theta,1)),7)]++;
++ dist[min(fls(bd.bd_bucket->hsb_count / max(theta, 1)), 7)]++;
+ cfs_hash_bd_unlock(hs, &bd, 0);
+ }
+
+- c += seq_printf(m, "%7d ", total);
+- c += seq_printf(m, "%7d ", maxdep);
+- c += seq_printf(m, "%7d ", maxdepb);
++ seq_printf(m, "%7d %7d %7d ", total, maxdep, maxdepb);
+ for (i = 0; i < 8; i++)
+- c += seq_printf(m, "%d%c", dist[i], (i == 7) ? '\n' : '/');
++ seq_printf(m, "%d%c", dist[i], (i == 7) ? '\n' : '/');
+
+ cfs_hash_unlock(hs, 0);
+- return c;
+ }
+ EXPORT_SYMBOL(cfs_hash_debug_str);
+diff --git a/lustre/fid/lproc_fid.c b/lustre/fid/lproc_fid.c
+index 078df00..00b2c7b 100644
+--- a/lustre/fid/lproc_fid.c
++++ b/lustre/fid/lproc_fid.c
+@@ -127,17 +127,15 @@ static int
+ lprocfs_server_fid_space_seq_show(struct seq_file *m, void *unused)
+ {
+ struct lu_server_seq *seq = (struct lu_server_seq *)m->private;
+- int rc;
+ ENTRY;
+
+ LASSERT(seq != NULL);
+
+ mutex_lock(&seq->lss_mutex);
+- rc = seq_printf(m, "["LPX64" - "LPX64"]:%x:%s\n",
+- PRANGE(&seq->lss_space));
++ seq_printf(m, "["LPX64" - "LPX64"]:%x:%s\n", PRANGE(&seq->lss_space));
+ mutex_unlock(&seq->lss_mutex);
+
+- RETURN(rc);
++ RETURN(0);
+ }
+
+ static int
+@@ -145,7 +143,6 @@ lprocfs_server_fid_server_seq_show(struct seq_file *m, void *unused)
+ {
+ struct lu_server_seq *seq = (struct lu_server_seq *)m->private;
+ struct client_obd *cli;
+- int rc;
+ ENTRY;
+
+ LASSERT(seq != NULL);
+@@ -153,16 +150,15 @@ lprocfs_server_fid_server_seq_show(struct seq_file *m, void *unused)
+ if (seq->lss_cli) {
+ if (seq->lss_cli->lcs_exp != NULL) {
+ cli = &seq->lss_cli->lcs_exp->exp_obd->u.cli;
+- rc = seq_printf(m, "%s\n", cli->cl_target_uuid.uuid);
++ seq_printf(m, "%s\n", cli->cl_target_uuid.uuid);
+ } else {
+- rc = seq_printf(m, "%s\n",
+- seq->lss_cli->lcs_srv->lss_name);
++ seq_printf(m, "%s\n", seq->lss_cli->lcs_srv->lss_name);
+ }
+ } else {
+- rc = seq_printf(m, "<none>\n");
++ seq_puts(m, "<none>\n");
+ }
+
+- RETURN(rc);
++ RETURN(0);
+ }
+
+ static ssize_t
+@@ -197,16 +193,15 @@ static int
+ lprocfs_server_fid_width_seq_show(struct seq_file *m, void *unused)
+ {
+ struct lu_server_seq *seq = (struct lu_server_seq *)m->private;
+- int rc;
+ ENTRY;
+
+ LASSERT(seq != NULL);
+
+ mutex_lock(&seq->lss_mutex);
+- rc = seq_printf(m, LPU64"\n", seq->lss_width);
++ seq_printf(m, LPU64"\n", seq->lss_width);
+ mutex_unlock(&seq->lss_mutex);
+
+- RETURN(rc);
++ RETURN(0);
+ }
+
+ LPROC_SEQ_FOPS(lprocfs_server_fid_space);
+@@ -334,7 +329,7 @@ static int fldb_seq_show(struct seq_file *p, void *v)
+ fld->lsf_name, rc);
+ } else if (fld_rec.lsr_start != 0) {
+ range_be_to_cpu(&fld_rec, &fld_rec);
+- rc = seq_printf(p, DRANGE"\n", PRANGE(&fld_rec));
++ seq_printf(p, DRANGE"\n", PRANGE(&fld_rec));
+ }
+
+ return rc;
+@@ -533,17 +528,16 @@ static int
+ lprocfs_client_fid_space_seq_show(struct seq_file *m, void *unused)
+ {
+ struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
+- int rc;
+ ENTRY;
+
+ LASSERT(seq != NULL);
+
+ mutex_lock(&seq->lcs_mutex);
+- rc = seq_printf(m, "["LPX64" - "LPX64"]:%x:%s\n",
+- PRANGE(&seq->lcs_space));
++ seq_printf(m, "["LPX64" - "LPX64"]:%x:%s\n",
++ PRANGE(&seq->lcs_space));
+ mutex_unlock(&seq->lcs_mutex);
+
+- RETURN(rc);
++ RETURN(0);
+ }
+
+ static ssize_t
+@@ -585,32 +579,30 @@ static int
+ lprocfs_client_fid_width_seq_show(struct seq_file *m, void *unused)
+ {
+ struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
+- int rc;
+ ENTRY;
+
+ LASSERT(seq != NULL);
+
+ mutex_lock(&seq->lcs_mutex);
+- rc = seq_printf(m, LPU64"\n", seq->lcs_width);
++ seq_printf(m, LPU64"\n", seq->lcs_width);
+ mutex_unlock(&seq->lcs_mutex);
+
+- RETURN(rc);
++ RETURN(0);
+ }
+
+ static int
+ lprocfs_client_fid_fid_seq_show(struct seq_file *m, void *unused)
+ {
+ struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
+- int rc;
+ ENTRY;
+
+ LASSERT(seq != NULL);
+
+ mutex_lock(&seq->lcs_mutex);
+- rc = seq_printf(m, DFID"\n", PFID(&seq->lcs_fid));
++ seq_printf(m, DFID"\n", PFID(&seq->lcs_fid));
+ mutex_unlock(&seq->lcs_mutex);
+
+- RETURN(rc);
++ RETURN(0);
+ }
+
+ static int
+@@ -618,18 +610,17 @@ lprocfs_client_fid_server_seq_show(struct seq_file *m, void *unused)
+ {
+ struct lu_client_seq *seq = (struct lu_client_seq *)m->private;
+ struct client_obd *cli;
+- int rc;
+ ENTRY;
+
+ LASSERT(seq != NULL);
+
+ if (seq->lcs_exp != NULL) {
+ cli = &seq->lcs_exp->exp_obd->u.cli;
+- rc = seq_printf(m, "%s\n", cli->cl_target_uuid.uuid);
++ seq_printf(m, "%s\n", cli->cl_target_uuid.uuid);
+ } else {
+- rc = seq_printf(m, "%s\n", seq->lcs_srv->lss_name);
++ seq_printf(m, "%s\n", seq->lcs_srv->lss_name);
+ }
+- RETURN(rc);
++ RETURN(0);
+ }
+
+ LPROC_SEQ_FOPS(lprocfs_client_fid_space);
+diff --git a/lustre/fld/lproc_fld.c b/lustre/fld/lproc_fld.c
+index 4ae4f26..24e336c 100644
+--- a/lustre/fld/lproc_fld.c
++++ b/lustre/fld/lproc_fld.c
+@@ -263,7 +263,7 @@ static int fldb_seq_show(struct seq_file *p, void *v)
+ fld->lsf_name, rc);
+ } else if (fld_rec->lsr_start != 0) {
+ range_be_to_cpu(fld_rec, fld_rec);
+- rc = seq_printf(p, DRANGE"\n", PRANGE(fld_rec));
++ seq_printf(p, DRANGE"\n", PRANGE(fld_rec));
+ }
+
+ return rc;
+diff --git a/lustre/ldlm/ldlm_pool.c b/lustre/ldlm/ldlm_pool.c
+index 5292266..5ed717c 100644
+--- a/lustre/ldlm/ldlm_pool.c
++++ b/lustre/ldlm/ldlm_pool.c
+@@ -685,20 +685,19 @@ static int lprocfs_pool_state_seq_show(struct seq_file *m, void *unused)
+ spin_unlock(&pl->pl_lock);
+
+ seq_printf(m, "LDLM pool state (%s):\n"
+- " SLV: "LPU64"\n"
+- " CLV: "LPU64"\n"
+- " LVF: %d\n",
+- pl->pl_name, slv, clv, lvf);
++ " SLV: "LPU64"\n"
++ " CLV: "LPU64"\n"
++ " LVF: %d\n",
++ pl->pl_name, slv, clv, lvf);
+
+ if (ns_is_server(ldlm_pl2ns(pl))) {
+- seq_printf(m, " GSP: %d%%\n"
+- " GP: %d\n",
+- grant_step, grant_plan);
++ seq_printf(m, " GSP: %d%%\n", grant_step);
++ seq_printf(m, " GP: %d\n", grant_plan);
+ }
+- seq_printf(m, " GR: %d\n" " CR: %d\n" " GS: %d\n"
+- " G: %d\n" " L: %d\n",
+- grant_rate, cancel_rate, grant_speed,
+- granted, limit);
++
++ seq_printf(m, " GR: %d\n CR: %d\n GS: %d\n G: %d\n L: %d\n",
++ grant_rate, cancel_rate, grant_speed,
++ granted, limit);
+ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(lprocfs_pool_state);
+diff --git a/lustre/ldlm/ldlm_resource.c b/lustre/ldlm/ldlm_resource.c
+index 7ed21e3..7abcaaa 100644
+--- a/lustre/ldlm/ldlm_resource.c
++++ b/lustre/ldlm/ldlm_resource.c
+@@ -88,7 +88,8 @@ LPROC_SEQ_FOPS_RO_TYPE(ldlm, uint);
+
+ static int seq_watermark_show(struct seq_file *m, void *data)
+ {
+- return seq_printf(m, LPU64"\n", *(__u64 *)m->private);
++ seq_printf(m, LPU64"\n", *(__u64 *)m->private);
++ return 0;
+ }
+
+ static ssize_t seq_watermark_write(struct file *file,
+@@ -161,8 +162,9 @@ static const struct file_operations ldlm_watermark_fops = {
+
+ static int seq_granted_show(struct seq_file *m, void *data)
+ {
+- return seq_printf(m, LPU64"\n", percpu_counter_sum_positive(
+- (struct percpu_counter *)m->private));
++ seq_printf(m, LPU64"\n", percpu_counter_sum_positive(
++ (struct percpu_counter *)m->private));
++ return 0;
+ }
+
+ static int seq_granted_open(struct inode *inode, struct file *file)
+diff --git a/lustre/lfsck/lfsck_internal.h b/lustre/lfsck/lfsck_internal.h
+index 281643e..a75e948 100644
+--- a/lustre/lfsck/lfsck_internal.h
++++ b/lustre/lfsck/lfsck_internal.h
+@@ -411,9 +411,9 @@ struct lfsck_operations {
+ int result,
+ bool init);
+
+- int (*lfsck_dump)(const struct lu_env *env,
+- struct lfsck_component *com,
+- struct seq_file *m);
++ void (*lfsck_dump)(const struct lu_env *env,
++ struct lfsck_component *com,
++ struct seq_file *m);
+
+ int (*lfsck_double_scan)(const struct lu_env *env,
+ struct lfsck_component *com);
+@@ -917,11 +917,11 @@ void lfsck_component_cleanup(const struct lu_env *env,
+ struct lfsck_component *com);
+ void lfsck_instance_cleanup(const struct lu_env *env,
+ struct lfsck_instance *lfsck);
+-int lfsck_bits_dump(struct seq_file *m, int bits, const char *names[],
++void lfsck_bits_dump(struct seq_file *m, int bits, const char *names[],
++ const char *prefix);
++void lfsck_time_dump(struct seq_file *m, __u64 time, const char *name);
++void lfsck_pos_dump(struct seq_file *m, struct lfsck_position *pos,
+ const char *prefix);
+-int lfsck_time_dump(struct seq_file *m, __u64 time, const char *name);
+-int lfsck_pos_dump(struct seq_file *m, struct lfsck_position *pos,
+- const char *prefix);
+ void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck,
+ struct lfsck_position *pos, bool init);
+ bool __lfsck_set_speed(struct lfsck_instance *lfsck, __u32 limit);
+diff --git a/lustre/lfsck/lfsck_layout.c b/lustre/lfsck/lfsck_layout.c
+index 66732d5..e40c311 100644
+--- a/lustre/lfsck/lfsck_layout.c
++++ b/lustre/lfsck/lfsck_layout.c
+@@ -4747,73 +4747,59 @@ static int lfsck_layout_slave_post(const struct lu_env *env,
+ return rc;
+ }
+
+-static int lfsck_layout_dump(const struct lu_env *env,
+- struct lfsck_component *com, struct seq_file *m)
++static void lfsck_layout_dump(const struct lu_env *env,
++ struct lfsck_component *com, struct seq_file *m)
+ {
+ struct lfsck_instance *lfsck = com->lc_lfsck;
+ struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram;
+ struct lfsck_layout *lo = com->lc_file_ram;
+- int rc;
+
+ down_read(&com->lc_sem);
+ seq_printf(m, "name: lfsck_layout\n"
+- "magic: %#x\n"
+- "version: %d\n"
+- "status: %s\n",
+- lo->ll_magic,
+- bk->lb_version,
+- lfsck_status2names(lo->ll_status));
+-
+- rc = lfsck_bits_dump(m, lo->ll_flags, lfsck_flags_names, "flags");
+- if (rc < 0)
+- goto out;
++ "magic: %#x\n"
++ "version: %d\n"
++ "status: %s\n",
++ lo->ll_magic,
++ bk->lb_version,
++ lfsck_status2name(lo->ll_status));
+
+- rc = lfsck_bits_dump(m, bk->lb_param, lfsck_param_names, "param");
+- if (rc < 0)
+- goto out;
++ lfsck_bits_dump(m, lo->ll_flags, lfsck_flags_names, "flags");
+
+- rc = lfsck_time_dump(m, lo->ll_time_last_complete,
+- "last_completed");
+- if (rc < 0)
+- goto out;
++ lfsck_bits_dump(m, bk->lb_param, lfsck_param_names, "param");
+
+- rc = lfsck_time_dump(m, lo->ll_time_latest_start,
+- "latest_start");
+- if (rc < 0)
+- goto out;
++ lfsck_time_dump(m, lo->ll_time_last_complete, "last_completed");
+
+- rc = lfsck_time_dump(m, lo->ll_time_last_checkpoint,
+- "last_checkpoint");
+- if (rc < 0)
+- goto out;
++ lfsck_time_dump(m, lo->ll_time_latest_start, "latest_start");
++
++ lfsck_time_dump(m, lo->ll_time_last_checkpoint, "last_checkpoint");
+
+ seq_printf(m, "latest_start_position: "LPU64"\n"
+- "last_checkpoint_position: "LPU64"\n"
+- "first_failure_position: "LPU64"\n",
+- lo->ll_pos_latest_start,
+- lo->ll_pos_last_checkpoint,
+- lo->ll_pos_first_inconsistent);
++ "last_checkpoint_position: "LPU64"\n"
++ "first_failure_position: "LPU64"\n",
++ lo->ll_pos_latest_start,
++ lo->ll_pos_last_checkpoint,
++ lo->ll_pos_first_inconsistent);
+
+ seq_printf(m, "success_count: %u\n"
+- "repaired_dangling: "LPU64"\n"
+- "repaired_unmatched_pair: "LPU64"\n"
+- "repaired_multiple_referenced: "LPU64"\n"
+- "repaired_orphan: "LPU64"\n"
+- "repaired_inconsistent_owner: "LPU64"\n"
+- "repaired_others: "LPU64"\n"
+- "skipped: "LPU64"\n"
+- "failed_phase1: "LPU64"\n"
+- "failed_phase2: "LPU64"\n",
+- lo->ll_success_count,
+- lo->ll_objs_repaired[LLIT_DANGLING - 1],
+- lo->ll_objs_repaired[LLIT_UNMATCHED_PAIR - 1],
+- lo->ll_objs_repaired[LLIT_MULTIPLE_REFERENCED - 1],
+- lo->ll_objs_repaired[LLIT_ORPHAN - 1],
+- lo->ll_objs_repaired[LLIT_INCONSISTENT_OWNER - 1],
+- lo->ll_objs_repaired[LLIT_OTHERS - 1],
+- lo->ll_objs_skipped,
+- lo->ll_objs_failed_phase1,
+- lo->ll_objs_failed_phase2);
++ "repaired_dangling: "LPU64"\n"
++ "repaired_unmatched_pair: "LPU64"\n"
++ "repaired_multiple_referenced: "LPU64"\n"
++ "repaired_orphan: "LPU64"\n"
++ "repaired_inconsistent_owner: "LPU64"\n"
++ "repaired_others: "LPU64"\n"
++ "skipped: "LPU64"\n"
++ "failed_phase1: "LPU64"\n"
++ "failed_phase2: "LPU64"\n",
++ lo->ll_success_count,
++ lo->ll_objs_repaired[LLIT_DANGLING - 1],
++ lo->ll_objs_repaired[LLIT_UNMATCHED_PAIR - 1],
++ lo->ll_objs_repaired[LLIT_MULTIPLE_REFERENCED - 1],
++ lo->ll_objs_repaired[LLIT_ORPHAN - 1],
++ lo->ll_objs_repaired[LLIT_INCONSISTENT_OWNER - 1],
++ lo->ll_objs_repaired[LLIT_OTHERS - 1],
++ lo->ll_objs_skipped,
++ lo->ll_objs_failed_phase1,
++ lo->ll_objs_failed_phase2);
+
+ if (lo->ll_status == LS_SCANNING_PHASE1) {
+ __u64 pos;
+@@ -4833,19 +4819,19 @@ static int lfsck_layout_dump(const struct lu_env *env,
+ if (rtime != 0)
+ do_div(speed, rtime);
+ seq_printf(m, "checked_phase1: "LPU64"\n"
+- "checked_phase2: "LPU64"\n"
+- "run_time_phase1: %u seconds\n"
+- "run_time_phase2: %u seconds\n"
+- "average_speed_phase1: "LPU64" items/sec\n"
+- "average_speed_phase2: N/A\n"
+- "real-time_speed_phase1: "LPU64" items/sec\n"
+- "real-time_speed_phase2: N/A\n",
+- checked,
+- lo->ll_objs_checked_phase2,
+- rtime,
+- lo->ll_run_time_phase2,
+- speed,
+- new_checked);
++ "checked_phase2: "LPU64"\n"
++ "run_time_phase1: %u seconds\n"
++ "run_time_phase2: %u seconds\n"
++ "average_speed_phase1: "LPU64" items/sec\n"
++ "average_speed_phase2: N/A\n"
++ "real-time_speed_phase1: "LPU64" items/sec\n"
++ "real-time_speed_phase2: N/A\n",
++ checked,
++ lo->ll_objs_checked_phase2,
++ rtime,
++ lo->ll_run_time_phase2,
++ speed,
++ new_checked);
+
+ LASSERT(lfsck->li_di_oit != NULL);
+
+@@ -4878,26 +4864,23 @@ static int lfsck_layout_dump(const struct lu_env *env,
+ do_div(speed1, lo->ll_run_time_phase1);
+ if (rtime != 0)
+ do_div(speed2, rtime);
+- rc = seq_printf(m, "checked_phase1: "LPU64"\n"
+- "checked_phase2: "LPU64"\n"
+- "run_time_phase1: %u seconds\n"
+- "run_time_phase2: %u seconds\n"
+- "average_speed_phase1: "LPU64" items/sec\n"
+- "average_speed_phase2: "LPU64" items/sec\n"
+- "real-time_speed_phase1: N/A\n"
+- "real-time_speed_phase2: "LPU64" items/sec\n"
+- "current_position: "DFID"\n",
+- lo->ll_objs_checked_phase1,
+- checked,
+- lo->ll_run_time_phase1,
+- rtime,
+- speed1,
+- speed2,
+- new_checked,
+- PFID(&com->lc_fid_latest_scanned_phase2));
+- if (rc <= 0)
+- goto out;
+-
++ seq_printf(m, "checked_phase1: "LPU64"\n"
++ "checked_phase2: "LPU64"\n"
++ "run_time_phase1: %u seconds\n"
++ "run_time_phase2: %u seconds\n"
++ "average_speed_phase1: "LPU64" items/sec\n"
++ "average_speed_phase2: "LPU64" items/sec\n"
++ "real-time_speed_phase1: N/A\n"
++ "real-time_speed_phase2: "LPU64" items/sec\n"
++ "current_position: "DFID"\n",
++ lo->ll_objs_checked_phase1,
++ checked,
++ lo->ll_run_time_phase1,
++ rtime,
++ speed1,
++ speed2,
++ new_checked,
++ PFID(&com->lc_fid_latest_scanned_phase2));
+ } else {
+ __u64 speed1 = lo->ll_objs_checked_phase1;
+ __u64 speed2 = lo->ll_objs_checked_phase2;
+@@ -4922,10 +4905,8 @@ static int lfsck_layout_dump(const struct lu_env *env,
+ speed1,
+ speed2);
+ }
+-out:
+- up_read(&com->lc_sem);
+
+- return rc;
++ up_read(&com->lc_sem);
+ }
+
+ static int lfsck_layout_master_double_scan(const struct lu_env *env,
+diff --git a/lustre/lfsck/lfsck_lib.c b/lustre/lfsck/lfsck_lib.c
+index 139c95b..1064392 100644
+--- a/lustre/lfsck/lfsck_lib.c
++++ b/lustre/lfsck/lfsck_lib.c
+@@ -1749,17 +1749,14 @@ static inline int lfsck_instance_add(struct lfsck_instance *lfsck)
+ return 0;
+ }
+
+-int lfsck_bits_dump(struct seq_file *m, int bits, const char *names[],
+- const char *prefix)
++void lfsck_bits_dump(struct seq_file *m, int bits, const char *names[],
++ const char *prefix)
+ {
+ int flag;
+ int i;
+ bool newline = (bits != 0 ? false : true);
+- int rc;
+
+- rc = seq_printf(m, "%s:%c", prefix, bits != 0 ? ' ' : '\n');
+- if (rc < 0)
+- return rc;
++ seq_printf(m, "%s:%c", prefix, bits != 0 ? ' ' : '\n');
+
+ for (i = 0, flag = 1; bits != 0; i++, flag = 1 << i) {
+ if (flag & bits) {
+@@ -1768,54 +1765,43 @@ int lfsck_bits_dump(struct seq_file *m, int bits, const char *names[],
+ if (bits == 0)
+ newline = true;
+
+- rc = seq_printf(m, "%s%c", names[i],
+- newline ? '\n' : ',');
+- if (rc < 0)
+- return rc;
++ seq_printf(m, "%s%c", names[i],
++ newline ? '\n' : ',');
+ }
+ }
+ }
+
+ if (!newline)
+- rc = seq_printf(m, "\n");
+-
+- return rc;
++ seq_putc(m, '\n');
+ }
+
+-int lfsck_time_dump(struct seq_file *m, __u64 time, const char *name)
++void lfsck_time_dump(struct seq_file *m, __u64 time, const char *name)
+ {
+- int rc;
+-
+ if (time == 0) {
+- rc = seq_printf(m, "%s_time: N/A\n", name);
+- if (rc == 0)
+- rc = seq_printf(m, "time_since_%s: N/A\n", name);
+-
+- return rc;
++ seq_printf(m, "%s_time: N/A\n", name);
++ seq_printf(m, "time_since_%s: N/A\n", name);
++ } else {
++ seq_printf(m, "%s_time: "LPU64"\n", name, time);
++ seq_printf(m, "time_since_%s: "LPU64" seconds\n",
++ name, cfs_time_current_sec() - time);
+ }
+-
+- rc = seq_printf(m, "%s_time: "LPU64"\n", name, time);
+- if (rc == 0)
+- rc = seq_printf(m, "time_since_%s: "LPU64" seconds\n",
+- name, cfs_time_current_sec() - time);
+-
+- return rc;
+ }
+
+-int lfsck_pos_dump(struct seq_file *m, struct lfsck_position *pos,
+- const char *prefix)
++void lfsck_pos_dump(struct seq_file *m, struct lfsck_position *pos,
++ const char *prefix)
+ {
+ if (fid_is_zero(&pos->lp_dir_parent)) {
+- if (pos->lp_oit_cookie == 0)
+- return seq_printf(m, "%s: N/A, N/A, N/A\n", prefix);
+-
+- return seq_printf(m, "%s: "LPU64", N/A, N/A\n",
+- prefix, pos->lp_oit_cookie);
++ if (pos->lp_oit_cookie == 0) {
++ seq_printf(m, "%s: N/A, N/A, N/A\n", prefix);
++ return;
++ }
++ seq_printf(m, "%s: "LPU64", N/A, N/A\n",
++ prefix, pos->lp_oit_cookie);
++ } else {
++ seq_printf(m, "%s: "LPU64", "DFID", "LPX64"\n",
++ prefix, pos->lp_oit_cookie,
++ PFID(&pos->lp_dir_parent), pos->lp_dir_cookie);
+ }
+-
+- return seq_printf(m, "%s: "LPU64", "DFID", "LPX64"\n",
+- prefix, pos->lp_oit_cookie,
+- PFID(&pos->lp_dir_parent), pos->lp_dir_cookie);
+ }
+
+ void lfsck_pos_fill(const struct lu_env *env, struct lfsck_instance *lfsck,
+@@ -2696,7 +2682,7 @@ int lfsck_dump(struct seq_file *m, struct dt_device *key, enum lfsck_type type)
+ if (likely(lfsck != NULL)) {
+ com = lfsck_component_find(lfsck, type);
+ if (likely(com != NULL)) {
+- rc = com->lc_ops->lfsck_dump(&env, com, m);
++ com->lc_ops->lfsck_dump(&env, com, m);
+ lfsck_component_put(&env, com);
+ } else {
+ rc = -ENOTSUPP;
+diff --git a/lustre/lfsck/lfsck_namespace.c b/lustre/lfsck/lfsck_namespace.c
+index fa448bb..a97fa17 100644
+--- a/lustre/lfsck/lfsck_namespace.c
++++ b/lustre/lfsck/lfsck_namespace.c
+@@ -3611,75 +3611,75 @@ static void lfsck_namespace_dump_statistics(struct seq_file *m,
+ __u32 time_phase2)
+ {
+ seq_printf(m, "checked_phase1: "LPU64"\n"
+- "checked_phase2: "LPU64"\n"
+- "updated_phase1: "LPU64"\n"
+- "updated_phase2: "LPU64"\n"
+- "failed_phase1: "LPU64"\n"
+- "failed_phase2: "LPU64"\n"
+- "directories: "LPU64"\n"
+- "dirent_repaired: "LPU64"\n"
+- "linkea_repaired: "LPU64"\n"
+- "nlinks_repaired: "LPU64"\n"
+- "multiple_linked_checked: "LPU64"\n"
+- "multiple_linked_repaired: "LPU64"\n"
+- "unknown_inconsistency: "LPU64"\n"
+- "unmatched_pairs_repaired: "LPU64"\n"
+- "dangling_repaired: "LPU64"\n"
+- "multiple_referenced_repaired: "LPU64"\n"
+- "bad_file_type_repaired: "LPU64"\n"
+- "lost_dirent_repaired: "LPU64"\n"
+- "local_lost_found_scanned: "LPU64"\n"
+- "local_lost_found_moved: "LPU64"\n"
+- "local_lost_found_skipped: "LPU64"\n"
+- "local_lost_found_failed: "LPU64"\n"
+- "striped_dirs_scanned: "LPU64"\n"
+- "striped_dirs_repaired: "LPU64"\n"
+- "striped_dirs_failed: "LPU64"\n"
+- "striped_dirs_disabled: "LPU64"\n"
+- "striped_dirs_skipped: "LPU64"\n"
+- "striped_shards_scanned: "LPU64"\n"
+- "striped_shards_repaired: "LPU64"\n"
+- "striped_shards_failed: "LPU64"\n"
+- "striped_shards_skipped: "LPU64"\n"
+- "name_hash_repaired: "LPU64"\n"
+- "success_count: %u\n"
+- "run_time_phase1: %u seconds\n"
+- "run_time_phase2: %u seconds\n",
+- checked_phase1,
+- checked_phase2,
+- ns->ln_items_repaired,
+- ns->ln_objs_repaired_phase2,
+- ns->ln_items_failed,
+- ns->ln_objs_failed_phase2,
+- ns->ln_dirs_checked,
+- ns->ln_dirent_repaired,
+- ns->ln_linkea_repaired,
+- ns->ln_objs_nlink_repaired,
+- ns->ln_mul_linked_checked,
+- ns->ln_mul_linked_repaired,
+- ns->ln_unknown_inconsistency,
+- ns->ln_unmatched_pairs_repaired,
+- ns->ln_dangling_repaired,
+- ns->ln_mul_ref_repaired,
+- ns->ln_bad_type_repaired,
+- ns->ln_lost_dirent_repaired,
+- ns->ln_local_lpf_scanned,
+- ns->ln_local_lpf_moved,
+- ns->ln_local_lpf_skipped,
+- ns->ln_local_lpf_failed,
+- ns->ln_striped_dirs_scanned,
+- ns->ln_striped_dirs_repaired,
+- ns->ln_striped_dirs_failed,
+- ns->ln_striped_dirs_disabled,
+- ns->ln_striped_dirs_skipped,
+- ns->ln_striped_shards_scanned,
+- ns->ln_striped_shards_repaired,
+- ns->ln_striped_shards_failed,
+- ns->ln_striped_shards_skipped,
+- ns->ln_name_hash_repaired,
+- ns->ln_success_count,
+- time_phase1,
+- time_phase2);
++ "checked_phase2: "LPU64"\n"
++ "updated_phase1: "LPU64"\n"
++ "updated_phase2: "LPU64"\n"
++ "failed_phase1: "LPU64"\n"
++ "failed_phase2: "LPU64"\n"
++ "directories: "LPU64"\n"
++ "dirent_repaired: "LPU64"\n"
++ "linkea_repaired: "LPU64"\n"
++ "nlinks_repaired: "LPU64"\n"
++ "multiple_linked_checked: "LPU64"\n"
++ "multiple_linked_repaired: "LPU64"\n"
++ "unknown_inconsistency: "LPU64"\n"
++ "unmatched_pairs_repaired: "LPU64"\n"
++ "dangling_repaired: "LPU64"\n"
++ "multiple_referenced_repaired: "LPU64"\n"
++ "bad_file_type_repaired: "LPU64"\n"
++ "lost_dirent_repaired: "LPU64"\n"
++ "local_lost_found_scanned: "LPU64"\n"
++ "local_lost_found_moved: "LPU64"\n"
++ "local_lost_found_skipped: "LPU64"\n"
++ "local_lost_found_failed: "LPU64"\n"
++ "striped_dirs_scanned: "LPU64"\n"
++ "striped_dirs_repaired: "LPU64"\n"
++ "striped_dirs_failed: "LPU64"\n"
++ "striped_dirs_disabled: "LPU64"\n"
++ "striped_dirs_skipped: "LPU64"\n"
++ "striped_shards_scanned: "LPU64"\n"
++ "striped_shards_repaired: "LPU64"\n"
++ "striped_shards_failed: "LPU64"\n"
++ "striped_shards_skipped: "LPU64"\n"
++ "name_hash_repaired: "LPU64"\n"
++ "success_count: %u\n"
++ "run_time_phase1: %u seconds\n"
++ "run_time_phase2: %u seconds\n",
++ checked_phase1,
++ checked_phase2,
++ ns->ln_items_repaired,
++ ns->ln_objs_repaired_phase2,
++ ns->ln_items_failed,
++ ns->ln_objs_failed_phase2,
++ ns->ln_dirs_checked,
++ ns->ln_dirent_repaired,
++ ns->ln_linkea_repaired,
++ ns->ln_objs_nlink_repaired,
++ ns->ln_mul_linked_checked,
++ ns->ln_mul_linked_repaired,
++ ns->ln_unknown_inconsistency,
++ ns->ln_unmatched_pairs_repaired,
++ ns->ln_dangling_repaired,
++ ns->ln_mul_ref_repaired,
++ ns->ln_bad_type_repaired,
++ ns->ln_lost_dirent_repaired,
++ ns->ln_local_lpf_scanned,
++ ns->ln_local_lpf_moved,
++ ns->ln_local_lpf_skipped,
++ ns->ln_local_lpf_failed,
++ ns->ln_striped_dirs_scanned,
++ ns->ln_striped_dirs_repaired,
++ ns->ln_striped_dirs_failed,
++ ns->ln_striped_dirs_disabled,
++ ns->ln_striped_dirs_skipped,
++ ns->ln_striped_shards_scanned,
++ ns->ln_striped_shards_repaired,
++ ns->ln_striped_shards_failed,
++ ns->ln_striped_shards_skipped,
++ ns->ln_name_hash_repaired,
++ ns->ln_success_count,
++ time_phase1,
++ time_phase2);
+ }
+
+ static void lfsck_namespace_release_lmv(const struct lu_env *env,
+@@ -4243,14 +4243,13 @@ static int lfsck_namespace_post(const struct lu_env *env,
+ RETURN(rc);
+ }
+
+-static int
++static void
+ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
+ struct seq_file *m)
+ {
+ struct lfsck_instance *lfsck = com->lc_lfsck;
+ struct lfsck_bookmark *bk = &lfsck->li_bookmark_ram;
+ struct lfsck_namespace *ns = com->lc_file_ram;
+- int rc;
+
+ down_read(&com->lc_sem);
+ seq_printf(m, "name: lfsck_namespace\n"
+@@ -4261,43 +4260,23 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
+ bk->lb_version,
+ lfsck_status2names(ns->ln_status));
+
+- rc = lfsck_bits_dump(m, ns->ln_flags, lfsck_flags_names, "flags");
+- if (rc < 0)
+- goto out;
++ lfsck_bits_dump(m, ns->ln_flags, lfsck_flags_names, "flags");
+
+- rc = lfsck_bits_dump(m, bk->lb_param, lfsck_param_names, "param");
+- if (rc < 0)
+- goto out;
++ lfsck_bits_dump(m, bk->lb_param, lfsck_param_names, "param");
+
+- rc = lfsck_time_dump(m, ns->ln_time_last_complete,
+- "last_completed");
+- if (rc < 0)
+- goto out;
++ lfsck_time_dump(m, ns->ln_time_last_complete, "last_completed");
+
+- rc = lfsck_time_dump(m, ns->ln_time_latest_start,
+- "latest_start");
+- if (rc < 0)
+- goto out;
++ lfsck_time_dump(m, ns->ln_time_latest_start, "latest_start");
+
+- rc = lfsck_time_dump(m, ns->ln_time_last_checkpoint,
+- "last_checkpoint");
+- if (rc < 0)
+- goto out;
++ lfsck_time_dump(m, ns->ln_time_last_checkpoint, "last_checkpoint");
+
+- rc = lfsck_pos_dump(m, &ns->ln_pos_latest_start,
+- "latest_start_position");
+- if (rc < 0)
+- goto out;
++ lfsck_pos_dump(m, &ns->ln_pos_latest_start, "latest_start_position");
+
+- rc = lfsck_pos_dump(m, &ns->ln_pos_last_checkpoint,
+- "last_checkpoint_position");
+- if (rc < 0)
+- goto out;
++ lfsck_pos_dump(m, &ns->ln_pos_last_checkpoint,
++ "last_checkpoint_position");
+
+- rc = lfsck_pos_dump(m, &ns->ln_pos_first_inconsistent,
+- "first_failure_position");
+- if (rc < 0)
+- goto out;
++ lfsck_pos_dump(m, &ns->ln_pos_first_inconsistent,
++ "first_failure_position");
+
+ if (ns->ln_status == LS_SCANNING_PHASE1) {
+ struct lfsck_position pos;
+@@ -4319,13 +4298,13 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
+
+ lfsck_namespace_dump_statistics(m, ns, checked, 0, rtime, 0);
+ seq_printf(m, "average_speed_phase1: "LPU64" items/sec\n"
+- "average_speed_phase2: N/A\n"
+- "average_speed_total: "LPU64" items/sec\n"
+- "real_time_speed_phase1: "LPU64" items/sec\n"
+- "real_time_speed_phase2: N/A\n",
+- speed,
+- speed,
+- new_checked);
++ "average_speed_phase2: N/A\n"
++ "average_speed_total: "LPU64" items/sec\n"
++ "real_time_speed_phase1: "LPU64" items/sec\n"
++ "real_time_speed_phase2: N/A\n",
++ speed,
++ speed,
++ new_checked);
+
+ LASSERT(lfsck->li_di_oit != NULL);
+
+@@ -4389,16 +4368,16 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
+ checked,
+ ns->ln_run_time_phase1, rtime);
+ seq_printf(m, "average_speed_phase1: "LPU64" items/sec\n"
+- "average_speed_phase2: "LPU64" objs/sec\n"
+- "average_speed_total: "LPU64" items/sec\n"
+- "real_time_speed_phase1: N/A\n"
+- "real_time_speed_phase2: "LPU64" objs/sec\n"
+- "current_position: "DFID"\n",
+- speed1,
+- speed2,
+- speed0,
+- new_checked,
+- PFID(&ns->ln_fid_latest_scanned_phase2));
++ "average_speed_phase2: "LPU64" objs/sec\n"
++ "average_speed_total: "LPU64" items/sec\n"
++ "real_time_speed_phase1: N/A\n"
++ "real_time_speed_phase2: "LPU64" objs/sec\n"
++ "current_position: "DFID"\n",
++ speed1,
++ speed2,
++ speed0,
++ new_checked,
++ PFID(&ns->ln_fid_latest_scanned_phase2));
+ } else {
+ __u64 speed1 = ns->ln_items_checked;
+ __u64 speed2 = ns->ln_objs_checked_phase2;
+@@ -4423,18 +4402,17 @@ lfsck_namespace_dump(const struct lu_env *env, struct lfsck_component *com,
+ ns->ln_run_time_phase1,
+ ns->ln_run_time_phase2);
+ seq_printf(m, "average_speed_phase1: "LPU64" items/sec\n"
+- "average_speed_phase2: "LPU64" objs/sec\n"
+- "average_speed_total: "LPU64" items/sec\n"
+- "real_time_speed_phase1: N/A\n"
+- "real_time_speed_phase2: N/A\n"
+- "current_position: N/A\n",
+- speed1,
+- speed2,
+- speed0);
++ "average_speed_phase2: "LPU64" objs/sec\n"
++ "average_speed_total: "LPU64" items/sec\n"
++ "real_time_speed_phase1: N/A\n"
++ "real_time_speed_phase2: N/A\n"
++ "current_position: N/A\n",
++ speed1,
++ speed2,
++ speed0);
+ }
+-out:
++
+ up_read(&com->lc_sem);
+- return 0;
+ }
+
+ static int lfsck_namespace_double_scan(const struct lu_env *env,
+diff --git a/lustre/llite/lproc_llite.c b/lustre/llite/lproc_llite.c
+index e631f50..1767a00 100644
+--- a/lustre/llite/lproc_llite.c
++++ b/lustre/llite/lproc_llite.c
+@@ -66,7 +66,7 @@ static int ll_blksize_seq_show(struct seq_file *m, void *v)
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ OBD_STATFS_NODELAY);
+ if (!rc)
+- rc = seq_printf(m, "%u\n", osfs.os_bsize);
++ seq_printf(m, "%u\n", osfs.os_bsize);
+ return rc;
+ }
+ LPROC_SEQ_FOPS_RO(ll_blksize);
+@@ -88,7 +88,7 @@ static int ll_kbytestotal_seq_show(struct seq_file *m, void *v)
+ while (blk_size >>= 1)
+ result <<= 1;
+
+- rc = seq_printf(m, LPU64"\n", result);
++ seq_printf(m, LPU64"\n", result);
+ }
+ return rc;
+ }
+@@ -111,7 +111,7 @@ static int ll_kbytesfree_seq_show(struct seq_file *m, void *v)
+ while (blk_size >>= 1)
+ result <<= 1;
+
+- rc = seq_printf(m, LPU64"\n", result);
++ seq_printf(m, LPU64"\n", result);
+ }
+ return rc;
+ }
+@@ -134,7 +134,7 @@ static int ll_kbytesavail_seq_show(struct seq_file *m, void *v)
+ while (blk_size >>= 1)
+ result <<= 1;
+
+- rc = seq_printf(m, LPU64"\n", result);
++ seq_printf(m, LPU64"\n", result);
+ }
+ return rc;
+ }
+@@ -151,7 +151,7 @@ static int ll_filestotal_seq_show(struct seq_file *m, void *v)
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ OBD_STATFS_NODELAY);
+ if (!rc)
+- rc = seq_printf(m, LPU64"\n", osfs.os_files);
++ seq_printf(m, LPU64"\n", osfs.os_files);
+ return rc;
+ }
+ LPROC_SEQ_FOPS_RO(ll_filestotal);
+@@ -167,7 +167,7 @@ static int ll_filesfree_seq_show(struct seq_file *m, void *v)
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ OBD_STATFS_NODELAY);
+ if (!rc)
+- rc = seq_printf(m, LPU64"\n", osfs.os_ffree);
++ seq_printf(m, LPU64"\n", osfs.os_ffree);
+ return rc;
+ }
+ LPROC_SEQ_FOPS_RO(ll_filesfree);
+@@ -175,15 +175,14 @@ LPROC_SEQ_FOPS_RO(ll_filesfree);
+ static int ll_client_type_seq_show(struct seq_file *m, void *v)
+ {
+ struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
+- int rc;
+
+ LASSERT(sbi != NULL);
+
+ if (sbi->ll_flags & LL_SBI_RMT_CLIENT)
+- rc = seq_printf(m, "remote client\n");
++ seq_puts(m, "remote client\n");
+ else
+- rc = seq_printf(m, "local client\n");
+- return rc;
++ seq_puts(m, "local client\n");
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ll_client_type);
+
+@@ -192,7 +191,8 @@ static int ll_fstype_seq_show(struct seq_file *m, void *v)
+ struct super_block *sb = m->private;
+
+ LASSERT(sb != NULL);
+- return seq_printf(m, "%s\n", sb->s_type->name);
++ seq_printf(m, "%s\n", sb->s_type->name);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ll_fstype);
+
+@@ -201,7 +201,8 @@ static int ll_sb_uuid_seq_show(struct seq_file *m, void *v)
+ struct super_block *sb = m->private;
+
+ LASSERT(sb != NULL);
+- return seq_printf(m, "%s\n", ll_s2sbi(sb)->ll_sb_uuid.uuid);
++ seq_printf(m, "%s\n", ll_s2sbi(sb)->ll_sb_uuid.uuid);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ll_sb_uuid);
+
+@@ -209,7 +210,8 @@ static int ll_xattr_cache_seq_show(struct seq_file *m, void *v)
+ {
+ struct ll_sb_info *sbi = ll_s2sbi((struct super_block *)m->private);
+
+- return seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled);
++ seq_printf(m, "%u\n", sbi->ll_xattr_cache_enabled);
++ return 0;
+ }
+
+ static ssize_t ll_xattr_cache_seq_write(struct file *file,
+@@ -407,17 +409,17 @@ static int ll_max_cached_mb_seq_show(struct seq_file *m, void *v)
+
+ max_cached_mb = cache->ccc_lru_max >> shift;
+ unused_mb = atomic_long_read(&cache->ccc_lru_left) >> shift;
+- return seq_printf(m,
+- "users: %d\n"
+- "max_cached_mb: %ld\n"
+- "used_mb: %ld\n"
+- "unused_mb: %ld\n"
+- "reclaim_count: %u\n",
+- atomic_read(&cache->ccc_users),
+- max_cached_mb,
+- max_cached_mb - unused_mb,
+- unused_mb,
+- cache->ccc_lru_shrinkers);
++ seq_printf(m, "users: %d\n"
++ "max_cached_mb: %ld\n"
++ "used_mb: %ld\n"
++ "unused_mb: %ld\n"
++ "reclaim_count: %u\n",
++ atomic_read(&cache->ccc_users),
++ max_cached_mb,
++ max_cached_mb - unused_mb,
++ unused_mb,
++ cache->ccc_lru_shrinkers);
++ return 0;
+ }
+
+ static ssize_t
+@@ -538,7 +540,8 @@ static int ll_checksum_seq_show(struct seq_file *m, void *v)
+ struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+
+- return seq_printf(m, "%u\n", (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0);
++ seq_printf(m, "%u\n", (sbi->ll_flags & LL_SBI_CHECKSUM) ? 1 : 0);
++ return 0;
+ }
+
+ static ssize_t ll_checksum_seq_write(struct file *file,
+@@ -575,13 +578,14 @@ static int ll_rd_track_id(struct seq_file *m, enum stats_track_type type)
+ struct super_block *sb = m->private;
+
+ if (ll_s2sbi(sb)->ll_stats_track_type == type) {
+- return seq_printf(m, "%d\n",
+- ll_s2sbi(sb)->ll_stats_track_id);
++ seq_printf(m, "%d\n",
++ ll_s2sbi(sb)->ll_stats_track_id);
+ } else if (ll_s2sbi(sb)->ll_stats_track_type == STATS_TRACK_ALL) {
+- return seq_printf(m, "0 (all)\n");
++ seq_puts(m, "0 (all)\n");
+ } else {
+- return seq_printf(m, "untracked\n");
++ seq_puts(m, "untracked\n");
+ }
++ return 0;
+ }
+
+ static int ll_wr_track_id(const char __user *buffer, unsigned long count,
+@@ -649,7 +653,8 @@ static int ll_statahead_max_seq_show(struct seq_file *m, void *v)
+ struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+
+- return seq_printf(m, "%u\n", sbi->ll_sa_max);
++ seq_printf(m, "%u\n", sbi->ll_sa_max);
++ return 0;
+ }
+
+ static ssize_t ll_statahead_max_seq_write(struct file *file,
+@@ -679,8 +684,9 @@ static int ll_statahead_agl_seq_show(struct seq_file *m, void *v)
+ struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+
+- return seq_printf(m, "%u\n",
+- sbi->ll_flags & LL_SBI_AGL_ENABLED ? 1 : 0);
++ seq_printf(m, "%u\n",
++ sbi->ll_flags & LL_SBI_AGL_ENABLED ? 1 : 0);
++ return 0;
+ }
+
+ static ssize_t ll_statahead_agl_seq_write(struct file *file,
+@@ -709,13 +715,13 @@ static int ll_statahead_stats_seq_show(struct seq_file *m, void *v)
+ struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+
+- return seq_printf(m,
+- "statahead total: %u\n"
+- "statahead wrong: %u\n"
+- "agl total: %u\n",
+- atomic_read(&sbi->ll_sa_total),
+- atomic_read(&sbi->ll_sa_wrong),
+- atomic_read(&sbi->ll_agl_total));
++ seq_printf(m, "statahead total: %u\n"
++ "statahead wrong: %u\n"
++ "agl total: %u\n",
++ atomic_read(&sbi->ll_sa_total),
++ atomic_read(&sbi->ll_sa_wrong),
++ atomic_read(&sbi->ll_agl_total));
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ll_statahead_stats);
+
+@@ -724,8 +730,9 @@ static int ll_lazystatfs_seq_show(struct seq_file *m, void *v)
+ struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+
+- return seq_printf(m, "%u\n",
+- (sbi->ll_flags & LL_SBI_LAZYSTATFS) ? 1 : 0);
++ seq_printf(m, "%u\n",
++ (sbi->ll_flags & LL_SBI_LAZYSTATFS) ? 1 : 0);
++ return 0;
+ }
+
+ static ssize_t ll_lazystatfs_seq_write(struct file *file,
+@@ -760,7 +767,8 @@ static int ll_max_easize_seq_show(struct seq_file *m, void *v)
+ if (rc)
+ return rc;
+
+- return seq_printf(m, "%u\n", ealen);
++ seq_printf(m, "%u\n", ealen);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ll_max_easize);
+
+@@ -786,7 +794,8 @@ static int ll_default_easize_seq_show(struct seq_file *m, void *v)
+ if (rc)
+ return rc;
+
+- return seq_printf(m, "%u\n", ealen);
++ seq_printf(m, "%u\n", ealen);
++ return 0;
+ }
+
+ /**
+@@ -865,10 +874,11 @@ static int ll_unstable_stats_seq_show(struct seq_file *m, void *v)
+ pages = atomic_long_read(&cache->ccc_unstable_nr);
+ mb = (pages * PAGE_CACHE_SIZE) >> 20;
+
+- return seq_printf(m, "unstable_check: %8d\n"
+- "unstable_pages: %12ld\n"
+- "unstable_mb: %8d\n",
+- cache->ccc_unstable_check, pages, mb);
++ seq_printf(m, "unstable_check: %8d\n"
++ "unstable_pages: %12ld\n"
++ "unstable_mb: %8d\n",
++ cache->ccc_unstable_check, pages, mb);
++ return 0;
+ }
+
+ static ssize_t ll_unstable_stats_seq_write(struct file *file,
+@@ -910,7 +920,8 @@ static int ll_root_squash_seq_show(struct seq_file *m, void *v)
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+ struct root_squash_info *squash = &sbi->ll_squash;
+
+- return seq_printf(m, "%u:%u\n", squash->rsi_uid, squash->rsi_gid);
++ seq_printf(m, "%u:%u\n", squash->rsi_uid, squash->rsi_gid);
++ return 0;
+ }
+
+ static ssize_t ll_root_squash_seq_write(struct file *file,
+@@ -932,20 +943,20 @@ static int ll_nosquash_nids_seq_show(struct seq_file *m, void *v)
+ struct super_block *sb = m->private;
+ struct ll_sb_info *sbi = ll_s2sbi(sb);
+ struct root_squash_info *squash = &sbi->ll_squash;
+- int len, rc;
++ int len;
+
+ down_read(&squash->rsi_sem);
+ if (!list_empty(&squash->rsi_nosquash_nids)) {
+ len = cfs_print_nidlist(m->buf + m->count, m->size - m->count,
+ &squash->rsi_nosquash_nids);
+ m->count += len;
+- rc = seq_printf(m, "\n");
++ seq_putc(m, '\n');
+ } else {
+- rc = seq_printf(m, "NONE\n");
++ seq_puts(m, "NONE\n");
+ }
+ up_read(&squash->rsi_sem);
+
+- return rc;
++ return 0;
+ }
+
+ static ssize_t ll_nosquash_nids_seq_write(struct file *file,
+@@ -1333,9 +1344,7 @@ static int ll_rw_extents_stats_pp_seq_show(struct seq_file *seq, void *v)
+ do_gettimeofday(&now);
+
+ if (!sbi->ll_rw_stats_on) {
+- seq_printf(seq, "disabled\n"
+- "write anything in this file to activate, "
+- "then 0 or \"[D/d]isabled\" to deactivate\n");
++ seq_puts(seq, "disabled\n write anything in this file to activate, then 0 or \[D/d]isabled\" to deactivate\n");
+ return 0;
+ }
+ seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
+@@ -1412,18 +1421,16 @@ static int ll_rw_extents_stats_seq_show(struct seq_file *seq, void *v)
+ do_gettimeofday(&now);
+
+ if (!sbi->ll_rw_stats_on) {
+- seq_printf(seq, "disabled\n"
+- "write anything in this file to activate, "
+- "then 0 or \"[D/d]isabled\" to deactivate\n");
+- return 0;
+- }
+- seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
+- now.tv_sec, now.tv_usec);
++ seq_puts(seq, "disabled\n write anything in this file to activate, then 0 or \"[D/d]isabled\" to deactivate\n");
++ return 0;
++ }
++ seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
++ now.tv_sec, now.tv_usec);
+
+- seq_printf(seq, "%15s %19s | %20s\n", " ", "read", "write");
+- seq_printf(seq, "%13s %14s %4s %4s | %14s %4s %4s\n",
+- "extents", "calls", "%", "cum%",
+- "calls", "%", "cum%");
++ seq_printf(seq, "%15s %19s | %20s\n", " ", "read", "write");
++ seq_printf(seq, "%13s %14s %4s %4s | %14s %4s %4s\n",
++ "extents", "calls", "%", "cum%",
++ "calls", "%", "cum%");
+ spin_lock(&sbi->ll_lock);
+ ll_display_extents_info(io_extents, seq, LL_PROCESS_HIST_MAX);
+ spin_unlock(&sbi->ll_lock);
+@@ -1591,11 +1598,9 @@ static int ll_rw_offset_stats_seq_show(struct seq_file *seq, void *v)
+ do_gettimeofday(&now);
+
+ if (!sbi->ll_rw_stats_on) {
+- seq_printf(seq, "disabled\n"
+- "write anything in this file to activate, "
+- "then 0 or \"[D/d]isabled\" to deactivate\n");
+- return 0;
+- }
++ seq_puts(seq, "disabled\n write anything in this file to activate, then 0 or \"[D/d]isabled\" to deactivate\n");
++ return 0;
++ }
+ spin_lock(&sbi->ll_process_lock);
+
+ seq_printf(seq, "snapshot_time: %lu.%lu (secs.usecs)\n",
+diff --git a/lustre/lmv/lproc_lmv.c b/lustre/lmv/lproc_lmv.c
+index 1f8b5a6..251dd93 100644
+--- a/lustre/lmv/lproc_lmv.c
++++ b/lustre/lmv/lproc_lmv.c
+@@ -55,7 +55,8 @@ static int lmv_numobd_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ desc = &dev->u.lmv.desc;
+- return seq_printf(m, "%u\n", desc->ld_tgt_count);
++ seq_printf(m, "%u\n", desc->ld_tgt_count);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(lmv_numobd);
+
+@@ -89,7 +90,8 @@ static int lmv_placement_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ lmv = &dev->u.lmv;
+- return seq_printf(m, "%s\n", placement_policy2name(lmv->lmv_placement));
++ seq_printf(m, "%s\n", placement_policy2name(lmv->lmv_placement));
++ return 0;
+ }
+
+ #define MAX_POLICY_STRING_SIZE 64
+@@ -137,7 +139,8 @@ static int lmv_activeobd_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ desc = &dev->u.lmv.desc;
+- return seq_printf(m, "%u\n", desc->ld_active_tgt_count);
++ seq_printf(m, "%u\n", desc->ld_active_tgt_count);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(lmv_activeobd);
+
+@@ -148,7 +151,8 @@ static int lmv_desc_uuid_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ lmv = &dev->u.lmv;
+- return seq_printf(m, "%s\n", lmv->desc.ld_uuid.uuid);
++ seq_printf(m, "%s\n", lmv->desc.ld_uuid.uuid);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(lmv_desc_uuid);
+
+@@ -178,8 +182,9 @@ static int lmv_tgt_seq_show(struct seq_file *p, void *v)
+
+ if (tgt == NULL)
+ return 0;
+- return seq_printf(p, "%u: %s %sACTIVE\n", tgt->ltd_idx,
+- tgt->ltd_uuid.uuid, tgt->ltd_active ? "" : "IN");
++ seq_printf(p, "%u: %s %sACTIVE\n", tgt->ltd_idx,
++ tgt->ltd_uuid.uuid, tgt->ltd_active ? "" : "IN");
++ return 0;
+ }
+
+ static const struct seq_operations lmv_tgt_sops = {
+diff --git a/lustre/lod/lproc_lod.c b/lustre/lod/lproc_lod.c
+index b02697f..06e2314 100644
+--- a/lustre/lod/lproc_lod.c
++++ b/lustre/lod/lproc_lod.c
+@@ -65,8 +65,9 @@ static int lod_stripesize_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ lod = lu2lod_dev(dev->obd_lu_dev);
+- return seq_printf(m, LPU64"\n",
+- lod->lod_desc.ld_default_stripe_size);
++ seq_printf(m, LPU64"\n",
++ lod->lod_desc.ld_default_stripe_size);
++ return 0;
+ }
+
+ /**
+@@ -120,8 +121,9 @@ static int lod_stripeoffset_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ lod = lu2lod_dev(dev->obd_lu_dev);
+- return seq_printf(m, LPU64"\n",
+- lod->lod_desc.ld_default_stripe_offset);
++ seq_printf(m, LPU64"\n",
++ lod->lod_desc.ld_default_stripe_offset);
++ return 0;
+ }
+
+ /**
+@@ -175,7 +177,8 @@ static int lod_stripetype_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ lod = lu2lod_dev(dev->obd_lu_dev);
+- return seq_printf(m, "%u\n", lod->lod_desc.ld_pattern);
++ seq_printf(m, "%u\n", lod->lod_desc.ld_pattern);
++ return 0;
+ }
+
+ /**
+@@ -227,8 +230,9 @@ static int lod_stripecount_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ lod = lu2lod_dev(dev->obd_lu_dev);
+- return seq_printf(m, "%d\n",
+- (__s16)(lod->lod_desc.ld_default_stripe_count + 1) - 1);
++ seq_printf(m, "%d\n",
++ (__s16)(lod->lod_desc.ld_default_stripe_count + 1) - 1);
++ return 0;
+ }
+
+ /**
+@@ -280,7 +284,8 @@ static int lod_numobd_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ lod = lu2lod_dev(dev->obd_lu_dev);
+- return seq_printf(m, "%u\n", lod->lod_desc.ld_tgt_count);
++ seq_printf(m, "%u\n", lod->lod_desc.ld_tgt_count);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(lod_numobd);
+
+@@ -300,7 +305,8 @@ static int lod_activeobd_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ lod = lu2lod_dev(dev->obd_lu_dev);
+- return seq_printf(m, "%u\n", lod->lod_desc.ld_active_tgt_count);
++ seq_printf(m, "%u\n", lod->lod_desc.ld_active_tgt_count);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(lod_activeobd);
+
+@@ -320,7 +326,8 @@ static int lod_desc_uuid_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ lod = lu2lod_dev(dev->obd_lu_dev);
+- return seq_printf(m, "%s\n", lod->lod_desc.ld_uuid.uuid);
++ seq_printf(m, "%s\n", lod->lod_desc.ld_uuid.uuid);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(lod_desc_uuid);
+
+@@ -344,8 +351,9 @@ static int lod_qos_priofree_seq_show(struct seq_file *m, void *v)
+ struct lod_device *lod = lu2lod_dev(dev->obd_lu_dev);
+
+ LASSERT(lod != NULL);
+- return seq_printf(m, "%d%%\n",
+- (lod->lod_qos.lq_prio_free * 100 + 255) >> 8);
++ seq_printf(m, "%d%%\n",
++ (lod->lod_qos.lq_prio_free * 100 + 255) >> 8);
++ return 0;
+ }
+
+ /**
+@@ -405,8 +413,9 @@ static int lod_qos_thresholdrr_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ lod = lu2lod_dev(dev->obd_lu_dev);
+- return seq_printf(m, "%d%%\n",
+- (lod->lod_qos.lq_threshold_rr * 100 + 255) >> 8);
++ seq_printf(m, "%d%%\n",
++ (lod->lod_qos.lq_threshold_rr * 100 + 255) >> 8);
++ return 0;
+ }
+
+ /**
+@@ -468,7 +477,8 @@ static int lod_qos_maxage_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ lod = lu2lod_dev(dev->obd_lu_dev);
+- return seq_printf(m, "%u Sec\n", lod->lod_desc.ld_qos_maxage);
++ seq_printf(m, "%u Sec\n", lod->lod_desc.ld_qos_maxage);
++ return 0;
+ }
+
+ /**
+@@ -612,9 +622,10 @@ static int lod_osts_seq_show(struct seq_file *p, void *v)
+ } else if (rc)
+ return rc;
+
+- return seq_printf(p, "%d: %s %sACTIVE\n", idx,
+- obd_uuid2str(&ost_desc->ltd_uuid),
+- active ? "" : "IN");
++ seq_printf(p, "%d: %s %sACTIVE\n", idx,
++ obd_uuid2str(&ost_desc->ltd_uuid),
++ active ? "" : "IN");
++ return 0;
+ }
+
+ static const struct seq_operations lod_osts_sops = {
+@@ -664,7 +675,8 @@ static int lod_lmv_failout_seq_show(struct seq_file *m, void *v)
+ LASSERT(dev != NULL);
+ lod = lu2lod_dev(dev->obd_lu_dev);
+
+- return seq_printf(m, "%d\n", lod->lod_lmv_failout ? 1 : 0);
++ seq_printf(m, "%d\n", lod->lod_lmv_failout ? 1 : 0);
++ return 0;
+ }
+
+ /**
+diff --git a/lustre/lov/lproc_lov.c b/lustre/lov/lproc_lov.c
+index 386ee62..4732a35 100644
+--- a/lustre/lov/lproc_lov.c
++++ b/lustre/lov/lproc_lov.c
+@@ -51,7 +51,8 @@ static int lov_stripesize_seq_show(struct seq_file *m, void *v)
+ LASSERT(dev != NULL);
+ desc = &dev->u.lov.desc;
+
+- return seq_printf(m, LPU64"\n", desc->ld_default_stripe_size);
++ seq_printf(m, LPU64"\n", desc->ld_default_stripe_size);
++ return 0;
+ }
+
+ static ssize_t lov_stripesize_seq_write(struct file *file,
+@@ -82,7 +83,8 @@ static int lov_stripeoffset_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ desc = &dev->u.lov.desc;
+- return seq_printf(m, LPU64"\n", desc->ld_default_stripe_offset);
++ seq_printf(m, LPU64"\n", desc->ld_default_stripe_offset);
++ return 0;
+ }
+
+ static ssize_t lov_stripeoffset_seq_write(struct file *file,
+@@ -112,7 +114,8 @@ static int lov_stripetype_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ desc = &dev->u.lov.desc;
+- return seq_printf(m, "%u\n", desc->ld_pattern);
++ seq_printf(m, "%u\n", desc->ld_pattern);
++ return 0;
+ }
+
+ static ssize_t lov_stripetype_seq_write(struct file *file,
+@@ -142,8 +145,9 @@ static int lov_stripecount_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ desc = &dev->u.lov.desc;
+- return seq_printf(m, "%d\n",
+- (__s16)(desc->ld_default_stripe_count + 1) - 1);
++ seq_printf(m, "%d\n",
++ (__s16)(desc->ld_default_stripe_count + 1) - 1);
++ return 0;
+ }
+
+ static ssize_t lov_stripecount_seq_write(struct file *file,
+@@ -173,7 +177,8 @@ static int lov_numobd_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ desc = &dev->u.lov.desc;
+- return seq_printf(m, "%u\n", desc->ld_tgt_count);
++ seq_printf(m, "%u\n", desc->ld_tgt_count);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(lov_numobd);
+
+@@ -184,7 +189,8 @@ static int lov_activeobd_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ desc = &dev->u.lov.desc;
+- return seq_printf(m, "%u\n", desc->ld_active_tgt_count);
++ seq_printf(m, "%u\n", desc->ld_active_tgt_count);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(lov_activeobd);
+
+@@ -195,7 +201,8 @@ static int lov_desc_uuid_seq_show(struct seq_file *m, void *v)
+
+ LASSERT(dev != NULL);
+ lov = &dev->u.lov;
+- return seq_printf(m, "%s\n", lov->desc.ld_uuid.uuid);
++ seq_printf(m, "%s\n", lov->desc.ld_uuid.uuid);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(lov_desc_uuid);
+
+@@ -231,9 +238,10 @@ static void *lov_tgt_seq_next(struct seq_file *p, void *v, loff_t *pos)
+ static int lov_tgt_seq_show(struct seq_file *p, void *v)
+ {
+ struct lov_tgt_desc *tgt = v;
+- return seq_printf(p, "%d: %s %sACTIVE\n", tgt->ltd_index,
+- obd_uuid2str(&tgt->ltd_uuid),
+- tgt->ltd_active ? "" : "IN");
++ seq_printf(p, "%d: %s %sACTIVE\n", tgt->ltd_index,
++ obd_uuid2str(&tgt->ltd_uuid),
++ tgt->ltd_active ? "" : "IN");
++ return 0;
+ }
+
+ static const struct seq_operations lov_tgt_sops = {
+diff --git a/lustre/mdc/lproc_mdc.c b/lustre/mdc/lproc_mdc.c
+index 023b779..c8b0cd6 100644
+--- a/lustre/mdc/lproc_mdc.c
++++ b/lustre/mdc/lproc_mdc.c
+@@ -46,12 +46,11 @@
+ static int mdc_active_seq_show(struct seq_file *m, void *v)
+ {
+ struct obd_device *dev = m->private;
+- int rc;
+
+ LPROCFS_CLIMP_CHECK(dev);
+- rc = seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
++ seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
+ LPROCFS_CLIMP_EXIT(dev);
+- return rc;
++ return 0;
+ }
+
+ static ssize_t mdc_active_seq_write(struct file *file,
+@@ -82,12 +81,11 @@ static int mdc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
+ {
+ struct obd_device *dev = m->private;
+ __u32 max;
+- int rc;
+
+ max = obd_get_max_rpcs_in_flight(&dev->u.cli);
+- rc = seq_printf(m, "%u\n", max);
++ seq_printf(m, "%u\n", max);
+
+- return rc;
++ return 0;
+ }
+
+ static ssize_t mdc_max_rpcs_in_flight_seq_write(struct file *file,
+@@ -115,12 +113,11 @@ static int mdc_max_mod_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
+ {
+ struct obd_device *dev = m->private;
+ __u16 max;
+- int rc;
+
+ max = obd_get_max_mod_rpcs_in_flight(&dev->u.cli);
+- rc = seq_printf(m, "%hu\n", max);
++ seq_printf(m, "%hu\n", max);
+
+- return rc;
++ return 0;
+ }
+
+ static ssize_t mdc_max_mod_rpcs_in_flight_seq_write(struct file *file,
+diff --git a/lustre/mdd/mdd_lproc.c b/lustre/mdd/mdd_lproc.c
+index c09ee9c..1329852 100644
+--- a/lustre/mdd/mdd_lproc.c
++++ b/lustre/mdd/mdd_lproc.c
+@@ -78,7 +78,8 @@ static int mdd_atime_diff_seq_show(struct seq_file *m, void *data)
+ {
+ struct mdd_device *mdd = m->private;
+
+- return seq_printf(m, "%lu\n", mdd->mdd_atime_diff);
++ seq_printf(m, "%lu\n", mdd->mdd_atime_diff);
++ return 0;
+ }
+ LPROC_SEQ_FOPS(mdd_atime_diff);
+
+@@ -182,7 +183,8 @@ static int mdd_sync_perm_seq_show(struct seq_file *m, void *data)
+ struct mdd_device *mdd = m->private;
+
+ LASSERT(mdd != NULL);
+- return seq_printf(m, "%d\n", mdd->mdd_sync_permission);
++ seq_printf(m, "%d\n", mdd->mdd_sync_permission);
++ return 0;
+ }
+
+ static ssize_t
+diff --git a/lustre/mdt/mdt_coordinator.c b/lustre/mdt/mdt_coordinator.c
+index 27ff1e3..9f371bc 100644
+--- a/lustre/mdt/mdt_coordinator.c
++++ b/lustre/mdt/mdt_coordinator.c
+@@ -2067,17 +2067,20 @@ int mdt_hsm_cdt_control_seq_show(struct seq_file *m, void *data)
+ static int
+ mdt_hsm_request_mask_show(struct seq_file *m, __u64 mask)
+ {
+- int i, rc = 0;
++ bool first = true;
++ int i;
+ ENTRY;
+
+ for (i = 0; i < 8 * sizeof(mask); i++) {
+- if (mask & (1UL << i))
+- rc += seq_printf(m, "%s%s", rc == 0 ? "" : " ",
+- hsm_copytool_action2name(i));
++ if (mask & (1UL << i)) {
++ seq_printf(m, "%s%s", first ? "" : " ",
++ hsm_copytool_action2name(i));
++ first = false;
++ }
+ }
+- rc += seq_printf(m, "\n");
++ seq_putc(m, '\n');
+
+- RETURN(rc);
++ RETURN(0);
+ }
+
+ static int
+diff --git a/lustre/mdt/mdt_hsm_cdt_actions.c b/lustre/mdt/mdt_hsm_cdt_actions.c
+index 59cbfe2..342a919 100644
+--- a/lustre/mdt/mdt_hsm_cdt_actions.c
++++ b/lustre/mdt/mdt_hsm_cdt_actions.c
+@@ -398,7 +398,7 @@ static int hsm_actions_show_cb(const struct lu_env *env,
+ struct llog_agent_req_rec *larr = (struct llog_agent_req_rec *)hdr;
+ struct seq_file *s = data;
+ struct agent_action_iterator *aai;
+- int rc, sz;
++ int sz;
+ size_t count;
+ char buf[12];
+ ENTRY;
+@@ -417,35 +417,29 @@ static int hsm_actions_show_cb(const struct lu_env *env,
+
+ count = s->count;
+ sz = larr->arr_hai.hai_len - sizeof(larr->arr_hai);
+- rc = seq_printf(s, "lrh=[type=%X len=%d idx=%d/%d] fid="DFID
+- " dfid="DFID
+- " compound/cookie="LPX64"/"LPX64
+- " action=%s archive#=%d flags="LPX64
+- " extent="LPX64"-"LPX64
+- " gid="LPX64" datalen=%d status=%s"
+- " data=[%s]\n",
+- hdr->lrh_type, hdr->lrh_len,
+- llh->lgh_hdr->llh_cat_idx, hdr->lrh_index,
+- PFID(&larr->arr_hai.hai_fid),
+- PFID(&larr->arr_hai.hai_dfid),
+- larr->arr_compound_id, larr->arr_hai.hai_cookie,
+- hsm_copytool_action2name(larr->arr_hai.hai_action),
+- larr->arr_archive_id,
+- larr->arr_flags,
+- larr->arr_hai.hai_extent.offset,
+- larr->arr_hai.hai_extent.length,
+- larr->arr_hai.hai_gid, sz,
+- agent_req_status2name(larr->arr_status),
+- hai_dump_data_field(&larr->arr_hai, buf, sizeof(buf)));
+- if (rc == 0) {
+- aai->aai_cat_index = llh->lgh_hdr->llh_cat_idx;
+- aai->aai_index = hdr->lrh_index;
+- } else {
+- if (s->count == s->size && count > 0) /* rewind the buffer */
+- s->count = count;
+- rc = LLOG_PROC_BREAK;
+- }
+- RETURN(rc);
++ seq_printf(s, "lrh=[type=%X len=%d idx=%d/%d] fid="DFID
++ " dfid="DFID" compound/cookie="LPX64"/"LPX64
++ " action=%s archive#=%d flags="LPX64
++ " extent="LPX64"-"LPX64
++ " gid="LPX64" datalen=%d status=%s data=[%s]\n",
++ hdr->lrh_type, hdr->lrh_len,
++ llh->lgh_hdr->llh_cat_idx, hdr->lrh_index,
++ PFID(&larr->arr_hai.hai_fid),
++ PFID(&larr->arr_hai.hai_dfid),
++ larr->arr_compound_id, larr->arr_hai.hai_cookie,
++ hsm_copytool_action2name(larr->arr_hai.hai_action),
++ larr->arr_archive_id,
++ larr->arr_flags,
++ larr->arr_hai.hai_extent.offset,
++ larr->arr_hai.hai_extent.length,
++ larr->arr_hai.hai_gid, sz,
++ agent_req_status2name(larr->arr_status),
++ hai_dump_data_field(&larr->arr_hai, buf, sizeof(buf)));
++
++ aai->aai_cat_index = llh->lgh_hdr->llh_cat_idx;
++ aai->aai_index = hdr->lrh_index;
++
++ RETURN(0);
+ }
+
+ /**
+diff --git a/lustre/mdt/mdt_lproc.c b/lustre/mdt/mdt_lproc.c
+index 58728e8..612da16 100644
+--- a/lustre/mdt/mdt_lproc.c
++++ b/lustre/mdt/mdt_lproc.c
+@@ -217,7 +217,8 @@ static int mdt_identity_expire_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%u\n", mdt->mdt_identity_cache->uc_entry_expire);
++ seq_printf(m, "%u\n", mdt->mdt_identity_cache->uc_entry_expire);
++ return 0;
+ }
+
+ static ssize_t
+@@ -243,7 +244,8 @@ static int mdt_identity_acquire_expire_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%u\n", mdt->mdt_identity_cache->uc_acquire_expire);
++ seq_printf(m, "%u\n", mdt->mdt_identity_cache->uc_acquire_expire);
++ return 0;
+ }
+
+ static ssize_t
+@@ -479,7 +481,8 @@ static int mdt_evict_tgt_nids_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%u\n", mdt->mdt_opts.mo_evict_tgt_nids);
++ seq_printf(m, "%u\n", mdt->mdt_opts.mo_evict_tgt_nids);
++ return 0;
+ }
+
+ static ssize_t
+@@ -505,7 +508,8 @@ static int mdt_sec_level_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%d\n", mdt->mdt_lut.lut_sec_level);
++ seq_printf(m, "%d\n", mdt->mdt_lut.lut_sec_level);
++ return 0;
+ }
+
+ static ssize_t
+@@ -540,7 +544,8 @@ static int mdt_cos_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%u\n", mdt_cos_is_enabled(mdt));
++ seq_printf(m, "%u\n", mdt_cos_is_enabled(mdt));
++ return 0;
+ }
+
+ static ssize_t
+@@ -566,8 +571,9 @@ static int mdt_root_squash_seq_show(struct seq_file *m, void *data)
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+ struct root_squash_info *squash = &mdt->mdt_squash;
+
+- return seq_printf(m, "%u:%u\n", squash->rsi_uid,
+- squash->rsi_gid);
++ seq_printf(m, "%u:%u\n", squash->rsi_uid,
++ squash->rsi_gid);
++ return 0;
+ }
+
+ static ssize_t
+@@ -589,19 +595,19 @@ static int mdt_nosquash_nids_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+ struct root_squash_info *squash = &mdt->mdt_squash;
+- int len = 0, rc;
++ int len = 0;
+
+ down_read(&squash->rsi_sem);
+ if (!list_empty(&squash->rsi_nosquash_nids)) {
+ len = cfs_print_nidlist(m->buf + m->count, m->size - m->count,
+ &squash->rsi_nosquash_nids);
+ m->count += len;
+- rc = seq_printf(m, "\n");
++ seq_putc(m, '\n');
+ } else
+- rc = seq_printf(m, "NONE\n");
++ seq_puts(m, "NONE\n");
+ up_read(&squash->rsi_sem);
+
+- return rc;
++ return 0;
+ }
+
+ static ssize_t
+@@ -623,7 +629,8 @@ static int mdt_enable_remote_dir_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%u\n", mdt->mdt_enable_remote_dir);
++ seq_printf(m, "%u\n", mdt->mdt_enable_remote_dir);
++ return 0;
+ }
+
+ static ssize_t
+@@ -653,8 +660,9 @@ static int mdt_enable_remote_dir_gid_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%d\n",
+- (int)mdt->mdt_enable_remote_dir_gid);
++ seq_printf(m, "%d\n",
++ (int)mdt->mdt_enable_remote_dir_gid);
++ return 0;
+ }
+
+ static ssize_t
+@@ -692,7 +700,8 @@ static int mdt_slc_seq_show(struct seq_file *m, void *data)
+ struct lu_target *tgt = obd->u.obt.obt_lut;
+ char *slc_states[] = {"never", "blocking", "always" };
+
+- return seq_printf(m, "%s\n", slc_states[tgt->lut_sync_lock_cancel]);
++ seq_printf(m, "%s\n", slc_states[tgt->lut_sync_lock_cancel]);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(mdt_slc);
+
+@@ -710,7 +719,8 @@ static int mdt_async_commit_count_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct mdt_device *mdt = mdt_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%d\n", atomic_read(&mdt->mdt_async_commit_count));
++ seq_printf(m, "%d\n", atomic_read(&mdt->mdt_async_commit_count));
++ return 0;
+ }
+
+ static ssize_t
+@@ -747,7 +757,8 @@ static int mdt_sync_count_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct lu_target *tgt = obd->u.obt.obt_lut;
+
+- return seq_printf(m, "%d\n", atomic_read(&tgt->lut_sync_count));
++ seq_printf(m, "%d\n", atomic_read(&tgt->lut_sync_count));
++ return 0;
+ }
+
+ static ssize_t
+diff --git a/lustre/mgc/mgc_request.c b/lustre/mgc/mgc_request.c
+index 9dc2a3e..3c83dc0 100644
+--- a/lustre/mgc/mgc_request.c
++++ b/lustre/mgc/mgc_request.c
+@@ -490,8 +490,8 @@ int lprocfs_mgc_rd_ir_state(struct seq_file *m, void *data)
+ if (cld->cld_recover == NULL)
+ continue;
+ seq_printf(m, " - { client: %s, nidtbl_version: %u }\n",
+- cld->cld_logname,
+- cld->cld_recover->cld_cfg.cfg_last_idx);
++ cld->cld_logname,
++ cld->cld_recover->cld_cfg.cfg_last_idx);
+ }
+ spin_unlock(&config_list_lock);
+
+diff --git a/lustre/obdclass/genops.c b/lustre/obdclass/genops.c
+index 7ca03f0..c13c9333 100644
+--- a/lustre/obdclass/genops.c
++++ b/lustre/obdclass/genops.c
+@@ -2184,8 +2184,8 @@ int obd_mod_rpc_stats_seq_show(struct client_obd *cli,
+ unsigned long mod = cli->cl_mod_rpcs_hist.oh_buckets[i];
+ mod_cum += mod;
+ seq_printf(seq, "%d:\t\t%10lu %3lu %3lu\n",
+- i, mod, pct(mod, mod_tot),
+- pct(mod_cum, mod_tot));
++ i, mod, pct(mod, mod_tot),
++ pct(mod_cum, mod_tot));
+ if (mod_cum == mod_tot)
+ break;
+ }
+diff --git a/lustre/obdclass/linux/linux-module.c b/lustre/obdclass/linux/linux-module.c
+index 200d19f..c019863 100644
+--- a/lustre/obdclass/linux/linux-module.c
++++ b/lustre/obdclass/linux/linux-module.c
+@@ -215,21 +215,23 @@ struct miscdevice obd_psdev = {
+ #ifdef CONFIG_PROC_FS
+ static int obd_proc_version_seq_show(struct seq_file *m, void *v)
+ {
+- return seq_printf(m, "lustre: %s\nkernel: %s\nbuild: %s\n",
+- LUSTRE_VERSION_STRING, "patchless_client",
+- BUILD_VERSION);
++ seq_printf(m, "lustre: %s\nkernel: %s\nbuild: %s\n",
++ LUSTRE_VERSION_STRING, "patchless_client",
++ BUILD_VERSION);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(obd_proc_version);
+
+ static int obd_proc_pinger_seq_show(struct seq_file *m, void *v)
+ {
+- return seq_printf(m, "%s\n",
++ seq_printf(m, "%s\n",
+ #ifdef ENABLE_PINGER
+- "on"
++ "on"
+ #else
+- "off"
++ "off"
+ #endif
+- );
++ );
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(obd_proc_pinger);
+
+@@ -266,7 +268,7 @@ static int obd_proc_health_seq_show(struct seq_file *m, void *data)
+
+ if (obd_health_check(NULL, obd)) {
+ seq_printf(m, "device %s reported unhealthy\n",
+- obd->obd_name);
++ obd->obd_name);
+ healthy = false;
+ }
+ class_decref(obd, __FUNCTION__, current);
+@@ -275,7 +277,7 @@ static int obd_proc_health_seq_show(struct seq_file *m, void *data)
+ read_unlock(&obd_dev_lock);
+
+ if (healthy)
+- return seq_printf(m, "healthy\n");
++ seq_puts(m, "healthy\n");
+
+ seq_printf(m, "NOT HEALTHY\n");
+ return 0;
+@@ -405,10 +407,11 @@ static int obd_device_list_seq_show(struct seq_file *p, void *v)
+ else
+ status = "--";
+
+- return seq_printf(p, "%3d %s %s %s %s %d\n",
+- (int)index, status, obd->obd_type->typ_name,
+- obd->obd_name, obd->obd_uuid.uuid,
+- atomic_read(&obd->obd_refcount));
++ seq_printf(p, "%3d %s %s %s %s %d\n",
++ (int)index, status, obd->obd_type->typ_name,
++ obd->obd_name, obd->obd_uuid.uuid,
++ atomic_read(&obd->obd_refcount));
++ return 0;
+ }
+
+ static const struct seq_operations obd_device_list_sops = {
+diff --git a/lustre/obdclass/lprocfs_jobstats.c b/lustre/obdclass/lprocfs_jobstats.c
+index c0ea8f3..af6cc5f 100644
+--- a/lustre/obdclass/lprocfs_jobstats.c
++++ b/lustre/obdclass/lprocfs_jobstats.c
+@@ -636,7 +636,8 @@ int lprocfs_job_interval_seq_show(struct seq_file *m, void *data)
+ return -ENODEV;
+
+ stats = &obd->u.obt.obt_jobstats;
+- return seq_printf(m, "%d\n", stats->ojs_cleanup_interval);
++ seq_printf(m, "%d\n", stats->ojs_cleanup_interval);
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_job_interval_seq_show);
+
+diff --git a/lustre/obdclass/lprocfs_status.c b/lustre/obdclass/lprocfs_status.c
+index 917bd6b..0cae0eb 100644
+--- a/lustre/obdclass/lprocfs_status.c
++++ b/lustre/obdclass/lprocfs_status.c
+@@ -292,7 +292,8 @@ EXPORT_SYMBOL(lprocfs_register);
+ /* Generic callbacks */
+ int lprocfs_uint_seq_show(struct seq_file *m, void *data)
+ {
+- return seq_printf(m, "%u\n", *(unsigned int *)data);
++ seq_printf(m, "%u\n", *(unsigned int *)data);
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_uint_seq_show);
+
+@@ -333,7 +334,8 @@ EXPORT_SYMBOL(lprocfs_uint_seq_write);
+ int lprocfs_u64_seq_show(struct seq_file *m, void *data)
+ {
+ LASSERT(data != NULL);
+- return seq_printf(m, LPU64"\n", *(__u64 *)data);
++ seq_printf(m, LPU64"\n", *(__u64 *)data);
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_u64_seq_show);
+
+@@ -341,7 +343,8 @@ int lprocfs_atomic_seq_show(struct seq_file *m, void *data)
+ {
+ atomic_t *atom = data;
+ LASSERT(atom != NULL);
+- return seq_printf(m, "%d\n", atomic_read(atom));
++ seq_printf(m, "%d\n", atomic_read(atom));
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_atomic_seq_show);
+
+@@ -370,7 +373,8 @@ int lprocfs_uuid_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = data;
+
+ LASSERT(obd != NULL);
+- return seq_printf(m, "%s\n", obd->obd_uuid.uuid);
++ seq_printf(m, "%s\n", obd->obd_uuid.uuid);
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_uuid_seq_show);
+
+@@ -379,7 +383,8 @@ int lprocfs_name_seq_show(struct seq_file *m, void *data)
+ struct obd_device *dev = data;
+
+ LASSERT(dev != NULL);
+- return seq_printf(m, "%s\n", dev->obd_name);
++ seq_printf(m, "%s\n", dev->obd_name);
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_name_seq_show);
+
+@@ -391,7 +396,7 @@ int lprocfs_blksize_seq_show(struct seq_file *m, void *data)
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ OBD_STATFS_NODELAY);
+ if (!rc)
+- rc = seq_printf(m, "%u\n", osfs.os_bsize);
++ seq_printf(m, "%u\n", osfs.os_bsize);
+ return rc;
+ }
+ EXPORT_SYMBOL(lprocfs_blksize_seq_show);
+@@ -410,7 +415,7 @@ int lprocfs_kbytestotal_seq_show(struct seq_file *m, void *data)
+ while (blk_size >>= 1)
+ result <<= 1;
+
+- rc = seq_printf(m, LPU64"\n", result);
++ seq_printf(m, LPU64"\n", result);
+ }
+ return rc;
+ }
+@@ -430,7 +435,7 @@ int lprocfs_kbytesfree_seq_show(struct seq_file *m, void *data)
+ while (blk_size >>= 1)
+ result <<= 1;
+
+- rc = seq_printf(m, LPU64"\n", result);
++ seq_printf(m, LPU64"\n", result);
+ }
+ return rc;
+ }
+@@ -450,7 +455,7 @@ int lprocfs_kbytesavail_seq_show(struct seq_file *m, void *data)
+ while (blk_size >>= 1)
+ result <<= 1;
+
+- rc = seq_printf(m, LPU64"\n", result);
++ seq_printf(m, LPU64"\n", result);
+ }
+ return rc;
+ }
+@@ -464,7 +469,7 @@ int lprocfs_filestotal_seq_show(struct seq_file *m, void *data)
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ OBD_STATFS_NODELAY);
+ if (!rc)
+- rc = seq_printf(m, LPU64"\n", osfs.os_files);
++ seq_printf(m, LPU64"\n", osfs.os_files);
+ return rc;
+ }
+ EXPORT_SYMBOL(lprocfs_filestotal_seq_show);
+@@ -477,7 +482,7 @@ int lprocfs_filesfree_seq_show(struct seq_file *m, void *data)
+ cfs_time_shift_64(-OBD_STATFS_CACHE_SECONDS),
+ OBD_STATFS_NODELAY);
+ if (!rc)
+- rc = seq_printf(m, LPU64"\n", osfs.os_ffree);
++ seq_printf(m, LPU64"\n", osfs.os_ffree);
+ return rc;
+ }
+ EXPORT_SYMBOL(lprocfs_filesfree_seq_show);
+@@ -493,8 +498,8 @@ int lprocfs_server_uuid_seq_show(struct seq_file *m, void *data)
+ LPROCFS_CLIMP_CHECK(obd);
+ imp = obd->u.cli.cl_import;
+ imp_state_name = ptlrpc_import_state_name(imp->imp_state);
+- rc = seq_printf(m, "%s\t%s%s\n", obd2cli_tgt(obd), imp_state_name,
+- imp->imp_deactive ? "\tDEACTIVATED" : "");
++ seq_printf(m, "%s\t%s%s\n", obd2cli_tgt(obd), imp_state_name,
++ imp->imp_deactive ? "\tDEACTIVATED" : "");
+
+ LPROCFS_CLIMP_EXIT(obd);
+ return rc;
+@@ -512,9 +517,9 @@ int lprocfs_conn_uuid_seq_show(struct seq_file *m, void *data)
+ LPROCFS_CLIMP_CHECK(obd);
+ conn = obd->u.cli.cl_import->imp_connection;
+ if (conn && obd->u.cli.cl_import)
+- rc = seq_printf(m, "%s\n", conn->c_remote_uuid.uuid);
++ seq_printf(m, "%s\n", conn->c_remote_uuid.uuid);
+ else
+- rc = seq_printf(m, "%s\n", "<none>");
++ seq_printf(m, "%s\n", "<none>");
+
+ LPROCFS_CLIMP_EXIT(obd);
+ return rc;
+@@ -705,16 +710,16 @@ static void obd_connect_data_seqprint(struct seq_file *m,
+ flags = ocd->ocd_connect_flags;
+
+ seq_printf(m, " connect_data:\n"
+- " flags: "LPX64"\n"
+- " instance: %u\n",
+- ocd->ocd_connect_flags,
+- ocd->ocd_instance);
++ " flags: "LPX64"\n"
++ " instance: %u\n",
++ ocd->ocd_connect_flags,
++ ocd->ocd_instance);
+ if (flags & OBD_CONNECT_VERSION)
+ seq_printf(m, " target_version: %u.%u.%u.%u\n",
+- OBD_OCD_VERSION_MAJOR(ocd->ocd_version),
+- OBD_OCD_VERSION_MINOR(ocd->ocd_version),
+- OBD_OCD_VERSION_PATCH(ocd->ocd_version),
+- OBD_OCD_VERSION_FIX(ocd->ocd_version));
++ OBD_OCD_VERSION_MAJOR(ocd->ocd_version),
++ OBD_OCD_VERSION_MINOR(ocd->ocd_version),
++ OBD_OCD_VERSION_PATCH(ocd->ocd_version),
++ OBD_OCD_VERSION_FIX(ocd->ocd_version));
+ if (flags & OBD_CONNECT_MDS)
+ seq_printf(m, " mdt_index: %d\n", ocd->ocd_group);
+ if (flags & OBD_CONNECT_GRANT)
+@@ -725,28 +730,30 @@ static void obd_connect_data_seqprint(struct seq_file *m,
+ seq_printf(m, " max_brw_size: %d\n", ocd->ocd_brw_size);
+ if (flags & OBD_CONNECT_IBITS)
+ seq_printf(m, " ibits_known: "LPX64"\n",
+- ocd->ocd_ibits_known);
++ ocd->ocd_ibits_known);
+ if (flags & OBD_CONNECT_GRANT_PARAM)
+ seq_printf(m, " grant_block_size: %d\n"
+- " grant_inode_size: %d\n"
+- " grant_extent_overhead: %d\n",
+- ocd->ocd_blocksize,
+- ocd->ocd_inodespace,
+- ocd->ocd_grant_extent);
++ " grant_inode_size: %d\n"
++ " grant_max_extent_size: %d\n"
++ " grant_extent_tax: %d\n",
++ 1 << ocd->ocd_grant_blkbits,
++ 1 << ocd->ocd_grant_inobits,
++ ocd->ocd_grant_max_blks << ocd->ocd_grant_blkbits,
++ ocd->ocd_grant_tax_kb << 10);
+ if (flags & OBD_CONNECT_TRANSNO)
+ seq_printf(m, " first_transno: "LPX64"\n",
+- ocd->ocd_transno);
++ ocd->ocd_transno);
+ if (flags & OBD_CONNECT_CKSUM)
+ seq_printf(m, " cksum_types: %#x\n",
+- ocd->ocd_cksum_types);
++ ocd->ocd_cksum_types);
+ if (flags & OBD_CONNECT_MAX_EASIZE)
+ seq_printf(m, " max_easize: %d\n", ocd->ocd_max_easize);
+ if (flags & OBD_CONNECT_MAXBYTES)
+ seq_printf(m, " max_object_bytes: "LPU64"\n",
+- ocd->ocd_maxbytes);
++ ocd->ocd_maxbytes);
+ if (flags & OBD_CONNECT_MULTIMODRPCS)
+ seq_printf(m, " max_mod_rpcs: %hu\n",
+- ocd->ocd_maxmodrpcs);
++ ocd->ocd_maxmodrpcs);
+ }
+
+ int lprocfs_import_seq_show(struct seq_file *m, void *data)
+@@ -768,23 +775,23 @@ int lprocfs_import_seq_show(struct seq_file *m, void *data)
+ ocd = &imp->imp_connect_data;
+
+ seq_printf(m, "import:\n"
+- " name: %s\n"
+- " target: %s\n"
+- " state: %s\n"
+- " connect_flags: [ ",
+- obd->obd_name,
+- obd2cli_tgt(obd),
+- ptlrpc_import_state_name(imp->imp_state));
++ " name: %s\n"
++ " target: %s\n"
++ " state: %s\n"
++ " connect_flags: [ ",
++ obd->obd_name,
++ obd2cli_tgt(obd),
++ ptlrpc_import_state_name(imp->imp_state));
+ obd_connect_seq_flags2str(m, imp->imp_connect_data.ocd_connect_flags,
+- ", ");
++ ", ");
+ seq_printf(m, " ]\n");
+ obd_connect_data_seqprint(m, ocd);
+ seq_printf(m, " import_flags: [ ");
+ obd_import_flags2str(imp, m);
+
+ seq_printf(m, " ]\n"
+- " connection:\n"
+- " failover_nids: [ ");
++ " connection:\n"
++ " failover_nids: [ ");
+ spin_lock(&imp->imp_lock);
+ j = 0;
+ list_for_each_entry(conn, &imp->imp_conn_list, oic_item) {
+@@ -799,14 +806,14 @@ int lprocfs_import_seq_show(struct seq_file *m, void *data)
+ else
+ strncpy(nidstr, "<none>", sizeof(nidstr));
+ seq_printf(m, " ]\n"
+- " current_connection: %s\n"
+- " connection_attempts: %u\n"
+- " generation: %u\n"
+- " in-progress_invalidations: %u\n",
+- nidstr,
+- imp->imp_conn_cnt,
+- imp->imp_generation,
+- atomic_read(&imp->imp_inval_count));
++ " current_connection: %s\n"
++ " connection_attempts: %u\n"
++ " generation: %u\n"
++ " in-progress_invalidations: %u\n",
++ nidstr,
++ imp->imp_conn_cnt,
++ imp->imp_generation,
++ atomic_read(&imp->imp_inval_count));
+ spin_unlock(&imp->imp_lock);
+
+ if (obd->obd_svc_stats == NULL)
+@@ -822,14 +829,14 @@ int lprocfs_import_seq_show(struct seq_file *m, void *data)
+ } else
+ ret.lc_sum = 0;
+ seq_printf(m, " rpcs:\n"
+- " inflight: %u\n"
+- " unregistering: %u\n"
+- " timeouts: %u\n"
+- " avg_waittime: "LPU64" %s\n",
+- atomic_read(&imp->imp_inflight),
+- atomic_read(&imp->imp_unregistering),
+- atomic_read(&imp->imp_timeouts),
+- ret.lc_sum, header->lc_units);
++ " inflight: %u\n"
++ " unregistering: %u\n"
++ " timeouts: %u\n"
++ " avg_waittime: "LPU64" %s\n",
++ atomic_read(&imp->imp_inflight),
++ atomic_read(&imp->imp_unregistering),
++ atomic_read(&imp->imp_timeouts),
++ ret.lc_sum, header->lc_units);
+
+ k = 0;
+ for(j = 0; j < IMP_AT_MAX_PORTALS; j++) {
+@@ -839,18 +846,18 @@ int lprocfs_import_seq_show(struct seq_file *m, void *data)
+ at_get(&imp->imp_at.iat_service_estimate[j]));
+ }
+ seq_printf(m, " service_estimates:\n"
+- " services: %u sec\n"
+- " network: %u sec\n",
+- k,
+- at_get(&imp->imp_at.iat_net_latency));
++ " services: %u sec\n"
++ " network: %u sec\n",
++ k,
++ at_get(&imp->imp_at.iat_net_latency));
+
+ seq_printf(m, " transactions:\n"
+- " last_replay: "LPU64"\n"
+- " peer_committed: "LPU64"\n"
+- " last_checked: "LPU64"\n",
+- imp->imp_last_replay_transno,
+- imp->imp_peer_committed_transno,
+- imp->imp_last_transno_checked);
++ " last_replay: "LPU64"\n"
++ " peer_committed: "LPU64"\n"
++ " last_checked: "LPU64"\n",
++ imp->imp_last_replay_transno,
++ imp->imp_peer_committed_transno,
++ imp->imp_last_transno_checked);
+
+ /* avg data rates */
+ for (rw = 0; rw <= 1; rw++) {
+@@ -863,9 +870,9 @@ int lprocfs_import_seq_show(struct seq_file *m, void *data)
+ do_div(sum, ret.lc_count);
+ ret.lc_sum = sum;
+ seq_printf(m, " %s_data_averages:\n"
+- " bytes_per_rpc: "LPU64"\n",
+- rw ? "write" : "read",
+- ret.lc_sum);
++ " bytes_per_rpc: "LPU64"\n",
++ rw ? "write" : "read",
++ ret.lc_sum);
+ }
+ k = (int)ret.lc_sum;
+ j = opcode_offset(OST_READ + rw) + EXTRA_MAX_OPCODES;
+@@ -877,11 +884,11 @@ int lprocfs_import_seq_show(struct seq_file *m, void *data)
+ do_div(sum, ret.lc_count);
+ ret.lc_sum = sum;
+ seq_printf(m, " %s_per_rpc: "LPU64"\n",
+- header->lc_units, ret.lc_sum);
++ header->lc_units, ret.lc_sum);
+ j = (int)ret.lc_sum;
+ if (j > 0)
+ seq_printf(m, " MB_per_sec: %u.%.02u\n",
+- k / j, (100 * k / j) % 100);
++ k / j, (100 * k / j) % 100);
+ }
+ }
+
+@@ -1223,8 +1230,8 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v)
+ struct timeval now;
+
+ do_gettimeofday(&now);
+- rc = seq_printf(p, "%-25s %lu.%lu secs.usecs\n",
+- "snapshot_time", now.tv_sec, now.tv_usec);
++ seq_printf(p, "%-25s %lu.%lu secs.usecs\n",
++ "snapshot_time", now.tv_sec, now.tv_usec);
+ if (rc < 0)
+ return rc;
+ }
+@@ -1235,22 +1242,22 @@ static int lprocfs_stats_seq_show(struct seq_file *p, void *v)
+ if (ctr.lc_count == 0)
+ goto out;
+
+- rc = seq_printf(p, "%-25s "LPD64" samples [%s]", hdr->lc_name,
+- ctr.lc_count, hdr->lc_units);
++ seq_printf(p, "%-25s "LPD64" samples [%s]", hdr->lc_name,
++ ctr.lc_count, hdr->lc_units);
+ if (rc < 0)
+ goto out;
+
+ if ((hdr->lc_config & LPROCFS_CNTR_AVGMINMAX) && ctr.lc_count > 0) {
+- rc = seq_printf(p, " "LPD64" "LPD64" "LPD64,
+- ctr.lc_min, ctr.lc_max, ctr.lc_sum);
++ seq_printf(p, " "LPD64" "LPD64" "LPD64,
++ ctr.lc_min, ctr.lc_max, ctr.lc_sum);
+ if (rc < 0)
+ goto out;
+ if (hdr->lc_config & LPROCFS_CNTR_STDDEV)
+- rc = seq_printf(p, " "LPD64, ctr.lc_sumsquare);
++ seq_printf(p, " "LPD64, ctr.lc_sumsquare);
+ if (rc < 0)
+ goto out;
+ }
+- rc = seq_printf(p, "\n");
++ seq_putc(p, '\n');
+ out:
+ return (rc < 0) ? rc : 0;
+ }
+@@ -1849,12 +1856,11 @@ int lprocfs_obd_max_pages_per_rpc_seq_show(struct seq_file *m, void *data)
+ {
+ struct obd_device *dev = data;
+ struct client_obd *cli = &dev->u.cli;
+- int rc;
+
+ spin_lock(&cli->cl_loi_list_lock);
+- rc = seq_printf(m, "%d\n", cli->cl_max_pages_per_rpc);
++ seq_printf(m, "%d\n", cli->cl_max_pages_per_rpc);
+ spin_unlock(&cli->cl_loi_list_lock);
+- return rc;
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_obd_max_pages_per_rpc_seq_show);
+
+diff --git a/lustre/obdclass/lprocfs_status_server.c b/lustre/obdclass/lprocfs_status_server.c
+index 148f65a..6bb6c27 100644
+--- a/lustre/obdclass/lprocfs_status_server.c
++++ b/lustre/obdclass/lprocfs_status_server.c
+@@ -109,7 +109,8 @@ int lprocfs_num_exports_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = data;
+
+ LASSERT(obd != NULL);
+- return seq_printf(m, "%u\n", obd->obd_num_exports);
++ seq_printf(m, "%u\n", obd->obd_num_exports);
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_num_exports_seq_show);
+
+@@ -237,9 +238,9 @@ int lprocfs_exp_print_replydata_seq(struct cfs_hash *hs, struct cfs_hash_bd *bd,
+ struct tg_export_data *ted = &exp->exp_target_data;
+
+ seq_printf(m, "reply_cnt: %d\n"
+- "reply_max: %d\n"
+- "reply_released_by_xid: %d\n"
+- "reply_released_by_tag: %d\n\n",
++ "reply_max: %d\n"
++ "reply_released_by_xid: %d\n"
++ "reply_released_by_tag: %d\n\n",
+ ted->ted_reply_cnt,
+ ted->ted_reply_max,
+ ted->ted_release_xid,
+@@ -260,8 +261,8 @@ LPROC_SEQ_FOPS_RO(lprocfs_exp_replydata);
+
+ int lprocfs_nid_stats_clear_seq_show(struct seq_file *m, void *data)
+ {
+- return seq_printf(m, "%s\n", "Write into this file to clear all nid "
+- "stats and stale nid entries");
++ seq_puts(m, "Write into this file to clear all nid stats and stale nid entries\n");
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_nid_stats_clear_seq_show);
+
+@@ -548,16 +549,15 @@ EXPORT_SYMBOL(lprocfs_free_obd_stats);
+ int lprocfs_hash_seq_show(struct seq_file *m, void *data)
+ {
+ struct obd_device *obd = m->private;
+- int c = 0;
+
+ if (obd == NULL)
+ return 0;
+
+- c += cfs_hash_debug_header(m);
+- c += cfs_hash_debug_str(obd->obd_uuid_hash, m);
+- c += cfs_hash_debug_str(obd->obd_nid_hash, m);
+- c += cfs_hash_debug_str(obd->obd_nid_stats_hash, m);
+- return c;
++ cfs_hash_debug_header(m);
++ cfs_hash_debug_str(obd->obd_uuid_hash, m);
++ cfs_hash_debug_str(obd->obd_nid_hash, m);
++ cfs_hash_debug_str(obd->obd_nid_stats_hash, m);
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_hash_seq_show);
+
+@@ -631,7 +631,8 @@ int lprocfs_ir_factor_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+
+ LASSERT(obd != NULL);
+- return seq_printf(m, "%d\n", obd->obd_recovery_ir_factor);
++ seq_printf(m, "%d\n", obd->obd_recovery_ir_factor);
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_ir_factor_seq_show);
+
+@@ -661,7 +662,8 @@ int lprocfs_recovery_time_soft_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+
+ LASSERT(obd != NULL);
+- return seq_printf(m, "%d\n", obd->obd_recovery_timeout);
++ seq_printf(m, "%d\n", obd->obd_recovery_timeout);
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_recovery_time_soft_seq_show);
+
+@@ -689,7 +691,8 @@ int lprocfs_recovery_time_hard_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+
+ LASSERT(obd != NULL);
+- return seq_printf(m, "%u\n", obd->obd_recovery_time_hard);
++ seq_printf(m, "%u\n", obd->obd_recovery_time_hard);
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_recovery_time_hard_seq_show);
+
+@@ -719,7 +722,8 @@ int lprocfs_target_instance_seq_show(struct seq_file *m, void *data)
+
+ LASSERT(obd != NULL);
+ LASSERT(target->obt_magic == OBT_MAGIC);
+- return seq_printf(m, "%u\n", obd->u.obt.obt_instance);
++ seq_printf(m, "%u\n", obd->u.obt.obt_instance);
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_target_instance_seq_show);
+
+diff --git a/lustre/obdclass/lu_object.c b/lustre/obdclass/lu_object.c
+index c478d51..7709a8d 100644
+--- a/lustre/obdclass/lu_object.c
++++ b/lustre/obdclass/lu_object.c
+@@ -2223,19 +2223,20 @@ int lu_site_stats_seq_print(const struct lu_site *s, struct seq_file *m)
+ memset(&stats, 0, sizeof(stats));
+ lu_site_stats_get(s->ls_obj_hash, &stats, 1);
+
+- return seq_printf(m, "%d/%d %d/%d %d %d %d %d %d %d %d %d\n",
+- stats.lss_busy,
+- stats.lss_total,
+- stats.lss_populated,
+- CFS_HASH_NHLIST(s->ls_obj_hash),
+- stats.lss_max_search,
+- ls_stats_read(s->ls_stats, LU_SS_CREATED),
+- ls_stats_read(s->ls_stats, LU_SS_CACHE_HIT),
+- ls_stats_read(s->ls_stats, LU_SS_CACHE_MISS),
+- ls_stats_read(s->ls_stats, LU_SS_CACHE_RACE),
+- ls_stats_read(s->ls_stats, LU_SS_CACHE_DEATH_RACE),
+- ls_stats_read(s->ls_stats, LU_SS_LRU_PURGED),
+- ls_stats_read(s->ls_stats, LU_SS_LRU_LEN));
++ seq_printf(m, "%d/%d %d/%d %d %d %d %d %d %d %d %d\n",
++ stats.lss_busy,
++ stats.lss_total,
++ stats.lss_populated,
++ CFS_HASH_NHLIST(s->ls_obj_hash),
++ stats.lss_max_search,
++ ls_stats_read(s->ls_stats, LU_SS_CREATED),
++ ls_stats_read(s->ls_stats, LU_SS_CACHE_HIT),
++ ls_stats_read(s->ls_stats, LU_SS_CACHE_MISS),
++ ls_stats_read(s->ls_stats, LU_SS_CACHE_RACE),
++ ls_stats_read(s->ls_stats, LU_SS_CACHE_DEATH_RACE),
++ ls_stats_read(s->ls_stats, LU_SS_LRU_PURGED),
++ ls_stats_read(s->ls_stats, LU_SS_LRU_LEN));
++ return 0;
+ }
+ EXPORT_SYMBOL(lu_site_stats_seq_print);
+
+diff --git a/lustre/ofd/lproc_ofd.c b/lustre/ofd/lproc_ofd.c
+index 65b57f3..29350da 100644
+--- a/lustre/ofd/lproc_ofd.c
++++ b/lustre/ofd/lproc_ofd.c
+@@ -64,7 +64,8 @@ static int ofd_seqs_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%u\n", ofd->ofd_seq_count);
++ seq_printf(m, "%u\n", ofd->ofd_seq_count);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ofd_seqs);
+
+@@ -84,7 +85,8 @@ static int ofd_tot_dirty_seq_show(struct seq_file *m, void *data)
+
+ LASSERT(obd != NULL);
+ ofd = ofd_dev(obd->obd_lu_dev);
+- return seq_printf(m, LPU64"\n", ofd->ofd_tot_dirty);
++ seq_printf(m, LPU64"\n", ofd->ofd_tot_dirty);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ofd_tot_dirty);
+
+@@ -104,7 +106,8 @@ static int ofd_tot_granted_seq_show(struct seq_file *m, void *data)
+
+ LASSERT(obd != NULL);
+ ofd = ofd_dev(obd->obd_lu_dev);
+- return seq_printf(m, LPU64"\n", ofd->ofd_tot_granted);
++ seq_printf(m, LPU64"\n", ofd->ofd_tot_granted);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ofd_tot_granted);
+
+@@ -124,7 +127,8 @@ static int ofd_tot_pending_seq_show(struct seq_file *m, void *data)
+
+ LASSERT(obd != NULL);
+ ofd = ofd_dev(obd->obd_lu_dev);
+- return seq_printf(m, LPU64"\n", ofd->ofd_tot_pending);
++ seq_printf(m, LPU64"\n", ofd->ofd_tot_pending);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ofd_tot_pending);
+
+@@ -142,8 +146,9 @@ static int ofd_grant_precreate_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+
+ LASSERT(obd != NULL);
+- return seq_printf(m, "%ld\n",
+- obd->obd_self_export->exp_filter_data.fed_grant);
++ seq_printf(m, "%ld\n",
++ obd->obd_self_export->exp_filter_data.fed_grant);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ofd_grant_precreate);
+
+@@ -225,7 +230,8 @@ static int ofd_precreate_batch_seq_show(struct seq_file *m, void *data)
+
+ LASSERT(obd != NULL);
+ ofd = ofd_dev(obd->obd_lu_dev);
+- return seq_printf(m, "%d\n", ofd->ofd_precreate_batch);
++ seq_printf(m, "%d\n", ofd->ofd_precreate_batch);
++ return 0;
+ }
+
+ /**
+@@ -277,7 +283,6 @@ static int ofd_last_id_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd;
+ struct ofd_seq *oseq = NULL;
+- int retval = 0, rc;
+
+ if (obd == NULL)
+ return 0;
+@@ -292,15 +297,10 @@ static int ofd_last_id_seq_show(struct seq_file *m, void *data)
+ fid_idif_seq(ostid_id(&oseq->os_oi),
+ ofd->ofd_lut.lut_lsd.lsd_osd_index) :
+ ostid_seq(&oseq->os_oi);
+- rc = seq_printf(m, DOSTID"\n", seq, ostid_id(&oseq->os_oi));
+- if (rc < 0) {
+- retval = rc;
+- break;
+- }
+- retval += rc;
++ seq_printf(m, DOSTID"\n", seq, ostid_id(&oseq->os_oi));
+ }
+ read_unlock(&ofd->ofd_seq_list_lock);
+- return retval;
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ofd_last_id);
+
+@@ -318,7 +318,8 @@ static int ofd_fmd_max_num_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%u\n", ofd->ofd_fmd_max_num);
++ seq_printf(m, "%u\n", ofd->ofd_fmd_max_num);
++ return 0;
+ }
+
+ /**
+@@ -373,8 +374,9 @@ static int ofd_fmd_max_age_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%ld\n", jiffies_to_msecs(ofd->ofd_fmd_max_age) /
+- MSEC_PER_SEC);
++ seq_printf(m, "%ld\n", jiffies_to_msecs(ofd->ofd_fmd_max_age) /
++ MSEC_PER_SEC);
++ return 0;
+ }
+
+ /**
+@@ -433,7 +435,8 @@ static int ofd_degraded_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%u\n", ofd->ofd_raid_degraded);
++ seq_printf(m, "%u\n", ofd->ofd_raid_degraded);
++ return 0;
+ }
+
+ /**
+@@ -491,7 +494,8 @@ static int ofd_fstype_seq_show(struct seq_file *m, void *data)
+ LASSERT(ofd->ofd_osd);
+ d = &ofd->ofd_osd->dd_lu_dev;
+ LASSERT(d->ld_type);
+- return seq_printf(m, "%s\n", d->ld_type->ldt_name);
++ seq_printf(m, "%s\n", d->ld_type->ldt_name);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ofd_fstype);
+
+@@ -517,7 +521,8 @@ static int ofd_syncjournal_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%u\n", ofd->ofd_syncjournal);
++ seq_printf(m, "%u\n", ofd->ofd_syncjournal);
++ return 0;
+ }
+
+ /**
+@@ -579,8 +584,9 @@ static int ofd_sync_lock_cancel_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct lu_target *tgt = obd->u.obt.obt_lut;
+
+- return seq_printf(m, "%s\n",
+- sync_on_cancel_states[tgt->lut_sync_lock_cancel]);
++ seq_printf(m, "%s\n",
++ sync_on_cancel_states[tgt->lut_sync_lock_cancel]);
++ return 0;
+ }
+
+ /**
+@@ -673,7 +679,8 @@ static int ofd_grant_compat_disable_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+- return seq_printf(m, "%u\n", ofd->ofd_grant_compat_disable);
++ seq_printf(m, "%u\n", ofd->ofd_grant_compat_disable);
++ return 0;
+ }
+
+ /**
+@@ -851,11 +858,11 @@ static int ofd_lfsck_verify_pfid_seq_show(struct seq_file *m, void *data)
+ struct obd_device *obd = m->private;
+ struct ofd_device *ofd = ofd_dev(obd->obd_lu_dev);
+
+- return seq_printf(m,
+- "switch: %s\ndetected: "LPU64"\nrepaired: "LPU64"\n",
+- ofd->ofd_lfsck_verify_pfid ? "on" : "off",
+- ofd->ofd_inconsistency_self_detected,
+- ofd->ofd_inconsistency_self_repaired);
++ seq_printf(m, "switch: %s\ndetected: "LPU64"\nrepaired: "LPU64"\n",
++ ofd->ofd_lfsck_verify_pfid ? "on" : "off",
++ ofd->ofd_inconsistency_self_detected,
++ ofd->ofd_inconsistency_self_repaired);
++ return 0;
+ }
+
+ /**
+diff --git a/lustre/osc/lproc_osc.c b/lustre/osc/lproc_osc.c
+index 983442f..3bd44a6 100644
+--- a/lustre/osc/lproc_osc.c
++++ b/lustre/osc/lproc_osc.c
+@@ -47,12 +47,11 @@
+ static int osc_active_seq_show(struct seq_file *m, void *v)
+ {
+ struct obd_device *dev = m->private;
+- int rc;
+
+ LPROCFS_CLIMP_CHECK(dev);
+- rc = seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
++ seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
+ LPROCFS_CLIMP_EXIT(dev);
+- return rc;
++ return 0;
+ }
+
+ static ssize_t osc_active_seq_write(struct file *file,
+@@ -82,12 +81,11 @@ static int osc_max_rpcs_in_flight_seq_show(struct seq_file *m, void *v)
+ {
+ struct obd_device *dev = m->private;
+ struct client_obd *cli = &dev->u.cli;
+- int rc;
+
+ spin_lock(&cli->cl_loi_list_lock);
+- rc = seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight);
++ seq_printf(m, "%u\n", cli->cl_max_rpcs_in_flight);
+ spin_unlock(&cli->cl_loi_list_lock);
+- return rc;
++ return 0;
+ }
+
+ static ssize_t osc_max_rpcs_in_flight_seq_write(struct file *file,
+@@ -179,18 +177,16 @@ static int osc_cached_mb_seq_show(struct seq_file *m, void *v)
+ struct obd_device *dev = m->private;
+ struct client_obd *cli = &dev->u.cli;
+ int shift = 20 - PAGE_CACHE_SHIFT;
+- int rc;
+
+- rc = seq_printf(m,
+- "used_mb: %ld\n"
+- "busy_cnt: %ld\n"
+- "reclaim: "LPU64"\n",
+- (atomic_long_read(&cli->cl_lru_in_list) +
+- atomic_long_read(&cli->cl_lru_busy)) >> shift,
+- atomic_long_read(&cli->cl_lru_busy),
+- cli->cl_lru_reclaim);
++ seq_printf(m, "used_mb: %ld\n"
++ "busy_cnt: %ld\n"
++ "reclaim: "LPU64"\n",
++ (atomic_long_read(&cli->cl_lru_in_list) +
++ atomic_long_read(&cli->cl_lru_busy)) >> shift,
++ atomic_long_read(&cli->cl_lru_busy),
++ cli->cl_lru_reclaim);
+
+- return rc;
++ return 0;
+ }
+
+ /* shrink the number of caching pages to a specific number */
+@@ -248,12 +244,11 @@ static int osc_cur_dirty_bytes_seq_show(struct seq_file *m, void *v)
+ {
+ struct obd_device *dev = m->private;
+ struct client_obd *cli = &dev->u.cli;
+- int rc;
+
+ spin_lock(&cli->cl_loi_list_lock);
+- rc = seq_printf(m, "%lu\n", cli->cl_dirty_pages << PAGE_CACHE_SHIFT);
++ seq_printf(m, "%lu\n", cli->cl_dirty_pages << PAGE_CACHE_SHIFT);
+ spin_unlock(&cli->cl_loi_list_lock);
+- return rc;
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osc_cur_dirty_bytes);
+
+@@ -261,12 +256,11 @@ static int osc_cur_grant_bytes_seq_show(struct seq_file *m, void *v)
+ {
+ struct obd_device *dev = m->private;
+ struct client_obd *cli = &dev->u.cli;
+- int rc;
+
+ spin_lock(&cli->cl_loi_list_lock);
+- rc = seq_printf(m, "%lu\n", cli->cl_avail_grant);
++ seq_printf(m, "%lu\n", cli->cl_avail_grant);
+ spin_unlock(&cli->cl_loi_list_lock);
+- return rc;
++ return 0;
+ }
+
+ static ssize_t osc_cur_grant_bytes_seq_write(struct file *file,
+@@ -308,23 +302,35 @@ static int osc_cur_lost_grant_bytes_seq_show(struct seq_file *m, void *v)
+ {
+ struct obd_device *dev = m->private;
+ struct client_obd *cli = &dev->u.cli;
+- int rc;
+
+ spin_lock(&cli->cl_loi_list_lock);
+- rc = seq_printf(m, "%lu\n", cli->cl_lost_grant);
++ seq_printf(m, "%lu\n", cli->cl_lost_grant);
+ spin_unlock(&cli->cl_loi_list_lock);
+- return rc;
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osc_cur_lost_grant_bytes);
+
++static int osc_cur_dirty_grant_bytes_seq_show(struct seq_file *m, void *v)
++{
++ struct obd_device *dev = m->private;
++ struct client_obd *cli = &dev->u.cli;
++
++ spin_lock(&cli->cl_loi_list_lock);
++ seq_printf(m, "%lu\n", cli->cl_dirty_grant);
++ spin_unlock(&cli->cl_loi_list_lock);
++ return 0;
++}
++LPROC_SEQ_FOPS_RO(osc_cur_dirty_grant_bytes);
++
+ static int osc_grant_shrink_interval_seq_show(struct seq_file *m, void *v)
+ {
+ struct obd_device *obd = m->private;
+
+ if (obd == NULL)
+ return 0;
+- return seq_printf(m, "%d\n",
+- obd->u.cli.cl_grant_shrink_interval);
++ seq_printf(m, "%d\n",
++ obd->u.cli.cl_grant_shrink_interval);
++ return 0;
+ }
+
+ static ssize_t osc_grant_shrink_interval_seq_write(struct file *file,
+@@ -357,8 +363,8 @@ static int osc_checksum_seq_show(struct seq_file *m, void *v)
+ if (obd == NULL)
+ return 0;
+
+- return seq_printf(m, "%d\n",
+- obd->u.cli.cl_checksum ? 1 : 0);
++ seq_printf(m, "%d\n", obd->u.cli.cl_checksum ? 1 : 0);
++ return 0;
+ }
+
+ static ssize_t osc_checksum_seq_write(struct file *file,
+@@ -439,7 +445,8 @@ static int osc_resend_count_seq_show(struct seq_file *m, void *v)
+ {
+ struct obd_device *obd = m->private;
+
+- return seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_resends));
++ seq_printf(m, "%u\n", atomic_read(&obd->u.cli.cl_resends));
++ return 0;
+ }
+
+ static ssize_t osc_resend_count_seq_write(struct file *file,
+@@ -467,7 +474,8 @@ static int osc_contention_seconds_seq_show(struct seq_file *m, void *v)
+ struct obd_device *obd = m->private;
+ struct osc_device *od = obd2osc_dev(obd);
+
+- return seq_printf(m, "%u\n", od->od_contention_time);
++ seq_printf(m, "%u\n", od->od_contention_time);
++ return 0;
+ }
+
+ static ssize_t osc_contention_seconds_seq_write(struct file *file,
+@@ -486,7 +494,8 @@ static int osc_lockless_truncate_seq_show(struct seq_file *m, void *v)
+ struct obd_device *obd = m->private;
+ struct osc_device *od = obd2osc_dev(obd);
+
+- return seq_printf(m, "%u\n", od->od_lockless_truncate);
++ seq_printf(m, "%u\n", od->od_lockless_truncate);
++ return 0;
+ }
+
+ static ssize_t osc_lockless_truncate_seq_write(struct file *file,
+@@ -504,8 +513,9 @@ LPROC_SEQ_FOPS(osc_lockless_truncate);
+ static int osc_destroys_in_flight_seq_show(struct seq_file *m, void *v)
+ {
+ struct obd_device *obd = m->private;
+- return seq_printf(m, "%u\n",
+- atomic_read(&obd->u.cli.cl_destroy_in_flight));
++ seq_printf(m, "%u\n",
++ atomic_read(&obd->u.cli.cl_destroy_in_flight));
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osc_destroys_in_flight);
+
+@@ -562,9 +572,10 @@ static int osc_unstable_stats_seq_show(struct seq_file *m, void *v)
+ pages = atomic_long_read(&cli->cl_unstable_count);
+ mb = (pages * PAGE_CACHE_SIZE) >> 20;
+
+- return seq_printf(m, "unstable_pages: %20ld\n"
+- "unstable_mb: %10d\n",
+- pages, mb);
++ seq_printf(m, "unstable_pages: %20ld\n"
++ "unstable_mb: %10d\n",
++ pages, mb);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osc_unstable_stats);
+
+@@ -716,11 +727,11 @@ static int osc_rpc_stats_seq_show(struct seq_file *seq, void *v)
+ unsigned long w = cli->cl_write_rpc_hist.oh_buckets[i];
+ read_cum += r;
+ write_cum += w;
+- seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
+- i, r, pct(r, read_tot),
+- pct(read_cum, read_tot), w,
+- pct(w, write_tot),
+- pct(write_cum, write_tot));
++ seq_printf(seq, "%d:\t\t%10lu %3lu %3lu | %10lu %3lu %3lu\n",
++ i, r, pct(r, read_tot),
++ pct(read_cum, read_tot), w,
++ pct(w, write_tot),
++ pct(write_cum, write_tot));
+ if (read_cum == read_tot && write_cum == write_tot)
+ break;
+ }
+diff --git a/lustre/osd-ldiskfs/osd_lproc.c b/lustre/osd-ldiskfs/osd_lproc.c
+index d15b3bf..4812342 100644
+--- a/lustre/osd-ldiskfs/osd_lproc.c
++++ b/lustre/osd-ldiskfs/osd_lproc.c
+@@ -243,7 +243,8 @@ static int ldiskfs_osd_fstype_seq_show(struct seq_file *m, void *data)
+ struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private);
+
+ LASSERT(osd != NULL);
+- return seq_printf(m, "ldiskfs\n");
++ seq_puts(m, "ldiskfs\n");
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ldiskfs_osd_fstype);
+
+@@ -255,7 +256,8 @@ static int ldiskfs_osd_mntdev_seq_show(struct seq_file *m, void *data)
+ if (unlikely(osd->od_mnt == NULL))
+ return -EINPROGRESS;
+
+- return seq_printf(m, "%s\n", osd->od_mntdev);
++ seq_printf(m, "%s\n", osd->od_mntdev);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ldiskfs_osd_mntdev);
+
+@@ -267,7 +269,8 @@ static int ldiskfs_osd_cache_seq_show(struct seq_file *m, void *data)
+ if (unlikely(osd->od_mnt == NULL))
+ return -EINPROGRESS;
+
+- return seq_printf(m, "%u\n", osd->od_read_cache);
++ seq_printf(m, "%u\n", osd->od_read_cache);
++ return 0;
+ }
+
+ static ssize_t
+@@ -300,7 +303,8 @@ static int ldiskfs_osd_wcache_seq_show(struct seq_file *m, void *data)
+ if (unlikely(osd->od_mnt == NULL))
+ return -EINPROGRESS;
+
+- return seq_printf(m, "%u\n", osd->od_writethrough_cache);
++ seq_printf(m, "%u\n", osd->od_writethrough_cache);
++ return 0;
+ }
+
+ static ssize_t
+@@ -351,7 +355,8 @@ LPROC_SEQ_FOPS_WO_TYPE(ldiskfs, osd_force_sync);
+
+ static int ldiskfs_osd_pdo_seq_show(struct seq_file *m, void *data)
+ {
+- return seq_printf(m, "%s\n", ldiskfs_pdo ? "ON" : "OFF");
++ seq_printf(m, "%s\n", ldiskfs_pdo ? "ON" : "OFF");
++ return 0;
+ }
+
+ static ssize_t
+@@ -378,7 +383,8 @@ static int ldiskfs_osd_auto_scrub_seq_show(struct seq_file *m, void *data)
+ if (unlikely(dev->od_mnt == NULL))
+ return -EINPROGRESS;
+
+- return seq_printf(m, "%d\n", !dev->od_noscrub);
++ seq_printf(m, "%d\n", !dev->od_noscrub);
++ return 0;
+ }
+
+ static ssize_t
+@@ -411,7 +417,8 @@ static int ldiskfs_osd_full_scrub_ratio_seq_show(struct seq_file *m, void *data)
+ if (unlikely(dev->od_mnt == NULL))
+ return -EINPROGRESS;
+
+- return seq_printf(m, LPU64"\n", dev->od_full_scrub_ratio);
++ seq_printf(m, LPU64"\n", dev->od_full_scrub_ratio);
++ return 0;
+ }
+
+ static ssize_t
+@@ -448,8 +455,9 @@ static int ldiskfs_osd_full_scrub_threshold_rate_seq_show(struct seq_file *m,
+ if (unlikely(dev->od_mnt == NULL))
+ return -EINPROGRESS;
+
+- return seq_printf(m, LPU64" (bad OI mappings/minute)\n",
+- dev->od_full_scrub_threshold_rate);
++ seq_printf(m, LPU64" (bad OI mappings/minute)\n",
++ dev->od_full_scrub_threshold_rate);
++ return 0;
+ }
+
+ static ssize_t
+@@ -481,7 +489,8 @@ LPROC_SEQ_FOPS(ldiskfs_osd_full_scrub_threshold_rate);
+ static int
+ ldiskfs_osd_track_declares_assert_seq_show(struct seq_file *m, void *data)
+ {
+- return seq_printf(m, "%d\n", ldiskfs_track_declares_assert);
++ seq_printf(m, "%d\n", ldiskfs_track_declares_assert);
++ return 0;
+ }
+
+ static ssize_t
+@@ -522,7 +531,8 @@ static int ldiskfs_osd_readcache_seq_show(struct seq_file *m, void *data)
+ if (unlikely(osd->od_mnt == NULL))
+ return -EINPROGRESS;
+
+- return seq_printf(m, LPU64"\n", osd->od_readcache_max_filesize);
++ seq_printf(m, LPU64"\n", osd->od_readcache_max_filesize);
++ return 0;
+ }
+
+ static ssize_t
+@@ -558,7 +568,8 @@ static int ldiskfs_osd_index_in_idif_seq_show(struct seq_file *m, void *data)
+ if (unlikely(dev->od_mnt == NULL))
+ return -EINPROGRESS;
+
+- return seq_printf(m, "%d\n", (int)(dev->od_index_in_idif));
++ seq_printf(m, "%d\n", (int)(dev->od_index_in_idif));
++ return 0;
+ }
+
+ static ssize_t
+diff --git a/lustre/osd-ldiskfs/osd_scrub.c b/lustre/osd-ldiskfs/osd_scrub.c
+index 80f2794..5d12724 100644
+--- a/lustre/osd-ldiskfs/osd_scrub.c
++++ b/lustre/osd-ldiskfs/osd_scrub.c
+@@ -2989,50 +2989,38 @@ static const char *scrub_param_names[] = {
+ NULL
+ };
+
+-static int scrub_bits_dump(struct seq_file *m, int bits, const char *names[],
+- const char *prefix)
++static void scrub_bits_dump(struct seq_file *m, int bits, const char *names[],
++ const char *prefix)
+ {
+ int flag;
+- int rc;
+ int i;
+
+- rc = seq_printf(m, "%s:%c", prefix, bits != 0 ? ' ' : '\n');
+- if (rc < 0)
+- return rc;
++ seq_printf(m, "%s:%c", prefix, bits != 0 ? ' ' : '\n');
+
+ for (i = 0, flag = 1; bits != 0; i++, flag = 1 << i) {
+ if (flag & bits) {
+ bits &= ~flag;
+- rc = seq_printf(m, "%s%c", names[i],
+- bits != 0 ? ',' : '\n');
+- if (rc < 0)
+- return rc;
++ seq_printf(m, "%s%c", names[i],
++ bits != 0 ? ',' : '\n');
+ }
+ }
+- return 0;
+ }
+
+-static int scrub_time_dump(struct seq_file *m, __u64 time, const char *prefix)
++static void scrub_time_dump(struct seq_file *m, __u64 time, const char *prefix)
+ {
+- int rc;
+-
+ if (time != 0)
+- rc = seq_printf(m, "%s: "LPU64" seconds\n", prefix,
+- cfs_time_current_sec() - time);
++ seq_printf(m, "%s: "LPU64" seconds\n", prefix,
++ cfs_time_current_sec() - time);
+ else
+- rc = seq_printf(m, "%s: N/A\n", prefix);
+- return rc;
++ seq_printf(m, "%s: N/A\n", prefix);
+ }
+
+-static int scrub_pos_dump(struct seq_file *m, __u64 pos, const char *prefix)
++static void scrub_pos_dump(struct seq_file *m, __u64 pos, const char *prefix)
+ {
+- int rc;
+-
+ if (pos != 0)
+- rc = seq_printf(m, "%s: "LPU64"\n", prefix, pos);
++ seq_printf(m, "%s: "LPU64"\n", prefix, pos);
+ else
+- rc = seq_printf(m, "%s: N/A\n", prefix);
+- return rc;
++ seq_printf(m, "%s: N/A\n", prefix);
+ }
+
+ int osd_scrub_dump(struct seq_file *m, struct osd_device *dev)
+@@ -3041,71 +3029,48 @@ int osd_scrub_dump(struct seq_file *m, struct osd_device *dev)
+ struct scrub_file *sf = &scrub->os_file;
+ __u64 checked;
+ __u64 speed;
+- int rc;
+
+ down_read(&scrub->os_rwsem);
+- rc = seq_printf(m, "name: OI_scrub\n"
+- "magic: 0x%x\n"
+- "oi_files: %d\n"
+- "status: %s\n",
+- sf->sf_magic, (int)sf->sf_oi_count,
+- scrub_status_names[sf->sf_status]);
+- if (rc < 0)
+- goto out;
++ seq_printf(m, "name: OI_scrub\n"
++ "magic: 0x%x\n"
++ "oi_files: %d\n"
++ "status: %s\n",
++ sf->sf_magic, (int)sf->sf_oi_count,
++ scrub_status_names[sf->sf_status]);
+
+- rc = scrub_bits_dump(m, sf->sf_flags, scrub_flags_names,
+- "flags");
+- if (rc < 0)
+- goto out;
++ scrub_bits_dump(m, sf->sf_flags, scrub_flags_names, "flags");
+
+- rc = scrub_bits_dump(m, sf->sf_param, scrub_param_names,
+- "param");
+- if (rc < 0)
+- goto out;
++ scrub_bits_dump(m, sf->sf_param, scrub_param_names, "param");
+
+- rc = scrub_time_dump(m, sf->sf_time_last_complete,
+- "time_since_last_completed");
+- if (rc < 0)
+- goto out;
++ scrub_time_dump(m, sf->sf_time_last_complete,
++ "time_since_last_completed");
+
+- rc = scrub_time_dump(m, sf->sf_time_latest_start,
+- "time_since_latest_start");
+- if (rc < 0)
+- goto out;
++ scrub_time_dump(m, sf->sf_time_latest_start,
++ "time_since_latest_start");
+
+- rc = scrub_time_dump(m, sf->sf_time_last_checkpoint,
+- "time_since_last_checkpoint");
+- if (rc < 0)
+- goto out;
++ scrub_time_dump(m, sf->sf_time_last_checkpoint,
++ "time_since_last_checkpoint");
+
+- rc = scrub_pos_dump(m, sf->sf_pos_latest_start,
+- "latest_start_position");
+- if (rc < 0)
+- goto out;
++ scrub_pos_dump(m, sf->sf_pos_latest_start,
++ "latest_start_position");
+
+- rc = scrub_pos_dump(m, sf->sf_pos_last_checkpoint,
+- "last_checkpoint_position");
+- if (rc < 0)
+- goto out;
++ scrub_pos_dump(m, sf->sf_pos_last_checkpoint,
++ "last_checkpoint_position");
+
+- rc = scrub_pos_dump(m, sf->sf_pos_first_inconsistent,
+- "first_failure_position");
+- if (rc < 0)
+- goto out;
++ scrub_pos_dump(m, sf->sf_pos_first_inconsistent,
++ "first_failure_position");
+
+ checked = sf->sf_items_checked + scrub->os_new_checked;
+- rc = seq_printf(m, "checked: "LPU64"\n"
+- "updated: "LPU64"\n"
+- "failed: "LPU64"\n"
+- "prior_updated: "LPU64"\n"
+- "noscrub: "LPU64"\n"
+- "igif: "LPU64"\n"
+- "success_count: %u\n",
+- checked, sf->sf_items_updated, sf->sf_items_failed,
+- sf->sf_items_updated_prior, sf->sf_items_noscrub,
+- sf->sf_items_igif, sf->sf_success_count);
+- if (rc < 0)
+- goto out;
++ seq_printf(m, "checked: "LPU64"\n"
++ "updated: "LPU64"\n"
++ "failed: "LPU64"\n"
++ "prior_updated: "LPU64"\n"
++ "noscrub: "LPU64"\n"
++ "igif: "LPU64"\n"
++ "success_count: %u\n",
++ checked, sf->sf_items_updated, sf->sf_items_failed,
++ sf->sf_items_updated_prior, sf->sf_items_noscrub,
++ sf->sf_items_igif, sf->sf_success_count);
+
+ speed = checked;
+ if (thread_is_running(&scrub->os_thread)) {
+@@ -3120,31 +3085,30 @@ int osd_scrub_dump(struct seq_file *m, struct osd_device *dev)
+ do_div(new_checked, duration);
+ if (rtime != 0)
+ do_div(speed, rtime);
+- rc = seq_printf(m, "run_time: %u seconds\n"
+- "average_speed: "LPU64" objects/sec\n"
+- "real-time_speed: "LPU64" objects/sec\n"
+- "current_position: %u\n"
+- "lf_scanned: "LPU64"\n"
+- "lf_repaired: "LPU64"\n"
+- "lf_failed: "LPU64"\n",
+- rtime, speed, new_checked, scrub->os_pos_current,
+- scrub->os_lf_scanned, scrub->os_lf_repaired,
+- scrub->os_lf_failed);
++ seq_printf(m, "run_time: %u seconds\n"
++ "average_speed: "LPU64" objects/sec\n"
++ "real-time_speed: "LPU64" objects/sec\n"
++ "current_position: %u\n"
++ "lf_scanned: "LPU64"\n"
++ "lf_repaired: "LPU64"\n"
++ "lf_failed: "LPU64"\n",
++ rtime, speed, new_checked, scrub->os_pos_current,
++ scrub->os_lf_scanned, scrub->os_lf_repaired,
++ scrub->os_lf_failed);
+ } else {
+ if (sf->sf_run_time != 0)
+ do_div(speed, sf->sf_run_time);
+- rc = seq_printf(m, "run_time: %u seconds\n"
+- "average_speed: "LPU64" objects/sec\n"
+- "real-time_speed: N/A\n"
+- "current_position: N/A\n"
+- "lf_scanned: "LPU64"\n"
+- "lf_repaired: "LPU64"\n"
+- "lf_failed: "LPU64"\n",
+- sf->sf_run_time, speed, scrub->os_lf_scanned,
+- scrub->os_lf_repaired, scrub->os_lf_failed);
++ seq_printf(m, "run_time: %u seconds\n"
++ "average_speed: "LPU64" objects/sec\n"
++ "real-time_speed: N/A\n"
++ "current_position: N/A\n"
++ "lf_scanned: "LPU64"\n"
++ "lf_repaired: "LPU64"\n"
++ "lf_failed: "LPU64"\n",
++ sf->sf_run_time, speed, scrub->os_lf_scanned,
++ scrub->os_lf_repaired, scrub->os_lf_failed);
+ }
+
+-out:
+ up_read(&scrub->os_rwsem);
+- return (rc < 0 ? -ENOSPC : 0);
++ return 0;
+ }
+diff --git a/lustre/osd-zfs/osd_lproc.c b/lustre/osd-zfs/osd_lproc.c
+index c43aff8..d648298 100644
+--- a/lustre/osd-zfs/osd_lproc.c
++++ b/lustre/osd-zfs/osd_lproc.c
+@@ -217,7 +217,8 @@ out:
+
+ static int zfs_osd_fstype_seq_show(struct seq_file *m, void *data)
+ {
+- return seq_printf(m, "zfs\n");
++ seq_puts(m, "zfs\n");
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(zfs_osd_fstype);
+
+@@ -226,7 +227,8 @@ static int zfs_osd_mntdev_seq_show(struct seq_file *m, void *data)
+ struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private);
+
+ LASSERT(osd != NULL);
+- return seq_printf(m, "%s\n", osd->od_mntdev);
++ seq_printf(m, "%s\n", osd->od_mntdev);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(zfs_osd_mntdev);
+
+@@ -254,7 +256,8 @@ static int zfs_osd_iused_est_seq_show(struct seq_file *m, void *data)
+ struct osd_device *osd = osd_dt_dev((struct dt_device *)m->private);
+ LASSERT(osd != NULL);
+
+- return seq_printf(m, "%d\n", osd->od_quota_iused_est);
++ seq_printf(m, "%d\n", osd->od_quota_iused_est);
++ return 0;
+ }
+
+ static ssize_t
+diff --git a/lustre/osp/lproc_osp.c b/lustre/osp/lproc_osp.c
+index 422b388..cf0ee83 100644
+--- a/lustre/osp/lproc_osp.c
++++ b/lustre/osp/lproc_osp.c
+@@ -52,12 +52,11 @@
+ static int osp_active_seq_show(struct seq_file *m, void *data)
+ {
+ struct obd_device *dev = m->private;
+- int rc;
+
+ LPROCFS_CLIMP_CHECK(dev);
+- rc = seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
++ seq_printf(m, "%d\n", !dev->u.cli.cl_import->imp_deactive);
+ LPROCFS_CLIMP_EXIT(dev);
+- return rc;
++ return 0;
+ }
+
+ /**
+@@ -113,7 +112,8 @@ static int osp_syn_in_flight_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL)
+ return -EINVAL;
+
+- return seq_printf(m, "%u\n", osp->opd_syn_rpc_in_flight);
++ seq_printf(m, "%u\n", osp->opd_syn_rpc_in_flight);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osp_syn_in_flight);
+
+@@ -133,7 +133,8 @@ static int osp_syn_in_prog_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL)
+ return -EINVAL;
+
+- return seq_printf(m, "%u\n", osp->opd_syn_rpc_in_progress);
++ seq_printf(m, "%u\n", osp->opd_syn_rpc_in_progress);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osp_syn_in_prog);
+
+@@ -153,7 +154,8 @@ static int osp_syn_changes_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL)
+ return -EINVAL;
+
+- return seq_printf(m, "%lu\n", osp->opd_syn_changes);
++ seq_printf(m, "%lu\n", osp->opd_syn_changes);
++ return 0;
+ }
+
+ /**
+@@ -203,7 +205,8 @@ static int osp_max_rpcs_in_flight_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL)
+ return -EINVAL;
+
+- return seq_printf(m, "%u\n", osp->opd_syn_max_rpc_in_flight);
++ seq_printf(m, "%u\n", osp->opd_syn_max_rpc_in_flight);
++ return 0;
+ }
+
+ /**
+@@ -256,7 +259,8 @@ static int osp_max_rpcs_in_prog_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL)
+ return -EINVAL;
+
+- return seq_printf(m, "%u\n", osp->opd_syn_max_rpc_in_progress);
++ seq_printf(m, "%u\n", osp->opd_syn_max_rpc_in_progress);
++ return 0;
+ }
+
+ /**
+@@ -310,7 +314,8 @@ static int osp_create_count_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL || osp->opd_pre == NULL)
+ return 0;
+
+- return seq_printf(m, "%d\n", osp->opd_pre_create_count);
++ seq_printf(m, "%d\n", osp->opd_pre_create_count);
++ return 0;
+ }
+
+ /**
+@@ -378,7 +383,8 @@ static int osp_max_create_count_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL || osp->opd_pre == NULL)
+ return 0;
+
+- return seq_printf(m, "%d\n", osp->opd_pre_max_create_count);
++ seq_printf(m, "%d\n", osp->opd_pre_max_create_count);
++ return 0;
+ }
+
+ /**
+@@ -437,7 +443,8 @@ static int osp_prealloc_next_id_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL || osp->opd_pre == NULL)
+ return 0;
+
+- return seq_printf(m, "%u\n", fid_oid(&osp->opd_pre_used_fid) + 1);
++ seq_printf(m, "%u\n", fid_oid(&osp->opd_pre_used_fid) + 1);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osp_prealloc_next_id);
+
+@@ -457,7 +464,8 @@ static int osp_prealloc_last_id_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL || osp->opd_pre == NULL)
+ return 0;
+
+- return seq_printf(m, "%u\n", fid_oid(&osp->opd_pre_last_created_fid));
++ seq_printf(m, "%u\n", fid_oid(&osp->opd_pre_last_created_fid));
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osp_prealloc_last_id);
+
+@@ -477,7 +485,8 @@ static int osp_prealloc_next_seq_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL || osp->opd_pre == NULL)
+ return 0;
+
+- return seq_printf(m, LPX64"\n", fid_seq(&osp->opd_pre_used_fid));
++ seq_printf(m, LPX64"\n", fid_seq(&osp->opd_pre_used_fid));
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osp_prealloc_next_seq);
+
+@@ -497,8 +506,9 @@ static int osp_prealloc_last_seq_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL || osp->opd_pre == NULL)
+ return 0;
+
+- return seq_printf(m, LPX64"\n",
+- fid_seq(&osp->opd_pre_last_created_fid));
++ seq_printf(m, LPX64"\n",
++ fid_seq(&osp->opd_pre_last_created_fid));
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osp_prealloc_last_seq);
+
+@@ -518,7 +528,8 @@ static int osp_prealloc_reserved_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL || osp->opd_pre == NULL)
+ return 0;
+
+- return seq_printf(m, LPU64"\n", osp->opd_pre_reserved);
++ seq_printf(m, LPU64"\n", osp->opd_pre_reserved);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osp_prealloc_reserved);
+
+@@ -538,7 +549,8 @@ static int osp_maxage_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL)
+ return -EINVAL;
+
+- return seq_printf(m, "%u\n", osp->opd_statfs_maxage);
++ seq_printf(m, "%u\n", osp->opd_statfs_maxage);
++ return 0;
+ }
+
+ /**
+@@ -593,7 +605,8 @@ static int osp_pre_status_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL || osp->opd_pre == NULL)
+ return -EINVAL;
+
+- return seq_printf(m, "%d\n", osp->opd_pre_status);
++ seq_printf(m, "%d\n", osp->opd_pre_status);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osp_pre_status);
+
+@@ -620,8 +633,9 @@ static int osp_destroys_in_flight_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL)
+ return -EINVAL;
+
+- return seq_printf(m, "%lu\n",
+- osp->opd_syn_rpc_in_progress + osp->opd_syn_changes);
++ seq_printf(m, "%lu\n",
++ osp->opd_syn_rpc_in_progress + osp->opd_syn_changes);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osp_destroys_in_flight);
+
+@@ -641,7 +655,8 @@ static int osp_old_sync_processed_seq_show(struct seq_file *m, void *data)
+ if (osp == NULL)
+ return -EINVAL;
+
+- return seq_printf(m, "%d\n", osp->opd_syn_prev_done);
++ seq_printf(m, "%d\n", osp->opd_syn_prev_done);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(osp_old_sync_processed);
+
+@@ -660,7 +675,8 @@ osp_lfsck_max_rpcs_in_flight_seq_show(struct seq_file *m, void *data)
+ __u32 max;
+
+ max = obd_get_max_rpcs_in_flight(&dev->u.cli);
+- return seq_printf(m, "%u\n", max);
++ seq_printf(m, "%u\n", max);
++ return 0;
+ }
+
+ /**
+diff --git a/lustre/ptlrpc/gss/lproc_gss.c b/lustre/ptlrpc/gss/lproc_gss.c
+index 13427fc..4648695 100644
+--- a/lustre/ptlrpc/gss/lproc_gss.c
++++ b/lustre/ptlrpc/gss/lproc_gss.c
+@@ -96,25 +96,26 @@ void gss_stat_oos_record_svc(int phase, int replay)
+
+ static int gss_proc_oos_seq_show(struct seq_file *m, void *v)
+ {
+- return seq_printf(m, "seqwin: %u\n"
+- "backwin: %u\n"
+- "client fall behind seqwin\n"
+- " occurrence: %d\n"
+- " max seq behind: %d\n"
+- "server replay detected:\n"
+- " phase 0: %d\n"
+- " phase 1: %d\n"
+- " phase 2: %d\n"
+- "server verify ok:\n"
+- " phase 2: %d\n",
+- GSS_SEQ_WIN_MAIN,
+- GSS_SEQ_WIN_BACK,
+- atomic_read(&gss_stat_oos.oos_cli_count),
+- gss_stat_oos.oos_cli_behind,
+- atomic_read(&gss_stat_oos.oos_svc_replay[0]),
+- atomic_read(&gss_stat_oos.oos_svc_replay[1]),
+- atomic_read(&gss_stat_oos.oos_svc_replay[2]),
+- atomic_read(&gss_stat_oos.oos_svc_pass[2]));
++ seq_printf(m, "seqwin: %u\n"
++ "backwin: %u\n"
++ "client fall behind seqwin\n"
++ " occurrence: %d\n"
++ " max seq behind: %d\n"
++ "server replay detected:\n"
++ " phase 0: %d\n"
++ " phase 1: %d\n"
++ " phase 2: %d\n"
++ "server verify ok:\n"
++ " phase 2: %d\n",
++ GSS_SEQ_WIN_MAIN,
++ GSS_SEQ_WIN_BACK,
++ atomic_read(&gss_stat_oos.oos_cli_count),
++ gss_stat_oos.oos_cli_behind,
++ atomic_read(&gss_stat_oos.oos_svc_replay[0]),
++ atomic_read(&gss_stat_oos.oos_svc_replay[1]),
++ atomic_read(&gss_stat_oos.oos_svc_replay[2]),
++ atomic_read(&gss_stat_oos.oos_svc_pass[2]));
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(gss_proc_oos);
+
+@@ -154,7 +155,8 @@ static int gss_lk_debug_level = 1;
+
+ static int gss_lk_proc_dl_seq_show(struct seq_file *m, void *v)
+ {
+- return seq_printf(m, "%u\n", gss_lk_debug_level);
++ seq_printf(m, "%u\n", gss_lk_debug_level);
++ return 0;
+ }
+
+ static ssize_t
+diff --git a/lustre/ptlrpc/lproc_ptlrpc.c b/lustre/ptlrpc/lproc_ptlrpc.c
+index 4c55fe1..3cb05f5 100644
+--- a/lustre/ptlrpc/lproc_ptlrpc.c
++++ b/lustre/ptlrpc/lproc_ptlrpc.c
+@@ -268,7 +268,8 @@ ptlrpc_lprocfs_req_history_len_seq_show(struct seq_file *m, void *v)
+ ptlrpc_service_for_each_part(svcpt, i, svc)
+ total += svcpt->scp_hist_nrqbds;
+
+- return seq_printf(m, "%d\n", total);
++ seq_printf(m, "%d\n", total);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_req_history_len);
+
+@@ -283,7 +284,8 @@ ptlrpc_lprocfs_req_history_max_seq_show(struct seq_file *m, void *n)
+ ptlrpc_service_for_each_part(svcpt, i, svc)
+ total += svc->srv_hist_nrqbds_cpt_max;
+
+- return seq_printf(m, "%d\n", total);
++ seq_printf(m, "%d\n", total);
++ return 0;
+ }
+
+ static ssize_t
+@@ -330,8 +332,9 @@ ptlrpc_lprocfs_threads_min_seq_show(struct seq_file *m, void *n)
+ {
+ struct ptlrpc_service *svc = m->private;
+
+- return seq_printf(m, "%d\n",
+- svc->srv_nthrs_cpt_init * svc->srv_ncpts);
++ seq_printf(m, "%d\n",
++ svc->srv_nthrs_cpt_init * svc->srv_ncpts);
++ return 0;
+ }
+
+ static ssize_t
+@@ -375,7 +378,8 @@ ptlrpc_lprocfs_threads_started_seq_show(struct seq_file *m, void *n)
+ ptlrpc_service_for_each_part(svcpt, i, svc)
+ total += svcpt->scp_nthrs_running;
+
+- return seq_printf(m, "%d\n", total);
++ seq_printf(m, "%d\n", total);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_threads_started);
+
+@@ -384,8 +388,9 @@ ptlrpc_lprocfs_threads_max_seq_show(struct seq_file *m, void *n)
+ {
+ struct ptlrpc_service *svc = m->private;
+
+- return seq_printf(m, "%d\n",
+- svc->srv_nthrs_cpt_limit * svc->srv_ncpts);
++ seq_printf(m, "%d\n",
++ svc->srv_nthrs_cpt_limit * svc->srv_ncpts);
++ return 0;
+ }
+
+ static ssize_t
+@@ -599,21 +604,21 @@ again:
+ for (pol_idx = 0; pol_idx < num_pols; pol_idx++) {
+ if (strlen(infos[pol_idx].pi_arg) > 0)
+ seq_printf(m, " - name: %s %s\n",
+- infos[pol_idx].pi_name,
+- infos[pol_idx].pi_arg);
++ infos[pol_idx].pi_name,
++ infos[pol_idx].pi_arg);
+ else
+ seq_printf(m, " - name: %s\n",
+- infos[pol_idx].pi_name);
++ infos[pol_idx].pi_name);
+
+
+ seq_printf(m, " state: %s\n"
+- " fallback: %s\n"
+- " queued: %-20d\n"
+- " active: %-20d\n\n",
+- nrs_state2str(infos[pol_idx].pi_state),
+- infos[pol_idx].pi_fallback ? "yes" : "no",
+- (int)infos[pol_idx].pi_req_queued,
+- (int)infos[pol_idx].pi_req_started);
++ " fallback: %s\n"
++ " queued: %-20d\n"
++ " active: %-20d\n\n",
++ nrs_state2str(infos[pol_idx].pi_state),
++ infos[pol_idx].pi_fallback ? "yes" : "no",
++ (int)infos[pol_idx].pi_req_queued,
++ (int)infos[pol_idx].pi_req_started);
+ }
+
+ if (!hp && nrs_svc_has_hp(svc)) {
+@@ -1047,7 +1052,8 @@ LPROC_SEQ_FOPS_RO(ptlrpc_lprocfs_timeouts);
+ static int ptlrpc_lprocfs_hp_ratio_seq_show(struct seq_file *m, void *v)
+ {
+ struct ptlrpc_service *svc = m->private;
+- return seq_printf(m, "%d\n", svc->srv_hpreq_ratio);
++ seq_printf(m, "%d\n", svc->srv_hpreq_ratio);
++ return 0;
+ }
+
+ static ssize_t
+@@ -1296,12 +1302,11 @@ int lprocfs_pinger_recov_seq_show(struct seq_file *m, void *n)
+ {
+ struct obd_device *obd = m->private;
+ struct obd_import *imp = obd->u.cli.cl_import;
+- int rc;
+
+ LPROCFS_CLIMP_CHECK(obd);
+- rc = seq_printf(m, "%d\n", !imp->imp_no_pinger_recover);
++ seq_printf(m, "%d\n", !imp->imp_no_pinger_recover);
+ LPROCFS_CLIMP_EXIT(obd);
+- return rc;
++ return 0;
+ }
+ EXPORT_SYMBOL(lprocfs_pinger_recov_seq_show);
+
+diff --git a/lustre/ptlrpc/nodemap_lproc.c b/lustre/ptlrpc/nodemap_lproc.c
+index e5c4b0c..a77c478 100644
+--- a/lustre/ptlrpc/nodemap_lproc.c
++++ b/lustre/ptlrpc/nodemap_lproc.c
+@@ -239,7 +239,8 @@ static int nodemap_exports_open(struct inode *inode, struct file *file)
+ */
+ static int nodemap_active_seq_show(struct seq_file *m, void *data)
+ {
+- return seq_printf(m, "%u\n", (unsigned int)nodemap_active);
++ seq_printf(m, "%u\n", (unsigned int)nodemap_active);
++ return 0;
+ }
+
+ /**
+@@ -290,21 +291,20 @@ LPROC_SEQ_FOPS(nodemap_active);
+ static int nodemap_id_seq_show(struct seq_file *m, void *data)
+ {
+ struct lu_nodemap *nodemap;
+- int rc;
+
+ mutex_lock(&active_config_lock);
+ nodemap = nodemap_lookup(m->private);
+ mutex_unlock(&active_config_lock);
+ if (IS_ERR(nodemap)) {
+- rc = PTR_ERR(nodemap);
++ int rc = PTR_ERR(nodemap);
+ CERROR("cannot find nodemap '%s': rc = %d\n",
+ (char *)m->private, rc);
+ return rc;
+ }
+
+- rc = seq_printf(m, "%u\n", nodemap->nm_id);
++ seq_printf(m, "%u\n", nodemap->nm_id);
+ nodemap_putref(nodemap);
+- return rc;
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(nodemap_id);
+
+@@ -318,21 +318,20 @@ LPROC_SEQ_FOPS_RO(nodemap_id);
+ static int nodemap_squash_uid_seq_show(struct seq_file *m, void *data)
+ {
+ struct lu_nodemap *nodemap;
+- int rc;
+
+ mutex_lock(&active_config_lock);
+ nodemap = nodemap_lookup(m->private);
+ mutex_unlock(&active_config_lock);
+ if (IS_ERR(nodemap)) {
+- rc = PTR_ERR(nodemap);
++ int rc = PTR_ERR(nodemap);
+ CERROR("cannot find nodemap '%s': rc = %d\n",
+ (char *)m->private, rc);
+ return rc;
+ }
+
+- rc = seq_printf(m, "%u\n", nodemap->nm_squash_uid);
++ seq_printf(m, "%u\n", nodemap->nm_squash_uid);
+ nodemap_putref(nodemap);
+- return rc;
++ return 0;
+ }
+
+ /**
+@@ -345,21 +344,20 @@ static int nodemap_squash_uid_seq_show(struct seq_file *m, void *data)
+ static int nodemap_squash_gid_seq_show(struct seq_file *m, void *data)
+ {
+ struct lu_nodemap *nodemap;
+- int rc;
+
+ mutex_lock(&active_config_lock);
+ nodemap = nodemap_lookup(m->private);
+ mutex_unlock(&active_config_lock);
+ if (IS_ERR(nodemap)) {
+- rc = PTR_ERR(nodemap);
++ int rc = PTR_ERR(nodemap);
+ CERROR("cannot find nodemap '%s': rc = %d\n",
+ (char *)m->private, rc);
+ return rc;
+ }
+
+- rc = seq_printf(m, "%u\n", nodemap->nm_squash_gid);
++ seq_printf(m, "%u\n", nodemap->nm_squash_gid);
+ nodemap_putref(nodemap);
+- return rc;
++ return 0;
+ }
+
+ /**
+@@ -372,21 +370,21 @@ static int nodemap_squash_gid_seq_show(struct seq_file *m, void *data)
+ static int nodemap_trusted_seq_show(struct seq_file *m, void *data)
+ {
+ struct lu_nodemap *nodemap;
+- int rc;
+
+ mutex_lock(&active_config_lock);
+ nodemap = nodemap_lookup(m->private);
+ mutex_unlock(&active_config_lock);
+ if (IS_ERR(nodemap)) {
+- rc = PTR_ERR(nodemap);
++ int rc = PTR_ERR(nodemap);
++
+ CERROR("cannot find nodemap '%s': rc = %d\n",
+ (char *)m->private, rc);
+ return rc;
+ }
+
+- rc = seq_printf(m, "%d\n", (int)nodemap->nmf_trust_client_ids);
++ seq_printf(m, "%d\n", (int)nodemap->nmf_trust_client_ids);
+ nodemap_putref(nodemap);
+- return rc;
++ return 0;
+ }
+
+ /**
+@@ -411,9 +409,9 @@ static int nodemap_admin_seq_show(struct seq_file *m, void *data)
+ return rc;
+ }
+
+- rc = seq_printf(m, "%d\n", (int)nodemap->nmf_allow_root_access);
++ seq_printf(m, "%d\n", (int)nodemap->nmf_allow_root_access);
+ nodemap_putref(nodemap);
+- return rc;
++ return 0;
+ }
+
+ #ifdef NODEMAP_PROC_DEBUG
+diff --git a/lustre/ptlrpc/nrs_tbf.c b/lustre/ptlrpc/nrs_tbf.c
+index 7f92e10..6c94ff5 100644
+--- a/lustre/ptlrpc/nrs_tbf.c
++++ b/lustre/ptlrpc/nrs_tbf.c
+@@ -832,9 +832,10 @@ static int nrs_tbf_jobid_rule_init(struct ptlrpc_nrs_policy *policy,
+ static int
+ nrs_tbf_jobid_rule_dump(struct nrs_tbf_rule *rule, struct seq_file *m)
+ {
+- return seq_printf(m, "%s {%s} %llu, ref %d\n", rule->tr_name,
++ seq_printf(m, "%s {%s} %llu, ref %d\n", rule->tr_name,
+ rule->tr_jobids_str, rule->tr_rpc_rate,
+ atomic_read(&rule->tr_ref) - 1);
++ return 0;
+ }
+
+ static int
+@@ -1037,9 +1038,10 @@ static int nrs_tbf_nid_rule_init(struct ptlrpc_nrs_policy *policy,
+ static int
+ nrs_tbf_nid_rule_dump(struct nrs_tbf_rule *rule, struct seq_file *m)
+ {
+- return seq_printf(m, "%s {%s} %llu, ref %d\n", rule->tr_name,
++ seq_printf(m, "%s {%s} %llu, ref %d\n", rule->tr_name,
+ rule->tr_nids_str, rule->tr_rpc_rate,
+ atomic_read(&rule->tr_ref) - 1);
++ return 0;
+ }
+
+ static int
+diff --git a/lustre/ptlrpc/sec_bulk.c b/lustre/ptlrpc/sec_bulk.c
+index c091dd6..87b570e 100644
+--- a/lustre/ptlrpc/sec_bulk.c
++++ b/lustre/ptlrpc/sec_bulk.c
+@@ -138,55 +138,49 @@ static struct shrinker *pools_shrinker;
+ */
+ int sptlrpc_proc_enc_pool_seq_show(struct seq_file *m, void *v)
+ {
+- int rc;
+-
+ spin_lock(&page_pools.epp_lock);
+
+- rc = seq_printf(m,
+- "physical pages: %lu\n"
+- "pages per pool: %lu\n"
+- "max pages: %lu\n"
+- "max pools: %u\n"
+- "total pages: %lu\n"
+- "total free: %lu\n"
+- "idle index: %lu/100\n"
+- "last shrink: %lds\n"
+- "last access: %lds\n"
+- "max pages reached: %lu\n"
+- "grows: %u\n"
+- "grows failure: %u\n"
+- "shrinks: %u\n"
+- "cache access: %lu\n"
+- "cache missing: %lu\n"
+- "low free mark: %lu\n"
+- "max waitqueue depth: %u\n"
+- "max wait time: "CFS_TIME_T"/%lu\n"
+- "out of mem: %lu\n"
+- ,
+- totalram_pages,
+- PAGES_PER_POOL,
+- page_pools.epp_max_pages,
+- page_pools.epp_max_pools,
+- page_pools.epp_total_pages,
+- page_pools.epp_free_pages,
+- page_pools.epp_idle_idx,
+- cfs_time_current_sec() - page_pools.epp_last_shrink,
+- cfs_time_current_sec() - page_pools.epp_last_access,
+- page_pools.epp_st_max_pages,
+- page_pools.epp_st_grows,
+- page_pools.epp_st_grow_fails,
+- page_pools.epp_st_shrinks,
+- page_pools.epp_st_access,
+- page_pools.epp_st_missings,
+- page_pools.epp_st_lowfree,
+- page_pools.epp_st_max_wqlen,
+- page_pools.epp_st_max_wait,
+- msecs_to_jiffies(MSEC_PER_SEC),
+- page_pools.epp_st_outofmem
+- );
++ seq_printf(m, "physical pages: %lu\n"
++ "pages per pool: %lu\n"
++ "max pages: %lu\n"
++ "max pools: %u\n"
++ "total pages: %lu\n"
++ "total free: %lu\n"
++ "idle index: %lu/100\n"
++ "last shrink: %lds\n"
++ "last access: %lds\n"
++ "max pages reached: %lu\n"
++ "grows: %u\n"
++ "grows failure: %u\n"
++ "shrinks: %u\n"
++ "cache access: %lu\n"
++ "cache missing: %lu\n"
++ "low free mark: %lu\n"
++ "max waitqueue depth: %u\n"
++ "max wait time: "CFS_TIME_T"/%lu\n"
++ "out of mem: %lu\n",
++ totalram_pages, PAGES_PER_POOL,
++ page_pools.epp_max_pages,
++ page_pools.epp_max_pools,
++ page_pools.epp_total_pages,
++ page_pools.epp_free_pages,
++ page_pools.epp_idle_idx,
++ cfs_time_current_sec() - page_pools.epp_last_shrink,
++ cfs_time_current_sec() - page_pools.epp_last_access,
++ page_pools.epp_st_max_pages,
++ page_pools.epp_st_grows,
++ page_pools.epp_st_grow_fails,
++ page_pools.epp_st_shrinks,
++ page_pools.epp_st_access,
++ page_pools.epp_st_missings,
++ page_pools.epp_st_lowfree,
++ page_pools.epp_st_max_wqlen,
++ page_pools.epp_st_max_wait,
++ msecs_to_jiffies(MSEC_PER_SEC),
++ page_pools.epp_st_outofmem);
+
+ spin_unlock(&page_pools.epp_lock);
+- return rc;
++ return 0;
+ }
+
+ static void enc_pools_release_free_pages(long npages)
+diff --git a/lustre/quota/qsd_lib.c b/lustre/quota/qsd_lib.c
+index 9f89cac..efd7840 100644
+--- a/lustre/quota/qsd_lib.c
++++ b/lustre/quota/qsd_lib.c
+@@ -77,7 +77,6 @@ static int qsd_state_seq_show(struct seq_file *m, void *data)
+ {
+ struct qsd_instance *qsd = m->private;
+ char enabled[5];
+- int rc;
+
+ LASSERT(qsd != NULL);
+
+@@ -89,14 +88,14 @@ static int qsd_state_seq_show(struct seq_file *m, void *data)
+ if (strlen(enabled) == 0)
+ strcat(enabled, "none");
+
+- rc = seq_printf(m, "target name: %s\n"
+- "pool ID: %d\n"
+- "type: %s\n"
+- "quota enabled: %s\n"
+- "conn to master: %s\n",
+- qsd->qsd_svname, qsd->qsd_pool_id,
+- qsd->qsd_is_md ? "md" : "dt", enabled,
+- qsd->qsd_exp_valid ? "setup" : "not setup yet");
++ seq_printf(m, "target name: %s\n"
++ "pool ID: %d\n"
++ "type: %s\n"
++ "quota enabled: %s\n"
++ "conn to master: %s\n",
++ qsd->qsd_svname, qsd->qsd_pool_id,
++ qsd->qsd_is_md ? "md" : "dt", enabled,
++ qsd->qsd_exp_valid ? "setup" : "not setup yet");
+
+ if (qsd->qsd_prepared) {
+ memset(enabled, 0, sizeof(enabled));
+@@ -106,18 +105,18 @@ static int qsd_state_seq_show(struct seq_file *m, void *data)
+ strcat(enabled, "g");
+ if (strlen(enabled) == 0)
+ strcat(enabled, "none");
+- rc += seq_printf(m, "space acct: %s\n"
+- "user uptodate: glb[%d],slv[%d],reint[%d]\n"
+- "group uptodate: glb[%d],slv[%d],reint[%d]\n",
+- enabled,
+- qsd->qsd_type_array[USRQUOTA]->qqi_glb_uptodate,
+- qsd->qsd_type_array[USRQUOTA]->qqi_slv_uptodate,
+- qsd->qsd_type_array[USRQUOTA]->qqi_reint,
+- qsd->qsd_type_array[GRPQUOTA]->qqi_glb_uptodate,
+- qsd->qsd_type_array[GRPQUOTA]->qqi_slv_uptodate,
+- qsd->qsd_type_array[GRPQUOTA]->qqi_reint);
++ seq_printf(m, "space acct: %s\n"
++ "user uptodate: glb[%d],slv[%d],reint[%d]\n"
++ "group uptodate: glb[%d],slv[%d],reint[%d]\n",
++ enabled,
++ qsd->qsd_type_array[USRQUOTA]->qqi_glb_uptodate,
++ qsd->qsd_type_array[USRQUOTA]->qqi_slv_uptodate,
++ qsd->qsd_type_array[USRQUOTA]->qqi_reint,
++ qsd->qsd_type_array[GRPQUOTA]->qqi_glb_uptodate,
++ qsd->qsd_type_array[GRPQUOTA]->qqi_slv_uptodate,
++ qsd->qsd_type_array[GRPQUOTA]->qqi_reint);
+ }
+- return rc;
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(qsd_state);
+
+@@ -136,7 +135,8 @@ static int qsd_enabled_seq_show(struct seq_file *m, void *data)
+ if (strlen(enabled) == 0)
+ strcat(enabled, "none");
+
+- return seq_printf(m, "%s\n", enabled);
++ seq_printf(m, "%s\n", enabled);
++ return 0;
+ }
+ LPROC_SEQ_FOPS_RO(qsd_enabled);
+
+@@ -185,7 +185,8 @@ static int qsd_timeout_seq_show(struct seq_file *m, void *data)
+ struct qsd_instance *qsd = m->private;
+ LASSERT(qsd != NULL);
+
+- return seq_printf(m, "%d\n", qsd_wait_timeout(qsd));
++ seq_printf(m, "%d\n", qsd_wait_timeout(qsd));
++ return 0;
+ }
+
+ static ssize_t
+--
+2.8.2
+
diff --git a/sys-cluster/lustre/files/0002-LU-6215-gss-cache_head-is-now-on-a-hlist-in-4.3-kern.patch b/sys-cluster/lustre/files/0002-LU-6215-gss-cache_head-is-now-on-a-hlist-in-4.3-kern.patch
new file mode 100644
index 000000000..ba4c2f184
--- /dev/null
+++ b/sys-cluster/lustre/files/0002-LU-6215-gss-cache_head-is-now-on-a-hlist-in-4.3-kern.patch
@@ -0,0 +1,192 @@
+From 449e99feba4cfd3e417cdfc87e0eb33e163c2cb6 Mon Sep 17 00:00:00 2001
+From: Li Dongyang <dongyang.li@anu.edu.au>
+Date: Tue, 1 Mar 2016 16:10:48 +1100
+Subject: [PATCH 02/19] LU-6215 gss: cache_head is now on a hlist in 4.3+
+ kernels
+
+Since kernel 4.3 struct cache_head switched from a single
+list to a hlist. This patch handles the change.
+
+Linux-commit: 129e5824cd96d9289679973f0ff7c48e88d569bb
+
+Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
+Change-Id: Iec4c7d0acf106a8f7b60d72eb2038b6d9e12f422
+Reviewed-on: http://review.whamcloud.com/18728
+Tested-by: Jenkins
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: James Simmons <uja.ornl@yahoo.com>
+Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+---
+ lustre/autoconf/lustre-core.m4 | 46 +++++++++++++++++++++++++++++++++++++
+ lustre/ptlrpc/gss/gss_svc_upcall.c | 47 ++++++++++++++++++++++++++++++++------
+ 2 files changed, 86 insertions(+), 7 deletions(-)
+
+diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
+index b8285d0..8ed3500 100644
+--- a/lustre/autoconf/lustre-core.m4
++++ b/lustre/autoconf/lustre-core.m4
+@@ -1948,6 +1948,49 @@ bio_endio, [
+ ]) # LC_BIO_ENDIO_USES_ONE_ARG
+
+ #
++# LC_HAVE_LOOP_CTL_GET_FREE
++#
++# 4.x kernel have moved userspace APIs to
++# the separate directory and all of them
++# support LOOP_CTL_GET_FREE
++#
++AC_DEFUN([LC_HAVE_LOOP_CTL_GET_FREE], [
++LB_CHECK_FILE([$LINUX/include/linux/loop.h], [
++ LB_CHECK_COMPILE([if have 'HAVE_LOOP_CTL_GET_FREE'],
++ LOOP_CTL_GET_FREE, [
++ #include <linux/loop.h>
++ ],[
++ int i;
++
++ i = LOOP_CTL_GET_FREE;
++ ],[
++ AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1,
++ [LOOP_CTL_GET_FREE exist])
++ ])
++],[
++ AC_DEFINE(HAVE_LOOP_CTL_GET_FREE, 1,
++ [kernel has LOOP_CTL_GET_FREE])
++])
++]) # LC_HAVE_LOOP_CTL_GET_FREE
++
++#
++# LC_HAVE_CACHE_HEAD_HLIST
++#
++# 4.3 kernel swiched to hlist for cache_head
++#
++AC_DEFUN([LC_HAVE_CACHE_HEAD_HLIST], [
++LB_CHECK_COMPILE([if 'struct cache_head' has 'cache_list' field],
++cache_head_has_hlist, [
++ #include <linux/sunrpc/cache.h>
++],[
++ do {} while(sizeof(((struct cache_head *)0)->cache_list));
++],[
++ AC_DEFINE(HAVE_CACHE_HEAD_HLIST, 1,
++ [cache_head has hlist cache_list])
++])
++]) # LC_HAVE_CACHE_HEAD_HLIST
++
++#
+ # LC_PROG_LINUX
+ #
+ # Lustre linux kernel checks
+@@ -2108,6 +2151,9 @@ AC_DEFUN([LC_PROG_LINUX], [
+ LC_BIO_ENDIO_USES_ONE_ARG
+ LC_SYMLINK_OPS_USE_NAMEIDATA
+
++ # 4.3
++ LC_HAVE_CACHE_HEAD_HLIST
++
+ #
+ AS_IF([test "x$enable_server" != xno], [
+ LC_FUNC_DEV_SET_RDONLY
+diff --git a/lustre/ptlrpc/gss/gss_svc_upcall.c b/lustre/ptlrpc/gss/gss_svc_upcall.c
+index 429b1eb..2786d69 100644
+--- a/lustre/ptlrpc/gss/gss_svc_upcall.c
++++ b/lustre/ptlrpc/gss/gss_svc_upcall.c
+@@ -149,7 +149,11 @@ struct rsi {
+ int major_status, minor_status;
+ };
+
++#ifdef HAVE_CACHE_HEAD_HLIST
++static struct hlist_head rsi_table[RSI_HASHMAX];
++#else
+ static struct cache_head *rsi_table[RSI_HASHMAX];
++#endif
+ static struct cache_detail rsi_cache;
+ static struct rsi *rsi_update(struct rsi *new, struct rsi *old);
+ static struct rsi *rsi_lookup(struct rsi *item);
+@@ -242,7 +246,11 @@ static void rsi_put(struct kref *ref)
+ {
+ struct rsi *rsi = container_of(ref, struct rsi, h.ref);
+
+- LASSERT(rsi->h.next == NULL);
++#ifdef HAVE_CACHE_HEAD_HLIST
++ LASSERT(rsi->h.cache_list.next == NULL);
++#else
++ LASSERT(rsi->h.next == NULL);
++#endif
+ rsi_free(rsi);
+ OBD_FREE_PTR(rsi);
+ }
+@@ -430,7 +438,11 @@ struct rsc {
+ struct gss_svc_ctx ctx;
+ };
+
++#ifdef HAVE_CACHE_HEAD_HLIST
++static struct hlist_head rsc_table[RSC_HASHMAX];
++#else
+ static struct cache_head *rsc_table[RSC_HASHMAX];
++#endif
+ static struct cache_detail rsc_cache;
+ static struct rsc *rsc_update(struct rsc *new, struct rsc *old);
+ static struct rsc *rsc_lookup(struct rsc *item);
+@@ -477,7 +489,11 @@ static void rsc_put(struct kref *ref)
+ {
+ struct rsc *rsci = container_of(ref, struct rsc, h.ref);
+
++#ifdef HAVE_CACHE_HEAD_HLIST
++ LASSERT(rsci->h.cache_list.next == NULL);
++#else
+ LASSERT(rsci->h.next == NULL);
++#endif
+ rsc_free(rsci);
+ OBD_FREE_PTR(rsci);
+ }
+@@ -693,24 +709,41 @@ typedef int rsc_entry_match(struct rsc *rscp, long data);
+
+ static void rsc_flush(rsc_entry_match *match, long data)
+ {
+- struct cache_head **ch;
++#ifdef HAVE_CACHE_HEAD_HLIST
++ struct cache_head *ch = NULL;
++ struct hlist_head *head;
++#else
++ struct cache_head **ch;
++#endif
+ struct rsc *rscp;
+ int n;
+ ENTRY;
+
+ write_lock(&rsc_cache.hash_lock);
+ for (n = 0; n < RSC_HASHMAX; n++) {
+- for (ch = &rsc_cache.hash_table[n]; *ch;) {
+- rscp = container_of(*ch, struct rsc, h);
++#ifdef HAVE_CACHE_HEAD_HLIST
++ head = &rsc_cache.hash_table[n];
++ hlist_for_each_entry(ch, head, cache_list) {
++ rscp = container_of(ch, struct rsc, h);
++#else
++ for (ch = &rsc_cache.hash_table[n]; *ch;) {
++ rscp = container_of(*ch, struct rsc, h);
++#endif
+
+ if (!match(rscp, data)) {
+- ch = &((*ch)->next);
++#ifndef HAVE_CACHE_HEAD_HLIST
++ ch = &((*ch)->next);
++#endif
+ continue;
+ }
+
+ /* it seems simply set NEGATIVE doesn't work */
+- *ch = (*ch)->next;
+- rscp->h.next = NULL;
++#ifdef HAVE_CACHE_HEAD_HLIST
++ hlist_del_init(&ch->cache_list);
++#else
++ *ch = (*ch)->next;
++ rscp->h.next = NULL;
++#endif
+ cache_get(&rscp->h);
+ set_bit(CACHE_NEGATIVE, &rscp->h.flags);
+ COMPAT_RSC_PUT(&rscp->h, &rsc_cache);
+--
+2.8.2
+
diff --git a/sys-cluster/lustre/files/0003-LU-6215-llite-handle-locks-API-change-in-4.4-kernels.patch b/sys-cluster/lustre/files/0003-LU-6215-llite-handle-locks-API-change-in-4.4-kernels.patch
new file mode 100644
index 000000000..4c1c66853
--- /dev/null
+++ b/sys-cluster/lustre/files/0003-LU-6215-llite-handle-locks-API-change-in-4.4-kernels.patch
@@ -0,0 +1,90 @@
+From ffcc66dc3a0e7249ac6d5f7506c595cc69209e54 Mon Sep 17 00:00:00 2001
+From: Li Dongyang <dongyang.li@anu.edu.au>
+Date: Tue, 1 Mar 2016 16:36:49 +1100
+Subject: [PATCH 03/19] LU-6215 llite: handle locks API change in 4.4+ kernels
+
+Since 4.4 linux kernel replaced both posix_lock_file_wait() and
+flock_lock_file_wait() by introducing locks_lock_file_wait().
+This patch handles the API change.
+
+Linux-commit: 4f6563677ae833baad8003e14353241bc25da4fc
+
+Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
+Change-Id: I1b9c98c2afcad9da3fb377c3e788b12f20261e9e
+Reviewed-on: http://review.whamcloud.com/18729
+Tested-by: Jenkins
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: James Simmons <uja.ornl@yahoo.com>
+Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+---
+ lustre/autoconf/lustre-core.m4 | 21 +++++++++++++++++++++
+ lustre/llite/file.c | 6 ++++++
+ 2 files changed, 27 insertions(+)
+
+diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
+index 8ed3500..b2a4af0 100644
+--- a/lustre/autoconf/lustre-core.m4
++++ b/lustre/autoconf/lustre-core.m4
+@@ -1991,6 +1991,24 @@ cache_head_has_hlist, [
+ ]) # LC_HAVE_CACHE_HEAD_HLIST
+
+ #
++# LC_HAVE_LOCKS_LOCK_FILE_WAIT
++#
++# 4.4 kernel have moved locks API users to
++# locks_lock_inode_wait()
++#
++AC_DEFUN([LC_HAVE_LOCKS_LOCK_FILE_WAIT], [
++LB_CHECK_COMPILE([if 'locks_lock_file_wait' exists],
++locks_lock_file_wait, [
++ #include <linux/fs.h>
++],[
++ locks_lock_file_wait(NULL, NULL);
++],[
++ AC_DEFINE(HAVE_LOCKS_LOCK_FILE_WAIT, 1,
++ [kernel has locks_lock_file_wait])
++])
++]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT
++
++#
+ # LC_PROG_LINUX
+ #
+ # Lustre linux kernel checks
+@@ -2154,6 +2172,9 @@ AC_DEFUN([LC_PROG_LINUX], [
+ # 4.3
+ LC_HAVE_CACHE_HEAD_HLIST
+
++ # 4.4
++ LC_HAVE_LOCKS_LOCK_FILE_WAIT
++
+ #
+ AS_IF([test "x$enable_server" != xno], [
+ LC_FUNC_DEV_SET_RDONLY
+diff --git a/lustre/llite/file.c b/lustre/llite/file.c
+index 8e6afbd..d1819c6 100644
+--- a/lustre/llite/file.c
++++ b/lustre/llite/file.c
+@@ -2918,6 +2918,11 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
+ if (!(flags & LDLM_FL_TEST_LOCK))
+ file_lock->fl_type = fl_type;
+
++#ifdef HAVE_LOCKS_LOCK_FILE_WAIT
++ if ((rc == 0 || file_lock->fl_type == F_UNLCK) &&
++ !(flags & LDLM_FL_TEST_LOCK))
++ rc2 = locks_lock_file_wait(file, file_lock);
++#else
+ if ((file_lock->fl_flags & FL_FLOCK) &&
+ (rc == 0 || file_lock->fl_type == F_UNLCK))
+ rc2 = flock_lock_file_wait(file, file_lock);
+@@ -2925,6 +2930,7 @@ ll_file_flock(struct file *file, int cmd, struct file_lock *file_lock)
+ (rc == 0 || file_lock->fl_type == F_UNLCK) &&
+ !(flags & LDLM_FL_TEST_LOCK))
+ rc2 = posix_lock_file_wait(file, file_lock);
++#endif /* HAVE_LOCKS_LOCK_FILE_WAIT */
+
+ if (rc2 && file_lock->fl_type != F_UNLCK) {
+ einfo.ei_mode = LCK_NL;
+--
+2.8.2
+
diff --git a/sys-cluster/lustre/files/0004-LU-6215-llite-make_request_fn-returns-blk_qc_t-in-ke.patch b/sys-cluster/lustre/files/0004-LU-6215-llite-make_request_fn-returns-blk_qc_t-in-ke.patch
new file mode 100644
index 000000000..3be9aef95
--- /dev/null
+++ b/sys-cluster/lustre/files/0004-LU-6215-llite-make_request_fn-returns-blk_qc_t-in-ke.patch
@@ -0,0 +1,95 @@
+From 7d62fb54e3faec60e86135d75cc6349cf626a46b Mon Sep 17 00:00:00 2001
+From: Li Dongyang <dongyang.li@anu.edu.au>
+Date: Tue, 1 Mar 2016 16:53:49 +1100
+Subject: [PATCH 04/19] LU-6215 llite: make_request_fn returns blk_qc_t in
+ kernel 4.4
+
+For the 4.4 kernel request_queue.make_request_fn is defined as
+a function returns blk_qc_t. loop_make_request() should return
+BLK_QC_T_NONE in this case.
+
+Linux-commit: dece16353ef47d8d33f5302bc158072a9d65e26f
+
+Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
+Change-Id: I20a796caf6d8e6411f084db2392683c12307a0bf
+Reviewed-on: http://review.whamcloud.com/18730
+Tested-by: Jenkins
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: James Simmons <uja.ornl@yahoo.com>
+Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
+Reviewed-by: Lai Siyao <lai.siyao@intel.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+---
+ lustre/autoconf/lustre-core.m4 | 21 +++++++++++++++++++++
+ lustre/include/lustre_compat.h | 15 ++++++++++-----
+ 2 files changed, 31 insertions(+), 5 deletions(-)
+
+diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
+index b2a4af0..0201a28 100644
+--- a/lustre/autoconf/lustre-core.m4
++++ b/lustre/autoconf/lustre-core.m4
+@@ -2009,6 +2009,26 @@ locks_lock_file_wait, [
+ ]) # LC_HAVE_LOCKS_LOCK_FILE_WAIT
+
+ #
++# LC_HAVE_QC_MAKE_REQUEST_FN
++#
++# 4.4 request_queue.make_request_fn defined as function returns with blk_qc_t
++# see kernel commit dece16353ef47d8d33f5302bc158072a9d65e26f
++#
++AC_DEFUN([LC_HAVE_QC_MAKE_REQUEST_FN], [
++LB_CHECK_COMPILE([if 'request_queue.make_request_fn' returns blk_qc_t],
++make_request_fn_blk_qc_t, [
++ #include <linux/blkdev.h>
++],[
++ blk_qc_t ret;
++ make_request_fn *mrf;
++ ret = mrf(NULL, NULL);
++],[
++ AC_DEFINE(HAVE_QC_MAKE_REQUEST_FN, 1,
++ [request_queue.make_request_fn returns blk_qc_t])
++])
++]) # LC_HAVE_QC_MAKE_REQUEST_FN
++
++#
+ # LC_PROG_LINUX
+ #
+ # Lustre linux kernel checks
+@@ -2174,6 +2194,7 @@ AC_DEFUN([LC_PROG_LINUX], [
+
+ # 4.4
+ LC_HAVE_LOCKS_LOCK_FILE_WAIT
++ LC_HAVE_QC_MAKE_REQUEST_FN
+
+ #
+ AS_IF([test "x$enable_server" != xno], [
+diff --git a/lustre/include/lustre_compat.h b/lustre/include/lustre_compat.h
+index c038aa1..4e9f3ac 100644
+--- a/lustre/include/lustre_compat.h
++++ b/lustre/include/lustre_compat.h
+@@ -298,12 +298,17 @@ static inline int ll_namei_to_lookup_intent_flag(int flag)
+ return flag;
+ }
+
+-#ifdef HAVE_VOID_MAKE_REQUEST_FN
+-# define ll_mrf_ret void
+-# define LL_MRF_RETURN(rc)
++#ifdef HAVE_QC_MAKE_REQUEST_FN
++# define ll_mrf_ret blk_qc_t
++# define LL_MRF_RETURN(rc) RETURN(BLK_QC_T_NONE)
+ #else
+-# define ll_mrf_ret int
+-# define LL_MRF_RETURN(rc) RETURN(rc)
++# ifdef HAVE_VOID_MAKE_REQUEST_FN
++# define ll_mrf_ret void
++# define LL_MRF_RETURN(rc)
++# else
++# define ll_mrf_ret int
++# define LL_MRF_RETURN(rc) RETURN(rc)
++# endif
+ #endif
+
+ #include <linux/fs.h>
+--
+2.8.2
+
diff --git a/sys-cluster/lustre/files/0005-LU-6215-gss-key-payload.data-is-an-array-in-4.4-kern.patch b/sys-cluster/lustre/files/0005-LU-6215-gss-key-payload.data-is-an-array-in-4.4-kern.patch
new file mode 100644
index 000000000..a21f41b79
--- /dev/null
+++ b/sys-cluster/lustre/files/0005-LU-6215-gss-key-payload.data-is-an-array-in-4.4-kern.patch
@@ -0,0 +1,229 @@
+From fba216ef655a9c13f5bac27d5911da2e6745ea3d Mon Sep 17 00:00:00 2001
+From: Li Dongyang <dongyang.li@anu.edu.au>
+Date: Thu, 21 Apr 2016 10:25:28 -0400
+Subject: [PATCH 05/19] LU-6215 gss: key->payload.data is an array in 4.4+
+ kernels
+
+Kernel 4.4 merged the type-specific data with the payload data
+for keys, as a result, payload.data is now an array.
+This patch handles the code change.
+
+Linux-commit: 146aa8b1453bd8f1ff2304ffb71b4ee0eb9acdcc
+
+Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
+Signed-off-by: James Simmons <uja.ornl@yahoo.com>
+Change-Id: I1036ab927514f0efa073d9f0136e299be8950461
+Reviewed-on: http://review.whamcloud.com/18731
+Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
+Tested-by: Jenkins
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+---
+ lustre/autoconf/lustre-core.m4 | 17 +++++++++++
+ lustre/ptlrpc/gss/gss_keyring.c | 67 ++++++++++++++++++++++++++++++++---------
+ 2 files changed, 69 insertions(+), 15 deletions(-)
+
+diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
+index 0201a28..9497cdd 100644
+--- a/lustre/autoconf/lustre-core.m4
++++ b/lustre/autoconf/lustre-core.m4
+@@ -2029,6 +2029,22 @@ make_request_fn_blk_qc_t, [
+ ]) # LC_HAVE_QC_MAKE_REQUEST_FN
+
+ #
++# LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
++#
++# 4.4 kernel merged type-specific data with the payload data for keys
++#
++AC_DEFUN([LC_HAVE_KEY_PAYLOAD_DATA_ARRAY], [
++LB_CHECK_COMPILE([if 'struct key' has 'payload.data' as an array],
++key_payload_data_array, [
++ #include <linux/key.h>
++],[
++ ((struct key *)0)->payload.data[0] = NULL;
++],[
++ AC_DEFINE(HAVE_KEY_PAYLOAD_DATA_ARRAY, 1, [payload.data is an array])
++])
++]) #LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
++
++#
+ # LC_PROG_LINUX
+ #
+ # Lustre linux kernel checks
+@@ -2195,6 +2211,7 @@ AC_DEFUN([LC_PROG_LINUX], [
+ # 4.4
+ LC_HAVE_LOCKS_LOCK_FILE_WAIT
+ LC_HAVE_QC_MAKE_REQUEST_FN
++ LC_HAVE_KEY_PAYLOAD_DATA_ARRAY
+
+ #
+ AS_IF([test "x$enable_server" != xno], [
+diff --git a/lustre/ptlrpc/gss/gss_keyring.c b/lustre/ptlrpc/gss/gss_keyring.c
+index 67188f5..e8fbe50 100644
+--- a/lustre/ptlrpc/gss/gss_keyring.c
++++ b/lustre/ptlrpc/gss/gss_keyring.c
+@@ -348,6 +348,43 @@ static int ctx_unlist_kr(struct ptlrpc_cli_ctx *ctx, int locked)
+ }
+
+ /*
++ * Get specific payload. Newer kernels support 4 slots.
++ */
++static void *
++key_get_payload(struct key *key, unsigned int index)
++{
++ void *key_ptr = NULL;
++
++#ifdef HAVE_KEY_PAYLOAD_DATA_ARRAY
++ key_ptr = key->payload.data[index];
++#else
++ if (!index)
++ key_ptr = key->payload.data;
++#endif
++ return key_ptr;
++}
++
++/*
++ * Set specific payload. Newer kernels support 4 slots.
++ */
++static int key_set_payload(struct key *key, unsigned int index,
++ struct ptlrpc_cli_ctx *ctx)
++{
++ int rc = -EINVAL;
++
++#ifdef HAVE_KEY_PAYLOAD_DATA_ARRAY
++ if (index < 4) {
++ key->payload.data[index] = ctx;
++#else
++ if (!index) {
++ key->payload.data = ctx;
++#endif
++ rc = 0;
++ }
++ return rc;
++}
++
++/*
+ * bind a key with a ctx together.
+ * caller must hold write lock of the key, as well as ref on key & ctx.
+ */
+@@ -356,13 +393,13 @@ static void bind_key_ctx(struct key *key, struct ptlrpc_cli_ctx *ctx)
+ LASSERT(atomic_read(&ctx->cc_refcount) > 0);
+ LASSERT(atomic_read(&key->usage) > 0);
+ LASSERT(ctx2gctx_keyring(ctx)->gck_key == NULL);
+- LASSERT(key->payload.data == NULL);
++ LASSERT(!key_get_payload(key, 0));
+
+ /* at this time context may or may not in list. */
+ key_get(key);
+ atomic_inc(&ctx->cc_refcount);
+ ctx2gctx_keyring(ctx)->gck_key = key;
+- key->payload.data = ctx;
++ LASSERT(!key_set_payload(key, 0, ctx));
+ }
+
+ /*
+@@ -371,13 +408,13 @@ static void bind_key_ctx(struct key *key, struct ptlrpc_cli_ctx *ctx)
+ */
+ static void unbind_key_ctx(struct key *key, struct ptlrpc_cli_ctx *ctx)
+ {
+- LASSERT(key->payload.data == ctx);
++ LASSERT(key_get_payload(key, 0) == ctx);
+ LASSERT(test_bit(PTLRPC_CTX_CACHED_BIT, &ctx->cc_flags) == 0);
+
+ /* must revoke the key, or others may treat it as newly created */
+ key_revoke_locked(key);
+
+- key->payload.data = NULL;
++ key_set_payload(key, 0, NULL);
+ ctx2gctx_keyring(ctx)->gck_key = NULL;
+
+ /* once ctx get split from key, the timer is meaningless */
+@@ -397,7 +434,7 @@ static void unbind_ctx_kr(struct ptlrpc_cli_ctx *ctx)
+ struct key *key = ctx2gctx_keyring(ctx)->gck_key;
+
+ if (key) {
+- LASSERT(key->payload.data == ctx);
++ LASSERT(key_get_payload(key, 0) == ctx);
+
+ key_get(key);
+ down_write(&key->sem);
+@@ -413,7 +450,7 @@ static void unbind_ctx_kr(struct ptlrpc_cli_ctx *ctx)
+ */
+ static void unbind_key_locked(struct key *key)
+ {
+- struct ptlrpc_cli_ctx *ctx = key->payload.data;
++ struct ptlrpc_cli_ctx *ctx = key_get_payload(key, 0);
+
+ if (ctx)
+ unbind_key_ctx(key, ctx);
+@@ -434,7 +471,7 @@ static void kill_ctx_kr(struct ptlrpc_cli_ctx *ctx)
+ */
+ static void kill_key_locked(struct key *key)
+ {
+- struct ptlrpc_cli_ctx *ctx = key->payload.data;
++ struct ptlrpc_cli_ctx *ctx = key_get_payload(key, 0);
+
+ if (ctx && ctx_unlist_kr(ctx, 0))
+ unbind_key_locked(key);
+@@ -799,9 +836,8 @@ struct ptlrpc_cli_ctx * gss_sec_lookup_ctx_kr(struct ptlrpc_sec *sec,
+ * need wirtelock of key->sem to serialize them. */
+ down_write(&key->sem);
+
+- if (likely(key->payload.data != NULL)) {
+- ctx = key->payload.data;
+-
++ ctx = key_get_payload(key, 0);
++ if (likely(ctx)) {
+ LASSERT(atomic_read(&ctx->cc_refcount) >= 1);
+ LASSERT(ctx2gctx_keyring(ctx)->gck_key == key);
+ LASSERT(atomic_read(&key->usage) >= 2);
+@@ -1167,7 +1203,7 @@ int sec_install_rctx_kr(struct ptlrpc_sec *sec,
+
+ down_write(&key->sem);
+
+- LASSERT(key->payload.data == NULL);
++ LASSERT(!key_get_payload(key, 0));
+
+ cli_ctx = ctx_create_kr(sec, &vcred);
+ if (cli_ctx == NULL) {
+@@ -1251,7 +1287,7 @@ int gss_kt_instantiate(struct key *key, const void *data, size_t datalen)
+ RETURN(-EINVAL);
+ }
+
+- if (key->payload.data != NULL) {
++ if (key_get_payload(key, 0)) {
+ CERROR("key already have payload\n");
+ RETURN(-EINVAL);
+ }
+@@ -1278,7 +1314,8 @@ int gss_kt_instantiate(struct key *key, const void *data, size_t datalen)
+ RETURN(rc);
+ }
+
+- CDEBUG(D_SEC, "key %p instantiated, ctx %p\n", key, key->payload.data);
++ CDEBUG(D_SEC, "key %p instantiated, ctx %p\n", key,
++ key_get_payload(key, 0));
+ RETURN(0);
+ }
+
+@@ -1297,7 +1334,7 @@ int gss_kt_update(struct key *key, const void *data, size_t datalen)
+ {
+ __u32 datalen32 = (__u32) datalen;
+ #endif
+- struct ptlrpc_cli_ctx *ctx = key->payload.data;
++ struct ptlrpc_cli_ctx *ctx = key_get_payload(key, 0);
+ struct gss_cli_ctx *gctx;
+ rawobj_t tmpobj = RAWOBJ_EMPTY;
+ int rc;
+@@ -1442,7 +1479,7 @@ static
+ void gss_kt_destroy(struct key *key)
+ {
+ ENTRY;
+- LASSERT(key->payload.data == NULL);
++ LASSERT(!key_get_payload(key, 0));
+ CDEBUG(D_SEC, "destroy key %p\n", key);
+ EXIT;
+ }
+--
+2.8.2
+
diff --git a/sys-cluster/lustre/files/0006-LU-6215-o2iblnd-rdma_create_id-takes-extra-parameter.patch b/sys-cluster/lustre/files/0006-LU-6215-o2iblnd-rdma_create_id-takes-extra-parameter.patch
new file mode 100644
index 000000000..3c725cc62
--- /dev/null
+++ b/sys-cluster/lustre/files/0006-LU-6215-o2iblnd-rdma_create_id-takes-extra-parameter.patch
@@ -0,0 +1,106 @@
+From 2d1eb63fe95584ae964e854479cabbe3f21783be Mon Sep 17 00:00:00 2001
+From: Li Dongyang <dongyang.li@anu.edu.au>
+Date: Fri, 1 Apr 2016 20:26:46 -0400
+Subject: [PATCH 06/19] LU-6215 o2iblnd: rdma_create_id() takes extra parameter
+
+4.4 kernel added network namespace parameter to rdma_create_id().
+This patch handles the API change.
+
+Linux-commit: fa20105e09e97e81aadf02f722c31195e4a75c84
+
+Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
+Change-Id: I3f3792e70e91ac3b3d9fefdd58cc9e7e4d1c25c6
+Reviewed-on: http://review.whamcloud.com/18759
+Reviewed-by: James Simmons <uja.ornl@yahoo.com>
+Tested-by: Jenkins
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+---
+ lnet/autoconf/lustre-lnet.m4 | 44 ++++++++++++++++++++++++++++++++++++++++++++
+ lnet/klnds/o2iblnd/o2iblnd.h | 13 ++++++++++---
+ 2 files changed, 54 insertions(+), 3 deletions(-)
+
+diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4
+index 842873d..f7eb217 100644
+--- a/lnet/autoconf/lustre-lnet.m4
++++ b/lnet/autoconf/lustre-lnet.m4
+@@ -379,6 +379,50 @@ AS_IF([test $ENABLEO2IB != "no"], [
+ [struct ib_cq_init_attr is used by ib_create_cq])
+ ])
+ ])
++
++# 4.3 removed ib_alloc_fast_reg_mr()
++AS_IF([test $ENABLEO2IB != "no"], [
++ LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
++ ib_alloc_fast_reg_mr, [
++ #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>
++ ],[
++ ib_alloc_fast_reg_mr(NULL, 0);
++ ],[
++ AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
++ [ib_alloc_fast_reg_mr is defined])
++ ])
++])
++
++# 4.4 added network namespace parameter for rdma_create_id()
++AS_IF([test $ENABLEO2IB != "no"], [
++ LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
++ rdma_create_id_5args, [
++ #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/rdma_cm.h>
++ ],[
++ rdma_create_id(NULL, NULL, NULL, 0, 0);
++ ],[
++ AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
++ [rdma_create_id wants 5 args])
++ ])
++])
+ ]) # LN_CONFIG_O2IB
+
+ #
+diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h
+index b3d9332..e69cd9f 100644
+--- a/lnet/klnds/o2iblnd/o2iblnd.h
++++ b/lnet/klnds/o2iblnd/o2iblnd.h
+@@ -138,10 +138,17 @@ extern kib_tunables_t kiblnd_tunables;
+ IBLND_CREDIT_HIGHWATER_V1 : \
+ *kiblnd_tunables.kib_peercredits_hiw) /* when eagerly to return credits */
+
+-#ifdef HAVE_RDMA_CREATE_ID_4ARG
+-#define kiblnd_rdma_create_id(cb, dev, ps, qpt) rdma_create_id(cb, dev, ps, qpt)
++#ifdef HAVE_RDMA_CREATE_ID_5ARG
++# define kiblnd_rdma_create_id(cb, dev, ps, qpt) rdma_create_id(current->nsproxy->net_ns, \
++ cb, dev, \
++ ps, qpt)
+ #else
+-#define kiblnd_rdma_create_id(cb, dev, ps, qpt) rdma_create_id(cb, dev, ps)
++# ifdef HAVE_RDMA_CREATE_ID_4ARG
++# define kiblnd_rdma_create_id(cb, dev, ps, qpt) rdma_create_id(cb, dev, \
++ ps, qpt)
++# else
++# define kiblnd_rdma_create_id(cb, dev, ps, qpt) rdma_create_id(cb, dev, ps)
++# endif
+ #endif
+
+ static inline int
+--
+2.8.2
+
diff --git a/sys-cluster/lustre/files/0007-LU-6215-lnet-split-struct-ib_send_wr.patch b/sys-cluster/lustre/files/0007-LU-6215-lnet-split-struct-ib_send_wr.patch
new file mode 100644
index 000000000..15209838d
--- /dev/null
+++ b/sys-cluster/lustre/files/0007-LU-6215-lnet-split-struct-ib_send_wr.patch
@@ -0,0 +1,451 @@
+From 6c4eae3aaac92d6d9ef35806fc7badb272702136 Mon Sep 17 00:00:00 2001
+From: Dmitry Eremin <dmitry.eremin@intel.com>
+Date: Tue, 17 May 2016 09:22:15 -0400
+Subject: [PATCH 07/19] LU-6215 lnet: split struct ib_send_wr
+
+In v4.4 Linux kernel split up struct ib_send_wr so that all non-trivial
+verbs use their own structure which embeds struct ib_send_wr.
+
+Linux-commit: e622f2f4ad2142d2a613a57fb85f8cf737935ef5
+Change-Id: Iea2599ea57a576a4c061841be47a989aba097cc6
+Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
+Reviewed-on: http://review.whamcloud.com/19168
+Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
+Reviewed-by: James Simmons <uja.ornl@yahoo.com>
+Reviewed-by: Li Dongyang <dongyang.li@anu.edu.au>
+Tested-by: Jenkins
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+---
+ lnet/autoconf/lustre-lnet.m4 | 84 ++++++++++++++++++--------
+ lnet/klnds/o2iblnd/o2iblnd.c | 127 +++++++++++++++++++++++++++++++++++++---
+ lnet/klnds/o2iblnd/o2iblnd.h | 21 ++++++-
+ lnet/klnds/o2iblnd/o2iblnd_cb.c | 71 ++++++++++++++--------
+ 4 files changed, 246 insertions(+), 57 deletions(-)
+
+diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4
+index f7eb217..2e2adb2 100644
+--- a/lnet/autoconf/lustre-lnet.m4
++++ b/lnet/autoconf/lustre-lnet.m4
+@@ -329,8 +329,8 @@ AC_SUBST(O2IBLND)
+ AC_SUBST(O2IBPATH)
+ AC_SUBST(ENABLEO2IB)
+
+-# In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
+ AS_IF([test $ENABLEO2IB != "no"], [
++ # In RHEL 6.2, rdma_create_id() takes the queue-pair type as a fourth argument
+ LB_CHECK_COMPILE([if 'rdma_create_id' wants four args],
+ rdma_create_id_4args, [
+ #ifdef HAVE_COMPAT_RDMA
+@@ -349,15 +349,32 @@ AS_IF([test $ENABLEO2IB != "no"], [
+ AC_DEFINE(HAVE_RDMA_CREATE_ID_4ARG, 1,
+ [rdma_create_id wants 4 args])
+ ])
+-])
+-#
+-# 4.2 introduced struct ib_cq_init_attr which is used
+-# by ib_create_cq(). Note some OFED stacks only keep
+-# their headers in sync with latest kernels but not
+-# the functionality which means for infiniband testing
+-# we need to always test functionality testings.
+-#
+-AS_IF([test $ENABLEO2IB != "no"], [
++
++ # 4.4 added network namespace parameter for rdma_create_id()
++ LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
++ rdma_create_id_5args, [
++ #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/rdma_cm.h>
++ ],[
++ rdma_create_id(NULL, NULL, NULL, 0, 0);
++ ],[
++ AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
++ [rdma_create_id wants 5 args])
++ ])
++
++ # 4.2 introduced struct ib_cq_init_attr which is used
++ # by ib_create_cq(). Note some OFED stacks only keep
++ # their headers in sync with latest kernels but not
++ # the functionality which means for infiniband testing
++ # we need to always test functionality testings.
+ LB_CHECK_COMPILE([if 'struct ib_cq_init_attr' is used],
+ ib_cq_init_attr, [
+ #ifdef HAVE_COMPAT_RDMA
+@@ -378,10 +395,8 @@ AS_IF([test $ENABLEO2IB != "no"], [
+ AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
+ [struct ib_cq_init_attr is used by ib_create_cq])
+ ])
+-])
+
+-# 4.3 removed ib_alloc_fast_reg_mr()
+-AS_IF([test $ENABLEO2IB != "no"], [
++ # 4.3 removed ib_alloc_fast_reg_mr()
+ LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
+ ib_alloc_fast_reg_mr, [
+ #ifdef HAVE_COMPAT_RDMA
+@@ -400,12 +415,13 @@ AS_IF([test $ENABLEO2IB != "no"], [
+ AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
+ [ib_alloc_fast_reg_mr is defined])
+ ])
+-])
+
+-# 4.4 added network namespace parameter for rdma_create_id()
+-AS_IF([test $ENABLEO2IB != "no"], [
+- LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
+- rdma_create_id_5args, [
++ # In v4.4 Linux kernel,
++ # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
++ # split up struct ib_send_wr so that all non-trivial verbs
++ # use their own structure which embedds struct ib_send_wr.
++ LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
++ ib_rdma_wr, [
+ #ifdef HAVE_COMPAT_RDMA
+ #undef PACKAGE_NAME
+ #undef PACKAGE_TARNAME
+@@ -415,14 +431,36 @@ AS_IF([test $ENABLEO2IB != "no"], [
+ #undef PACKAGE_URL
+ #include <linux/compat-2.6.h>
+ #endif
+- #include <rdma/rdma_cm.h>
++ #include <rdma/ib_verbs.h>
+ ],[
+- rdma_create_id(NULL, NULL, NULL, 0, 0);
++ struct ib_rdma_wr *wr __attribute__ ((unused));
++
++ wr = rdma_wr(NULL);
+ ],[
+- AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
+- [rdma_create_id wants 5 args])
++ AC_DEFINE(HAVE_IB_RDMA_WR, 1,
++ [struct ib_rdma_wr is defined])
+ ])
+-])
++
++ # new fast registration API introduced in 4.4
++ LB_CHECK_COMPILE([if 'ib_map_mr_sg' exists],
++ ib_map_mr_sg, [
++ #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>
++ ],[
++ ib_map_mr_sg(NULL, NULL, 0, 0);
++ ],[
++ AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
++ [ib_map_mr_sg exists])
++ ])
++]) # ENABLEO2IB != "no"
+ ]) # LN_CONFIG_O2IB
+
+ #
+diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c
+index d9761ee..00c4ce2 100644
+--- a/lnet/klnds/o2iblnd/o2iblnd.c
++++ b/lnet/klnds/o2iblnd/o2iblnd.c
+@@ -1592,13 +1592,126 @@ again:
+ fpo->fpo_map_count++;
+ spin_unlock(&fps->fps_lock);
+
+- pfmr = ib_fmr_pool_map_phys(fpo->fpo_fmr_pool,
+- pages, npages, iov);
+- if (likely(!IS_ERR(pfmr))) {
+- fmr->fmr_pool = fpo;
+- fmr->fmr_pfmr = pfmr;
+- return 0;
+- }
++ if (fpo->fpo_is_fmr) {
++ struct ib_pool_fmr *pfmr;
++
++ spin_unlock(&fps->fps_lock);
++
++ if (!tx_pages_mapped) {
++ npages = kiblnd_map_tx_pages(tx, rd);
++ tx_pages_mapped = 1;
++ }
++
++ pfmr = ib_fmr_pool_map_phys(fpo->fmr.fpo_fmr_pool,
++ pages, npages, iov);
++ if (likely(!IS_ERR(pfmr))) {
++ fmr->fmr_key = is_rx ? pfmr->fmr->rkey
++ : pfmr->fmr->lkey;
++ fmr->fmr_frd = NULL;
++ fmr->fmr_pfmr = pfmr;
++ fmr->fmr_pool = fpo;
++ return 0;
++ }
++ rc = PTR_ERR(pfmr);
++ } else {
++ if (!list_empty(&fpo->fast_reg.fpo_pool_list)) {
++ struct kib_fast_reg_descriptor *frd;
++#ifdef HAVE_IB_MAP_MR_SG
++ struct ib_reg_wr *wr;
++ int n;
++#else
++ struct ib_rdma_wr *wr;
++ struct ib_fast_reg_page_list *frpl;
++#endif
++ struct ib_mr *mr;
++
++ frd = list_first_entry(&fpo->fast_reg.fpo_pool_list,
++ struct kib_fast_reg_descriptor,
++ frd_list);
++ list_del(&frd->frd_list);
++ spin_unlock(&fps->fps_lock);
++
++#ifndef HAVE_IB_MAP_MR_SG
++ frpl = frd->frd_frpl;
++#endif
++ mr = frd->frd_mr;
++
++ if (!frd->frd_valid) {
++ struct ib_rdma_wr *inv_wr;
++ __u32 key = is_rx ? mr->rkey : mr->lkey;
++
++ inv_wr = &frd->frd_inv_wr;
++ memset(inv_wr, 0, sizeof(*inv_wr));
++
++ inv_wr->wr.opcode = IB_WR_LOCAL_INV;
++ inv_wr->wr.wr_id = IBLND_WID_MR;
++ inv_wr->wr.ex.invalidate_rkey = key;
++
++ /* Bump the key */
++ key = ib_inc_rkey(key);
++ ib_update_fast_reg_key(mr, key);
++ }
++
++#ifdef HAVE_IB_MAP_MR_SG
++ n = ib_map_mr_sg(mr, tx->tx_frags,
++ tx->tx_nfrags, PAGE_SIZE);
++ if (unlikely(n != tx->tx_nfrags)) {
++ CERROR("Failed to map mr %d/%d "
++ "elements\n", n, tx->tx_nfrags);
++ return n < 0 ? n : -EINVAL;
++ }
++
++ mr->iova = iov;
++
++ wr = &frd->frd_fastreg_wr;
++ memset(wr, 0, sizeof(*wr));
++
++ wr->wr.opcode = IB_WR_REG_MR;
++ wr->wr.wr_id = IBLND_WID_MR;
++ wr->wr.num_sge = 0;
++ wr->wr.send_flags = 0;
++ wr->mr = mr;
++ wr->key = is_rx ? mr->rkey : mr->lkey;
++ wr->access = (IB_ACCESS_LOCAL_WRITE |
++ IB_ACCESS_REMOTE_WRITE);
++#else
++ if (!tx_pages_mapped) {
++ npages = kiblnd_map_tx_pages(tx, rd);
++ tx_pages_mapped = 1;
++ }
++
++ LASSERT(npages <= frpl->max_page_list_len);
++ memcpy(frpl->page_list, pages,
++ sizeof(*pages) * npages);
++
++ /* Prepare FastReg WR */
++ wr = &frd->frd_fastreg_wr;
++ memset(wr, 0, sizeof(*wr));
++
++ wr->wr.opcode = IB_WR_FAST_REG_MR;
++ wr->wr.wr_id = IBLND_WID_MR;
++
++ wr->wr.wr.fast_reg.iova_start = iov;
++ wr->wr.wr.fast_reg.page_list = frpl;
++ wr->wr.wr.fast_reg.page_list_len = npages;
++ wr->wr.wr.fast_reg.page_shift = PAGE_SHIFT;
++ wr->wr.wr.fast_reg.length = nob;
++ wr->wr.wr.fast_reg.rkey =
++ is_rx ? mr->rkey : mr->lkey;
++ wr->wr.wr.fast_reg.access_flags =
++ (IB_ACCESS_LOCAL_WRITE |
++ IB_ACCESS_REMOTE_WRITE);
++#endif
++
++ fmr->fmr_key = is_rx ? mr->rkey : mr->lkey;
++ fmr->fmr_frd = frd;
++ fmr->fmr_pfmr = NULL;
++ fmr->fmr_pool = fpo;
++ return 0;
++ }
++ spin_unlock(&fps->fps_lock);
++ rc = -EBUSY;
++ }
+
+ spin_lock(&fps->fps_lock);
+ fpo->fpo_map_count--;
+diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h
+index e69cd9f..3baa255 100644
+--- a/lnet/klnds/o2iblnd/o2iblnd.h
++++ b/lnet/klnds/o2iblnd/o2iblnd.h
+@@ -344,6 +344,25 @@ typedef struct
+ cfs_time_t fps_next_retry;
+ } kib_fmr_poolset_t;
+
++#ifndef HAVE_IB_RDMA_WR
++struct ib_rdma_wr {
++ struct ib_send_wr wr;
++};
++#endif
++
++struct kib_fast_reg_descriptor { /* For fast registration */
++ struct list_head frd_list;
++ struct ib_rdma_wr frd_inv_wr;
++#ifdef HAVE_IB_MAP_MR_SG
++ struct ib_reg_wr frd_fastreg_wr;
++#else
++ struct ib_rdma_wr frd_fastreg_wr;
++ struct ib_fast_reg_page_list *frd_frpl;
++#endif
++ struct ib_mr *frd_mr;
++ bool frd_valid;
++};
++
+ typedef struct
+ {
+ struct list_head fpo_list; /* chain on pool list */
+@@ -620,7 +639,7 @@ typedef struct kib_tx /* transmit message */
+ /* # send work items */
+ int tx_nwrq;
+ /* send work items... */
+- struct ib_send_wr *tx_wrq;
++ struct ib_rdma_wr *tx_wrq;
+ /* ...and their memory */
+ struct ib_sge *tx_sge;
+ /* rdma descriptor */
+diff --git a/lnet/klnds/o2iblnd/o2iblnd_cb.c b/lnet/klnds/o2iblnd/o2iblnd_cb.c
+index 6887c07..d25e45a 100644
+--- a/lnet/klnds/o2iblnd/o2iblnd_cb.c
++++ b/lnet/klnds/o2iblnd/o2iblnd_cb.c
+@@ -847,14 +847,27 @@ __must_hold(&conn->ibc_lock)
+ /* close_conn will launch failover */
+ rc = -ENETDOWN;
+ } else {
+- struct ib_send_wr *wrq = &tx->tx_wrq[tx->tx_nwrq - 1];
++ struct kib_fast_reg_descriptor *frd = tx->fmr.fmr_frd;
++ struct ib_send_wr *bad = &tx->tx_wrq[tx->tx_nwrq - 1].wr;
++ struct ib_send_wr *wr = &tx->tx_wrq[0].wr;
++
++ if (frd != NULL) {
++ if (!frd->frd_valid) {
++ wr = &frd->frd_inv_wr.wr;
++ wr->next = &frd->frd_fastreg_wr.wr;
++ } else {
++ wr = &frd->frd_fastreg_wr.wr;
++ }
++ frd->frd_fastreg_wr.wr.next = &tx->tx_wrq[0].wr;
++ }
+
+ LASSERTF(wrq->wr_id == kiblnd_ptr2wreqid(tx, IBLND_WID_TX),
+ "bad wr_id "LPX64", opc %d, flags %d, peer: %s\n",
+ wrq->wr_id, wrq->opcode, wrq->send_flags,
+ libcfs_nid2str(conn->ibc_peer->ibp_nid));
+- wrq = NULL;
+- rc = ib_post_send(conn->ibc_cmid->qp, tx->tx_wrq, &wrq);
++
++ bad = NULL;
++ rc = ib_post_send(conn->ibc_cmid->qp, wr, &bad);
+ }
+
+ conn->ibc_last_send = jiffies;
+@@ -1023,11 +1036,11 @@ kiblnd_tx_complete (kib_tx_t *tx, int status)
+ static void
+ kiblnd_init_tx_msg (lnet_ni_t *ni, kib_tx_t *tx, int type, int body_nob)
+ {
+- kib_hca_dev_t *hdev = tx->tx_pool->tpo_hdev;
+- struct ib_sge *sge = &tx->tx_sge[tx->tx_nwrq];
+- struct ib_send_wr *wrq = &tx->tx_wrq[tx->tx_nwrq];
+- int nob = offsetof (kib_msg_t, ibm_u) + body_nob;
+- struct ib_mr *mr = hdev->ibh_mrs;
++ kib_hca_dev_t *hdev = tx->tx_pool->tpo_hdev;
++ struct ib_sge *sge = &tx->tx_sge[tx->tx_nwrq];
++ struct ib_rdma_wr *wrq;
++ int nob = offsetof(kib_msg_t, ibm_u) + body_nob;
++ struct ib_mr *mr = hdev->ibh_mrs;
+
+ LASSERT(tx->tx_nwrq >= 0);
+ LASSERT(tx->tx_nwrq < IBLND_MAX_RDMA_FRAGS + 1);
+@@ -1040,16 +1053,17 @@ kiblnd_init_tx_msg (lnet_ni_t *ni, kib_tx_t *tx, int type, int body_nob)
+ sge->addr = tx->tx_msgaddr;
+ sge->length = nob;
+
+- memset(wrq, 0, sizeof(*wrq));
++ wrq = &tx->tx_wrq[tx->tx_nwrq];
++ memset(wrq, 0, sizeof(*wrq));
+
+- wrq->next = NULL;
+- wrq->wr_id = kiblnd_ptr2wreqid(tx, IBLND_WID_TX);
+- wrq->sg_list = sge;
+- wrq->num_sge = 1;
+- wrq->opcode = IB_WR_SEND;
+- wrq->send_flags = IB_SEND_SIGNALED;
++ wrq->wr.next = NULL;
++ wrq->wr.wr_id = kiblnd_ptr2wreqid(tx, IBLND_WID_TX);
++ wrq->wr.sg_list = sge;
++ wrq->wr.num_sge = 1;
++ wrq->wr.opcode = IB_WR_SEND;
++ wrq->wr.send_flags = IB_SEND_SIGNALED;
+
+- tx->tx_nwrq++;
++ tx->tx_nwrq++;
+ }
+
+ static int
+@@ -1059,7 +1073,7 @@ kiblnd_init_rdma(kib_conn_t *conn, kib_tx_t *tx, int type,
+ kib_msg_t *ibmsg = tx->tx_msg;
+ kib_rdma_desc_t *srcrd = tx->tx_rd;
+ struct ib_sge *sge = &tx->tx_sge[0];
+- struct ib_send_wr *wrq = &tx->tx_wrq[0];
++ struct ib_rdma_wr *wrq;
+ int rc = resid;
+ int srcidx;
+ int dstidx;
+@@ -1106,15 +1120,20 @@ kiblnd_init_rdma(kib_conn_t *conn, kib_tx_t *tx, int type,
+
+ wrq = &tx->tx_wrq[tx->tx_nwrq];
+
+- wrq->next = wrq + 1;
+- wrq->wr_id = kiblnd_ptr2wreqid(tx, IBLND_WID_RDMA);
+- wrq->sg_list = sge;
+- wrq->num_sge = 1;
+- wrq->opcode = IB_WR_RDMA_WRITE;
+- wrq->send_flags = 0;
+-
+- wrq->wr.rdma.remote_addr = kiblnd_rd_frag_addr(dstrd, dstidx);
+- wrq->wr.rdma.rkey = kiblnd_rd_frag_key(dstrd, dstidx);
++ wrq->wr.next = &(wrq + 1)->wr;
++ wrq->wr.wr_id = kiblnd_ptr2wreqid(tx, IBLND_WID_RDMA);
++ wrq->wr.sg_list = sge;
++ wrq->wr.num_sge = 1;
++ wrq->wr.opcode = IB_WR_RDMA_WRITE;
++ wrq->wr.send_flags = 0;
++
++#ifdef HAVE_IB_RDMA_WR
++ wrq->remote_addr = kiblnd_rd_frag_addr(dstrd, dstidx);
++ wrq->rkey = kiblnd_rd_frag_key(dstrd, dstidx);
++#else
++ wrq->wr.wr.rdma.remote_addr = kiblnd_rd_frag_addr(dstrd, dstidx);
++ wrq->wr.wr.rdma.rkey = kiblnd_rd_frag_key(dstrd, dstidx);
++#endif
+
+ srcidx = kiblnd_rd_consume_frag(srcrd, srcidx, wrknob);
+ dstidx = kiblnd_rd_consume_frag(dstrd, dstidx, wrknob);
+--
+2.8.2
+
diff --git a/sys-cluster/lustre/files/0008-LU-6215-o2iblnd-ib_alloc_fast_reg_mr-removed-in-4.3.patch b/sys-cluster/lustre/files/0008-LU-6215-o2iblnd-ib_alloc_fast_reg_mr-removed-in-4.3.patch
new file mode 100644
index 000000000..993f3b90f
--- /dev/null
+++ b/sys-cluster/lustre/files/0008-LU-6215-o2iblnd-ib_alloc_fast_reg_mr-removed-in-4.3.patch
@@ -0,0 +1,199 @@
+From 12fe2bd8fb80b71bcbc6526f916e6225c12610ee Mon Sep 17 00:00:00 2001
+From: Li Dongyang <dongyang.li@anu.edu.au>
+Date: Tue, 29 Mar 2016 14:57:57 +1100
+Subject: [PATCH 08/19] LU-6215 o2iblnd: ib_alloc_fast_reg_mr() removed in 4.3
+
+ib_alloc_fast_reg_mr() is replaced by a more generic
+ib_alloc_mr() since kernel 4.3
+
+Linux-commit: d9f272c523db47a56a64942eb6f25361c400de66
+
+Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
+Change-Id: I53f4e7c395c83d731aaa342f308f878b07b54d61
+Reviewed-on: http://review.whamcloud.com/19185
+Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
+Tested-by: Jenkins
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: James Simmons <uja.ornl@yahoo.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+---
+ lnet/autoconf/lustre-lnet.m4 | 51 ++----------------------
+ lnet/klnds/o2iblnd/o2iblnd.c | 92 +++++++++++++++++++++++++++++++++++++++++++-
+ 2 files changed, 95 insertions(+), 48 deletions(-)
+
+diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4
+index 2e2adb2..a1498aa 100644
+--- a/lnet/autoconf/lustre-lnet.m4
++++ b/lnet/autoconf/lustre-lnet.m4
+@@ -395,8 +395,10 @@ AS_IF([test $ENABLEO2IB != "no"], [
+ AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
+ [struct ib_cq_init_attr is used by ib_create_cq])
+ ])
++])
+
+- # 4.3 removed ib_alloc_fast_reg_mr()
++# 4.3 removed ib_alloc_fast_reg_mr()
++AS_IF([test $ENABLEO2IB != "no"], [
+ LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
+ ib_alloc_fast_reg_mr, [
+ #ifdef HAVE_COMPAT_RDMA
+@@ -415,52 +417,7 @@ AS_IF([test $ENABLEO2IB != "no"], [
+ AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
+ [ib_alloc_fast_reg_mr is defined])
+ ])
+-
+- # In v4.4 Linux kernel,
+- # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
+- # split up struct ib_send_wr so that all non-trivial verbs
+- # use their own structure which embedds struct ib_send_wr.
+- LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
+- ib_rdma_wr, [
+- #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_rdma_wr *wr __attribute__ ((unused));
+-
+- wr = rdma_wr(NULL);
+- ],[
+- AC_DEFINE(HAVE_IB_RDMA_WR, 1,
+- [struct ib_rdma_wr is defined])
+- ])
+-
+- # new fast registration API introduced in 4.4
+- LB_CHECK_COMPILE([if 'ib_map_mr_sg' exists],
+- ib_map_mr_sg, [
+- #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>
+- ],[
+- ib_map_mr_sg(NULL, NULL, 0, 0);
+- ],[
+- AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
+- [ib_map_mr_sg exists])
+- ])
+-]) # ENABLEO2IB != "no"
++])
+ ]) # LN_CONFIG_O2IB
+
+ #
+diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c
+index 00c4ce2..57f51ca 100644
+--- a/lnet/klnds/o2iblnd/o2iblnd.c
++++ b/lnet/klnds/o2iblnd/o2iblnd.c
+@@ -1444,7 +1444,97 @@ kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t **pp_fpo)
+ .dirty_watermark = fps->fps_flush_trigger,
+ .flush_function = NULL,
+ .flush_arg = NULL,
+- .cache = !!*kiblnd_tunables.kib_fmr_cache};
++ .cache = !!fps->fps_cache };
++ int rc = 0;
++
++ fpo->fmr.fpo_fmr_pool = ib_create_fmr_pool(fpo->fpo_hdev->ibh_pd,
++ &param);
++ if (IS_ERR(fpo->fmr.fpo_fmr_pool)) {
++ rc = PTR_ERR(fpo->fmr.fpo_fmr_pool);
++ if (rc != -ENOSYS)
++ CERROR("Failed to create FMR pool: %d\n", rc);
++ else
++ CERROR("FMRs are not supported\n");
++ }
++
++ return rc;
++}
++
++static int kiblnd_alloc_freg_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t *fpo)
++{
++ struct kib_fast_reg_descriptor *frd, *tmp;
++ int i, rc;
++
++ INIT_LIST_HEAD(&fpo->fast_reg.fpo_pool_list);
++ fpo->fast_reg.fpo_pool_size = 0;
++ for (i = 0; i < fps->fps_pool_size; i++) {
++ LIBCFS_CPT_ALLOC(frd, lnet_cpt_table(), fps->fps_cpt,
++ sizeof(*frd));
++ if (!frd) {
++ CERROR("Failed to allocate a new fast_reg descriptor\n");
++ rc = -ENOMEM;
++ goto out;
++ }
++ frd->frd_mr = NULL;
++
++ frd->frd_frpl = ib_alloc_fast_reg_page_list(fpo->fpo_hdev->ibh_ibdev,
++ LNET_MAX_PAYLOAD/PAGE_SIZE);
++ if (IS_ERR(frd->frd_frpl)) {
++ rc = PTR_ERR(frd->frd_frpl);
++ CERROR("Failed to allocate ib_fast_reg_page_list: %d\n",
++ rc);
++ frd->frd_frpl = NULL;
++ goto out_middle;
++ }
++
++#ifdef HAVE_IB_ALLOC_FAST_REG_MR
++ frd->frd_mr = ib_alloc_fast_reg_mr(fpo->fpo_hdev->ibh_pd,
++ LNET_MAX_PAYLOAD/PAGE_SIZE);
++#else
++ frd->frd_mr = ib_alloc_mr(fpo->fpo_hdev->ibh_pd,
++ IB_MR_TYPE_MEM_REG,
++ LNET_MAX_PAYLOAD/PAGE_SIZE);
++#endif
++ if (IS_ERR(frd->frd_mr)) {
++ rc = PTR_ERR(frd->frd_mr);
++ CERROR("Failed to allocate ib_fast_reg_mr: %d\n", rc);
++ frd->frd_mr = NULL;
++ goto out_middle;
++ }
++
++ frd->frd_valid = true;
++
++ list_add_tail(&frd->frd_list, &fpo->fast_reg.fpo_pool_list);
++ fpo->fast_reg.fpo_pool_size++;
++ }
++
++ return 0;
++
++out_middle:
++ if (frd->frd_mr)
++ ib_dereg_mr(frd->frd_mr);
++ if (frd->frd_frpl)
++ ib_free_fast_reg_page_list(frd->frd_frpl);
++ LIBCFS_FREE(frd, sizeof(*frd));
++
++out:
++ list_for_each_entry_safe(frd, tmp, &fpo->fast_reg.fpo_pool_list,
++ frd_list) {
++ list_del(&frd->frd_list);
++ ib_free_fast_reg_page_list(frd->frd_frpl);
++ ib_dereg_mr(frd->frd_mr);
++ LIBCFS_FREE(frd, sizeof(*frd));
++ }
++
++ return rc;
++}
++
++static int
++kiblnd_create_fmr_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t **pp_fpo)
++{
++ struct ib_device_attr *dev_attr;
++ kib_dev_t *dev = fps->fps_net->ibn_dev;
++ kib_fmr_pool_t *fpo;
+ int rc;
+
+ LIBCFS_CPT_ALLOC(fpo, lnet_cpt_table(), fps->fps_cpt, sizeof(*fpo));
+--
+2.8.2
+
diff --git a/sys-cluster/lustre/files/0009-LU-6215-o2iblnd-port-to-new-fast-reg-API-introduced-.patch b/sys-cluster/lustre/files/0009-LU-6215-o2iblnd-port-to-new-fast-reg-API-introduced-.patch
new file mode 100644
index 000000000..b2df9e8ed
--- /dev/null
+++ b/sys-cluster/lustre/files/0009-LU-6215-o2iblnd-port-to-new-fast-reg-API-introduced-.patch
@@ -0,0 +1,332 @@
+From f1b1ef4f8af7751e1fc73b8f4ad2363b48159fa9 Mon Sep 17 00:00:00 2001
+From: Li Dongyang <dongyang.li@anu.edu.au>
+Date: Wed, 4 May 2016 13:11:15 -0400
+Subject: [PATCH 09/19] LU-6215 o2iblnd: port to new fast reg API introduced in
+ 4.4
+
+Remove the allocation of fastreg page list, as the page
+vector is now private to the provider. Just pass tx_frags
+to ib_map_mr_sg() and construct ib_reg_wr.
+Defer the conversion of tx_frags to tx_pages and only do
+it when the new API is not available.
+
+Linux-commit: 4c67e2bfc8b7121d51434362fa7c2d012f8bcf1b
+Linux-commit: 39bfc271bd687be2c8e396e976c0fb9a97963400
+
+Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
+Change-Id: I5c62b0370ad6ddcc93102a29343491968e4446d0
+Reviewed-on: http://review.whamcloud.com/19186
+Tested-by: Jenkins
+Reviewed-by: James Simmons <uja.ornl@yahoo.com>
+Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+---
+ lnet/autoconf/lustre-lnet.m4 | 44 +++++++++++++++++++++++++
+ lnet/klnds/o2iblnd/o2iblnd.c | 71 ++++++++++++++++++++++++++++++++++-------
+ lnet/klnds/o2iblnd/o2iblnd.h | 11 ++++---
+ lnet/klnds/o2iblnd/o2iblnd_cb.c | 39 ++++++++++------------
+ 4 files changed, 127 insertions(+), 38 deletions(-)
+
+diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4
+index a1498aa..5f90bca 100644
+--- a/lnet/autoconf/lustre-lnet.m4
++++ b/lnet/autoconf/lustre-lnet.m4
+@@ -418,6 +418,50 @@ AS_IF([test $ENABLEO2IB != "no"], [
+ [ib_alloc_fast_reg_mr is defined])
+ ])
+ ])
++
++# 4.4 added network namespace parameter for rdma_create_id()
++AS_IF([test $ENABLEO2IB != "no"], [
++ LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
++ rdma_create_id_5args, [
++ #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/rdma_cm.h>
++ ],[
++ rdma_create_id(NULL, NULL, NULL, 0, 0);
++ ],[
++ AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
++ [rdma_create_id wants 5 args])
++ ])
++])
++
++# new fast registration API introduced in 4.4
++AS_IF([test $ENABLEO2IB != "no"], [
++ LB_CHECK_COMPILE([if 'ib_map_mr_sg' exists],
++ ib_map_mr_sg, [
++ #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>
++ ],[
++ ib_map_mr_sg(NULL, NULL, 0, 0);
++ ],[
++ AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
++ [ib_map_mr_sg exists])
++ ])
++])
+ ]) # LN_CONFIG_O2IB
+
+ #
+diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c
+index 57f51ca..1262268 100644
+--- a/lnet/klnds/o2iblnd/o2iblnd.c
++++ b/lnet/klnds/o2iblnd/o2iblnd.c
+@@ -1394,8 +1394,27 @@ kiblnd_destroy_fmr_pool(kib_fmr_pool_t *pool)
+ {
+ LASSERT (pool->fpo_map_count == 0);
+
+- if (pool->fpo_fmr_pool != NULL)
+- ib_destroy_fmr_pool(pool->fpo_fmr_pool);
++ if (fpo->fpo_is_fmr) {
++ if (fpo->fmr.fpo_fmr_pool)
++ ib_destroy_fmr_pool(fpo->fmr.fpo_fmr_pool);
++ } else {
++ struct kib_fast_reg_descriptor *frd, *tmp;
++ int i = 0;
++
++ list_for_each_entry_safe(frd, tmp, &fpo->fast_reg.fpo_pool_list,
++ frd_list) {
++ list_del(&frd->frd_list);
++#ifndef HAVE_IB_MAP_MR_SG
++ ib_free_fast_reg_page_list(frd->frd_frpl);
++#endif
++ ib_dereg_mr(frd->frd_mr);
++ LIBCFS_FREE(frd, sizeof(*frd));
++ i++;
++ }
++ if (i < fpo->fast_reg.fpo_pool_size)
++ CERROR("FastReg pool still has %d regions registered\n",
++ fpo->fast_reg.fpo_pool_size - i);
++ }
+
+ if (pool->fpo_hdev != NULL)
+ kiblnd_hdev_decref(pool->fpo_hdev);
+@@ -1477,6 +1496,7 @@ static int kiblnd_alloc_freg_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t *fpo)
+ }
+ frd->frd_mr = NULL;
+
++#ifndef HAVE_IB_MAP_MR_SG
+ frd->frd_frpl = ib_alloc_fast_reg_page_list(fpo->fpo_hdev->ibh_ibdev,
+ LNET_MAX_PAYLOAD/PAGE_SIZE);
+ if (IS_ERR(frd->frd_frpl)) {
+@@ -1486,6 +1506,7 @@ static int kiblnd_alloc_freg_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t *fpo)
+ frd->frd_frpl = NULL;
+ goto out_middle;
+ }
++#endif
+
+ #ifdef HAVE_IB_ALLOC_FAST_REG_MR
+ frd->frd_mr = ib_alloc_fast_reg_mr(fpo->fpo_hdev->ibh_pd,
+@@ -1513,15 +1534,19 @@ static int kiblnd_alloc_freg_pool(kib_fmr_poolset_t *fps, kib_fmr_pool_t *fpo)
+ out_middle:
+ if (frd->frd_mr)
+ ib_dereg_mr(frd->frd_mr);
++#ifndef HAVE_IB_MAP_MR_SG
+ if (frd->frd_frpl)
+ ib_free_fast_reg_page_list(frd->frd_frpl);
++#endif
+ LIBCFS_FREE(frd, sizeof(*frd));
+
+ out:
+ list_for_each_entry_safe(frd, tmp, &fpo->fast_reg.fpo_pool_list,
+ frd_list) {
+ list_del(&frd->frd_list);
++#ifndef HAVE_IB_MAP_MR_SG
+ ib_free_fast_reg_page_list(frd->frd_frpl);
++#endif
+ ib_dereg_mr(frd->frd_mr);
+ LIBCFS_FREE(frd, sizeof(*frd));
+ }
+@@ -1625,6 +1650,28 @@ kiblnd_fmr_pool_is_idle(kib_fmr_pool_t *fpo, cfs_time_t now)
+ return cfs_time_aftereq(now, fpo->fpo_deadline);
+ }
+
++static int
++kiblnd_map_tx_pages(kib_tx_t *tx, kib_rdma_desc_t *rd)
++{
++ kib_hca_dev_t *hdev;
++ __u64 *pages = tx->tx_pages;
++ int npages;
++ int size;
++ int i;
++
++ hdev = tx->tx_pool->tpo_hdev;
++
++ for (i = 0, npages = 0; i < rd->rd_nfrags; i++) {
++ for (size = 0; size < rd->rd_frags[i].rf_nob;
++ size += hdev->ibh_page_size) {
++ pages[npages++] = (rd->rd_frags[i].rf_addr &
++ hdev->ibh_page_mask) + size;
++ }
++ }
++
++ return npages;
++}
++
+ void
+ kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status)
+ {
+@@ -1666,13 +1713,16 @@ kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status)
+ }
+
+ int
+-kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages, int npages,
+- __u64 iov, kib_fmr_t *fmr)
++kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, kib_tx_t *tx, kib_rdma_desc_t *rd,
++ __u32 nob, __u64 iov, kib_fmr_t *fmr)
+ {
+- struct ib_pool_fmr *pfmr;
+- kib_fmr_pool_t *fpo;
+- __u64 version;
+- int rc;
++ kib_fmr_pool_t *fpo;
++ __u64 *pages = tx->tx_pages;
++ __u64 version;
++ bool is_rx = (rd != tx->tx_rd);
++ bool tx_pages_mapped = 0;
++ int npages = 0;
++ int rc;
+
+ again:
+ spin_lock(&fps->fps_lock);
+@@ -1710,7 +1760,7 @@ again:
+ struct ib_reg_wr *wr;
+ int n;
+ #else
+- struct ib_rdma_wr *wr;
++ struct ib_send_wr *wr;
+ struct ib_fast_reg_page_list *frpl;
+ #endif
+ struct ib_mr *mr;
+@@ -1755,9 +1805,8 @@ again:
+
+ wr = &frd->frd_fastreg_wr;
+ memset(wr, 0, sizeof(*wr));
+-
+ wr->wr.opcode = IB_WR_REG_MR;
+- wr->wr.wr_id = IBLND_WID_MR;
++ wr->wr.wr_id = IBLND_WID_MR;
+ wr->wr.num_sge = 0;
+ wr->wr.send_flags = 0;
+ wr->mr = mr;
+diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h
+index 3baa255..60334b7 100644
+--- a/lnet/klnds/o2iblnd/o2iblnd.h
++++ b/lnet/klnds/o2iblnd/o2iblnd.h
+@@ -352,12 +352,12 @@ struct ib_rdma_wr {
+
+ struct kib_fast_reg_descriptor { /* For fast registration */
+ struct list_head frd_list;
+- struct ib_rdma_wr frd_inv_wr;
++ struct ib_send_wr frd_inv_wr;
+ #ifdef HAVE_IB_MAP_MR_SG
+ struct ib_reg_wr frd_fastreg_wr;
+ #else
+- struct ib_rdma_wr frd_fastreg_wr;
+- struct ib_fast_reg_page_list *frd_frpl;
++ struct ib_send_wr frd_fastreg_wr;
++ struct ib_fast_reg_page_list *frd_frpl;
+ #endif
+ struct ib_mr *frd_mr;
+ bool frd_valid;
+@@ -1125,8 +1125,9 @@ void kiblnd_unmap_rx_descs(kib_conn_t *conn);
+ void kiblnd_pool_free_node(kib_pool_t *pool, struct list_head *node);
+ struct list_head *kiblnd_pool_alloc_node(kib_poolset_t *ps);
+
+-int kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, __u64 *pages,
+- int npages, __u64 iov, kib_fmr_t *fmr);
++int kiblnd_fmr_pool_map(kib_fmr_poolset_t *fps, kib_tx_t *tx,
++ kib_rdma_desc_t *rd, __u32 nob, __u64 iov,
++ kib_fmr_t *fmr);
+ void kiblnd_fmr_pool_unmap(kib_fmr_t *fmr, int status);
+
+ int kiblnd_tunables_init(void);
+diff --git a/lnet/klnds/o2iblnd/o2iblnd_cb.c b/lnet/klnds/o2iblnd/o2iblnd_cb.c
+index d25e45a..e400eb2 100644
+--- a/lnet/klnds/o2iblnd/o2iblnd_cb.c
++++ b/lnet/klnds/o2iblnd/o2iblnd_cb.c
+@@ -565,35 +565,22 @@ static int
+ kiblnd_fmr_map_tx(kib_net_t *net, kib_tx_t *tx, kib_rdma_desc_t *rd, int nob)
+ {
+ kib_hca_dev_t *hdev;
+- __u64 *pages = tx->tx_pages;
+ kib_fmr_poolset_t *fps;
+- int npages;
+- int size;
+ int cpt;
+ int rc;
+- int i;
+
+ LASSERT(tx->tx_pool != NULL);
+ LASSERT(tx->tx_pool->tpo_pool.po_owner != NULL);
+
+- hdev = tx->tx_pool->tpo_hdev;
+-
+- for (i = 0, npages = 0; i < rd->rd_nfrags; i++) {
+- for (size = 0; size < rd->rd_frags[i].rf_nob;
+- size += hdev->ibh_page_size) {
+- pages[npages ++] = (rd->rd_frags[i].rf_addr &
+- hdev->ibh_page_mask) + size;
+- }
+- }
+-
++ hdev = tx->tx_pool->tpo_hdev;
+ cpt = tx->tx_pool->tpo_pool.po_owner->ps_cpt;
+
+ fps = net->ibn_fmr_ps[cpt];
+- rc = kiblnd_fmr_pool_map(fps, pages, npages, 0, &tx->fmr);
+- if (rc != 0) {
+- CERROR ("Can't map %d pages: %d\n", npages, rc);
+- return rc;
+- }
++ rc = kiblnd_fmr_pool_map(fps, tx, rd, nob, 0, &tx->fmr);
++ if (rc != 0) {
++ CERROR("Can't map %u pages: %d\n", nob, rc);
++ return rc;
++ }
+
+ /* If rd is not tx_rd, it's going to get sent to a peer, who will need
+ * the rkey */
+@@ -853,12 +840,20 @@ __must_hold(&conn->ibc_lock)
+
+ if (frd != NULL) {
+ if (!frd->frd_valid) {
+- wr = &frd->frd_inv_wr.wr;
+- wr->next = &frd->frd_fastreg_wr.wr;
++ wrq = &frd->frd_inv_wr;
++#ifdef HAVE_IB_MAP_MR_SG
++ wrq->next = &frd->frd_fastreg_wr.wr;
++ } else {
++ wrq = &frd->frd_fastreg_wr.wr;
++ }
++ frd->frd_fastreg_wr.wr.next = tx->tx_wrq;
++#else
++ wrq->next = &frd->frd_fastreg_wr;
+ } else {
+ wr = &frd->frd_fastreg_wr.wr;
+ }
+- frd->frd_fastreg_wr.wr.next = &tx->tx_wrq[0].wr;
++ frd->frd_fastreg_wr.next = tx->tx_wrq;
++#endif
+ }
+
+ LASSERTF(wrq->wr_id == kiblnd_ptr2wreqid(tx, IBLND_WID_TX),
+--
+2.8.2
+
diff --git a/sys-cluster/lustre/files/0010-LU-6215-o2iblnd-rdma_create_id-takes-extra-parameter.patch b/sys-cluster/lustre/files/0010-LU-6215-o2iblnd-rdma_create_id-takes-extra-parameter.patch
new file mode 100644
index 000000000..5a195bcda
--- /dev/null
+++ b/sys-cluster/lustre/files/0010-LU-6215-o2iblnd-rdma_create_id-takes-extra-parameter.patch
@@ -0,0 +1,46 @@
+From 2c6365b12588a44c95695bfef2b14f7fa449a8d5 Mon Sep 17 00:00:00 2001
+From: Li Dongyang <dongyang.li@anu.edu.au>
+Date: Fri, 1 Apr 2016 20:26:46 -0400
+Subject: [PATCH 10/19] LU-6215 o2iblnd: rdma_create_id() takes extra parameter
+
+4.4 kernel added network namespace parameter to rdma_create_id().
+This patch handles the API change.
+
+Linux-commit: fa20105e09e97e81aadf02f722c31195e4a75c84
+
+Signed-off-by: Li Dongyang <dongyang.li@anu.edu.au>
+Change-Id: I3f3792e70e91ac3b3d9fefdd58cc9e7e4d1c25c6
+Reviewed-on: http://review.whamcloud.com/18759
+Reviewed-by: James Simmons <uja.ornl@yahoo.com>
+Tested-by: Jenkins
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: Sebastien Buisson <sbuisson@ddn.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+---
+ lnet/klnds/o2iblnd/o2iblnd.h | 10 ++++------
+ 1 file changed, 4 insertions(+), 6 deletions(-)
+
+diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h
+index 60334b7..e784adf 100644
+--- a/lnet/klnds/o2iblnd/o2iblnd.h
++++ b/lnet/klnds/o2iblnd/o2iblnd.h
+@@ -131,12 +131,10 @@ extern kib_tunables_t kiblnd_tunables;
+ #define IBLND_CREDITS_DEFAULT 8 /* default # of peer credits */
+ #define IBLND_CREDITS_MAX ((typeof(((kib_msg_t*) 0)->ibm_credits)) - 1) /* Max # of peer credits */
+
+-#define IBLND_MSG_QUEUE_SIZE(v) ((v) == IBLND_MSG_VERSION_1 ? \
+- IBLND_MSG_QUEUE_SIZE_V1 : \
+- *kiblnd_tunables.kib_peertxcredits) /* # messages/RDMAs in-flight */
+-#define IBLND_CREDITS_HIGHWATER(v) ((v) == IBLND_MSG_VERSION_1 ? \
+- IBLND_CREDIT_HIGHWATER_V1 : \
+- *kiblnd_tunables.kib_peercredits_hiw) /* when eagerly to return credits */
++/* when eagerly to return credits */
++#define IBLND_CREDITS_HIGHWATER(t, v) ((v) == IBLND_MSG_VERSION_1 ? \
++ IBLND_CREDIT_HIGHWATER_V1 : \
++ t->lnd_peercredits_hiw)
+
+ #ifdef HAVE_RDMA_CREATE_ID_5ARG
+ # define kiblnd_rdma_create_id(cb, dev, ps, qpt) rdma_create_id(current->nsproxy->net_ns, \
+--
+2.8.2
+
diff --git a/sys-cluster/lustre/files/0011-LU-6215-llite-remove-obsolete-conditional-code.patch b/sys-cluster/lustre/files/0011-LU-6215-llite-remove-obsolete-conditional-code.patch
new file mode 100644
index 000000000..1b9f266ac
--- /dev/null
+++ b/sys-cluster/lustre/files/0011-LU-6215-llite-remove-obsolete-conditional-code.patch
@@ -0,0 +1,97 @@
+From b63795fa3bfd8002351c002c316c53b9f0660636 Mon Sep 17 00:00:00 2001
+From: Andreas Dilger <andreas.dilger@intel.com>
+Date: Fri, 29 Apr 2016 14:48:52 -0600
+Subject: [PATCH 11/19] LU-6215 llite: remove obsolete conditional code
+
+Remove conditional flock/aops code that was only for out-of-tree
+vendor kernels but is not relevant anymore.
+
+Linux-commit: 3746e6f93bbf28a25d2d69350ab6bfba02e14654
+
+Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Change-Id: If119a2da2bbc30a48d872029bd048ea90a3ebbe5
+Reviewed-on: http://review.whamcloud.com/19890
+Tested-by: Jenkins
+Reviewed-by: James Simmons <uja.ornl@yahoo.com>
+Reviewed-by: Frank Zago <fzago@cray.com>
+Reviewed-by: John L. Hammond <john.hammond@intel.com>
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+---
+ lustre/llite/llite_internal.h | 4 ----
+ lustre/llite/llite_lib.c | 8 --------
+ lustre/llite/rw26.c | 17 -----------------
+ 3 files changed, 29 deletions(-)
+
+diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
+index 15530dc..adbf9d3 100644
+--- a/lustre/llite/llite_internal.h
++++ b/lustre/llite/llite_internal.h
+@@ -813,11 +813,7 @@ struct ll_cl_context *ll_cl_find(struct file *file);
+ void ll_cl_add(struct file *file, const struct lu_env *env, struct cl_io *io);
+ void ll_cl_remove(struct file *file, const struct lu_env *env);
+
+-#ifndef MS_HAS_NEW_AOPS
+ extern const struct address_space_operations ll_aops;
+-#else
+-extern const struct address_space_operations_ext ll_aops;
+-#endif
+
+ /* llite/file.c */
+ extern struct file_operations ll_file_operations;
+diff --git a/lustre/llite/llite_lib.c b/lustre/llite/llite_lib.c
+index cf17367..d1050d4 100644
+--- a/lustre/llite/llite_lib.c
++++ b/lustre/llite/llite_lib.c
+@@ -232,14 +232,6 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt,
+ if (sbi->ll_flags & LL_SBI_USER_XATTR)
+ data->ocd_connect_flags |= OBD_CONNECT_XATTR;
+
+-#ifdef HAVE_MS_FLOCK_LOCK
+- /* force vfs to use lustre handler for flock() calls - bug 10743 */
+- sb->s_flags |= MS_FLOCK_LOCK;
+-#endif
+-#ifdef MS_HAS_NEW_AOPS
+- sb->s_flags |= MS_HAS_NEW_AOPS;
+-#endif
+-
+ if (sbi->ll_flags & LL_SBI_FLOCK)
+ sbi->ll_fop = &ll_file_operations_flock;
+ else if (sbi->ll_flags & LL_SBI_LOCALFLOCK)
+diff --git a/lustre/llite/rw26.c b/lustre/llite/rw26.c
+index ee17a73..b362532 100644
+--- a/lustre/llite/rw26.c
++++ b/lustre/llite/rw26.c
+@@ -806,7 +806,6 @@ static int ll_migratepage(struct address_space *mapping,
+ }
+ #endif
+
+-#ifndef MS_HAS_NEW_AOPS
+ const struct address_space_operations ll_aops = {
+ .readpage = ll_readpage,
+ .direct_IO = ll_direct_IO,
+@@ -821,19 +820,3 @@ const struct address_space_operations ll_aops = {
+ .migratepage = ll_migratepage,
+ #endif
+ };
+-#else
+-const struct address_space_operations_ext ll_aops = {
+- .orig_aops.readpage = ll_readpage,
+- .orig_aops.direct_IO = ll_direct_IO,
+- .orig_aops.writepage = ll_writepage,
+- .orig_aops.writepages = ll_writepages,
+- .orig_aops.set_page_dirty = __set_page_dirty_nobuffers,
+- .orig_aops.invalidatepage = ll_invalidatepage,
+- .orig_aops.releasepage = ll_releasepage,
+-#ifdef CONFIG_MIGRATION
+- .orig_aops.migratepage = ll_migratepage,
+-#endif
+- .write_begin = ll_write_begin,
+- .write_end = ll_write_end
+-};
+-#endif
+--
+2.8.2
+
diff --git a/sys-cluster/lustre/files/0012-LU-6215-lnet-split-struct-ib_send_wr.patch b/sys-cluster/lustre/files/0012-LU-6215-lnet-split-struct-ib_send_wr.patch
new file mode 100644
index 000000000..ff28978af
--- /dev/null
+++ b/sys-cluster/lustre/files/0012-LU-6215-lnet-split-struct-ib_send_wr.patch
@@ -0,0 +1,169 @@
+From d514117bc52fee3e392aa48dc44b3552c01a0981 Mon Sep 17 00:00:00 2001
+From: Dmitry Eremin <dmitry.eremin@intel.com>
+Date: Tue, 17 May 2016 09:22:15 -0400
+Subject: [PATCH 12/19] LU-6215 lnet: split struct ib_send_wr
+
+In v4.4 Linux kernel split up struct ib_send_wr so that all non-trivial
+verbs use their own structure which embeds struct ib_send_wr.
+
+Linux-commit: e622f2f4ad2142d2a613a57fb85f8cf737935ef5
+Change-Id: Iea2599ea57a576a4c061841be47a989aba097cc6
+Signed-off-by: Dmitry Eremin <dmitry.eremin@intel.com>
+Reviewed-on: http://review.whamcloud.com/19168
+Reviewed-by: Doug Oucharek <doug.s.oucharek@intel.com>
+Reviewed-by: James Simmons <uja.ornl@yahoo.com>
+Reviewed-by: Li Dongyang <dongyang.li@anu.edu.au>
+Tested-by: Jenkins
+Tested-by: Maloo <hpdd-maloo@intel.com>
+Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
+---
+ lnet/autoconf/lustre-lnet.m4 | 31 +++++++++++++++----------------
+ lnet/klnds/o2iblnd/o2iblnd.c | 5 +++--
+ lnet/klnds/o2iblnd/o2iblnd.h | 6 +++---
+ lnet/klnds/o2iblnd/o2iblnd_cb.c | 14 +++-----------
+ 4 files changed, 24 insertions(+), 32 deletions(-)
+
+diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4
+index 5f90bca..2e2adb2 100644
+--- a/lnet/autoconf/lustre-lnet.m4
++++ b/lnet/autoconf/lustre-lnet.m4
+@@ -395,10 +395,8 @@ AS_IF([test $ENABLEO2IB != "no"], [
+ AC_DEFINE(HAVE_IB_CQ_INIT_ATTR, 1,
+ [struct ib_cq_init_attr is used by ib_create_cq])
+ ])
+-])
+
+-# 4.3 removed ib_alloc_fast_reg_mr()
+-AS_IF([test $ENABLEO2IB != "no"], [
++ # 4.3 removed ib_alloc_fast_reg_mr()
+ LB_CHECK_COMPILE([if 'ib_alloc_fast_reg_mr' exists],
+ ib_alloc_fast_reg_mr, [
+ #ifdef HAVE_COMPAT_RDMA
+@@ -417,12 +415,13 @@ AS_IF([test $ENABLEO2IB != "no"], [
+ AC_DEFINE(HAVE_IB_ALLOC_FAST_REG_MR, 1,
+ [ib_alloc_fast_reg_mr is defined])
+ ])
+-])
+
+-# 4.4 added network namespace parameter for rdma_create_id()
+-AS_IF([test $ENABLEO2IB != "no"], [
+- LB_CHECK_COMPILE([if 'rdma_create_id' wants five args],
+- rdma_create_id_5args, [
++ # In v4.4 Linux kernel,
++ # commit e622f2f4ad2142d2a613a57fb85f8cf737935ef5
++ # split up struct ib_send_wr so that all non-trivial verbs
++ # use their own structure which embedds struct ib_send_wr.
++ LB_CHECK_COMPILE([if 'struct ib_rdma_wr' is defined],
++ ib_rdma_wr, [
+ #ifdef HAVE_COMPAT_RDMA
+ #undef PACKAGE_NAME
+ #undef PACKAGE_TARNAME
+@@ -432,17 +431,17 @@ AS_IF([test $ENABLEO2IB != "no"], [
+ #undef PACKAGE_URL
+ #include <linux/compat-2.6.h>
+ #endif
+- #include <rdma/rdma_cm.h>
++ #include <rdma/ib_verbs.h>
+ ],[
+- rdma_create_id(NULL, NULL, NULL, 0, 0);
++ struct ib_rdma_wr *wr __attribute__ ((unused));
++
++ wr = rdma_wr(NULL);
+ ],[
+- AC_DEFINE(HAVE_RDMA_CREATE_ID_5ARG, 1,
+- [rdma_create_id wants 5 args])
++ AC_DEFINE(HAVE_IB_RDMA_WR, 1,
++ [struct ib_rdma_wr is defined])
+ ])
+-])
+
+-# new fast registration API introduced in 4.4
+-AS_IF([test $ENABLEO2IB != "no"], [
++ # new fast registration API introduced in 4.4
+ LB_CHECK_COMPILE([if 'ib_map_mr_sg' exists],
+ ib_map_mr_sg, [
+ #ifdef HAVE_COMPAT_RDMA
+@@ -461,7 +460,7 @@ AS_IF([test $ENABLEO2IB != "no"], [
+ AC_DEFINE(HAVE_IB_MAP_MR_SG, 1,
+ [ib_map_mr_sg exists])
+ ])
+-])
++]) # ENABLEO2IB != "no"
+ ]) # LN_CONFIG_O2IB
+
+ #
+diff --git a/lnet/klnds/o2iblnd/o2iblnd.c b/lnet/klnds/o2iblnd/o2iblnd.c
+index 1262268..ada1322 100644
+--- a/lnet/klnds/o2iblnd/o2iblnd.c
++++ b/lnet/klnds/o2iblnd/o2iblnd.c
+@@ -1760,7 +1760,7 @@ again:
+ struct ib_reg_wr *wr;
+ int n;
+ #else
+- struct ib_send_wr *wr;
++ struct ib_rdma_wr *wr;
+ struct ib_fast_reg_page_list *frpl;
+ #endif
+ struct ib_mr *mr;
+@@ -1805,8 +1805,9 @@ again:
+
+ wr = &frd->frd_fastreg_wr;
+ memset(wr, 0, sizeof(*wr));
++
+ wr->wr.opcode = IB_WR_REG_MR;
+- wr->wr.wr_id = IBLND_WID_MR;
++ wr->wr.wr_id = IBLND_WID_MR;
+ wr->wr.num_sge = 0;
+ wr->wr.send_flags = 0;
+ wr->mr = mr;
+diff --git a/lnet/klnds/o2iblnd/o2iblnd.h b/lnet/klnds/o2iblnd/o2iblnd.h
+index e784adf..38e5f14 100644
+--- a/lnet/klnds/o2iblnd/o2iblnd.h
++++ b/lnet/klnds/o2iblnd/o2iblnd.h
+@@ -350,12 +350,12 @@ struct ib_rdma_wr {
+
+ struct kib_fast_reg_descriptor { /* For fast registration */
+ struct list_head frd_list;
+- struct ib_send_wr frd_inv_wr;
++ struct ib_rdma_wr frd_inv_wr;
+ #ifdef HAVE_IB_MAP_MR_SG
+ struct ib_reg_wr frd_fastreg_wr;
+ #else
+- struct ib_send_wr frd_fastreg_wr;
+- struct ib_fast_reg_page_list *frd_frpl;
++ struct ib_rdma_wr frd_fastreg_wr;
++ struct ib_fast_reg_page_list *frd_frpl;
+ #endif
+ struct ib_mr *frd_mr;
+ bool frd_valid;
+diff --git a/lnet/klnds/o2iblnd/o2iblnd_cb.c b/lnet/klnds/o2iblnd/o2iblnd_cb.c
+index e400eb2..6541d94 100644
+--- a/lnet/klnds/o2iblnd/o2iblnd_cb.c
++++ b/lnet/klnds/o2iblnd/o2iblnd_cb.c
+@@ -840,20 +840,12 @@ __must_hold(&conn->ibc_lock)
+
+ if (frd != NULL) {
+ if (!frd->frd_valid) {
+- wrq = &frd->frd_inv_wr;
+-#ifdef HAVE_IB_MAP_MR_SG
+- wrq->next = &frd->frd_fastreg_wr.wr;
+- } else {
+- wrq = &frd->frd_fastreg_wr.wr;
+- }
+- frd->frd_fastreg_wr.wr.next = tx->tx_wrq;
+-#else
+- wrq->next = &frd->frd_fastreg_wr;
++ wr = &frd->frd_inv_wr.wr;
++ wr->next = &frd->frd_fastreg_wr.wr;
+ } else {
+ wr = &frd->frd_fastreg_wr.wr;
+ }
+- frd->frd_fastreg_wr.next = tx->tx_wrq;
+-#endif
++ frd->frd_fastreg_wr.wr.next = &tx->tx_wrq[0].wr;
+ }
+
+ LASSERTF(wrq->wr_id == kiblnd_ptr2wreqid(tx, IBLND_WID_TX),
+--
+2.8.2
+
diff --git a/sys-cluster/lustre/files/0013-LU-8056-libcfs-Support-for-linux-4.2-kernels.patch b/sys-cluster/lustre/files/0013-LU-8056-libcfs-Support-for-linux-4.2-kernels.patch
new file mode 100644
index 000000000..b8944768b
--- /dev/null
+++ b/sys-cluster/lustre/files/0013-LU-8056-libcfs-Support-for-linux-4.2-kernels.patch
@@ -0,0 +1,80 @@
+From f6253abe465ac9ffea7664da948e0f40b46ca24f Mon Sep 17 00:00:00 2001
+From: Dmitry Eremin <dmitry.eremin@intel.com>
+Date: Thu, 5 May 2016 22:08:05 +0300
+Subject: [PATCH 13/19] 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 <dmitry.eremin@intel.com>
+---
+ 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 c787203..9ae2698 100644
+--- a/libcfs/autoconf/lustre-libcfs.m4
++++ b/libcfs/autoconf/lustre-libcfs.m4
+@@ -318,6 +318,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
+@@ -356,6 +366,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/0014-LU-8056-o2iblnd-ib_query_device-removed-in-4.5.patch b/sys-cluster/lustre/files/0014-LU-8056-o2iblnd-ib_query_device-removed-in-4.5.patch
new file mode 100644
index 000000000..4647eed9a
--- /dev/null
+++ b/sys-cluster/lustre/files/0014-LU-8056-o2iblnd-ib_query_device-removed-in-4.5.patch
@@ -0,0 +1,167 @@
+From 53b7041eed99418ec8b2a6c3fb29eaa331accfe2 Mon Sep 17 00:00:00 2001
+From: Li Dongyang <dongyang.li@anu.edu.au>
+Date: Mon, 16 May 2016 17:18:39 +1000
+Subject: [PATCH 14/19] 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 <dongyang.li@anu.edu.au>
+Change-Id: Ie2ab681a3b508f0a1f89d3ff86bf2713b7257e62
+---
+ lnet/autoconf/lustre-lnet.m4 | 22 ++++++++++++++
+ lnet/klnds/o2iblnd/o2iblnd.c | 69 ++++++++++++++++++++++++++++++++++++++------
+ 2 files changed, 82 insertions(+), 9 deletions(-)
+
+diff --git a/lnet/autoconf/lustre-lnet.m4 b/lnet/autoconf/lustre-lnet.m4
+index 2e2adb2..2aefe70 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 ada1322..5bae966 100644
+--- a/lnet/klnds/o2iblnd/o2iblnd.c
++++ b/lnet/klnds/o2iblnd/o2iblnd.c
+@@ -1562,25 +1562,70 @@ 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 == NULL)
+ return -ENOMEM;
+
+ fpo->fpo_hdev = kiblnd_current_hdev(dev);
+
+- fpo->fpo_fmr_pool = ib_create_fmr_pool(fpo->fpo_hdev->ibh_pd, &param);
+- if (IS_ERR(fpo->fpo_fmr_pool)) {
+- rc = PTR_ERR(fpo->fpo_fmr_pool);
+- CERROR("Failed to create FMR pool: %d\n", rc);
++#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;
++ if (fpo->fpo_hdev->ibh_ibdev->alloc_fmr &&
++ fpo->fpo_hdev->ibh_ibdev->dealloc_fmr &&
++ fpo->fpo_hdev->ibh_ibdev->map_phys_fmr &&
++ fpo->fpo_hdev->ibh_ibdev->unmap_fmr) {
++ LCONSOLE_INFO("Using FMR for registration\n");
++ fpo->fpo_is_fmr = 1;
++ } else if (dev_attr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) {
++ LCONSOLE_INFO("Using FastReg for registration\n");
++ } else {
++ rc = -ENOSYS;
++ LCONSOLE_ERROR_MSG(rc, "IB device does not support FMRs nor FastRegs, can't register memory\n");
++ goto out_dev_attr;
++ }
++
++ if (fpo->fpo_is_fmr)
++ rc = kiblnd_alloc_fmr_pool(fps, fpo);
++ else
++ rc = kiblnd_alloc_freg_pool(fps, 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;
++
++ return 0;
+
+ kiblnd_hdev_decref(fpo->fpo_hdev);
+ LIBCFS_FREE(fpo, sizeof(kib_fmr_pool_t));
+ return rc;
+ }
+
+- fpo->fpo_deadline = cfs_time_shift(IBLND_POOL_DEADLINE);
+- fpo->fpo_owner = fps;
+- *pp_fpo = fpo;
++out_dev_attr:
++#ifndef HAVE_IB_DEVICE_ATTRS
++ kfree(dev_attr);
++#endif
+
+ return 0;
+ }
+@@ -2388,8 +2433,10 @@ kiblnd_net_init_pools(kib_net_t *net, __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 */
+@@ -2397,6 +2444,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");
+@@ -2413,6 +2463,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/0015-LU-8056-socklnd-NETIF_F_ALL_CSUM-renamed-to-NETIF_F_.patch b/sys-cluster/lustre/files/0015-LU-8056-socklnd-NETIF_F_ALL_CSUM-renamed-to-NETIF_F_.patch
new file mode 100644
index 000000000..f39059c8c
--- /dev/null
+++ b/sys-cluster/lustre/files/0015-LU-8056-socklnd-NETIF_F_ALL_CSUM-renamed-to-NETIF_F_.patch
@@ -0,0 +1,49 @@
+From ed100a806582374d95a7ef5d714d28276bffe9dc Mon Sep 17 00:00:00 2001
+From: Li Dongyang <dongyang.li@anu.edu.au>
+Date: Mon, 16 May 2016 17:27:23 +1000
+Subject: [PATCH 15/19] 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 <dongyang.li@anu.edu.au>
+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 4065ef3..ad04fb5 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 f270fa7..a672791 100644
+--- a/lnet/klnds/socklnd/socklnd_lib.c
++++ b/lnet/klnds/socklnd/socklnd_lib.c
+@@ -377,7 +377,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/0016-LU-8056-llite-use-inode_lock-to-access-i_mutex.patch b/sys-cluster/lustre/files/0016-LU-8056-llite-use-inode_lock-to-access-i_mutex.patch
new file mode 100644
index 000000000..7ed56fe2b
--- /dev/null
+++ b/sys-cluster/lustre/files/0016-LU-8056-llite-use-inode_lock-to-access-i_mutex.patch
@@ -0,0 +1,363 @@
+From 917e3d42d9fe0584c740584db5c5f59cf6875c9f Mon Sep 17 00:00:00 2001
+From: Li Dongyang <dongyang.li@anu.edu.au>
+Date: Mon, 16 May 2016 17:40:55 +1000
+Subject: [PATCH 16/19] 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 <dongyang.li@anu.edu.au>
+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 | 29 +++++++++++++++++++----------
+ 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, 63 insertions(+), 30 deletions(-)
+
+diff --git a/lustre/autoconf/lustre-core.m4 b/lustre/autoconf/lustre-core.m4
+index 9497cdd..622345f 100644
+--- a/lustre/autoconf/lustre-core.m4
++++ b/lustre/autoconf/lustre-core.m4
+@@ -2045,6 +2045,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
+@@ -2213,6 +2230,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 4e9f3ac..2a5a2fd 100644
+--- a/lustre/include/lustre_compat.h
++++ b/lustre/include/lustre_compat.h
+@@ -370,6 +370,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 4f28145..f657725 100644
+--- a/lustre/llite/dir.c
++++ b/lustre/llite/dir.c
+@@ -1736,7 +1736,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;
+@@ -1774,7 +1774,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 d1819c6..b8670c7 100644
+--- a/lustre/llite/file.c
++++ b/lustre/llite/file.c
+@@ -2144,13 +2144,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)
+@@ -2197,9 +2197,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);
+ }
+@@ -2598,9 +2598,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:
+ /*
+@@ -2758,7 +2758,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 */
+@@ -2796,7 +2796,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);
+ }
+@@ -3021,7 +3021,15 @@ int ll_migrate(struct inode *parent, struct file *file, int mdtidx,
+ if (child_inode == NULL)
+ GOTO(out_free, rc = -EINVAL);
+
+- mutex_lock(&child_inode->i_mutex);
++ /*
++ * lfs migrate command needs to be blocked on the client
++ * by checking the migrate FID against the FID of the
++ * filesystem root.
++ */
++ if (child_inode == parent->i_sb->s_root->d_inode)
++ GOTO(out_iput, rc = -EINVAL);
++
++ 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",
+@@ -3099,7 +3107,8 @@ 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:
+ ll_finish_md_op_data(op_data);
+diff --git a/lustre/llite/llite_internal.h b/lustre/llite/llite_internal.h
+index adbf9d3..94c8045 100644
+--- a/lustre/llite/llite_internal.h
++++ b/lustre/llite/llite_internal.h
+@@ -681,8 +681,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 d1050d4..bf80506 100644
+--- a/lustre/llite/llite_lib.c
++++ b/lustre/llite/llite_lib.c
+@@ -1521,10 +1521,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);
+@@ -1613,7 +1613,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;
+@@ -1690,7 +1690,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 f3b9288..c20df96 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 b362532..ad692db 100644
+--- a/lustre/llite/rw26.c
++++ b/lustre/llite/rw26.c
+@@ -388,7 +388,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;
+@@ -439,7 +439,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 cbc4997..8dc657b 100644
+--- a/lustre/llite/vvp_io.c
++++ b/lustre/llite/vvp_io.c
+@@ -736,7 +736,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);
+@@ -762,7 +762,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/0017-LU-8056-llite-inode_operations-interface-changed-in-.patch b/sys-cluster/lustre/files/0017-LU-8056-llite-inode_operations-interface-changed-in-.patch
new file mode 100644
index 000000000..1c574f6cf
--- /dev/null
+++ b/sys-cluster/lustre/files/0017-LU-8056-llite-inode_operations-interface-changed-in-.patch
@@ -0,0 +1,166 @@
+From 4780e65730a868432c4be7c6ea635496c725fc3a Mon Sep 17 00:00:00 2001
+From: Li Dongyang <dongyang.li@anu.edu.au>
+Date: Mon, 16 May 2016 21:57:31 +1000
+Subject: [PATCH 17/19] 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 <dongyang.li@anu.edu.au>
+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 622345f..867fa51 100644
+--- a/lustre/autoconf/lustre-core.m4
++++ b/lustre/autoconf/lustre-core.m4
+@@ -2062,6 +2062,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
+@@ -2232,6 +2251,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 4ec4421..d579ba0 100644
+--- a/lustre/llite/dcache.c
++++ b/lustre/llite/dcache.c
+@@ -368,7 +368,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/0018-LU-8056-llite-POSIX_ACL_XATTR_-ACCESS-DEFAULT-remove.patch b/sys-cluster/lustre/files/0018-LU-8056-llite-POSIX_ACL_XATTR_-ACCESS-DEFAULT-remove.patch
new file mode 100644
index 000000000..9da787c61
--- /dev/null
+++ b/sys-cluster/lustre/files/0018-LU-8056-llite-POSIX_ACL_XATTR_-ACCESS-DEFAULT-remove.patch
@@ -0,0 +1,53 @@
+From 9f0940464d87e1111ab665684f9e9a45db6c3787 Mon Sep 17 00:00:00 2001
+From: Li Dongyang <dongyang.li@anu.edu.au>
+Date: Mon, 16 May 2016 22:07:54 +1000
+Subject: [PATCH 18/19] 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 <dongyang.li@anu.edu.au>
+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/0019-LU-8056-lloop-fix-bio_for_each_segment_all-for-newer.patch b/sys-cluster/lustre/files/0019-LU-8056-lloop-fix-bio_for_each_segment_all-for-newer.patch
new file mode 100644
index 000000000..a6135400c
--- /dev/null
+++ b/sys-cluster/lustre/files/0019-LU-8056-lloop-fix-bio_for_each_segment_all-for-newer.patch
@@ -0,0 +1,66 @@
+From 6f44b5a0d02e5a805c5be265d5b92ab69ef9a421 Mon Sep 17 00:00:00 2001
+From: James Simmons <uja.ornl@yahoo.com>
+Date: Fri, 3 Jun 2016 14:09:54 -0400
+Subject: [PATCH 19/19] 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 <uja.ornl@yahoo.com>
+---
+ lustre/llite/lloop.c | 17 ++---------------
+ 1 file changed, 2 insertions(+), 15 deletions(-)
+
+diff --git a/lustre/llite/lloop.c b/lustre/llite/lloop.c
+index c20df96..834d068 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,17 +221,10 @@ 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(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;
+- bio_for_each_segment(bvec, bio, iter) {
++#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/lustre-2.8.0.ebuild b/sys-cluster/lustre/lustre-2.8.0.ebuild
index 4fab54d33..c56b6b130 100644
--- a/sys-cluster/lustre/lustre-2.8.0.ebuild
+++ b/sys-cluster/lustre/lustre-2.8.0.ebuild
@@ -25,7 +25,7 @@ EGIT_REPO_URI="git://git.whamcloud.com/fs/lustre-release.git"
LICENSE="GPL-2"
SLOT="0"
-IUSE="client +utils modules server readline tests"
+IUSE="+client +utils +modules server readline tests"
RDEPEND="
virtual/awk
@@ -43,7 +43,28 @@ REQUIRED_USE="
modules? ( client )
modules? ( server )"
-PATCHES=( "${FILESDIR}/lustre-do-not-include-udef.h.patch" )
+PATCHES=(
+ "${FILESDIR}/0001-LU-6215-lprocfs-handle-seq_printf-api-change.patch"
+ "${FILESDIR}/0002-LU-6215-gss-cache_head-is-now-on-a-hlist-in-4.3-kern.patch"
+ "${FILESDIR}/0003-LU-6215-llite-handle-locks-API-change-in-4.4-kernels.patch"
+ "${FILESDIR}/0004-LU-6215-llite-make_request_fn-returns-blk_qc_t-in-ke.patch"
+ "${FILESDIR}/0005-LU-6215-gss-key-payload.data-is-an-array-in-4.4-kern.patch"
+ "${FILESDIR}/0006-LU-6215-o2iblnd-rdma_create_id-takes-extra-parameter.patch"
+ "${FILESDIR}/0007-LU-6215-lnet-split-struct-ib_send_wr.patch"
+ "${FILESDIR}/0008-LU-6215-o2iblnd-ib_alloc_fast_reg_mr-removed-in-4.3.patch"
+ "${FILESDIR}/0009-LU-6215-o2iblnd-port-to-new-fast-reg-API-introduced-.patch"
+ "${FILESDIR}/0010-LU-6215-o2iblnd-rdma_create_id-takes-extra-parameter.patch"
+ "${FILESDIR}/0011-LU-6215-llite-remove-obsolete-conditional-code.patch"
+ "${FILESDIR}/0012-LU-6215-lnet-split-struct-ib_send_wr.patch"
+ "${FILESDIR}/0013-LU-8056-libcfs-Support-for-linux-4.2-kernels.patch"
+ "${FILESDIR}/0014-LU-8056-o2iblnd-ib_query_device-removed-in-4.5.patch"
+ "${FILESDIR}/0015-LU-8056-socklnd-NETIF_F_ALL_CSUM-renamed-to-NETIF_F_.patch"
+ "${FILESDIR}/0016-LU-8056-llite-use-inode_lock-to-access-i_mutex.patch"
+ "${FILESDIR}/0017-LU-8056-llite-inode_operations-interface-changed-in-.patch"
+ "${FILESDIR}/0018-LU-8056-llite-POSIX_ACL_XATTR_-ACCESS-DEFAULT-remove.patch"
+ "${FILESDIR}/0019-LU-8056-lloop-fix-bio_for_each_segment_all-for-newer.patch"
+ "${FILESDIR}/lustre-do-not-include-udef.h.patch"
+ )
pkg_setup() {
filter-mfpmath sse
diff --git a/sys-cluster/lustre/lustre-9999.ebuild b/sys-cluster/lustre/lustre-9999.ebuild
index 4fab54d33..c56b6b130 100644
--- a/sys-cluster/lustre/lustre-9999.ebuild
+++ b/sys-cluster/lustre/lustre-9999.ebuild
@@ -25,7 +25,7 @@ EGIT_REPO_URI="git://git.whamcloud.com/fs/lustre-release.git"
LICENSE="GPL-2"
SLOT="0"
-IUSE="client +utils modules server readline tests"
+IUSE="+client +utils +modules server readline tests"
RDEPEND="
virtual/awk
@@ -43,7 +43,28 @@ REQUIRED_USE="
modules? ( client )
modules? ( server )"
-PATCHES=( "${FILESDIR}/lustre-do-not-include-udef.h.patch" )
+PATCHES=(
+ "${FILESDIR}/0001-LU-6215-lprocfs-handle-seq_printf-api-change.patch"
+ "${FILESDIR}/0002-LU-6215-gss-cache_head-is-now-on-a-hlist-in-4.3-kern.patch"
+ "${FILESDIR}/0003-LU-6215-llite-handle-locks-API-change-in-4.4-kernels.patch"
+ "${FILESDIR}/0004-LU-6215-llite-make_request_fn-returns-blk_qc_t-in-ke.patch"
+ "${FILESDIR}/0005-LU-6215-gss-key-payload.data-is-an-array-in-4.4-kern.patch"
+ "${FILESDIR}/0006-LU-6215-o2iblnd-rdma_create_id-takes-extra-parameter.patch"
+ "${FILESDIR}/0007-LU-6215-lnet-split-struct-ib_send_wr.patch"
+ "${FILESDIR}/0008-LU-6215-o2iblnd-ib_alloc_fast_reg_mr-removed-in-4.3.patch"
+ "${FILESDIR}/0009-LU-6215-o2iblnd-port-to-new-fast-reg-API-introduced-.patch"
+ "${FILESDIR}/0010-LU-6215-o2iblnd-rdma_create_id-takes-extra-parameter.patch"
+ "${FILESDIR}/0011-LU-6215-llite-remove-obsolete-conditional-code.patch"
+ "${FILESDIR}/0012-LU-6215-lnet-split-struct-ib_send_wr.patch"
+ "${FILESDIR}/0013-LU-8056-libcfs-Support-for-linux-4.2-kernels.patch"
+ "${FILESDIR}/0014-LU-8056-o2iblnd-ib_query_device-removed-in-4.5.patch"
+ "${FILESDIR}/0015-LU-8056-socklnd-NETIF_F_ALL_CSUM-renamed-to-NETIF_F_.patch"
+ "${FILESDIR}/0016-LU-8056-llite-use-inode_lock-to-access-i_mutex.patch"
+ "${FILESDIR}/0017-LU-8056-llite-inode_operations-interface-changed-in-.patch"
+ "${FILESDIR}/0018-LU-8056-llite-POSIX_ACL_XATTR_-ACCESS-DEFAULT-remove.patch"
+ "${FILESDIR}/0019-LU-8056-lloop-fix-bio_for_each_segment_all-for-newer.patch"
+ "${FILESDIR}/lustre-do-not-include-udef.h.patch"
+ )
pkg_setup() {
filter-mfpmath sse