Skip to contentSkip to conversation

staging:lustre: split kernel comm between user and kernel

PATCH In review James Simmons 2 participants 15 messages Dec 23, 2015 – Feb 3, 2016 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover staging:lustre: split kernel comm between user and kernel

The kernel communication code used for HSM and changelog is entangled. Move the user space bits into the liblustreapi. This will also help for a possible relicensing. The kernel portion is also moved from libcfs to obdclass.

The original libcfs_kernelcomm.h header is split into three parts:

* lustre_kernelcomm.h, a new header for the kernel parts;
* uapi_kernelcomm.h, a new header for the data structures shared

    between userspace and kernelspace;

* lustreapi_internal.h receives the private liblustreapi prototypes.

The original code in kernel_user_comm.c is split into two parts:

* obdclass/kernelcomm.c for the kernel part. filp_user_write() was

    moved there, and linux-fs.c deleted;

* liblustreapi_kernelconn.c for the user part. The calls to CDEBUG have been removed, and calls to CERROR have been transformed to llapi_err_noerrno. The type lustre_kernelcomm has been removed and replace by struct lustre_kernelcomm.

Various names and filenames have been harmonized to *kernelcomm*.

The unused symbol KUC_FL_BLOCK has been removed.

Signed-off-by: frank zago <fzago at cray.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/14270
Reviewed-by: Nathan Rutman <nathan.rutman at seagate.com>
Reviewed-by: James Simmons <uja.ornl at yahoo.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin at intel.com>
Reviewed-by: John L. Hammond <john.hammond at intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin at intel.com>

Henri Doreau (1):
staging: lustre: Prevent duplicate CT registrations

Hongchao Zhang (1):
staging: lustre: embed kr_data into kkuc_reg

James Simmons (9):
staging: lustre: kg_sem semaphore handling is incorrectly
staging: lustre: convert kernelcomm group to unsigned int
staging: lustre: remove unnecessary NULL checks in kernel_comm.c
staging: lustre: cleanup block comment style in kernel_comm code
staging: lustre: add space around '+' in kernel_comm code
staging: lustre: use proper braces in libcfs_kkuc_group_put
staging: lustre: return proper error code for libcfs_kkuc_msg_put
staging: lustre: fix all conditional comparison to zero for
kernelcomm.c
staging: lustre: cleanup white space in kernel comm code

frank zago (2):
staging: lustre: move kernel_user_comm.c from libcfs to lustre
staging: lustre: split kernel comm between user and kernel

 .../staging/lustre/include/linux/libcfs/libcfs.h   |    1 -
 .../staging/lustre/lustre/include/lustre_export.h  |    7 ++
 .../lustre/lustre/include/lustre_kernelcomm.h      |   55 +++++++++++++
 .../include/uapi_kernelcomm.h}                     |   72 ++++++------------
 drivers/staging/lustre/lustre/libcfs/Makefile      |    5 +-
 drivers/staging/lustre/lustre/llite/dir.c          |    1 +
 drivers/staging/lustre/lustre/lmv/lmv_obd.c        |   30 +++++--
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |   21 ++++--
 drivers/staging/lustre/lustre/obdclass/Makefile    |   10 +-
 drivers/staging/lustre/lustre/obdclass/genops.c    |    1 +
 .../kernel_user_comm.c => obdclass/kernelcomm.c}   |   80 ++++++++++---------
 11 files changed, 172 insertions(+), 111 deletions(-)
 create mode 100644 drivers/staging/lustre/lustre/include/lustre_kernelcomm.h
 rename drivers/staging/lustre/{include/linux/libcfs/libcfs_kernelcomm.h => lustre/include/uapi_kernelcomm.h} (51%)
 rename drivers/staging/lustre/lustre/{libcfs/kernel_user_comm.c => obdclass/kernelcomm.c} (81%)
#1 lore raw

PATCH v2 1/13 staging: lustre: kg_sem semaphore handling is incorrectly

During the removal of the cfs wrappers the kg_sem semaphore was handled incorrectly. We need to take a write lock when writing data to the kkuc_groups. The libcfs_kkuc_group_foreach needs to only take a read lock. This makes use match the OpenSFS development branch.

---
 .../lustre/lustre/libcfs/kernel_user_comm.c        |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c +4 -4
index d8230ae..1a052ac 100644
@@ -186,7 +186,7 @@ int libcfs_kkuc_group_put(int group, void *payload)
 	int		 rc = 0;
 	int one_success = 0;
 
-	down_read(&kg_sem);
+	down_write(&kg_sem);
 	list_for_each_entry(reg, &kkuc_groups[group], kr_chain) {
 		if (reg->kr_fp != NULL) {
 			rc = libcfs_kkuc_msg_put(reg->kr_fp, payload);
@@ -198,7 +198,7 @@ int libcfs_kkuc_group_put(int group, void *payload)
 			}
 		}
 	}
-	up_read(&kg_sem);
+	up_write(&kg_sem);
 
 	/* don't return an error if the message has been delivered
 	 * at least to one agent */
@@ -230,12 +230,12 @@ int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func,
 	if (kkuc_groups[group].next == NULL)
 		return 0;
 
-	down_write(&kg_sem);
+	down_read(&kg_sem);
 	list_for_each_entry(reg, &kkuc_groups[group], kr_chain) {
 		if (reg->kr_fp != NULL)
 			rc = cb_func(reg->kr_data, cb_arg);
 	}
-	up_write(&kg_sem);
+	up_read(&kg_sem);
 
 	return rc;
 }
Signature · 1 line
1.7.1
#2 lore raw

PATCH v2 2/13 staging: lustre: Prevent duplicate CT registrations

In reply to James Simmons

From: Henri Doreau <[email protected]>

