Skip to contentSkip to conversation

staging:lustre: split kernel comm between user and kernel

PATCH Superseded James Simmons 4 participants 9 messages Oct 23, 2015 – Nov 4, 2015 Staging

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

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.

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

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

James Simmons (1):
staging:lustre: kg_sem semaphore handling is incorrectly

frank zago (3):
staging:lustre: move kernel_user_comm.c from libcfs to lustre staging:lustre: split kernel comm between user and kernel staging:lustre: Update license and copyright for kernel comm

 .../staging/lustre/include/linux/libcfs/libcfs.h   |    1 -
 .../staging/lustre/lustre/include/lustre_export.h  |    7 +++
 .../lustre/lustre/include/lustre_kernelcomm.h      |   56 ++++++++++++++++++++
 .../include/uapi_kernelcomm.h}                     |   52 +++++--------------
 drivers/staging/lustre/lustre/libcfs/Makefile      |    5 +-
 drivers/staging/lustre/lustre/llite/dir.c          |    1 +
 drivers/staging/lustre/lustre/lmv/lmv_obd.c        |   43 +++++++++++-----
 drivers/staging/lustre/lustre/mdc/lproc_mdc.c      |    2 +
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |   23 +++++---
 drivers/staging/lustre/lustre/obdclass/Makefile    |    7 ++-
 drivers/staging/lustre/lustre/obdclass/genops.c    |    1 +
 .../kernel_user_comm.c => obdclass/kernelcomm.c}   |   40 +++++++-------
 12 files changed, 150 insertions(+), 88 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} (61%)
 rename drivers/staging/lustre/lustre/{libcfs/kernel_user_comm.c => obdclass/kernelcomm.c} (88%)
#1 lore raw

PATCH 1/5 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 d9b7c6b..48df275 100644
@@ -184,7 +184,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);
@@ -196,7 +196,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 */
@@ -228,12 +228,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 1/1 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 a989d26..7323ca6 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, 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 1daf4c5..e0a5171 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 862d920..04c6d2d 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,8 +109,9 @@ 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, int group, __u32 data)
+int libcfs_kkuc_group_add(struct file *filp, int uid, int group, void *data)
 {
 	struct kkuc_reg *reg;
 
@@ -144,7 +145,7 @@ int libcfs_kkuc_group_add(struct file *filp, int uid, int group, __u32 data)
 }
 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;
 
@@ -170,6 +171,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 != NULL)
+				*pdata = reg->kr_data;
 			kfree(reg);
 		}
 	}
@@ -212,7 +215,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 635a93c..d6d70d8 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 != NULL)
+		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 == NULL)
 		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 == NULL) {
 		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 != 0) {
+		if (filp != NULL)
+			fput(filp);
+		kfree(kcd);
+	}
+
 	return rc;
 }
 
