All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: James Simmons <jsimmons@infradead.org>
Cc: devel@driverdev.osuosl.org, Oleg Drokin <oleg.drokin@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	Parinay Kondekar <parinay.kondekar@seagate.com>,
	James Simmons <uja.ornl@yahoo.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	lustre-devel@lists.lustre.org
Subject: [lustre-devel] [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release]
Date: Wed, 3 Feb 2016 14:40:35 -0800	[thread overview]
Message-ID: <20160203224035.GA10529@kroah.com> (raw)
In-Reply-To: <1452022519-6716-6-git-send-email-jsimmons@infradead.org>

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

WARNING: multiple messages have this Message-ID (diff)
From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
To: James Simmons <jsimmons@infradead.org>
Cc: devel@driverdev.osuosl.org, Oleg Drokin <oleg.drokin@intel.com>,
	Andreas Dilger <andreas.dilger@intel.com>,
	Parinay Kondekar <parinay.kondekar@seagate.com>,
	James Simmons <uja.ornl@yahoo.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	lustre-devel@lists.lustre.org
Subject: Re: [PATCH 5/7] staging:lustre: simplify libcfs_psdev_[open|release]
Date: Wed, 3 Feb 2016 14:40:35 -0800	[thread overview]
Message-ID: <20160203224035.GA10529@kroah.com> (raw)
In-Reply-To: <1452022519-6716-6-git-send-email-jsimmons@infradead.org>

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

  reply	other threads:[~2016-02-03 22:40 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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   ` [lustre-devel] " Greg Kroah-Hartman
2016-02-03 22:41     ` 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 [this message]
2016-02-03 22:40     ` Greg Kroah-Hartman
2016-02-12 23:16     ` [lustre-devel] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160203224035.GA10529@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=andreas.dilger@intel.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=jsimmons@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lustre-devel@lists.lustre.org \
    --cc=oleg.drokin@intel.com \
    --cc=parinay.kondekar@seagate.com \
    --cc=uja.ornl@yahoo.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.