Associate copytool registration to a given MDC import so that multiple mounts of the same filesystem do not lead to having the copytool registered multiple time.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3882
Reviewed-on: http://review.whamcloud.com/7612

---
 .../include/linux/libcfs/libcfs_kernelcomm.h       |    6 ++--
 .../staging/lustre/lustre/include/lustre_export.h  |    7 ++++
 .../lustre/lustre/libcfs/kernel_user_comm.c        |   15 +++++---
 drivers/staging/lustre/lustre/lmv/lmv_obd.c        |   39 +++++++++++++++-----
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |   22 +++++++----
 5 files changed, 62 insertions(+), 27 deletions(-)
drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +3 -3
index 41f3d81..3a89a3b 100644
@@ -77,7 +77,7 @@ enum kuc_generic_message_type {
 };
 
 /* prototype for callback function on kuc groups */
-typedef int (*libcfs_kkuc_cb_t)(__u32 data, void *cb_arg);
+typedef int (*libcfs_kkuc_cb_t)(void *data, void *cb_arg);
 
 /* KUC Broadcast Groups. This determines which userspace process hears which
  * messages.  Mutliple transports may be used within a group, or multiple
@@ -92,8 +92,8 @@ typedef int (*libcfs_kkuc_cb_t)(__u32 data, void *cb_arg);
 int libcfs_kkuc_msg_put(struct file *fp, void *payload);
 int libcfs_kkuc_group_put(int group, void *payload);
 int libcfs_kkuc_group_add(struct file *fp, int uid, unsigned int group,
-				 __u32 data);
-int libcfs_kkuc_group_rem(int uid, int group);
+			  void *data);
+int libcfs_kkuc_group_rem(int uid, int group, void **pdata);
 int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func,
 				     void *cb_arg);
 
drivers/staging/lustre/lustre/include/lustre_export.h +7 -0
index 311e5aa..a030a98 100644
@@ -338,6 +338,13 @@ static inline bool imp_connect_disp_stripe(struct obd_import *imp)
 
 struct obd_export *class_conn2export(struct lustre_handle *conn);
 
+#define KKUC_CT_DATA_MAGIC	0x092013cea
+struct kkuc_ct_data {
+	__u32		kcd_magic;
+	struct obd_uuid	kcd_uuid;
+	__u32		kcd_archive;
+};
+
 /** @} export */
 
 #endif /* __EXPORT_H */
drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c +9 -6
index 1a052ac..3b4731a 100644
@@ -95,10 +95,10 @@ EXPORT_SYMBOL(libcfs_kkuc_msg_put);
  * group from any fs */
 /** A single group registration has a uid and a file pointer */
 struct kkuc_reg {
-	struct list_head	kr_chain;
-	int		kr_uid;
+	struct list_head kr_chain;
+	int		 kr_uid;
 	struct file	*kr_fp;
-	__u32		kr_data;
+	void		*kr_data;
 };
 
 static struct list_head kkuc_groups[KUC_GRP_MAX+1] = {};
@@ -109,9 +109,10 @@ static DECLARE_RWSEM(kg_sem);
  * @param filp pipe to write into
  * @param uid identifier for this receiver
  * @param group group number
+ * @param data user data
  */
 int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group,
-			  __u32 data)
+			  void *data)
 {
 	struct kkuc_reg *reg;
 
@@ -145,7 +146,7 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group,
 }
 EXPORT_SYMBOL(libcfs_kkuc_group_add);
 
-int libcfs_kkuc_group_rem(int uid, int group)
+int libcfs_kkuc_group_rem(int uid, int group, void **pdata)
 {
 	struct kkuc_reg *reg, *next;
 
@@ -171,6 +172,8 @@ int libcfs_kkuc_group_rem(int uid, int group)
 			       reg->kr_uid, reg->kr_fp, group);
 			if (reg->kr_fp != NULL)
 				fput(reg->kr_fp);
+			if (pdata)
+				*pdata = reg->kr_data;
 			kfree(reg);
 		}
 	}
@@ -213,7 +216,7 @@ EXPORT_SYMBOL(libcfs_kkuc_group_put);
  * Calls a callback function for each link of the given kuc group.
  * @param group the group to call the function on.
  * @param cb_func the function to be called.
- * @param cb_arg iextra argument to be passed to the callback function.
+ * @param cb_arg extra argument to be passed to the callback function.
  */
 int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func,
 			      void *cb_arg)
drivers/staging/lustre/lustre/lmv/lmv_obd.c +29 -10
index bbafe0a..e2f181e 100644
@@ -794,7 +794,9 @@ static void lmv_hsm_req_build(struct lmv_obd *lmv,
 static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, unsigned int cmd, int len,
 				 struct lustre_kernelcomm *lk, void *uarg)
 {
-	int	i, rc = 0;
+	struct kkuc_ct_data *kcd = NULL;
+	int rc = 0;
+	__u32 i;
 
 	/* unregister request (call from llapi_hsm_copytool_fini) */
 	for (i = 0; i < lmv->desc.ld_tgt_count; i++) {
@@ -807,17 +809,21 @@ static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, unsigned int cmd, int len,
 	 * Unreached coordinators will get EPIPE on next requests
 	 * and will unregister automatically.
 	 */
-	rc = libcfs_kkuc_group_rem(lk->lk_uid, lk->lk_group);
+	rc = libcfs_kkuc_group_rem(lk->lk_uid, lk->lk_group, (void **)&kcd);
+	if (kcd)
+		kfree(kcd);
+
 	return rc;
 }
 
 static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len,
 			       struct lustre_kernelcomm *lk, void *uarg)
 {
-	struct file	*filp;
-	int		 i, j, err;
-	int		 rc = 0;
-	bool		 any_set = false;
+	struct file *filp;
+	__u32 i, j;
+	int err, rc = 0;
+	bool any_set = false;
+	struct kkuc_ct_data *kcd;
 
 	/* All or nothing: try to register to all MDS.
 	 * In case of failure, unregister from previous MDS,
@@ -854,12 +860,25 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len,
 
 	/* at least one registration done, with no failure */
 	filp = fget(lk->lk_wfd);
-	if (filp == NULL) {
+	if (!filp)
 		return -EBADF;
-	}
-	rc = libcfs_kkuc_group_add(filp, lk->lk_uid, lk->lk_group, lk->lk_data);
-	if (rc != 0 && filp != NULL)
+
+	kcd = kzalloc(sizeof(*kcd), GFP_NOFS);
+	if (!kcd) {
 		fput(filp);
+		return -ENOMEM;
+	}
+	kcd->kcd_magic = KKUC_CT_DATA_MAGIC;
+	kcd->kcd_uuid = lmv->cluuid;
+	kcd->kcd_archive = lk->lk_data;
+
+	rc = libcfs_kkuc_group_add(filp, lk->lk_uid, lk->lk_group, kcd);
+	if (rc) {
+		if (filp)
+			fput(filp);
+		kfree(kcd);
+	}
+
 	return rc;
 }
 
