Linux Device Mapper development
 help / color / mirror / Atom feed
From: Mike Snitzer <snitzer@redhat.com>
To: Mikulas Patocka <mpatocka@redhat.com>
Cc: device-mapper development <dm-devel@redhat.com>,
	"Bryn M. Reeves" <breeves@redhat.com>,
	ejt@redhat.com, Alasdair G Kergon <agk@redhat.com>,
	Zdenek Kabelac <zkabelac@redhat.com>
Subject: Re: staged dm_internal_{suspend, resume} related changes for wider review
Date: Wed, 5 Nov 2014 15:16:12 -0500	[thread overview]
Message-ID: <20141105201612.GA18581@redhat.com> (raw)
In-Reply-To: <20141105165611.GA19885@redhat.com>

On Wed, Nov 05 2014 at 11:56am -0500,
Mike Snitzer <snitzer@redhat.com> wrote:

> On Wed, Nov 05 2014 at 11:10am -0500,
> Mike Snitzer <snitzer@redhat.com> wrote:
> 
> > On Wed, Nov 05 2014 at  9:37am -0500,
> > Mikulas Patocka <mpatocka@redhat.com> wrote:
> > 
> > > This is not about performance, it is about unclear behavior.
> > > 
> > > If someone does internal_suspend followed by remove, what should be the 
> > > correct behavior? The current code deadlocks in this case.
> > 
> > You need to be specific, if internal suspend was used by the thin-pool
> > suspend to suspend thin devices you'll need the thin-pool resumed before
> > you can remove any thin device!
> >
> > Like any interface there is a right way and a wrong way to use it.
> > dm_internal_suspend must always be followed by dm_internal_resume.
> > I cannot yet see a hole where properly written code is exposed here.
> 
> But thinking further about what you said, you're correctly concerned
> about the potential for dm-stats to have used dm_internal_suspend and
> then someone attempting to remove that device while it is internally
> suspended.

As we discussed (but for benefit of others): dm-stats does the
dm_internal_suspend+dm_internal_resume within a single DM message
(ioctl) so there is no potential for race with device delete.

> We just need a patch like this:

That untested patch was flawed, caused deadlock due to wait_on_bit()
while holding _hash_lock -- so resume ioctl wasn't possible.

So I'm still really not sure what your original point was about "If
someone does internal_suspend followed by remove, what should be the
correct behavior? The current code deadlocks in this case."

There is no deadlock:

dmsetup suspend thin-pool
dmsetup remove thin-thin1
dmsetup resume thin-pool

the thin-pool suspend will internal suspend thin-thin1, but I can still
remove thin-thin1 (provided it isn't in-use), and later resuming the
thin-pool works fine too.

  reply	other threads:[~2014-11-05 20:16 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20141028014825.GA21949@redhat.com>
     [not found] ` <544F988D.7090901@redhat.com>
     [not found]   ` <20141028134012.GA25229@redhat.com>
     [not found]     ` <20141028141749.GD25229@redhat.com>
     [not found]       ` <20141028143742.GE25229@redhat.com>
     [not found]         ` <20141028171003.GG25229@redhat.com>
     [not found]           ` <20141028224753.GA29288@redhat.com>
     [not found]             ` <20141028232638.GB29288@redhat.com>
     [not found]               ` <20141029002125.GC29288@redhat.com>
2014-10-29  1:22                 ` staged dm_internal_{suspend, resume} related changes for wider review Mike Snitzer
2014-10-29 19:06                   ` Mike Snitzer
2014-10-29 20:49                     ` Mike Snitzer
2014-11-03 23:25                   ` Mikulas Patocka
2014-11-04  0:17                     ` Mike Snitzer
2014-11-05  1:16                       ` Mike Snitzer
2014-11-05 12:43                         ` Mikulas Patocka
2014-11-05 13:05                           ` Mikulas Patocka
2014-11-05 14:11                             ` Mike Snitzer
2014-11-05 14:37                               ` Mikulas Patocka
2014-11-05 14:50                                 ` Zdenek Kabelac
2014-11-05 16:10                                 ` Mike Snitzer
2014-11-05 16:56                                   ` Mike Snitzer
2014-11-05 20:16                                     ` Mike Snitzer [this message]
2014-11-05 16:29                                 ` Mike Snitzer
2014-11-07 16:20                                   ` Mikulas Patocka
2014-11-07 18:33                                     ` Mike Snitzer
2015-01-02 22:56                                       ` Mikulas Patocka
2015-01-05 15:50                                         ` Mike Snitzer
2015-01-08 23:52                                           ` [PATCH] dm: handle multiple internal suspends correctly (was: staged dm_internal_{suspend, resume} related changes for wider review) Mikulas Patocka
2014-11-07 23:16                                     ` [PATCH] Suspend all active bios when the pool is suspended " Mikulas Patocka
2014-11-07 23:29                                       ` Mike Snitzer
2014-11-09  1:17                                       ` [PATCH] " 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=20141105201612.GA18581@redhat.com \
    --to=snitzer@redhat.com \
    --cc=agk@redhat.com \
    --cc=breeves@redhat.com \
    --cc=dm-devel@redhat.com \
    --cc=ejt@redhat.com \
    --cc=mpatocka@redhat.com \
    --cc=zkabelac@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox