From: Mike Snitzer <snitzer@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: dm-devel@redhat.com, "Alasdair G. Kergon" <agk@redhat.com>
Subject: Re: dm: wait until kobject is destroyed
Date: Fri, 10 Jan 2014 16:03:15 -0500 [thread overview]
Message-ID: <20140110210314.GA12660@redhat.com> (raw)
In-Reply-To: <alpine.LRH.2.02.1401092050190.31354@file01.intranet.prod.int.rdu2.redhat.com>
On Thu, Jan 09 2014 at 8:53pm -0500,
Mikulas Patocka <mpatocka@redhat.com> wrote:
> Hi
>
> Here I'm sending the updated kobject patch.
>
> Changes:
> The file was renamed to dm-builtin.c
> A comment with explanation of the race condition added.
>
> Mikulas
>
>
>
> From: Mikulas Patocka <mpatocka@redhat.com>
>
> There may be other parts of the kernel taking reference to the dm kobject.
> We must wait until they drop the references before deallocating the md
> structure.
>
> Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
> Cc: stable@vger.kernel.org
This header could use some work considering the previous patch is
already staged in linux-dm.git's 'for-next' -- so this patch will build
on that. Would be nice to see some commentary about introducing a
dm-builtin to avoid concerns about dm_kobject_release crash after dm-mod
is unloaded. Also, touch on the role/need of struct dm_kobject_holder?
> Index: linux-3.13-rc7/drivers/md/dm-sysfs.c
> ===================================================================
> --- linux-3.13-rc7.orig/drivers/md/dm-sysfs.c 2014-01-09 20:50:18.000000000 +0100
> +++ linux-3.13-rc7/drivers/md/dm-sysfs.c 2014-01-09 20:50:38.000000000 +0100
> @@ -86,6 +86,7 @@ static const struct sysfs_ops dm_sysfs_o
> static struct kobj_type dm_ktype = {
> .sysfs_ops = &dm_sysfs_ops,
> .default_attrs = dm_attrs,
> + .release = dm_kobject_release,
> };
>
> /*
> @@ -104,5 +105,7 @@ int dm_sysfs_init(struct mapped_device *
> */
> void dm_sysfs_exit(struct mapped_device *md)
> {
> - kobject_put(dm_kobject(md));
> + struct kobject *kobj = dm_kobject(md);
> + kobject_put(kobj);
> + wait_for_completion(dm_get_completion_from_kobject(kobj));
> }
> Index: linux-3.13-rc7/drivers/md/dm.c
> ===================================================================
> --- linux-3.13-rc7.orig/drivers/md/dm.c 2014-01-09 20:50:18.000000000 +0100
> +++ linux-3.13-rc7/drivers/md/dm.c 2014-01-09 20:50:38.000000000 +0100
> @@ -200,8 +200,8 @@ struct mapped_device {
> /* forced geometry settings */
> struct hd_geometry geometry;
>
> - /* sysfs handle */
> - struct kobject kobj;
> + /* kobject and completion */
> + struct dm_kobject_holder h;
>
> /* zero-length flush that will be cloned and submitted to targets */
> struct bio flush_bio;
Could you rename 'h' to 'kobj_holder'?
Also, this patch needs to be rebased ontop of linux-dm.git's 'for-next'
branch.
Mike
next prev parent reply other threads:[~2014-01-10 21:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-10 1:53 [PATCH] dm: wait until kobject is destroyed Mikulas Patocka
2014-01-10 21:03 ` Mike Snitzer [this message]
2014-01-14 0:37 ` [PATCH v2] " Mikulas Patocka
2014-01-14 3:02 ` Mike Snitzer
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=20140110210314.GA12660@redhat.com \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=mpatocka@redhat.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.