drivers/staging/lustre/lustre/mdc/mdc_request.c +14 -8
index 57e0fc1..1936b49 100644
@@ -2013,21 +2013,27 @@ static int mdc_hsm_copytool_send(int len, void *val)
 /**
  * callback function passed to kuc for re-registering each HSM copytool
  * running on MDC, after MDT shutdown/recovery.
- * @param data archive id served by the copytool
+ * @param data copytool registration data
  * @param cb_arg callback argument (obd_import)
  */
-static int mdc_hsm_ct_reregister(__u32 data, void *cb_arg)
+static int mdc_hsm_ct_reregister(void *data, void *cb_arg)
 {
+	struct kkuc_ct_data	*kcd = data;
 	struct obd_import	*imp = (struct obd_import *)cb_arg;
-	__u32			 archive = data;
 	int			 rc;
 
-	CDEBUG(D_HA, "recover copytool registration to MDT (archive=%#x)\n",
-	       archive);
-	rc = mdc_ioc_hsm_ct_register(imp, archive);
+	if (!kcd || kcd->kcd_magic != KKUC_CT_DATA_MAGIC)
+		return -EPROTO;
+
+	if (!obd_uuid_equals(&kcd->kcd_uuid, &imp->imp_obd->obd_uuid))
+		return 0;
+
+	CDEBUG(D_HA, "%s: recover copytool registration to MDT (archive=%#x)\n",
+	       imp->imp_obd->obd_name, kcd->kcd_archive);
+	rc = mdc_ioc_hsm_ct_register(imp, kcd->kcd_archive);
 
 	/* ignore error if the copytool is already registered */
-	return ((rc != 0) && (rc != -EEXIST)) ? rc : 0;
+	return (rc == -EEXIST) ? 0 : rc;
 }
 
 static int mdc_set_info_async(const struct lu_env *env,
@@ -2369,7 +2375,7 @@ static int mdc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
 	case OBD_CLEANUP_EXPORTS:
 		/* Failsafe, ok if racy */
 		if (obd->obd_type->typ_refcnt <= 1)
-			libcfs_kkuc_group_rem(0, KUC_GRP_HSM);
+			libcfs_kkuc_group_rem(0, KUC_GRP_HSM, NULL);
 
 		obd_cleanup_client_import(obd);
 		ptlrpc_lprocfs_unregister_obd(obd);
Signature · 1 line
1.7.1
#3 lore raw

PATCH v2 3/13 staging: lustre: move kernel_user_comm.c from libcfs to lustre

In reply to James Simmons

From: frank zago <[email protected]>

Move the kernel portion from libcfs to obdclass. This code is only used by lustre. This is broken out of the original patch 14270. The part covered by this change is as follows:

The original code in kernel_user_comm.c is split into two parts:

* obdclass/kernelcomm.c for the kernel part. filp_user_write() was

    moved there, and linux-fs.c deleted;

* liblustreapi_kernelconn.c for the user part. The calls to CDEBUG have been removed, and calls to CERROR have been transformed to llapi_err_noerrno. The type lustre_kernelcomm has been removed and replace by struct lustre_kernelcomm.

Various names and filenames have been harmonized to *kernelcomm*.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/14270

---
 drivers/staging/lustre/lustre/libcfs/Makefile      |    5 ++---
 drivers/staging/lustre/lustre/obdclass/Makefile    |   10 +++++-----
 .../kernel_user_comm.c => obdclass/kernelcomm.c}   |    0
 3 files changed, 7 insertions(+), 8 deletions(-)
 rename drivers/staging/lustre/lustre/{libcfs/kernel_user_comm.c => obdclass/kernelcomm.c} (100%)
drivers/staging/lustre/lustre/libcfs/Makefile +2 -3
index 03d3f3d..277c123 100644
@@ -11,8 +11,7 @@ libcfs-linux-objs += linux-mem.o
 libcfs-linux-objs := $(addprefix linux/,$(libcfs-linux-objs))
 
 libcfs-all-objs := debug.o fail.o module.o tracefile.o \
-		   libcfs_string.o hash.o kernel_user_comm.o \
-		   prng.o workitem.o libcfs_cpu.o \
-		   libcfs_mem.o libcfs_lock.o
+		   libcfs_string.o hash.o prng.o workitem.o \
+		   libcfs_cpu.o libcfs_mem.o libcfs_lock.o
 
 libcfs-objs := $(libcfs-linux-objs) $(libcfs-all-objs)
