linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Daniel Baluta <daniel.baluta@intel.com>,
	jic23@kernel.org, jlbec@evilplan.org, linux-iio@vger.kernel.org,
	linux-fsdevel@vger.kernel.org
Cc: knaack.h@gmx.de, linux-kernel@vger.kernel.org,
	octavian.purdila@intel.com, pebolle@tiscali.nl,
	patrick.porlan@intel.com, adriana.reus@intel.com,
	constantin.musca@intel.com, marten@intuitiveaerial.com,
	cristina.opriceana@gmail.com, pmeerw@pmeerw.net, hch@lst.de,
	viro@zeniv.linux.org.uk, akpm@linux-foundation.org
Subject: Re: [PATCH v7 1/5] configfs: Allow dynamic group (un)registration
Date: Mon, 31 Aug 2015 18:02:43 +0200	[thread overview]
Message-ID: <55E47AA3.3040001@metafoo.de> (raw)
In-Reply-To: <1439246562-17515-2-git-send-email-daniel.baluta@intel.com>

[...]
> +int configfs_register_group(struct config_group *parent_group,
> +	struct config_group *group)
> +{
> +	struct dentry *dentry;
> +	int ret;
> +
> +	link_group(parent_group, group);

This needs to hold subsys->su_mutex

I think from here to before the return we need to hold the parent dentry
mutex with I_MUTEX_PARENT

> +
> +	ret = create_default_group(parent_group, group, &dentry);
> +	if (ret == 0)
> +		configfs_dir_set_ready(dentry->d_fsdata);

This needs to hold configfs_dirent_lock

> +
> +	return ret;
> +}
> +EXPORT_SYMBOL(configfs_register_group);
> +
> +void configfs_unregister_group(struct config_group *group)
> +{
> +	struct dentry *dentry = group->cg_item.ci_dentry;
> +

We probably need to do the detach_prep stuff somewhere in here.


I think this needs to hold the parent dentry mutex with I_MUTEX_PARENT from
here to ...

> +	mutex_lock(&d_inode(dentry)->i_mutex);
> +	configfs_detach_group(&group->cg_item);
> +	d_inode(dentry)->i_flags |= S_DEAD;
> +	dont_mount(dentry);
> +	mutex_unlock(&d_inode(dentry)->i_mutex);
> +
> +	d_delete(dentry);

 ... here

> +	dput(dentry);
> +	unlink_group(group);

needs subsys->su_mutex

> +}
> +EXPORT_SYMBOL(configfs_unregister_group);
> +
>  int configfs_register_subsystem(struct configfs_subsystem *subsys)
>  {
>  	int err;
> diff --git a/include/linux/configfs.h b/include/linux/configfs.h
> index c9e5c57..726980e 100644
> --- a/include/linux/configfs.h
> +++ b/include/linux/configfs.h
> @@ -251,6 +251,10 @@ static inline struct configfs_subsystem *to_configfs_subsystem(struct config_gro
>  int configfs_register_subsystem(struct configfs_subsystem *subsys);
>  void configfs_unregister_subsystem(struct configfs_subsystem *subsys);
>  
> +int configfs_register_group(struct config_group *parent_group,
> +			    struct config_group *group);
> +void configfs_unregister_group(struct config_group *group);
> +
>  /* These functions can sleep and can alloc with GFP_KERNEL */
>  /* WARNING: These cannot be called underneath configfs callbacks!! */
>  int configfs_depend_item(struct configfs_subsystem *subsys, struct config_item *target);
> 


  reply	other threads:[~2015-08-31 16:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-10 22:42 [PATCH v7 0/5] Add initial configfs support for IIO Daniel Baluta
     [not found] ` <1439246562-17515-1-git-send-email-daniel.baluta-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-08-10 22:42   ` [PATCH v7 1/5] configfs: Allow dynamic group (un)registration Daniel Baluta
2015-08-31 16:02     ` Lars-Peter Clausen [this message]
2015-08-10 22:42 ` [PATCH v7 2/5] iio: core: Introduce IIO configfs support Daniel Baluta
2015-08-10 22:42 ` [PATCH v7 3/5] iio: core: Introduce IIO software triggers Daniel Baluta
2015-08-17 11:31   ` Vladimir Barinov
     [not found]   ` <1439246562-17515-4-git-send-email-daniel.baluta-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-08-31 14:41     ` Lars-Peter Clausen
2015-08-10 22:42 ` [PATCH v7 4/5] iio: trigger: Introduce IIO hrtimer based trigger Daniel Baluta
     [not found]   ` <1439246562-17515-5-git-send-email-daniel.baluta-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-08-17 12:45     ` Vladimir Barinov
2015-08-17 12:49       ` Daniel Baluta
2015-08-31 14:57       ` Lars-Peter Clausen
     [not found]         ` <55E46B45.8040909-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2015-09-02 12:16           ` Vladimir Barinov
2015-08-31 15:13   ` Lars-Peter Clausen
2015-08-10 22:42 ` [PATCH v7 5/5] iio: Documentation: Add IIO configfs documentation Daniel Baluta
     [not found]   ` <1439246562-17515-6-git-send-email-daniel.baluta-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>
2015-08-17 12:01     ` Vladimir Barinov

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=55E47AA3.3040001@metafoo.de \
    --to=lars@metafoo.de \
    --cc=adriana.reus@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=constantin.musca@intel.com \
    --cc=cristina.opriceana@gmail.com \
    --cc=daniel.baluta@intel.com \
    --cc=hch@lst.de \
    --cc=jic23@kernel.org \
    --cc=jlbec@evilplan.org \
    --cc=knaack.h@gmx.de \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marten@intuitiveaerial.com \
    --cc=octavian.purdila@intel.com \
    --cc=patrick.porlan@intel.com \
    --cc=pebolle@tiscali.nl \
    --cc=pmeerw@pmeerw.net \
    --cc=viro@zeniv.linux.org.uk \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).