From: Mike Snitzer <snitzer@redhat.com>
To: Hannes Reinecke <hare@suse.de>
Cc: device-mapper development <dm-devel@redhat.com>,
Mikulas Patocka <mpatocka@redhat.com>,
Alasdair Kergon <agk@redhat.com>
Subject: Re: dm-table: delayed cleanup for dm_table_destroy()
Date: Tue, 20 Mar 2012 15:43:08 -0400 [thread overview]
Message-ID: <20120320194307.GD30980@redhat.com> (raw)
In-Reply-To: <4F68A3D8.40005@suse.de>
On Tue, Mar 20 2012 at 11:35am -0400,
Hannes Reinecke <hare@suse.de> wrote:
> Hi Mikulas,
>
> On 03/19/2012 10:45 PM, Mikulas Patocka wrote:
> > Hi Hannes
> >
> > I wouldn't do this. This behavior actually existed in kernels <= 2.6.28.
> > And it caused trouble.
> >
> > The problems are these:
> >
> > Some code may hold a spinlock and call dm_table_put. Currently,
> > dm_table_put just decrements the counter and the cleanup is done
> > synchronously in dm_table_destroy. With your patch, cleanup would be done
> > in dm_table_put --- you call a target destructor (which may sleep) in a
> > non-sleeping context.
> >
> > Some code may hold a mutex and call dm_table_put. If you call a target
> > destructor from dm_table_put and it takes the same mutex, it deadlocks.
> >
> > Currently, when dm_table_destroy exits, it is guaranteed that the table is
> > destroyed and all target destructors have been called. With your patch,
> > dm_table_destroy may exit and the table could be still alive because of
> > some other reference. This may cause leaked references to some other files
> > or devices. For example, suppose that the user has a device mapper device
> > "dm" that redirects requests to "/dev/sda". The user assumes that if he
> > runs "dmsetup remove dm" and this command returns, "/dev/sda" will not be
> > open. Your patch breaks this assumption.
> >
> Hmm. Yes, true.
>
> > Look at the commit "d58168763f74d1edbc296d7038c60efe6493fdd4" in 2.6.29
> > --- I was actually removing the old-style reference counting (that is
> > functionally equivalent to what your patch does) because of these three
> > problems. The old code really caused a crash although it happened very
> > rarely.
> >
> Ah. That'll explain it.
> The actual problem I'm trying to track down is that I'm seeing an
> excessive duration for the 'resume' dm ioctl after a table update.
> I've got reports where the ioctl can take up to several seconds.
> Which (as this is multipath) causes an extremely erratic behaviour.
>
> And the 'msleep' here is one of the obvious culprits.
>
> But I'll continue debugging, maybe I'll find something else.
I once wanted to replace all msleep(1); with cpu_relax();:
http://www.redhat.com/archives/dm-devel/2010-September/msg00100.html
But Alasdair wasn't sure if cpu_relax() would provide the required
delay effect:
https://www.redhat.com/archives/dm-devel/2011-June/msg00080.html
next prev parent reply other threads:[~2012-03-20 19:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-19 15:53 [PATCH] Device-mapper misc cleanup Hannes Reinecke
2012-03-19 15:53 ` [PATCH] dm: zero out bi_end_io on remapping failure Hannes Reinecke
2012-03-19 15:53 ` [PATCH] dm-table: simplify call to free_devices() Hannes Reinecke
2012-03-19 15:53 ` [PATCH] dm-table: delayed cleanup for dm_table_destroy() Hannes Reinecke
2012-03-19 21:45 ` Mikulas Patocka
2012-03-20 15:35 ` Hannes Reinecke
2012-03-20 19:43 ` Mike Snitzer [this message]
2012-03-21 1:20 ` Mikulas Patocka
2012-03-21 1:24 ` [PATCH] " Mikulas Patocka
2012-03-21 5:34 ` Jun'ichi Nomura
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=20120320194307.GD30980@redhat.com \
--to=snitzer@redhat.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=hare@suse.de \
--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.