drivers/staging/lustre/lustre/obdclass/Makefile +5 -5
index acc6857..c404eb3 100644
@@ -2,8 +2,8 @@ obj-$(CONFIG_LUSTRE_FS) += obdclass.o
 
 obdclass-y := linux/linux-module.o linux/linux-obdo.o linux/linux-sysctl.o \
 	      llog.o llog_cat.o llog_obd.o llog_swab.o class_obd.o debug.o \
-	      genops.o uuid.o lprocfs_status.o \
-	      lustre_handles.o lustre_peer.o \
-	      statfs_pack.o obdo.o obd_config.o obd_mount.o \
-	      lu_object.o cl_object.o   \
-	      cl_page.o cl_lock.o cl_io.o lu_ref.o acl.o lprocfs_counters.o
+	      genops.o uuid.o lprocfs_status.o lprocfs_counters.o \
+	      lustre_handles.o lustre_peer.o statfs_pack.o \
+	      obdo.o obd_config.o obd_mount.o lu_object.o lu_ref.o \
+	      cl_object.o cl_page.o cl_lock.o cl_io.o \
+	      acl.o kernelcomm.o
drivers/staging/lustre/lustre/obdclass/kernelcomm.c renamed from drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c +0 -0
similarity index 100%
rename from drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
rename to drivers/staging/lustre/lustre/obdclass/kernelcomm.c
Signature · 1 line
1.7.1
#4 lore raw

PATCH v2 4/13 staging: lustre: split kernel comm between user and kernel

In reply to James Simmons

From: frank zago <[email protected]>

Split the kernel comm header in libcfs into two new headers to handle both kernel space and user space for the lustre layer. This is broken out of the original patch 14270. The part covered by this change is as follows:

The original libcfs_kernelcomm.h header is split into three parts:
* lustre_kernelcomm.h, a new header for the kernel parts;
* uapi_kernelcomm.h, a new header for the data structures shared

    between userspace and kernelspace;

* lustreapi_internal.h receives the private liblustreapi prototypes.

Various names and filenames have been harmonized to *kernelcomm*.

The unused symbol KUC_FL_BLOCK has been removed.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/14270

---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |    1 -
 .../lustre/lustre/include/lustre_kernelcomm.h      |   55 ++++++++++++++++++++
 .../include/uapi_kernelcomm.h}                     |   50 ++++--------------
 drivers/staging/lustre/lustre/llite/dir.c          |    1 +
 drivers/staging/lustre/lustre/lmv/lmv_obd.c        |    1 +
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |    1 +
 drivers/staging/lustre/lustre/obdclass/genops.c    |    1 +
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    5 +-
 8 files changed, 73 insertions(+), 42 deletions(-)
 create mode 100644 drivers/staging/lustre/lustre/include/lustre_kernelcomm.h
 rename drivers/staging/lustre/{include/linux/libcfs/libcfs_kernelcomm.h => lustre/include/uapi_kernelcomm.h} (62%)
drivers/staging/lustre/include/linux/libcfs/libcfs.h +0 -1
index 0d8a91e..9626d97 100644
@@ -115,7 +115,6 @@ void cfs_get_random_bytes(void *buf, int size);
 #include "libcfs_prim.h"
 #include "libcfs_time.h"
 #include "libcfs_string.h"
-#include "libcfs_kernelcomm.h"
 #include "libcfs_workitem.h"
 #include "libcfs_hash.h"
 #include "libcfs_fail.h"
drivers/staging/lustre/lustre/include/lustre_kernelcomm.h new file +55 -0

55 lines not on this page · raw message

drivers/staging/lustre/lustre/include/uapi_kernelcomm.h renamed from drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h +12 -38

99 lines not on this page · raw message

drivers/staging/lustre/lustre/llite/dir.c +1 -0
index 7b35531..87e0401 100644
@@ -55,6 +55,7 @@
 #include "../include/lustre_lite.h"
 #include "../include/lustre_dlm.h"
 #include "../include/lustre_fid.h"