drivers/staging/lustre/lustre/mdc/mdc_request.c +14 -8
index 16a5a10..ee9381c 100644
@@ -2018,21 +2018,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 == NULL || 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;
 }
 
 /**
@@ -2382,7 +2388,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

Re: [PATCH] staging:lustre: Prevent duplicate CT registrations

drivers/staging/lustre/lustre/lmv/lmv_obd.c static void lmv_hsm_req_build(struct lmv_obd *lmv, · line 799

Quoted 12 lines · James Simmons
drivers/staging/lustre/lustre/lmv/lmv_obd.c +3 -1
index 635a93c..d6d70d8 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;

We have been introducing a lot of new __u32 types here and I just assumed there was a reason for it but this one is clearly wrong. The new code implies that ->ld_tgt_count can overflow INT_MAX which is not true and that this is code shared with userspace which might be true but it's not described in the changelog. Is this a static checker fix? Stop using that broken static checker, because the correct type here is int.

Anyway, stop making gratuitous unrelated changes (like the white space changes to local declarations). I feel like I have held off commenting on this for a while and shown great restraint. :P

drivers/staging/lustre/lustre/lmv/lmv_obd.c static int lmv_hsm_ct_unregister(struct lmv_obd *lmv, unsigned int cmd, int len, · line 814

Quoted 4 lines
drivers/staging/lustre/lustre/lmv/lmv_obd.c +3 -1
-	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 != NULL)
+		kfree(kcd);

NULL check not needed.

Quoted 31 lines
drivers/staging/lustre/lustre/lmv/lmv_obd.c +9 -8
+
 	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 == NULL)
 		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);

drivers/staging/lustre/lustre/lmv/lmv_obd.c static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len, · line 876

Quoted 10 lines
drivers/staging/lustre/lustre/lmv/lmv_obd.c +9 -0
+	if (kcd == NULL) {
 		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 != 0) {

These double negatives are a pet peev of mine. "if (rc) {" Comparing with zero like this is idiomatic when you're talking about the number zero or strcmp(). Can we use a goto for unwinding? goto free_kcd;

drivers/staging/lustre/lustre/lmv/lmv_obd.c static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len, · line 877

Quoted 1 line
drivers/staging/lustre/lustre/lmv/lmv_obd.c +1 -0
+		if (filp != NULL)

The earlier NULL check means this can't happen.

drivers/staging/lustre/lustre/lmv/lmv_obd.c static int lmv_hsm_ct_register(struct lmv_obd *lmv, unsigned int cmd, int len, · line 882

Quoted 5 lines
drivers/staging/lustre/lustre/lmv/lmv_obd.c +4 -0
+			fput(filp);
+		kfree(kcd);
+	}
+
 	return rc;
	return 0;

free_kcd:

	kfree(kcd);
put_filp:
	fput(filp);

	return rc;

regards,
dan carpenter

#4 lore raw

RE: [PATCH] staging:lustre: Prevent duplicate CT registrations

Quoted 14 lines · James Simmons

drivers/staging/lustre/lustre/lmv/lmv_obd.c static void lmv_hsm_req_build(struct lmv_obd *lmv, · line 799

Quoted 12 lines
drivers/staging/lustre/lustre/lmv/lmv_obd.c +3 -1
index 635a93c..d6d70d8 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;
Quoted 7 lines

We have been introducing a lot of new __u32 types here and I just assumed there was a reason for it but this one is clearly wrong. The new code implies that ->ld_tgt_count can overflow INT_MAX which is not true and that this is code shared with userspace which might be true but it's not described in the changelog. Is this a static checker fix? Stop using that broken static checker, because the correct type here is int.

No this patch is from a real fix. You can read the details at
https://jira.hpdd.intel.com/browse/LU-3882. I bet he did this to avoid the pickiness of gcc. We have build failure due to gcc stupidity. I could be wrong which if that is the case the original Author is CC.

Quoted 3 lines

Anyway, stop making gratuitous unrelated changes (like the white space changes to local declarations). I feel like I have held off commenting on this for a while and shown great restraint. :P

This is a direct drop of the original patch. I see lots of corrections to the code below. Would a new follow on patch to correct these issues be okay with you. This way we can perverse our bug fix history.

#5 lore raw

PATCH 1/1 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
#6 lore raw

PATCH 4/5 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      |   56 ++++++++++++++++++++
 .../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/lproc_mdc.c      |    2 +
 drivers/staging/lustre/lustre/mdc/mdc_request.c    |    1 +
 drivers/staging/lustre/lustre/obdclass/genops.c    |    1 +
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |    5 +-
 9 files changed, 76 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 5dd9cdf..1117310 100644
@@ -125,7 +125,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 +56 -0

56 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 3d746a9..6b2834d 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 50eccb1..ee16236 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/lproc_mdc.c +2 -0
index 1c95f87..7d7b671 100644
@@ -38,6 +38,8 @@
 #include <linux/vfs.h>
 #include "../include/obd_class.h"
 #include "../include/lprocfs_status.h"
+/* temporary for testing */
+#include "../include/lustre_kernelcomm.h"
 #include "mdc_internal.h"
 
 static ssize_t max_rpcs_in_flight_show(struct kobject *kobj,
drivers/staging/lustre/lustre/mdc/mdc_request.c +1 -0
index dc98239..4aa48e4 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 978c3c5..6181826 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 04c6d2d..70bd729 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
#7 lore raw

PATCH 5/5 staging:lustre: Update license and copyright for kernel comm

In reply to James Simmons

From: frank zago <[email protected]>

Point to the right place for GNU license. Update Intel copyright. Update Nathan Rutmans email address. This was broken out of the original patch 14270.

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

---
 .../lustre/lustre/include/lustre_kernelcomm.h      |    2 +-
 .../lustre/lustre/include/uapi_kernelcomm.h        |    2 +-
 .../staging/lustre/lustre/obdclass/kernelcomm.c    |   11 +++--------
 3 files changed, 5 insertions(+), 10 deletions(-)
drivers/staging/lustre/lustre/include/lustre_kernelcomm.h +1 -1
index a5baa80..a61263f 100644
@@ -28,7 +28,7 @@
 /*
  * This file is part of Lustre, http://www.lustre.org/
  *
- * Author: Nathan Rutman <[email protected]>
+ * Author: Nathan Rutman <[email protected]>
  *
  * Kernel <-> userspace communication routines.
  * The definitions below are used in the kernel and userspace.
drivers/staging/lustre/lustre/include/uapi_kernelcomm.h +1 -1
index 5e0b8de..ad608b7 100644
@@ -28,7 +28,7 @@
 /*
  * This file is part of Lustre, http://www.lustre.org/
  *
- * Author: Nathan Rutman <[email protected]>
+ * Author: Nathan Rutman <[email protected]>
  *
  * Kernel <-> userspace communication routines.
  * The definitions below are used in the kernel and userspace.
drivers/staging/lustre/lustre/obdclass/kernelcomm.c +3 -8
index 70bd729..978191a 100644
@@ -15,11 +15,7 @@
  *
  * 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
  */
@@ -27,13 +23,12 @@
  * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  * Use is subject to license terms.
  *
- * Copyright (c) 2012, Intel Corporation.
+ * Copyright (c) 2012, 2015, Intel Corporation.
  */
 /*
  * This file is part of Lustre, http://www.lustre.org/
- * Lustre is a trademark of Sun Microsystems, Inc.
  *
- * Author: Nathan Rutman <[email protected]>
+ * Author: Nathan Rutman <[email protected]>
  *
  * Kernel <-> userspace communication routines.
  * Using pipes for all arches.
Signature · 1 line
1.7.1
#8 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

The series didn't all have numbers on them, so I don't know what order to apply them in :(

Please resend them with the proper numbering on them so I know what to do here.

thanks,

greg k-h