All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/7] staging:lustre: get rid of IOC_LIBCFS_MEMHOG and IOC_LIBCFS_PANIC ioctls
@ 2016-01-05 19:35 James Simmons
  2016-01-05 19:35 ` [PATCH 1/7] staging:lustre: remove obsolete comment in libcfs_ioctl.h James Simmons
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: James Simmons @ 2016-01-05 19:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, James Simmons,
	Parinay Kondekar, James Simmons

Removing unused IOC_LIBCFS_MEMHOG and IOC_LIBCFS_PANIC ioctls
from the libcfs/ lnet/ code. This cleanup allows us to remove
the cfs_psdev abstraction.

Signed-off-by: Parinay Kondekar <parinay.kondekar@seagate.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492
Reviewed-by: Andreas Dilger <andreas.dilger@intel.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>

Parinay Kondekar (7):
  staging:lustre: remove obsolete comment in libcfs_ioctl.h
  staging:lustre: remove last bits of the IOC_LIBCFS_PANIC ioctl
  staging:lustre: remove the IOC_LIBCFS_MEMHOG ioctl
  staging:lustre: remove struct libcfs_device_userstate
  staging:lustre: simplify libcfs_psdev_[open|release]
  staging:lustre: call libcfs_ioctl directly
  staging:lustre: remove libcfs pseudo device abstraction

 .../staging/lustre/include/linux/libcfs/libcfs.h   |   23 +---
 .../lustre/include/linux/libcfs/libcfs_ioctl.h     |    5 +-
 .../lustre/include/linux/libcfs/libcfs_private.h   |    5 -
 .../staging/lustre/include/linux/lnet/lnetctl.h    |    2 -
 .../lustre/lustre/libcfs/linux/linux-module.c      |   54 +-----
 drivers/staging/lustre/lustre/libcfs/module.c      |  175 +-------------------
 6 files changed, 19 insertions(+), 245 deletions(-)


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

* [PATCH 1/7] staging:lustre: remove obsolete comment in libcfs_ioctl.h
  2016-01-05 19:35 [PATCH 0/7] staging:lustre: get rid of IOC_LIBCFS_MEMHOG and IOC_LIBCFS_PANIC ioctls James Simmons
@ 2016-01-05 19:35 ` James Simmons
  2016-02-03 22:41     ` [lustre-devel] " Greg Kroah-Hartman
  2016-01-05 19:35 ` [PATCH 2/7] staging:lustre: remove last bits of the IOC_LIBCFS_PANIC ioctl James Simmons
                   ` (5 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: James Simmons @ 2016-01-05 19:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, Parinay Kondekar, James Simmons

From: Parinay Kondekar <parinay.kondekar@seagate.com>

The libcfs_ioctl.h header has a comment about a snapshot ioctl
which has been removed for years. Lets remove the comment to
avoid confusion. Broken out of patch 17492.

Signed-off-by: Parinay Kondekar <parinay.kondekar@seagate.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492
Reviewed-by: Andreas Dilger <andreas.dilger@intel.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>
---
 .../lustre/include/linux/libcfs/libcfs_ioctl.h     |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
index 485ab26..ba47cdf 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
@@ -102,7 +102,6 @@ struct libcfs_ioctl_handler {
 /* FIXME check conflict with lustre_lib.h */
 #define LIBCFS_IOC_DEBUG_MASK	     _IOWR('f', 250, long)
 
-/* ioctls for manipulating snapshots 30- */
 #define IOC_LIBCFS_TYPE		   'e'
 #define IOC_LIBCFS_MIN_NR		 30
 /* libcfs ioctls */
-- 
1.7.1


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

* [PATCH 2/7] staging:lustre: remove last bits of the IOC_LIBCFS_PANIC ioctl
  2016-01-05 19:35 [PATCH 0/7] staging:lustre: get rid of IOC_LIBCFS_MEMHOG and IOC_LIBCFS_PANIC ioctls James Simmons
  2016-01-05 19:35 ` [PATCH 1/7] staging:lustre: remove obsolete comment in libcfs_ioctl.h James Simmons