+#include "../include/lustre_kernelcomm.h"
 #include "llite_internal.h"
 
 /*
drivers/staging/lustre/lustre/lmv/lmv_obd.c +1 -0
index e2f181e..30c73c2 100644
@@ -53,6 +53,7 @@
 #include "../include/lprocfs_status.h"
 #include "../include/lustre_lite.h"
 #include "../include/lustre_fid.h"
+#include "../include/lustre_kernelcomm.h"
 #include "lmv_internal.h"
 
 static void lmv_activate_target(struct lmv_obd *lmv,
drivers/staging/lustre/lustre/mdc/mdc_request.c +1 -0
index 1936b49..6923ace 100644
@@ -48,6 +48,7 @@
 #include "../include/lprocfs_status.h"
 #include "../include/lustre_param.h"
 #include "../include/lustre_log.h"
+#include "../include/lustre_kernelcomm.h"
 
 #include "mdc_internal.h"
 
drivers/staging/lustre/lustre/obdclass/genops.c +1 -0
index 228c44c..5665655 100644
@@ -42,6 +42,7 @@
 #define DEBUG_SUBSYSTEM S_CLASS
 #include "../include/obd_class.h"
 #include "../include/lprocfs_status.h"
+#include "../include/lustre_kernelcomm.h"
 
 spinlock_t obd_types_lock;
 
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +2 -3
index 3b4731a..e3f5a3c 100644
@@ -42,9 +42,8 @@
 #define DEBUG_SUBSYSTEM S_CLASS
 #define D_KUC D_OTHER
 
-#include "../../include/linux/libcfs/libcfs.h"
-
-/* This is the kernel side (liblustre as well). */
+#include "../include/obd_support.h"
+#include "../include/lustre_kernelcomm.h"
 
 /**
  * libcfs_kkuc_msg_put - send an message from kernel to userspace
Signature · 1 line
1.7.1
#5 lore raw

PATCH v2 5/13 staging: lustre: embed kr_data into kkuc_reg

In reply to James Simmons

From: Hongchao Zhang <[email protected]>

In struct kkuc_reg, the "kr_data" is difficult to be freed outside of libcfs, then it's better to change it to be inline data instead of the data pointer.

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6485
Reviewed-on: http://review.whamcloud.com/14638

---
 .../lustre/lustre/include/lustre_kernelcomm.h      |    4 +-
 drivers/staging/lustre/lustre/lmv/lmv_obd.c        |   22 ++++++-------------
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |    2 +-
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |   12 ++++------
 4 files changed, 15 insertions(+), 25 deletions(-)
drivers/staging/lustre/lustre/include/lustre_kernelcomm.h +2 -2
index 76959c6..2312efc 100644
@@ -47,8 +47,8 @@ typedef int (*libcfs_kkuc_cb_t)(void *data, void *cb_arg);
 int libcfs_kkuc_msg_put(struct file *fp, void *payload);
 int libcfs_kkuc_group_put(int group, void *payload);
 int libcfs_kkuc_group_add(struct file *fp, int uid, unsigned int group,
-			  void *data);
-int libcfs_kkuc_group_rem(int uid, int group, void **pdata);
+			  void *data, size_t data_len);
+int libcfs_kkuc_group_rem(int uid, int group);
 int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func,
 			      void *cb_arg);
 
drivers/staging/lustre/lustre/lmv/lmv_obd.c +7 -15
index 30c73c2..9ebfb39 100644
@@ -795,7 +795,6 @@ static void lmv_hsm_req_build(struct lmv_obd *lmv,
 static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, unsigned int cmd, int len,
 				 struct lustre_kernelcomm *lk, void *uarg)
 {
-	struct kkuc_ct_data *kcd = NULL;
 	int rc = 0;
 	__u32 i;
 
@@ -810,9 +809,7 @@ static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, unsigned int cmd, int len,
 	 * Unreached coordinators will get EPIPE on next requests
 	 * and will unregister automatically.
 	 */
-	rc = libcfs_kkuc_group_rem(lk->lk_uid, lk->lk_group, (void **)&kcd);
-	if (kcd)
-		kfree(kcd);
+	rc = libcfs_kkuc_group_rem(lk->lk_uid, lk->lk_group);
 
 	return rc;
 }
@@ -824,7 +821,7 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len,
 	__u32 i, j;
 	int err, rc = 0;
 	bool any_set = false;
-	struct kkuc_ct_data *kcd;
+	struct kkuc_ct_data kcd = { 0 };
 
 	/* All or nothing: try to register to all MDS.
 	 * In case of failure, unregister from previous MDS,
@@ -864,20 +861,15 @@ static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len,
 	if (!filp)
 		return -EBADF;
 
-	kcd = kzalloc(sizeof(*kcd), GFP_NOFS);
-	if (!kcd) {
-		fput(filp);
-		return -ENOMEM;
-	}
-	kcd->kcd_magic = KKUC_CT_DATA_MAGIC;
-	kcd->kcd_uuid = lmv->cluuid;
-	kcd->kcd_archive = lk->lk_data;
+	kcd.kcd_magic = KKUC_CT_DATA_MAGIC;
+	kcd.kcd_uuid = lmv->cluuid;
+	kcd.kcd_archive = lk->lk_data;
 
-	rc = libcfs_kkuc_group_add(filp, lk->lk_uid, lk->lk_group, kcd);
+	rc = libcfs_kkuc_group_add(filp, lk->lk_uid, lk->lk_group,
+				   &kcd, sizeof(kcd));
 	if (rc) {
 		if (filp)
 			fput(filp);
-		kfree(kcd);
 	}
 
 	return rc;
drivers/staging/lustre/lustre/mdc/mdc_request.c +1 -1
index 6923ace..3929f91 100644
@@ -2376,7 +2376,7 @@ static int mdc_precleanup(struct obd_device *obd, enum obd_cleanup_stage stage)
 	case OBD_CLEANUP_EXPORTS:
 		/* Failsafe, ok if racy */
 		if (obd->obd_type->typ_refcnt <= 1)
-			libcfs_kkuc_group_rem(0, KUC_GRP_HSM, NULL);
+			libcfs_kkuc_group_rem(0, KUC_GRP_HSM);
 
 		obd_cleanup_client_import(obd);
 		ptlrpc_lprocfs_unregister_obd(obd);
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +5 -7
index e3f5a3c..e290246 100644
@@ -97,7 +97,7 @@ struct kkuc_reg {
 	struct list_head kr_chain;
 	int		 kr_uid;
 	struct file	*kr_fp;
-	void		*kr_data;
+	char		 kr_data[0];
 };
 
 static struct list_head kkuc_groups[KUC_GRP_MAX+1] = {};
@@ -111,7 +111,7 @@ static DECLARE_RWSEM(kg_sem);
  * @param data user data
  */
 int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group,
-			  void *data)
+			  void *data, size_t data_len)
 {
 	struct kkuc_reg *reg;
 
@@ -125,13 +125,13 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group,
 		return -EBADF;
 
 	/* freed in group_rem */
-	reg = kmalloc(sizeof(*reg), 0);
+	reg = kmalloc(sizeof(*reg) + data_len, 0);
 	if (reg == NULL)
 		return -ENOMEM;
 
 	reg->kr_fp = filp;
 	reg->kr_uid = uid;
-	reg->kr_data = data;
+	memcpy(reg->kr_data, data, data_len);
 
 	down_write(&kg_sem);
 	if (kkuc_groups[group].next == NULL)
@@ -145,7 +145,7 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group,
 }
 EXPORT_SYMBOL(libcfs_kkuc_group_add);
 
