All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel
@ 2015-12-23 21:24 James Simmons
  2015-12-23 21:24 ` [PATCH v2 01/13] staging: lustre: kg_sem semaphore handling is incorrectly James Simmons
                   ` (13 more replies)
  0 siblings, 14 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, 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.

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%)


^ permalink raw reply	[flat|nested] 16+ messages in thread

* [PATCH v2 01/13] staging: lustre: kg_sem semaphore handling is incorrectly
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
@ 2015-12-23 21:24 ` James Simmons
  2015-12-23 21:24 ` [PATCH v2 02/13] staging: lustre: Prevent duplicate CT registrations James Simmons
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, James Simmons

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.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/lustre/libcfs/kernel_user_comm.c        |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
index d8230ae..1a052ac 100644
--- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
+++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
@@ -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;
 }
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 02/13] staging: lustre: Prevent duplicate CT registrations
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
  2015-12-23 21:24 ` [PATCH v2 01/13] staging: lustre: kg_sem semaphore handling is incorrectly James Simmons
@ 2015-12-23 21:24 ` James Simmons
  2015-12-23 21:24 ` [PATCH v2 03/13] staging: lustre: move kernel_user_comm.c from libcfs to lustre James Simmons
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, Henri Doreau,
	James Simmons

From: Henri Doreau <henri.doreau@cea.fr>

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.

Signed-off-by: Henri Doreau <henri.doreau@cea.fr>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3882
Reviewed-on: http://review.whamcloud.com/7612
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Jinshan Xiong <jinshan.xiong@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../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(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h
index 41f3d81..3a89a3b 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h
@@ -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);
 
diff --git a/drivers/staging/lustre/lustre/include/lustre_export.h b/drivers/staging/lustre/lustre/include/lustre_export.h
index 311e5aa..a030a98 100644
--- a/drivers/staging/lustre/lustre/include/lustre_export.h
+++ b/drivers/staging/lustre/lustre/include/lustre_export.h
@@ -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 */
diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
index 1a052ac..3b4731a 100644
--- a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
+++ b/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
@@ -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)
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index bbafe0a..e2f181e 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -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;
 }
 
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 57e0fc1..1936b49 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -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);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 03/13] staging: lustre: move kernel_user_comm.c from libcfs to lustre
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
  2015-12-23 21:24 ` [PATCH v2 01/13] staging: lustre: kg_sem semaphore handling is incorrectly James Simmons
  2015-12-23 21:24 ` [PATCH v2 02/13] staging: lustre: Prevent duplicate CT registrations James Simmons
@ 2015-12-23 21:24 ` James Simmons
  2015-12-23 21:24 ` [PATCH v2 04/13] staging: lustre: split kernel comm between user and kernel James Simmons
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, frank zago,
	James Simmons

From: frank zago <fzago@cray.com>

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*.

Signed-off-by: frank zago <fzago@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@seagate.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 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%)

diff --git a/drivers/staging/lustre/lustre/libcfs/Makefile b/drivers/staging/lustre/lustre/libcfs/Makefile
index 03d3f3d..277c123 100644
--- a/drivers/staging/lustre/lustre/libcfs/Makefile
+++ b/drivers/staging/lustre/lustre/libcfs/Makefile
@@ -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)
diff --git a/drivers/staging/lustre/lustre/obdclass/Makefile b/drivers/staging/lustre/lustre/obdclass/Makefile
index acc6857..c404eb3 100644
--- a/drivers/staging/lustre/lustre/obdclass/Makefile
+++ b/drivers/staging/lustre/lustre/obdclass/Makefile
@@ -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
diff --git a/drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
similarity index 100%
rename from drivers/staging/lustre/lustre/libcfs/kernel_user_comm.c
rename to drivers/staging/lustre/lustre/obdclass/kernelcomm.c
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 04/13] staging: lustre: split kernel comm between user and kernel
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
                   ` (2 preceding siblings ...)
  2015-12-23 21:24 ` [PATCH v2 03/13] staging: lustre: move kernel_user_comm.c from libcfs to lustre James Simmons
@ 2015-12-23 21:24 ` James Simmons
  2015-12-23 21:24 ` [PATCH v2 05/13] staging: lustre: embed kr_data into kkuc_reg James Simmons
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, frank zago,
	James Simmons

From: frank zago <fzago@cray.com>

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.

Signed-off-by: frank zago <fzago@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@seagate.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../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%)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 0d8a91e..9626d97 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -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"
diff --git a/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h b/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h
new file mode 100644
index 0000000..76959c6
--- /dev/null
+++ b/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h
@@ -0,0 +1,55 @@
+/*
+ * GPL HEADER START
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 only,
+ * as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License version 2 for more details (a copy is included
+ * in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License
+ * version 2 along with this program; If not, see
+ * http://www.gnu.org/licenses/gpl-2.0.html
+ *
+ * GPL HEADER END
+ */
+/*
+ * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Use is subject to license terms.
+ *
+ * Copyright (c) 2013 Intel Corporation.
+ */
+/*
+ * This file is part of Lustre, http://www.lustre.org/
+ *
+ * Author: Nathan Rutman <nathan.rutman@sun.com>
+ *
+ * Kernel <-> userspace communication routines.
+ * The definitions below are used in the kernel and userspace.
+ */
+
+#ifndef __LUSTRE_KERNELCOMM_H__
+#define __LUSTRE_KERNELCOMM_H__
+
+/* For declarations shared with userspace */
+#include "uapi_kernelcomm.h"
+
+/* prototype for callback function on kuc groups */
+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_add(struct file *fp, int uid, unsigned 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);
+
+#endif /* __LUSTRE_KERNELCOMM_H__ */
diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h b/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h
similarity index 62%
rename from drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h
rename to drivers/staging/lustre/lustre/include/uapi_kernelcomm.h
index 3a89a3b..5e0b8de 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_kernelcomm.h
+++ b/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h
@@ -15,37 +15,29 @@
  *
  * You should have received a copy of the GNU General Public License
  * version 2 along with this program; If not, see
- * http://www.sun.com/software/products/lustre/docs/GPLv2.pdf
- *
- * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
- * CA 95054 USA or visit www.sun.com if you need additional information or
- * have any questions.
+ * http://www.gnu.org/licenses/gpl-2.0.html
  *
  * GPL HEADER END
  */
 /*
  * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
+ *
+ * Copyright (c) 2013, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
  * Author: Nathan Rutman <nathan.rutman@sun.com>
  *
- * libcfs/include/libcfs/libcfs_kernelcomm.h
- *
  * Kernel <-> userspace communication routines.
  * The definitions below are used in the kernel and userspace.
- *
  */
 
-#ifndef __LIBCFS_KERNELCOMM_H__
-#define __LIBCFS_KERNELCOMM_H__
+#ifndef __UAPI_KERNELCOMM_H__
+#define __UAPI_KERNELCOMM_H__
 
-#ifndef __LIBCFS_LIBCFS_H__
-#error Do not #include this file directly. #include <linux/libcfs/libcfs.h> instead
-#endif
+#include <linux/types.h>
 
 /* KUC message header.
  * All current and future KUC messages should use this header.
@@ -63,7 +55,6 @@ struct kuc_hdr {
 #define KUC_CHANGELOG_MSG_MAXSIZE (sizeof(struct kuc_hdr)+CR_MAXSIZE)
 
 #define KUC_MAGIC  0x191C /*Lustre9etLinC */
-#define KUC_FL_BLOCK 0x01   /* Wait for send */
 
 /* kuc_msgtype values are defined in each transport */
 enum kuc_transport_type {
@@ -76,43 +67,26 @@ enum kuc_generic_message_type {
 	KUC_MSG_SHUTDOWN = 1,
 };
 
-/* prototype for callback function on kuc groups */
-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
  * groups may use the same transport.  Broadcast
  * groups need not be used if e.g. a UID is specified instead;
  * use group 0 to signify unicast.
  */
-#define KUC_GRP_HSM	   0x02
-#define KUC_GRP_MAX	   KUC_GRP_HSM
-
-/* 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_add(struct file *fp, int uid, unsigned 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);
+#define KUC_GRP_HSM	0x02
+#define KUC_GRP_MAX	KUC_GRP_HSM
 
 #define LK_FLG_STOP 0x01
+#define LK_NOFD -1U
 
 /* kernelcomm control structure, passed from userspace to kernel */
-typedef struct lustre_kernelcomm {
+struct lustre_kernelcomm {
 	__u32 lk_wfd;
 	__u32 lk_rfd;
 	__u32 lk_uid;
 	__u32 lk_group;
 	__u32 lk_data;
 	__u32 lk_flags;
-} __packed lustre_kernelcomm;
-
-/* Userspace methods */
-int libcfs_ukuc_start(lustre_kernelcomm *l, int groups);
-int libcfs_ukuc_stop(lustre_kernelcomm *l);
-int libcfs_ukuc_msg_get(lustre_kernelcomm *l, char *buf, int maxsize,
-			       int transport);
+} __packed;
 
-#endif /* __LIBCFS_KERNELCOMM_H__ */
+#endif	/* __UAPI_KERNELCOMM_H__ */
diff --git a/drivers/staging/lustre/lustre/llite/dir.c b/drivers/staging/lustre/lustre/llite/dir.c
index 7b35531..87e0401 100644
--- a/drivers/staging/lustre/lustre/llite/dir.c
+++ b/drivers/staging/lustre/lustre/llite/dir.c
@@ -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"
 
 /*
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index e2f181e..30c73c2 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -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,
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 1936b49..6923ace 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -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"
 
diff --git a/drivers/staging/lustre/lustre/obdclass/genops.c b/drivers/staging/lustre/lustre/obdclass/genops.c
index 228c44c..5665655 100644
--- a/drivers/staging/lustre/lustre/obdclass/genops.c
+++ b/drivers/staging/lustre/lustre/obdclass/genops.c
@@ -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;
 
diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
index 3b4731a..e3f5a3c 100644
--- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
+++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
@@ -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
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 05/13] staging: lustre: embed kr_data into kkuc_reg
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
                   ` (3 preceding siblings ...)
  2015-12-23 21:24 ` [PATCH v2 04/13] staging: lustre: split kernel comm between user and kernel James Simmons
@ 2015-12-23 21:24 ` James Simmons
  2015-12-23 21:24 ` [PATCH v2 06/13] staging: lustre: convert kernelcomm group to unsigned int James Simmons
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, Hongchao Zhang

From: Hongchao Zhang <hongchao.zhang@intel.com>

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.

Signed-off-by: Hongchao Zhang <hongchao.zhang@intel.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6485
Reviewed-on: http://review.whamcloud.com/14638
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: frank zago <fzago@cray.com>
Reviewed-by: Robert Read <robert.read@intel.com>
Reviewed-by: Henri Doreau <henri.doreau@cea.fr>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
---
 .../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(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h b/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h
index 76959c6..2312efc 100644
--- a/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h
+++ b/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h
@@ -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);
 
diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
index 30c73c2..9ebfb39 100644
--- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c
+++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c
@@ -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;
diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c
index 6923ace..3929f91 100644
--- a/drivers/staging/lustre/lustre/mdc/mdc_request.c
+++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c
@@ -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);
diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
index e3f5a3c..e290246 100644
--- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
+++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
@@ -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);
 		}
 	}
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 06/13] staging: lustre: convert kernelcomm group to unsigned int
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
                   ` (4 preceding siblings ...)
  2015-12-23 21:24 ` [PATCH v2 05/13] staging: lustre: embed kr_data into kkuc_reg James Simmons
@ 2015-12-23 21:24 ` James Simmons
  2015-12-23 21:24 ` [PATCH v2 07/13] staging: lustre: remove unnecessary NULL checks in kernel_comm.c James Simmons
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, 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.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/lustre/include/lustre_kernelcomm.h      |    6 +++---
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    6 +++---
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h b/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h
index 2312efc..31c2d35 100644
--- a/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h
+++ b/drivers/staging/lustre/lustre/include/lustre_kernelcomm.h
@@ -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__ */
diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
index e290246..1081253 100644
--- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
+++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
@@ -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;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 07/13] staging: lustre: remove unnecessary NULL checks in kernel_comm.c
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
                   ` (5 preceding siblings ...)
  2015-12-23 21:24 ` [PATCH v2 06/13] staging: lustre: convert kernelcomm group to unsigned int James Simmons
@ 2015-12-23 21:24 ` James Simmons
  2015-12-23 21:24 ` [PATCH v2 08/13] staging: lustre: cleanup block comment style in kernel_comm code James Simmons
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, James Simmons

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

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
index 1081253..c9405e6 100644
--- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
+++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
@@ -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);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH v2 08/13] staging: lustre: cleanup block comment style in kernel_comm code
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
                   ` (6 preceding siblings ...)
  2015-12-23 21:24 ` [PATCH v2 07/13] staging: lustre: remove unnecessary NULL checks in kernel_comm.c James Simmons
@ 2015-12-23 21:24 ` James Simmons
  2015-12-23 21:24 ` [PATCH 09/13] staging: lustre: add space around '+' " James Simmons
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, James Simmons

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

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/lustre/include/uapi_kernelcomm.h        |   10 ++++++----
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |   12 ++++++++----
 2 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h b/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h
index 5e0b8de..a8feab6 100644
--- a/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h
+++ b/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h
@@ -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)
diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
index c9405e6..eb5b0be 100644
--- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
+++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
@@ -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;
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 09/13] staging: lustre: add space around '+' in kernel_comm code
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
                   ` (7 preceding siblings ...)
  2015-12-23 21:24 ` [PATCH v2 08/13] staging: lustre: cleanup block comment style in kernel_comm code James Simmons
@ 2015-12-23 21:24 ` James Simmons
  2015-12-23 21:24 ` [PATCH 10/13] staging: lustre: use proper braces in libcfs_kkuc_group_put James Simmons
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, James Simmons

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

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/lustre/include/uapi_kernelcomm.h        |    2 +-
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h b/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h
index a8feab6..5ace9f8 100644
--- a/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h
+++ b/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h
@@ -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 */
 
diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
index eb5b0be..709b1ab 100644
--- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
+++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
@@ -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);
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 10/13] staging: lustre: use proper braces in libcfs_kkuc_group_put
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
                   ` (8 preceding siblings ...)
  2015-12-23 21:24 ` [PATCH 09/13] staging: lustre: add space around '+' " James Simmons
@ 2015-12-23 21:24 ` James Simmons
  2015-12-23 21:24 ` [PATCH 11/13] staging: lustre: return proper error code for libcfs_kkuc_msg_put James Simmons
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, James Simmons

Add in missing braces for libcfs_kkuc_group_put();.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
index 709b1ab..46cb81a 100644
--- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
+++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
@@ -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;
 			}
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 11/13] staging: lustre: return proper error code for libcfs_kkuc_msg_put
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
                   ` (9 preceding siblings ...)
  2015-12-23 21:24 ` [PATCH 10/13] staging: lustre: use proper braces in libcfs_kkuc_group_put James Simmons
@ 2015-12-23 21:24 ` James Simmons
  2015-12-23 21:24 ` [PATCH 12/13] staging: lustre: fix all conditional comparison to zero for kernelcomm.c James Simmons
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, James Simmons

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

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
index 46cb81a..281cfd6 100644
--- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
+++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
@@ -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();
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 12/13] staging: lustre: fix all conditional comparison to zero for kernelcomm.c
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
                   ` (10 preceding siblings ...)
  2015-12-23 21:24 ` [PATCH 11/13] staging: lustre: return proper error code for libcfs_kkuc_msg_put James Simmons
@ 2015-12-23 21:24 ` James Simmons
  2015-12-23 21:24 ` [PATCH 13/13] staging: lustre: cleanup white space in kernel comm code James Simmons
  2016-02-03 22:19   ` Greg Kroah-Hartman
  13 siblings, 0 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, 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.

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
index 281cfd6..285fee0 100644
--- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
+++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
@@ -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);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [PATCH 13/13] staging: lustre: cleanup white space in kernel comm code
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
                   ` (11 preceding siblings ...)
  2015-12-23 21:24 ` [PATCH 12/13] staging: lustre: fix all conditional comparison to zero for kernelcomm.c James Simmons