@ 2016-01-05 19:35 ` James Simmons
  2016-01-05 19:35 ` [PATCH 3/7] staging:lustre: remove the IOC_LIBCFS_MEMHOG ioctl James Simmons
                   ` (4 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2016-01-05 19:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, Parinay Kondekar, James Simmons

From: Parinay Kondekar <parinay.kondekar@seagate.com>

A few pieces still exist for the IOC_LIBCFS_PANIC ioctl. Remove
these last bits to prevent old tools from using them. The latest
lustre utilities no longer use this ioctl.

Signed-off-by: Parinay Kondekar <parinay.kondekar@seagate.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492
Reviewed-by: Andreas Dilger <andreas.dilger@intel.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>
---
 .../lustre/include/linux/libcfs/libcfs_ioctl.h     |    2 +-
 .../staging/lustre/include/linux/lnet/lnetctl.h    |    1 -
 .../lustre/lustre/libcfs/linux/linux-module.c      |    5 -----
 drivers/staging/lustre/lustre/libcfs/module.c      |    5 +----
 4 files changed, 2 insertions(+), 11 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
index ba47cdf..b0d5c78 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
@@ -105,7 +105,7 @@ struct libcfs_ioctl_handler {
 #define IOC_LIBCFS_TYPE		   'e'
 #define IOC_LIBCFS_MIN_NR		 30
 /* libcfs ioctls */
-#define IOC_LIBCFS_PANIC		   _IOWR('e', 30, long)
+/* IOC_LIBCFS_PANIC obsolete in 2.8.0, was _IOWR('e', 30, IOCTL_LIBCFS_TYPE) */
 #define IOC_LIBCFS_CLEAR_DEBUG	     _IOWR('e', 31, long)
 #define IOC_LIBCFS_MARK_DEBUG	      _IOWR('e', 32, long)
 #define IOC_LIBCFS_MEMHOG		  _IOWR('e', 36, long)
diff --git a/drivers/staging/lustre/include/linux/lnet/lnetctl.h b/drivers/staging/lustre/include/linux/lnet/lnetctl.h
index bdd69b2..b9ec555 100644
--- a/drivers/staging/lustre/include/linux/lnet/lnetctl.h
+++ b/drivers/staging/lustre/include/linux/lnet/lnetctl.h
@@ -74,6 +74,5 @@ int jt_dbg_debug_file(int argc, char **argv);
 int jt_dbg_clear_debug_buf(int argc, char **argv);
 int jt_dbg_mark_debug_buf(int argc, char **argv);
 int jt_dbg_modules(int argc, char **argv);
-int jt_dbg_panic(int argc, char **argv);
 
 #endif
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
index 70a99cf..4ade712 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
@@ -147,11 +147,6 @@ static long libcfs_ioctl(struct file *file,
 
 	/* Handle platform-dependent IOC requests */
 	switch (cmd) {
-	case IOC_LIBCFS_PANIC:
-		if (!capable(CFS_CAP_SYS_BOOT))
-			return -EPERM;
-		panic("debugctl-invoked panic");
-		return 0;
 	case IOC_LIBCFS_MEMHOG:
 		if (!capable(CFS_CAP_SYS_ADMIN))
 			return -EPERM;
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
index 329d78c..1ad67c6 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -250,10 +250,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
 	case IOC_LIBCFS_CLEAR_DEBUG:
 		libcfs_debug_clear_buffer();
 		return 0;
-	/*
-	 * case IOC_LIBCFS_PANIC:
-	 * Handled in arch/cfs_module.c
-	 */
+
 	case IOC_LIBCFS_MARK_DEBUG:
 		if (data->ioc_inlbuf1 == NULL ||
 		    data->ioc_inlbuf1[data->ioc_inllen1 - 1] != '\0')
-- 
1.7.1


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

* [PATCH 3/7] staging:lustre: remove the IOC_LIBCFS_MEMHOG ioctl
  2016-01-05 19:35 [PATCH 0/7] staging:lustre: get rid of IOC_LIBCFS_MEMHOG and IOC_LIBCFS_PANIC ioctls James Simmons
  2016-01-05 19:35 ` [PATCH 1/7] staging:lustre: remove obsolete comment in libcfs_ioctl.h James Simmons
  2016-01-05 19:35 ` [PATCH 2/7] staging:lustre: remove last bits of the IOC_LIBCFS_PANIC ioctl James Simmons
@ 2016-01-05 19:35 ` James Simmons
  2016-01-05 19:35 ` [PATCH 4/7] staging:lustre: remove struct libcfs_device_userstate James Simmons
                   ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2016-01-05 19:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, Parinay Kondekar, James Simmons

From: Parinay Kondekar <parinay.kondekar@seagate.com>

The IOC_LIBCFS_MEMHOG is not needed so remove it.

Signed-off-by: Parinay Kondekar <parinay.kondekar@seagate.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492
Reviewed-by: Andreas Dilger <andreas.dilger@intel.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>
---
 .../lustre/include/linux/libcfs/libcfs_ioctl.h     |    2 +-
 .../staging/lustre/include/linux/lnet/lnetctl.h    |    1 -
 .../lustre/lustre/libcfs/linux/linux-module.c      |    8 --
 drivers/staging/lustre/lustre/libcfs/module.c      |  125 +-------------------
 4 files changed, 2 insertions(+), 134 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
index b0d5c78..7e8ccf6 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_ioctl.h
@@ -108,7 +108,7 @@ struct libcfs_ioctl_handler {
 /* IOC_LIBCFS_PANIC obsolete in 2.8.0, was _IOWR('e', 30, IOCTL_LIBCFS_TYPE) */
 #define IOC_LIBCFS_CLEAR_DEBUG	     _IOWR('e', 31, long)
 #define IOC_LIBCFS_MARK_DEBUG	      _IOWR('e', 32, long)
-#define IOC_LIBCFS_MEMHOG		  _IOWR('e', 36, long)
+/* IOC_LIBCFS_MEMHOG obsolete in 2.8.0, was _IOWR('e', 36, IOCTL_LIBCFS_TYPE) */
 /* lnet ioctls */
 #define IOC_LIBCFS_GET_NI		  _IOWR('e', 50, long)
 #define IOC_LIBCFS_FAIL_NID		_IOWR('e', 51, long)
diff --git a/drivers/staging/lustre/include/linux/lnet/lnetctl.h b/drivers/staging/lustre/include/linux/lnet/lnetctl.h
index b9ec555..a437bf0 100644
--- a/drivers/staging/lustre/include/linux/lnet/lnetctl.h
+++ b/drivers/staging/lustre/include/linux/lnet/lnetctl.h
@@ -62,7 +62,6 @@ int jt_ptl_print_routes(int argc, char **argv);
 int jt_ptl_fail_nid(int argc, char **argv);
 int jt_ptl_lwt(int argc, char **argv);
 int jt_ptl_testprotocompat(int argc, char **argv);
-int jt_ptl_memhog(int argc, char **argv);
 
 int dbg_initialize(int argc, char **argv);
 int jt_dbg_filter(int argc, char **argv);
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
index 4ade712..0dffff7 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
@@ -145,14 +145,6 @@ static long libcfs_ioctl(struct file *file,
 		return -EINVAL;
 	}
 
-	/* Handle platform-dependent IOC requests */
-	switch (cmd) {
-	case IOC_LIBCFS_MEMHOG:
-		if (!capable(CFS_CAP_SYS_ADMIN))
-			return -EPERM;
-		/* go thought */
-	}
-
 	pfile.off = 0;
 	pfile.private_data = file->private_data;
 	if (libcfs_psdev_ops.p_ioctl != NULL)
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
index 1ad67c6..286c53f 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -68,114 +68,6 @@ MODULE_LICENSE("GPL");
 
 static struct dentry *lnet_debugfs_root;
 
-static void kportal_memhog_free(struct libcfs_device_userstate *ldu)
-{
-	struct page **level0p = &ldu->ldu_memhog_root_page;
-	struct page **level1p;
-	struct page **level2p;
-	int	   count1;
-	int	   count2;
-
-	if (*level0p != NULL) {
-
-		level1p = (struct page **)page_address(*level0p);
-		count1 = 0;
-
-		while (count1 < PAGE_CACHE_SIZE/sizeof(struct page *) &&
-		       *level1p != NULL) {
-
-			level2p = (struct page **)page_address(*level1p);
-			count2 = 0;
-
-			while (count2 < PAGE_CACHE_SIZE/sizeof(struct page *) &&
-			       *level2p != NULL) {
-
-				__free_page(*level2p);
-				ldu->ldu_memhog_pages--;
-				level2p++;
-				count2++;
-			}
-
-			__free_page(*level1p);
-			ldu->ldu_memhog_pages--;
-			level1p++;
-			count1++;
-		}
-
-		__free_page(*level0p);
-		ldu->ldu_memhog_pages--;
-
-		*level0p = NULL;
-	}
-
-	LASSERT(ldu->ldu_memhog_pages == 0);
-}
-
-static int kportal_memhog_alloc(struct libcfs_device_userstate *ldu, int npages,
-		     gfp_t flags)
-{
-	struct page **level0p;
-	struct page **level1p;
-	struct page **level2p;
-	int	   count1;
-	int	   count2;
-
-	LASSERT(ldu->ldu_memhog_pages == 0);
-	LASSERT(ldu->ldu_memhog_root_page == NULL);
-
-	if (npages < 0)
-		return -EINVAL;
-
-	if (npages == 0)
-		return 0;
-
-	level0p = &ldu->ldu_memhog_root_page;
-	*level0p = alloc_page(flags);
-	if (*level0p == NULL)
-		return -ENOMEM;
-	ldu->ldu_memhog_pages++;
-
-	level1p = (struct page **)page_address(*level0p);
-	count1 = 0;
-	memset(level1p, 0, PAGE_CACHE_SIZE);
-
-	while (ldu->ldu_memhog_pages < npages &&
-	       count1 < PAGE_CACHE_SIZE/sizeof(struct page *)) {
-
-		if (cfs_signal_pending())
-			return -EINTR;
-
-		*level1p = alloc_page(flags);
-		if (*level1p == NULL)
-			return -ENOMEM;
-		ldu->ldu_memhog_pages++;
-
-		level2p = (struct page **)page_address(*level1p);
-		count2 = 0;
-		memset(level2p, 0, PAGE_CACHE_SIZE);
-
-		while (ldu->ldu_memhog_pages < npages &&
-		       count2 < PAGE_CACHE_SIZE/sizeof(struct page *)) {
-
-			if (cfs_signal_pending())
-				return -EINTR;
-
-			*level2p = alloc_page(flags);
-			if (*level2p == NULL)
-				return -ENOMEM;
-			ldu->ldu_memhog_pages++;
-
-			level2p++;
-			count2++;
-		}
-
-		level1p++;
-		count1++;
-	}
-
-	return 0;
-}
-
 /* called when opening /dev/device */
 static int libcfs_psdev_open(unsigned long flags, void *args)
 {
@@ -199,10 +91,8 @@ static int libcfs_psdev_release(unsigned long flags, void *args)
 	struct libcfs_device_userstate *ldu;
 
 	ldu = (struct libcfs_device_userstate *)args;
-	if (ldu != NULL) {
-		kportal_memhog_free(ldu);
+	if (ldu != NULL)
 		LIBCFS_FREE(ldu, sizeof(*ldu));
-	}
 
 	module_put(THIS_MODULE);
 	return 0;
@@ -257,19 +147,6 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
 			return -EINVAL;
 		libcfs_debug_mark_buffer(data->ioc_inlbuf1);
 		return 0;
-	case IOC_LIBCFS_MEMHOG:
-		if (pfile->private_data == NULL) {
-			err = -EINVAL;
-		} else {
-			kportal_memhog_free(pfile->private_data);
-			/* XXX The ioc_flags is not GFP flags now, need to be fixed */
-			err = kportal_memhog_alloc(pfile->private_data,
-						   data->ioc_count,
-						   data->ioc_flags);
-			if (err != 0)
-				kportal_memhog_free(pfile->private_data);
-		}
-		break;
 
 	default: {
 		struct libcfs_ioctl_handler *hand;
-- 
1.7.1


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

* [PATCH 4/7] staging:lustre: remove struct libcfs_device_userstate
  2016-01-05 19:35 [PATCH 0/7] staging:lustre: get rid of IOC_LIBCFS_MEMHOG and IOC_LIBCFS_PANIC ioctls James Simmons
                   ` (2 preceding siblings ...)
  2016-01-05 19:35 ` [PATCH 3/7] staging:lustre: remove the IOC_LIBCFS_MEMHOG ioctl James Simmons
@ 2016-01-05 19:35 ` James Simmons
  2016-01-05 19:35 ` [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release] James Simmons
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2016-01-05 19:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, Parinay Kondekar, James Simmons

From: Parinay Kondekar <parinay.kondekar@seagate.com>

With the removal of the IOC_LIBCFS_MEMHOG ioctl we no
longer need struct libcfs_device_userstate.

Signed-off-by: Parinay Kondekar <parinay.kondekar@seagate.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492
Reviewed-by: Andreas Dilger <andreas.dilger@intel.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>
---
 .../lustre/include/linux/libcfs/libcfs_private.h   |    5 -----
 .../lustre/lustre/libcfs/linux/linux-module.c      |    8 ++------
 drivers/staging/lustre/lustre/libcfs/module.c      |   16 ----------------
 3 files changed, 2 insertions(+), 27 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
index d6273e1..e044d6f 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs_private.h
@@ -391,11 +391,6 @@ int cfs_percpt_atomic_summary(atomic_t **refs);
  * Support for temporary event tracing with minimal Heisenberg effect.
  * -------------------------------------------------------------------- */
 
-struct libcfs_device_userstate {
-	int	   ldu_memhog_pages;
-	struct page   *ldu_memhog_root_page;
-};
-
 #define MKSTR(ptr) ((ptr)) ? (ptr) : ""
 
 static inline int cfs_size_round4(int val)
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
index 0dffff7..33f6036 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
@@ -98,14 +98,12 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size)
 static int
 libcfs_psdev_open(struct inode *inode, struct file *file)
 {
-	struct libcfs_device_userstate **pdu = NULL;
 	int    rc = 0;
 
 	if (!inode)
 		return -EINVAL;
-	pdu = (struct libcfs_device_userstate **)&file->private_data;
 	if (libcfs_psdev_ops.p_open != NULL)
-		rc = libcfs_psdev_ops.p_open(0, (void *)pdu);
+		rc = libcfs_psdev_ops.p_open(0, NULL);
 	else
 		return -EPERM;
 	return rc;
@@ -115,14 +113,12 @@ libcfs_psdev_open(struct inode *inode, struct file *file)
 static int
 libcfs_psdev_release(struct inode *inode, struct file *file)
 {
-	struct libcfs_device_userstate *pdu;
 	int    rc = 0;
 
 	if (!inode)
 		return -EINVAL;
-	pdu = file->private_data;
 	if (libcfs_psdev_ops.p_close != NULL)
-		rc = libcfs_psdev_ops.p_close(0, (void *)pdu);
+		rc = libcfs_psdev_ops.p_close(0, NULL);
 	else
 		rc = -EPERM;
 	return rc;
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
index 286c53f..80d2333 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -71,29 +71,13 @@ static struct dentry *lnet_debugfs_root;
 /* called when opening /dev/device */
 static int libcfs_psdev_open(unsigned long flags, void *args)
 {
-	struct libcfs_device_userstate *ldu;
-
 	try_module_get(THIS_MODULE);
-
-	LIBCFS_ALLOC(ldu, sizeof(*ldu));
-	if (ldu != NULL) {
-		ldu->ldu_memhog_pages = 0;
-		ldu->ldu_memhog_root_page = NULL;
-	}
-	*(struct libcfs_device_userstate **)args = ldu;
-
 	return 0;
 }
 
 /* called when closing /dev/device */
 static int libcfs_psdev_release(unsigned long flags, void *args)
 {
-	struct libcfs_device_userstate *ldu;
-
-	ldu = (struct libcfs_device_userstate *)args;
-	if (ldu != NULL)
-		LIBCFS_FREE(ldu, sizeof(*ldu));
-
 	module_put(THIS_MODULE);
 	return 0;
 }
-- 
1.7.1


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

* [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release]
  2016-01-05 19:35 [PATCH 0/7] staging:lustre: get rid of IOC_LIBCFS_MEMHOG and IOC_LIBCFS_PANIC ioctls James Simmons
                   ` (3 preceding siblings ...)
  2016-01-05 19:35 ` [PATCH 4/7] staging:lustre: remove struct libcfs_device_userstate James Simmons
@ 2016-01-05 19:35 ` James Simmons
  2016-02-03 22:40     ` [lustre-devel] " Greg Kroah-Hartman
  2016-01-05 19:35 ` [PATCH 6/7] staging:lustre: call libcfs_ioctl directly James Simmons
  2016-01-05 19:35 ` [PATCH 7/7] staging:lustre: remove libcfs pseudo device abstraction James Simmons
  6 siblings, 1 reply; 14+ messages in thread
From: James Simmons @ 2016-01-05 19:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, Parinay Kondekar, James Simmons

From: Parinay Kondekar <parinay.kondekar@seagate.com>

With struct libcfs_device_userstate gone we can move
the remaining code of libcfs_psdev_ops.p_[open|close]
into the libcfs_psdev_[open|release] functions directly.

Signed-off-by: Parinay Kondekar <parinay.kondekar@seagate.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492
Reviewed-by: Andreas Dilger <andreas.dilger@intel.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>
---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |    2 --
 .../lustre/lustre/libcfs/linux/linux-module.c      |   20 ++++++--------------
 drivers/staging/lustre/lustre/libcfs/module.c      |   16 ----------------
 3 files changed, 6 insertions(+), 32 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 0d8a91e..06bb676 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -73,8 +73,6 @@ struct cfs_psdev_file {
 };
 
 struct cfs_psdev_ops {
-	int (*p_open)(unsigned long, void *);
-	int (*p_close)(unsigned long, void *);
 	int (*p_read)(struct cfs_psdev_file *, char *, unsigned long);
 	int (*p_write)(struct cfs_psdev_file *, char *, unsigned long);
 	int (*p_ioctl)(struct cfs_psdev_file *, unsigned long, void *);
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
index 33f6036..64f0fbf 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
@@ -98,30 +98,22 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size)
 static int
 libcfs_psdev_open(struct inode *inode, struct file *file)
 {
-	int    rc = 0;
-
 	if (!inode)
 		return -EINVAL;
-	if (libcfs_psdev_ops.p_open != NULL)
-		rc = libcfs_psdev_ops.p_open(0, NULL);
-	else
-		return -EPERM;
-	return rc;
+
+	try_module_get(THIS_MODULE);
+	return 0;
 }
 
 /* called when closing /dev/device */
 static int
 libcfs_psdev_release(struct inode *inode, struct file *file)
 {
-	int    rc = 0;
-
 	if (!inode)
 		return -EINVAL;
-	if (libcfs_psdev_ops.p_close != NULL)
-		rc = libcfs_psdev_ops.p_close(0, NULL);
-	else
-		rc = -EPERM;
-	return rc;
+
+	module_put(THIS_MODULE);
+	return 0;
 }
 
 static long libcfs_ioctl(struct file *file,
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
index 80d2333..8a8a533 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -68,20 +68,6 @@ MODULE_LICENSE("GPL");
 
 static struct dentry *lnet_debugfs_root;
 
-/* called when opening /dev/device */
-static int libcfs_psdev_open(unsigned long flags, void *args)
-{
-	try_module_get(THIS_MODULE);
-	return 0;
-}
-
-/* called when closing /dev/device */
-static int libcfs_psdev_release(unsigned long flags, void *args)
-{
-	module_put(THIS_MODULE);
-	return 0;
-}
-
 static DECLARE_RWSEM(ioctl_list_sem);
 static LIST_HEAD(ioctl_list);
 
@@ -180,8 +166,6 @@ out:
 }
 
 struct cfs_psdev_ops libcfs_psdev_ops = {
-	libcfs_psdev_open,
-	libcfs_psdev_release,
 	NULL,
 	NULL,
 	libcfs_ioctl
-- 
1.7.1


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

* [PATCH 6/7] staging:lustre: call libcfs_ioctl directly
  2016-01-05 19:35 [PATCH 0/7] staging:lustre: get rid of IOC_LIBCFS_MEMHOG and IOC_LIBCFS_PANIC ioctls James Simmons
                   ` (4 preceding siblings ...)
  2016-01-05 19:35 ` [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release] James Simmons
@ 2016-01-05 19:35 ` James Simmons
  2016-01-05 19:35 ` [PATCH 7/7] staging:lustre: remove libcfs pseudo device abstraction James Simmons
  6 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2016-01-05 19:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, Parinay Kondekar, James Simmons

From: Parinay Kondekar <parinay.kondekar@seagate.com>

No reason to go through the cfs_psdev_ops abstract
to call libcfs_ioctl. Just call libcfs_ioctl directly.

Signed-off-by: Parinay Kondekar <parinay.kondekar@seagate.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492
Reviewed-by: Andreas Dilger <andreas.dilger@intel.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>
---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |    2 +-
 .../lustre/lustre/libcfs/linux/linux-module.c      |   13 ++++---------
 drivers/staging/lustre/lustre/libcfs/module.c      |    4 ++--
 3 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 06bb676..38d65ee 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -75,8 +75,8 @@ struct cfs_psdev_file {
 struct cfs_psdev_ops {
 	int (*p_read)(struct cfs_psdev_file *, char *, unsigned long);
 	int (*p_write)(struct cfs_psdev_file *, char *, unsigned long);
-	int (*p_ioctl)(struct cfs_psdev_file *, unsigned long, void *);
 };
+int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg);
 
 /*
  * Drop into debugger, if possible. Implementation is provided by platform.
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
index 64f0fbf..0710d0b 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
@@ -116,11 +116,10 @@ libcfs_psdev_release(struct inode *inode, struct file *file)
 	return 0;
 }
 
-static long libcfs_ioctl(struct file *file,
-			 unsigned int cmd, unsigned long arg)
+static long
+libcfs_psdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
 	struct cfs_psdev_file	 pfile;
-	int    rc = 0;
 
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
@@ -135,15 +134,11 @@ static long libcfs_ioctl(struct file *file,
 
 	pfile.off = 0;
 	pfile.private_data = file->private_data;
-	if (libcfs_psdev_ops.p_ioctl != NULL)
-		rc = libcfs_psdev_ops.p_ioctl(&pfile, cmd, (void *)arg);
-	else
-		rc = -EPERM;
-	return rc;
+	return libcfs_ioctl(&pfile, cmd, (void __user *)arg);
 }
 
 static const struct file_operations libcfs_fops = {
-	.unlocked_ioctl	= libcfs_ioctl,
+	.unlocked_ioctl	= libcfs_psdev_ioctl,
 	.open		= libcfs_psdev_open,
 	.release	= libcfs_psdev_release,
 };
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
index 8a8a533..63b2b37 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -140,7 +140,8 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
 	return err;
 }
 
-static int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg)
+int
+libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg)
 {
 	char    *buf;
 	struct libcfs_ioctl_data *data;
@@ -168,7 +169,6 @@ out:
 struct cfs_psdev_ops libcfs_psdev_ops = {
 	NULL,
 	NULL,
-	libcfs_ioctl
 };
 
 static int proc_call_handler(void *data, int write, loff_t *ppos,
-- 
1.7.1


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

* [PATCH 7/7] staging:lustre: remove libcfs pseudo device abstraction
  2016-01-05 19:35 [PATCH 0/7] staging:lustre: get rid of IOC_LIBCFS_MEMHOG and IOC_LIBCFS_PANIC ioctls James Simmons
                   ` (5 preceding siblings ...)
  2016-01-05 19:35 ` [PATCH 6/7] staging:lustre: call libcfs_ioctl directly James Simmons
@ 2016-01-05 19:35 ` James Simmons
  6 siblings, 0 replies; 14+ messages in thread