-int libcfs_kkuc_group_rem(int uid, int group, void **pdata)
+int libcfs_kkuc_group_rem(int uid, int group)
 {
 	struct kkuc_reg *reg, *next;
 
@@ -171,8 +171,6 @@ int libcfs_kkuc_group_rem(int uid, int group, void **pdata)
 			       reg->kr_uid, reg->kr_fp, group);
 			if (reg->kr_fp != NULL)
 				fput(reg->kr_fp);
-			if (pdata)
-				*pdata = reg->kr_data;
 			kfree(reg);
 		}
 	}
Signature · 1 line
1.7.1
#6 lore raw

PATCH v2 6/13 staging: lustre: convert kernelcomm group to unsigned int

In reply to James Simmons

The group variable was converted to an unsigned int in libcfs_kkuc_group_add() to avoid a potential overflow. The variable group is used in other kernelcomm functions so it makes sense to convert the rest of the group variables to unsigned int.

---
 .../lustre/lustre/include/lustre_kernelcomm.h      |    6 +++---
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/include/lustre_kernelcomm.h +3 -3
index 2312efc..31c2d35 100644
@@ -45,11 +45,11 @@ typedef int (*libcfs_kkuc_cb_t)(void *data, void *cb_arg);
 
 /* Kernel methods */
 int libcfs_kkuc_msg_put(struct file *fp, void *payload);
-int libcfs_kkuc_group_put(int group, void *payload);
+int libcfs_kkuc_group_put(unsigned int group, void *payload);
 int libcfs_kkuc_group_add(struct file *fp, int uid, unsigned int group,
 			  void *data, size_t data_len);
-int libcfs_kkuc_group_rem(int uid, int group);
-int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func,
+int libcfs_kkuc_group_rem(int uid, unsigned int group);
+int libcfs_kkuc_group_foreach(unsigned int group, libcfs_kkuc_cb_t cb_func,
 			      void *cb_arg);
 
 #endif /* __LUSTRE_KERNELCOMM_H__ */
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +3 -3
index e290246..1081253 100644
@@ -145,7 +145,7 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group,
 }
 EXPORT_SYMBOL(libcfs_kkuc_group_add);
 
-int libcfs_kkuc_group_rem(int uid, int group)
+int libcfs_kkuc_group_rem(int uid, unsigned int group)
 {
 	struct kkuc_reg *reg, *next;
 
@@ -180,7 +180,7 @@ int libcfs_kkuc_group_rem(int uid, int group)
 }
 EXPORT_SYMBOL(libcfs_kkuc_group_rem);
 