@ 2015-12-23 21:24 ` James Simmons
  2016-02-03 22:19   ` Greg Kroah-Hartman
  13 siblings, 0 replies; 16+ messages in thread
From: James Simmons @ 2015-12-23 21:24 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, James Simmons

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

Signed-off-by: James Simmons <jsimmons@infradead.org>
---
 .../lustre/lustre/include/uapi_kernelcomm.h        |   10 +++++-----
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h b/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h
index 5ace9f8..5e99836 100644
--- a/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h
+++ b/drivers/staging/lustre/lustre/include/uapi_kernelcomm.h
@@ -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
diff --git a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
index 285fee0..be4867c 100644
--- a/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
+++ b/drivers/staging/lustre/lustre/obdclass/kernelcomm.c
@@ -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);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 16+ messages in thread

* [lustre-devel] [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel
  2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
@ 2016-02-03 22:19   ` Greg Kroah-Hartman
  2015-12-23 21:24 ` [PATCH v2 02/13] staging: lustre: Prevent duplicate CT registrations James Simmons
                     ` (12 subsequent siblings)
  13 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2016-02-03 22:19 UTC (permalink / raw)
  To: James Simmons
  Cc: devel, Oleg Drokin, Andreas Dilger, Linux Kernel Mailing List,
	lustre-devel

On Wed, Dec 23, 2015 at 04:24:39PM -0500, James Simmons wrote:
> 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@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@seagate.com>
> Reviewed-by: James Simmons <uja.ornl@yahoo.com>
> Reviewed-by: Dmitry Eremin <dmitry.eremin@intel.com>
> Reviewed-by: John L. Hammond <john.hammond@intel.com>
> Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>

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...

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel
@ 2016-02-03 22:19   ` Greg Kroah-Hartman
  0 siblings, 0 replies; 16+ messages in thread
From: Greg Kroah-Hartman @ 2016-02-03 22:19 UTC (permalink / raw)
  To: James Simmons
  Cc: devel, Oleg Drokin, Andreas Dilger, Linux Kernel Mailing List,
	lustre-devel

On Wed, Dec 23, 2015 at 04:24:39PM -0500, James Simmons wrote:
> 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>

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...

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-02-03 22:19 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-23 21:24 [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel James Simmons
2015-12-23 21:24 ` [PATCH v2 01/13] staging: lustre: kg_sem semaphore handling is incorrectly James Simmons
2015-12-23 21:24 ` [PATCH v2 02/13] staging: lustre: Prevent duplicate CT registrations James Simmons
2015-12-23 21:24 ` [PATCH v2 03/13] staging: lustre: move kernel_user_comm.c from libcfs to lustre James Simmons
2015-12-23 21:24 ` [PATCH v2 04/13] staging: lustre: split kernel comm between user and kernel James Simmons
2015-12-23 21:24 ` [PATCH v2 05/13] staging: lustre: embed kr_data into kkuc_reg James Simmons
2015-12-23 21:24 ` [PATCH v2 06/13] staging: lustre: convert kernelcomm group to unsigned int James Simmons
2015-12-23 21:24 ` [PATCH v2 07/13] staging: lustre: remove unnecessary NULL checks in kernel_comm.c James Simmons
2015-12-23 21:24 ` [PATCH v2 08/13] staging: lustre: cleanup block comment style in kernel_comm code James Simmons
2015-12-23 21:24 ` [PATCH 09/13] staging: lustre: add space around '+' " James Simmons
2015-12-23 21:24 ` [PATCH 10/13] staging: lustre: use proper braces in libcfs_kkuc_group_put James Simmons
2015-12-23 21:24 ` [PATCH 11/13] staging: lustre: return proper error code for libcfs_kkuc_msg_put James Simmons
2015-12-23 21:24 ` [PATCH 12/13] staging: lustre: fix all conditional comparison to zero for kernelcomm.c James Simmons
2015-12-23 21:24 ` [PATCH 13/13] staging: lustre: cleanup white space in kernel comm code James Simmons
2016-02-03 22:19 ` [lustre-devel] [PATCH v2 00/13] staging:lustre: split kernel comm between user and kernel Greg Kroah-Hartman
2016-02-03 22:19   ` Greg Kroah-Hartman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.