From: James Simmons @ 2016-01-05 19:35 UTC (permalink / raw)
  To: Greg Kroah-Hartman, devel, Oleg Drokin, Andreas Dilger
  Cc: Linux Kernel Mailing List, lustre-devel, Parinay Kondekar, James Simmons

From: Parinay Kondekar <parinay.kondekar@seagate.com>

With the libcfs ioctl cleanup we no longer need the libcfs
pseudo device abstraction.

Signed-off-by: Parinay Kondekar <parinay.kondekar@seagate.com>
Signed-off-by: James Simmons <uja.ornl@yahoo.com>
Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
Reviewed-on: http://review.whamcloud.com/17492
Reviewed-by: Andreas Dilger <andreas.dilger@intel.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>
---
 .../staging/lustre/include/linux/libcfs/libcfs.h   |   21 +-------------------
 .../lustre/lustre/libcfs/linux/linux-module.c      |    6 +----
 drivers/staging/lustre/lustre/libcfs/module.c      |   13 +++--------
 3 files changed, 6 insertions(+), 34 deletions(-)

diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
index 38d65ee..6995367 100644
--- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
+++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
@@ -59,24 +59,7 @@
 #define LNET_ACCEPTOR_MIN_RESERVED_PORT    512
 #define LNET_ACCEPTOR_MAX_RESERVED_PORT    1023
 