-int libcfs_kkuc_group_put(int group, void *payload)
+int libcfs_kkuc_group_put(unsigned int group, void *payload)
 {
 	struct kkuc_reg	*reg;
 	int		 rc = 0;
@@ -215,7 +215,7 @@ EXPORT_SYMBOL(libcfs_kkuc_group_put);
  * @param cb_func the function to be called.
  * @param cb_arg extra argument to be passed to the callback function.
  */
-int libcfs_kkuc_group_foreach(int group, libcfs_kkuc_cb_t cb_func,
+int libcfs_kkuc_group_foreach(unsigned int group, libcfs_kkuc_cb_t cb_func,
 			      void *cb_arg)
 {
 	struct kkuc_reg *reg;
Signature · 1 line
1.7.1
#7 lore raw

PATCH v2 7/13 staging: lustre: remove unnecessary NULL checks in kernel_comm.c

In reply to James Simmons

Fix checkpatch.pl reports of NULL comparison in kernel_comm.c.

---
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +9 -9
index 1081253..c9405e6 100644
@@ -59,7 +59,7 @@ int libcfs_kkuc_msg_put(struct file *filp, void *payload)
 	mm_segment_t fs;
 	int rc = -ENOSYS;
 
-	if (filp == NULL || IS_ERR(filp))
+	if (!filp || IS_ERR(filp))
 		return -EBADF;
 
 	if (kuch->kuc_magic != KUC_MAGIC) {
@@ -121,12 +121,12 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group,
 	}
 
 	/* fput in group_rem */
-	if (filp == NULL)
+	if (!filp)
 		return -EBADF;
 
 	/* freed in group_rem */
 	reg = kmalloc(sizeof(*reg) + data_len, 0);
-	if (reg == NULL)
+	if (!reg)
 		return -ENOMEM;
 
 	reg->kr_fp = filp;
@@ -134,7 +134,7 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, unsigned int group,
 	memcpy(reg->kr_data, data, data_len);
 
 	down_write(&kg_sem);
-	if (kkuc_groups[group].next == NULL)
+	if (!kkuc_groups[group].next)
 		INIT_LIST_HEAD(&kkuc_groups[group]);
 	list_add(&reg->kr_chain, &kkuc_groups[group]);
 	up_write(&kg_sem);
@@ -149,7 +149,7 @@ int libcfs_kkuc_group_rem(int uid, unsigned int group)
 {
 	struct kkuc_reg *reg, *next;
 
-	if (kkuc_groups[group].next == NULL)
+	if (!kkuc_groups[group].next)
 		return 0;
 
 	if (uid == 0) {
@@ -169,7 +169,7 @@ int libcfs_kkuc_group_rem(int uid, unsigned int group)
 			list_del(&reg->kr_chain);
 			CDEBUG(D_KUC, "Removed uid=%d fp=%p from group %d\n",
 			       reg->kr_uid, reg->kr_fp, group);
-			if (reg->kr_fp != NULL)
+			if (reg->kr_fp)
 				fput(reg->kr_fp);
 			kfree(reg);
 		}
@@ -188,7 +188,7 @@ int libcfs_kkuc_group_put(unsigned int group, void *payload)
 
 	down_write(&kg_sem);
 	list_for_each_entry(reg, &kkuc_groups[group], kr_chain) {
-		if (reg->kr_fp != NULL) {
+		if (reg->kr_fp) {
 			rc = libcfs_kkuc_msg_put(reg->kr_fp, payload);
 			if (rc == 0)
 				one_success = 1;
@@ -227,12 +227,12 @@ int libcfs_kkuc_group_foreach(unsigned int group, libcfs_kkuc_cb_t cb_func,
 	}
 
 	/* no link for this group */
-	if (kkuc_groups[group].next == NULL)
+	if (!kkuc_groups[group].next)
 		return 0;
 
 	down_read(&kg_sem);
 	list_for_each_entry(reg, &kkuc_groups[group], kr_chain) {
-		if (reg->kr_fp != NULL)
+		if (reg->kr_fp)
 			rc = cb_func(reg->kr_data, cb_arg);
 	}
 	up_read(&kg_sem);
Signature · 1 line
1.7.1
#8 lore raw

PATCH v2 8/13 staging: lustre: cleanup block comment style in kernel_comm code

In reply to James Simmons

Fixup the comments to the linux kernel style for the source and headers related to the kernel_comm work.

---
 .../lustre/lustre/include/uapi_kernelcomm.h        |   10 ++++++----
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |   12 ++++++++----
 2 files changed, 14 insertions(+), 8 deletions(-)
drivers/staging/lustre/lustre/include/uapi_kernelcomm.h +6 -4
index 5e0b8de..a8feab6 100644
@@ -45,11 +45,13 @@
  */
 struct kuc_hdr {
 	__u16 kuc_magic;
-	__u8  kuc_transport;  /* Each new Lustre feature should use a different
-				 transport */
+	/* Each new Lustre feature should use a different transport */
+	__u8  kuc_transport;
 	__u8  kuc_flags;
-	__u16 kuc_msgtype;    /* Message type or opcode, transport-specific */
-	__u16 kuc_msglen;     /* Including header */
+	/* Message type or opcode, transport-specific */
+	__u16 kuc_msgtype;
+	/* Including header */
+	__u16 kuc_msglen;
 } __aligned(sizeof(__u64));
 
 #define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr)+CR_MAXSIZE)
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +8 -4
index c9405e6..eb5b0be 100644
@@ -89,9 +89,11 @@ int libcfs_kkuc_msg_put(struct file *filp, void *payload)
 }
 EXPORT_SYMBOL(libcfs_kkuc_msg_put);
 
-/* Broadcast groups are global across all mounted filesystems;
+/*
+ * Broadcast groups are global across all mounted filesystems;
  * i.e. registering for a group on 1 fs will get messages for that
- * group from any fs */
+ * group from any fs
+ */
 /** A single group registration has a uid and a file pointer */
 struct kkuc_reg {
 	struct list_head kr_chain;
@@ -200,8 +202,10 @@ int libcfs_kkuc_group_put(unsigned int group, void *payload)
 	}
 	up_write(&kg_sem);
 
-	/* don't return an error if the message has been delivered
-	 * at least to one agent */
+	/*
+	 * don't return an error if the message has been delivered
+	 * at least to one agent
+	 */
 	if (one_success)
 		rc = 0;
 
Signature · 1 line
1.7.1
#9 lore raw

PATCH v2 9/13 staging: lustre: add space around '+' in kernel_comm code

In reply to James Simmons

Add in missing space arouund '+' in the kernel_comm code.

---
 .../lustre/lustre/include/uapi_kernelcomm.h        |    2 +-
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/include/uapi_kernelcomm.h +1 -1
index a8feab6..5ace9f8 100644
@@ -54,7 +54,7 @@ struct kuc_hdr {
 	__u16 kuc_msglen;
 } __aligned(sizeof(__u64));
 
-#define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr)+CR_MAXSIZE)
+#define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr) + CR_MAXSIZE)
 
 #define KUC_MAGIC  0x191C /*Lustre9etLinC */
 
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +1 -1
index eb5b0be..709b1ab 100644
@@ -102,7 +102,7 @@ struct kkuc_reg {
 	char		 kr_data[0];
 };
 
-static struct list_head kkuc_groups[KUC_GRP_MAX+1] = {};
+static struct list_head kkuc_groups[KUC_GRP_MAX + 1] = {};
 /* Protect message sending against remove and adds */
 static DECLARE_RWSEM(kg_sem);
 
Signature · 1 line
1.7.1
#10 lore raw

PATCH v2 10/13 staging: lustre: use proper braces in libcfs_kkuc_group_put

In reply to James Simmons

Add in missing braces for libcfs_kkuc_group_put();.

---
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +2 -2
index 709b1ab..46cb81a 100644
@@ -192,9 +192,9 @@ int libcfs_kkuc_group_put(unsigned int group, void *payload)
 	list_for_each_entry(reg, &kkuc_groups[group], kr_chain) {
 		if (reg->kr_fp) {
 			rc = libcfs_kkuc_msg_put(reg->kr_fp, payload);
-			if (rc == 0)
+			if (rc == 0) {
 				one_success = 1;
-			else if (rc == -EPIPE) {
+			} else if (rc == -EPIPE) {
 				fput(reg->kr_fp);
 				reg->kr_fp = NULL;
 			}
Signature · 1 line
1.7.1
#11 lore raw

PATCH v2 11/13 staging: lustre: return proper error code for libcfs_kkuc_msg_put

In reply to James Simmons

The functon libcfs_kkuc_msg_put() returns -ENOSYS which is not correct. Return -ENXIO instead if the kuc header is corrupt.

---
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +2 -2
index 46cb81a..281cfd6 100644
@@ -57,14 +57,14 @@ int libcfs_kkuc_msg_put(struct file *filp, void *payload)
 	ssize_t count = kuch->kuc_msglen;
 	loff_t offset = 0;
 	mm_segment_t fs;
-	int rc = -ENOSYS;
+	int rc = -ENXIO;
 
 	if (!filp || IS_ERR(filp))
 		return -EBADF;
 
 	if (kuch->kuc_magic != KUC_MAGIC) {
 		CERROR("KernelComm: bad magic %x\n", kuch->kuc_magic);
-		return -ENOSYS;
+		return rc;
 	}
 
 	fs = get_fs();
Signature · 1 line
1.7.1
#12 lore raw

PATCH v2 12/13 staging: lustre: fix all conditional comparison to zero for kernelcomm.c

In reply to James Simmons

Doing if (rc != 0) or if (rc == 0) is bad form. This patch corrects kernelcomm.c to behavior according to kernel coding standards.

---
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +3 -3
index 281cfd6..285fee0 100644
@@ -154,7 +154,7 @@ int libcfs_kkuc_group_rem(int uid, unsigned int group)
 	if (!kkuc_groups[group].next)
 		return 0;
 
-	if (uid == 0) {
+	if (!uid) {
 		/* Broadcast a shutdown message */
 		struct kuc_hdr lh;
 
@@ -167,7 +167,7 @@ int libcfs_kkuc_group_rem(int uid, unsigned int group)
 
 	down_write(&kg_sem);
 	list_for_each_entry_safe(reg, next, &kkuc_groups[group], kr_chain) {
-		if ((uid == 0) || (uid == reg->kr_uid)) {
+		if (!uid || (uid == reg->kr_uid)) {
 			list_del(&reg->kr_chain);
 			CDEBUG(D_KUC, "Removed uid=%d fp=%p from group %d\n",
 			       reg->kr_uid, reg->kr_fp, group);
@@ -192,7 +192,7 @@ int libcfs_kkuc_group_put(unsigned int group, void *payload)
 	list_for_each_entry(reg, &kkuc_groups[group], kr_chain) {
 		if (reg->kr_fp) {
 			rc = libcfs_kkuc_msg_put(reg->kr_fp, payload);
-			if (rc == 0) {
+			if (!rc) {
 				one_success = 1;
 			} else if (rc == -EPIPE) {
 				fput(reg->kr_fp);
Signature · 1 line
1.7.1
#13 lore raw

PATCH v2 13/13 staging: lustre: cleanup white space in kernel comm code

In reply to James Simmons

Cleanup the last white space issues in the kernel comm code.

---
 .../lustre/lustre/include/uapi_kernelcomm.h        |   10 +++++-----
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/lustre/lustre/include/uapi_kernelcomm.h +5 -5
index 5ace9f8..5e99836 100644
@@ -56,17 +56,17 @@ struct kuc_hdr {
 
 #define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr) + CR_MAXSIZE)
 
-#define KUC_MAGIC  0x191C /*Lustre9etLinC */
+#define KUC_MAGIC		0x191C /*Lustre9etLinC */
 
 /* kuc_msgtype values are defined in each transport */
 enum kuc_transport_type {
-	KUC_TRANSPORT_GENERIC   = 1,
-	KUC_TRANSPORT_HSM       = 2,
-	KUC_TRANSPORT_CHANGELOG = 3,
+	KUC_TRANSPORT_GENERIC	= 1,
+	KUC_TRANSPORT_HSM	= 2,
+	KUC_TRANSPORT_CHANGELOG	= 3,
 };
 
 enum kuc_generic_message_type {
-	KUC_MSG_SHUTDOWN = 1,
+	KUC_MSG_SHUTDOWN	= 1,
 };
 
 /* KUC Broadcast Groups. This determines which userspace process hears which
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +1 -1
index 285fee0..be4867c 100644
@@ -185,7 +185,7 @@ EXPORT_SYMBOL(libcfs_kkuc_group_rem);
 int libcfs_kkuc_group_put(unsigned int group, void *payload)
 {
 	struct kkuc_reg	*reg;
-	int		 rc = 0;
+	int rc = 0;
 	int one_success = 0;
 
 	down_write(&kg_sem);
Signature · 1 line
1.7.1
#14 lore raw
In reply to James Simmons
Quoted 25 lines · James Simmons

The kernel communication code used for HSM and changelog is entangled. Move the user space bits into the liblustreapi. This will also help for a possible relicensing. The kernel portion is also moved from libcfs to obdclass.

The original libcfs_kernelcomm.h header is split into three parts:

* lustre_kernelcomm.h, a new header for the kernel parts;
* uapi_kernelcomm.h, a new header for the data structures shared

    between userspace and kernelspace;

* lustreapi_internal.h receives the private liblustreapi prototypes.

The original code in kernel_user_comm.c is split into two parts:

* obdclass/kernelcomm.c for the kernel part. filp_user_write() was

    moved there, and linux-fs.c deleted;

* liblustreapi_kernelconn.c for the user part. The calls to CDEBUG have been removed, and calls to CERROR have been transformed to llapi_err_noerrno. The type lustre_kernelcomm has been removed and replace by struct lustre_kernelcomm.

Various names and filenames have been harmonized to *kernelcomm*.

The unused symbol KUC_FL_BLOCK has been removed.

Quoted 8 lines

Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6245
Reviewed-on: http://review.whamcloud.com/14270

Note, your subject is the most difficult to deal with, as you didn't put the 'v2' before each patch, just some of them, so you can't sort them in an email client and I have to hand-edit them to get this to apply properly :(

Please don't do that again...