-/*
- * libcfs pseudo device operations
- *
- * It's just draft now.
- */
-
-struct cfs_psdev_file {
-	unsigned long   off;
-	void	    *private_data;
-	unsigned long   reserved1;
-	unsigned long   reserved2;
-};
-
-struct cfs_psdev_ops {
-	int (*p_read)(struct cfs_psdev_file *, char *, unsigned long);
-	int (*p_write)(struct cfs_psdev_file *, char *, unsigned long);
-};
-int libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg);
+int libcfs_ioctl(unsigned long cmd, void *arg);
 
 /*
  * Drop into debugger, if possible. Implementation is provided by platform.
@@ -143,8 +126,6 @@ extern struct miscdevice libcfs_dev;
 extern char lnet_upcall[1024];
 extern char lnet_debug_log_upcall[1024];
 
-extern struct cfs_psdev_ops libcfs_psdev_ops;
-
 extern struct cfs_wi_sched *cfs_sched_rehash;
 
 struct lnet_debugfs_symlink_def {
diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
index 0710d0b..02ef039 100644
--- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
@@ -119,8 +119,6 @@ libcfs_psdev_release(struct inode *inode, struct file *file)
 static long
 libcfs_psdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 {
-	struct cfs_psdev_file	 pfile;
-
 	if (!capable(CAP_SYS_ADMIN))
 		return -EACCES;
 
@@ -132,9 +130,7 @@ libcfs_psdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
 		return -EINVAL;
 	}
 
-	pfile.off = 0;
-	pfile.private_data = file->private_data;
-	return libcfs_ioctl(&pfile, cmd, (void __user *)arg);
+	return libcfs_ioctl(cmd, (void __user *)arg);
 }
 
 static const struct file_operations libcfs_fops = {
diff --git a/drivers/staging/lustre/lustre/libcfs/module.c b/drivers/staging/lustre/lustre/libcfs/module.c
index 63b2b37..1c8da7d 100644
--- a/drivers/staging/lustre/lustre/libcfs/module.c
+++ b/drivers/staging/lustre/lustre/libcfs/module.c
@@ -101,8 +101,8 @@ int libcfs_deregister_ioctl(struct libcfs_ioctl_handler *hand)
 }
 EXPORT_SYMBOL(libcfs_deregister_ioctl);
 
-static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
-			    void *arg, struct libcfs_ioctl_data *data)
+static int
+libcfs_ioctl_int(unsigned long cmd, void *arg, struct libcfs_ioctl_data *data)
 {
 	int err = -EINVAL;
 
@@ -141,7 +141,7 @@ static int libcfs_ioctl_int(struct cfs_psdev_file *pfile, unsigned long cmd,
 }
 
 int
-libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg)
+libcfs_ioctl(unsigned long cmd, void *arg)
 {
 	char    *buf;
 	struct libcfs_ioctl_data *data;
@@ -159,18 +159,13 @@ libcfs_ioctl(struct cfs_psdev_file *pfile, unsigned long cmd, void *arg)
 	}
 	data = (struct libcfs_ioctl_data *)buf;
 
-	err = libcfs_ioctl_int(pfile, cmd, arg, data);
+	err = libcfs_ioctl_int(cmd, arg, data);
 
 out:
 	LIBCFS_FREE(buf, 1024);
 	return err;
 }
 
-struct cfs_psdev_ops libcfs_psdev_ops = {
-	NULL,
-	NULL,
-};
-
 static int proc_call_handler(void *data, int write, loff_t *ppos,
 		void __user *buffer, size_t *lenp,
 		int (*handler)(void *data, int write,
-- 
1.7.1


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

* Re: [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release]
  2016-01-05 19:35 ` [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release] James Simmons
@ 2016-02-03 22:40     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2016-02-03 22:40 UTC (permalink / raw)
  To: James Simmons
  Cc: devel, Oleg Drokin, Andreas Dilger, Parinay Kondekar,
	James Simmons, Linux Kernel Mailing List, lustre-devel

On Tue, Jan 05, 2016 at 02:35:17PM -0500, James Simmons wrote:
> From: Parinay Kondekar <parinay.kondekar@seagate.com>
> 
> With struct libcfs_device_userstate gone we can move
> the remaining code of libcfs_psdev_ops.p_[open|close]
> into the libcfs_psdev_[open|release] functions directly.
> 
> Signed-off-by: Parinay Kondekar <parinay.kondekar@seagate.com>
> Signed-off-by: James Simmons <uja.ornl@yahoo.com>
> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
> Reviewed-on: http://review.whamcloud.com/17492
> Reviewed-by: Andreas Dilger <andreas.dilger@intel.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>
> ---
>  .../staging/lustre/include/linux/libcfs/libcfs.h   |    2 --
>  .../lustre/lustre/libcfs/linux/linux-module.c      |   20 ++++++--------------
>  drivers/staging/lustre/lustre/libcfs/module.c      |   16 ----------------
>  3 files changed, 6 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
> index 0d8a91e..06bb676 100644
> --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
> +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
> @@ -73,8 +73,6 @@ struct cfs_psdev_file {
>  };
>  
>  struct cfs_psdev_ops {
> -	int (*p_open)(unsigned long, void *);
> -	int (*p_close)(unsigned long, void *);
>  	int (*p_read)(struct cfs_psdev_file *, char *, unsigned long);
>  	int (*p_write)(struct cfs_psdev_file *, char *, unsigned long);
>  	int (*p_ioctl)(struct cfs_psdev_file *, unsigned long, void *);
> diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
> index 33f6036..64f0fbf 100644
> --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
> +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
> @@ -98,30 +98,22 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size)
>  static int
>  libcfs_psdev_open(struct inode *inode, struct file *file)
>  {
> -	int    rc = 0;
> -
>  	if (!inode)
>  		return -EINVAL;
> -	if (libcfs_psdev_ops.p_open != NULL)
> -		rc = libcfs_psdev_ops.p_open(0, NULL);
> -	else
> -		return -EPERM;
> -	return rc;
> +
> +	try_module_get(THIS_MODULE);

Note, code like this is racy and incorrect and never needed, please fix
this up properly (hint, set the module in the file operations.)

Again, if you ever see code with that line, it is incorrect.

thanks,

greg k-h

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

* [lustre-devel] [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release]
@ 2016-02-03 22:40     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2016-02-03 22:40 UTC (permalink / raw)
  To: James Simmons
  Cc: devel, Oleg Drokin, Andreas Dilger, Parinay Kondekar,
	James Simmons, Linux Kernel Mailing List, lustre-devel

On Tue, Jan 05, 2016 at 02:35:17PM -0500, James Simmons wrote:
> From: Parinay Kondekar <parinay.kondekar@seagate.com>
> 
> With struct libcfs_device_userstate gone we can move
> the remaining code of libcfs_psdev_ops.p_[open|close]
> into the libcfs_psdev_[open|release] functions directly.
> 
> Signed-off-by: Parinay Kondekar <parinay.kondekar@seagate.com>
> Signed-off-by: James Simmons <uja.ornl@yahoo.com>
> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
> Reviewed-on: http://review.whamcloud.com/17492
> Reviewed-by: Andreas Dilger <andreas.dilger@intel.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>
> ---
>  .../staging/lustre/include/linux/libcfs/libcfs.h   |    2 --
>  .../lustre/lustre/libcfs/linux/linux-module.c      |   20 ++++++--------------
>  drivers/staging/lustre/lustre/libcfs/module.c      |   16 ----------------
>  3 files changed, 6 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/staging/lustre/include/linux/libcfs/libcfs.h b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
> index 0d8a91e..06bb676 100644
> --- a/drivers/staging/lustre/include/linux/libcfs/libcfs.h
> +++ b/drivers/staging/lustre/include/linux/libcfs/libcfs.h
> @@ -73,8 +73,6 @@ struct cfs_psdev_file {
>  };
>  
>  struct cfs_psdev_ops {
> -	int (*p_open)(unsigned long, void *);
> -	int (*p_close)(unsigned long, void *);
>  	int (*p_read)(struct cfs_psdev_file *, char *, unsigned long);
>  	int (*p_write)(struct cfs_psdev_file *, char *, unsigned long);
>  	int (*p_ioctl)(struct cfs_psdev_file *, unsigned long, void *);
> diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
> index 33f6036..64f0fbf 100644
> --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
> +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
> @@ -98,30 +98,22 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size)
>  static int
>  libcfs_psdev_open(struct inode *inode, struct file *file)
>  {
> -	int    rc = 0;
> -
>  	if (!inode)
>  		return -EINVAL;
> -	if (libcfs_psdev_ops.p_open != NULL)
> -		rc = libcfs_psdev_ops.p_open(0, NULL);
> -	else
> -		return -EPERM;
> -	return rc;
> +
> +	try_module_get(THIS_MODULE);

Note, code like this is racy and incorrect and never needed, please fix
this up properly (hint, set the module in the file operations.)

Again, if you ever see code with that line, it is incorrect.

thanks,

greg k-h

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

* Re: [PATCH 1/7] staging:lustre: remove obsolete comment in libcfs_ioctl.h
  2016-01-05 19:35 ` [PATCH 1/7] staging:lustre: remove obsolete comment in libcfs_ioctl.h James Simmons
@ 2016-02-03 22:41     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2016-02-03 22:41 UTC (permalink / raw)
  To: James Simmons
  Cc: devel, Oleg Drokin, Andreas Dilger, Parinay Kondekar,
	James Simmons, Linux Kernel Mailing List, lustre-devel

On Tue, Jan 05, 2016 at 02:35:13PM -0500, James Simmons wrote:
> From: Parinay Kondekar <parinay.kondekar@seagate.com>
> 
> The libcfs_ioctl.h header has a comment about a snapshot ioctl
> which has been removed for years. Lets remove the comment to
> avoid confusion. Broken out of patch 17492.
> 
> Signed-off-by: Parinay Kondekar <parinay.kondekar@seagate.com>
> Signed-off-by: James Simmons <uja.ornl@yahoo.com>
> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
> Reviewed-on: http://review.whamcloud.com/17492
> Reviewed-by: Andreas Dilger <andreas.dilger@intel.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>
> ---
>  .../lustre/include/linux/libcfs/libcfs_ioctl.h     |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)

Only this patch applied in this series, please rebase the rest of them
(fixing up the one I pointed out) and resend.

thanks,

greg k-h

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

* [lustre-devel] [PATCH 1/7] staging:lustre: remove obsolete comment in libcfs_ioctl.h
@ 2016-02-03 22:41     ` Greg Kroah-Hartman
  0 siblings, 0 replies; 14+ messages in thread
From: Greg Kroah-Hartman @ 2016-02-03 22:41 UTC (permalink / raw)
  To: James Simmons
  Cc: devel, Oleg Drokin, Andreas Dilger, Parinay Kondekar,
	James Simmons, Linux Kernel Mailing List, lustre-devel

On Tue, Jan 05, 2016 at 02:35:13PM -0500, James Simmons wrote:
> From: Parinay Kondekar <parinay.kondekar@seagate.com>
> 
> The libcfs_ioctl.h header has a comment about a snapshot ioctl
> which has been removed for years. Lets remove the comment to
> avoid confusion. Broken out of patch 17492.
> 
> Signed-off-by: Parinay Kondekar <parinay.kondekar@seagate.com>
> Signed-off-by: James Simmons <uja.ornl@yahoo.com>
> Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-5844
> Reviewed-on: http://review.whamcloud.com/17492
> Reviewed-by: Andreas Dilger <andreas.dilger@intel.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>
> ---
>  .../lustre/include/linux/libcfs/libcfs_ioctl.h     |    1 -
>  1 files changed, 0 insertions(+), 1 deletions(-)

Only this patch applied in this series, please rebase the rest of them
(fixing up the one I pointed out) and resend.

thanks,

greg k-h

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

* RE: [lustre-devel] [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release]
  2016-02-03 22:40     ` [lustre-devel] " Greg Kroah-Hartman
@ 2016-02-12 23:16       ` Simmons, James A.
  -1 siblings, 0 replies; 14+ messages in thread
From: Simmons, James A. @ 2016-02-12 23:16 UTC (permalink / raw)
  To: 'Greg Kroah-Hartman', James Simmons
  Cc: devel, Parinay Kondekar, James Simmons,
	Linux Kernel Mailing List, Oleg Drokin, lustre-devel

>> diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>> index 33f6036..64f0fbf 100644
>> --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>> +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>> @@ -98,30 +98,22 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size)
>>  static int
>>  libcfs_psdev_open(struct inode *inode, struct file *file)
>>  {
>> -	int    rc = 0;
>> -
>>  	if (!inode)
>>  		return -EINVAL;
>> -	if (libcfs_psdev_ops.p_open != NULL)
>> -		rc = libcfs_psdev_ops.p_open(0, NULL);
>> -	else
>> -		return -EPERM;
>> -	return rc;
>> +
>> +	try_module_get(THIS_MODULE);
>
>Note, code like this is racy and incorrect and never needed, please fix
>this up properly (hint, set the module in the file operations.)
>
>Again, if you ever see code with that line, it is incorrect.

So simple

static struct file_operations libcfs_fops = {
        .module  = THIS_MODULE,
        .unlocked_ioctl = libcfs_psdev_ioctl,
};

With the open and release deleted should do the trick then.

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

* [lustre-devel] [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release]
@ 2016-02-12 23:16       ` Simmons, James A.
  0 siblings, 0 replies; 14+ messages in thread
From: Simmons, James A. @ 2016-02-12 23:16 UTC (permalink / raw)
  To: 'Greg Kroah-Hartman', James Simmons
  Cc: devel, Parinay Kondekar, James Simmons,
	Linux Kernel Mailing List, Oleg Drokin, lustre-devel

>> diff --git a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>> index 33f6036..64f0fbf 100644
>> --- a/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>> +++ b/drivers/staging/lustre/lustre/libcfs/linux/linux-module.c
>> @@ -98,30 +98,22 @@ int libcfs_ioctl_popdata(void *arg, void *data, int size)
>>  static int
>>  libcfs_psdev_open(struct inode *inode, struct file *file)
>>  {
>> -	int    rc = 0;
>> -
>>  	if (!inode)
>>  		return -EINVAL;
>> -	if (libcfs_psdev_ops.p_open != NULL)
>> -		rc = libcfs_psdev_ops.p_open(0, NULL);
>> -	else
>> -		return -EPERM;
>> -	return rc;
>> +
>> +	try_module_get(THIS_MODULE);
>
>Note, code like this is racy and incorrect and never needed, please fix
>this up properly (hint, set the module in the file operations.)
>
>Again, if you ever see code with that line, it is incorrect.

So simple

static struct file_operations libcfs_fops = {
        .module  = THIS_MODULE,
        .unlocked_ioctl = libcfs_psdev_ioctl,
};

With the open and release deleted should do the trick then.

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

end of thread, other threads:[~2016-02-12 23:25 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-05 19:35 [PATCH 0/7] staging:lustre: get rid of IOC_LIBCFS_MEMHOG and IOC_LIBCFS_PANIC ioctls James Simmons
2016-01-05 19:35 ` [PATCH 1/7] staging:lustre: remove obsolete comment in libcfs_ioctl.h James Simmons
2016-02-03 22:41   ` Greg Kroah-Hartman
2016-02-03 22:41     ` [lustre-devel] " Greg Kroah-Hartman
2016-01-05 19:35 ` [PATCH 2/7] staging:lustre: remove last bits of the IOC_LIBCFS_PANIC ioctl James Simmons
2016-01-05 19:35 ` [PATCH 3/7] staging:lustre: remove the IOC_LIBCFS_MEMHOG ioctl James Simmons
2016-01-05 19:35 ` [PATCH 4/7] staging:lustre: remove struct libcfs_device_userstate James Simmons
2016-01-05 19:35 ` [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release] James Simmons
2016-02-03 22:40   ` Greg Kroah-Hartman
2016-02-03 22:40     ` [lustre-devel] " Greg Kroah-Hartman
2016-02-12 23:16     ` Simmons, James A.
2016-02-12 23:16       ` Simmons, James A.
2016-01-05 19:35 ` [PATCH 6/7] staging:lustre: call libcfs_ioctl directly James Simmons
2016-01-05 19:35 ` [PATCH 7/7] staging:lustre: remove libcfs pseudo device abstraction James Simmons

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.