From: "Pali Rohár" <pali.rohar@gmail.com>
To: Mike Snitzer <snitzer@redhat.com>
Cc: Len Brown <len.brown@intel.com>,
linux-pm@vger.kernel.org, "Rafael J. Wysocki" <rjw@rjwysocki.net>,
linux-kernel@vger.kernel.org, linux-raid@vger.kernel.org,
dm-devel@redhat.com, Pavel Machek <pavel@ucw.cz>,
Alasdair Kergon <agk@redhat.com>
Subject: Re: [PATCH v2 2/3] dm: Export function dm_suspend_md()
Date: Fri, 17 Jul 2015 19:13:56 +0200 [thread overview]
Message-ID: <201507171913.57104@pali> (raw)
In-Reply-To: <20150717153045.GB1021@redhat.com>
[-- Attachment #1: Type: Text/Plain, Size: 4036 bytes --]
On Friday 17 July 2015 17:30:45 Mike Snitzer wrote:
> On Fri, Jul 17 2015 at 11:22am -0400,
>
> Mike Snitzer <snitzer@redhat.com> wrote:
> > On Fri, Jul 17 2015 at 10:22am -0400,
> >
> > Pali Rohár <pali.rohar@gmail.com> wrote:
> > > On Friday 17 July 2015 10:04:39 Mike Snitzer wrote:
> > > > On Sun, Jun 21 2015 at 7:20am -0400,
> > > >
> > > > Pali Rohár <pali.rohar@gmail.com> wrote:
> > > > > This patch exports function dm_suspend_md() which suspend
> > > > > mapped device so other kernel drivers can use it and could
> > > > > suspend mapped device when needed.
> > > > >
> > > > > Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
> > > > > ---
> > > > >
> > > > > drivers/md/dm.c | 6 ++++++
> > > > > drivers/md/dm.h | 5 +++++
> > > > > 2 files changed, 11 insertions(+)
> > > > >
> > > > > diff --git a/drivers/md/dm.c b/drivers/md/dm.c
> > > > > index 2caf492..03298ff 100644
> > > > > --- a/drivers/md/dm.c
> > > > > +++ b/drivers/md/dm.c
> > > > >
> > > > > @@ -3343,6 +3343,12 @@ out:
> > > > > return r;
> > > > >
> > > > > }
> > > > >
> > > > > +int dm_suspend_md(struct mapped_device *md)
> > > > > +{
> > > > > + return dm_suspend(md, DM_SUSPEND_LOCKFS_FLAG);
> > > > > +}
> > > > > +EXPORT_SYMBOL_GPL(dm_suspend_md);
> > > > > +
> > > > >
> > > > > /*
> > > > >
> > > > > * Internal suspend/resume works like userspace-driven
> > > > > suspend. It waits * until all bios finish and prevents
> > > > > issuing new bios to the target drivers.
> > > >
> > > > To do this properly you should be introducing a variant of
> > > > dm_internal_suspend. We currently have two variants:
> > > > dm_internal_suspend_fast
> > > > dm_internal_suspend_noflush
> > > >
> > > > The reason to use a dm_internal_suspend variant is this suspend
> > > > was _not_ initiated by an upper level ioctl (from userspace).
> > > > It was done internally from within the target.
> > > >
> > > > You're explicitly using DM_SUSPEND_LOCKFS_FLAG above.. meaning
> > > > you're interested in flushing all pending IO (in the FS
> > > > layered on dm-crupt, if one exists).
> > > >
> > > > But see the comment in __dm_internal_suspend() about
> > > > TASK_UNINTERRUPTIBLE. If you're OK with the dm-crypt initiated
> > > > suspend being TASK_UNINTERRUPTIBLE then you could just
> > > > introduce:
> > > >
> > > > void dm_internal_suspend_uninterruptible_flush(struct
> > > > mapped_device *md) {
> > > >
> > > > mutex_lock(&md->suspend_lock);
> > > > __dm_internal_suspend(md, DM_SUSPEND_LOCKFS_FLAG);
> > > > mutex_unlock(&md->suspend_lock);
> > > >
> > > > }
> > > > EXPORT_SYMBOL_GPL(dm_internal_suspend_uninterruptible_flush);
> > > >
> > > > Otherwise, there is much more extensive DM core changes needed
> > > > to __dm_internal_suspend() and .presuspend to properly support
> > > > TASK_INTERRUPTIBLE.
> > >
> > > Hi! I will look at dm_internal_suspend. Anyway use case for
> > > suspend is from dm-crypt to do both operations: suspend + key
> > > wipe. It means that without entering key again from userspace,
> > > resume is not possible. So my question is: It is possible to do
> > > internal suspend and then using resume from userspace via ioctl?
> >
> > Good question: no, userspace resume would block waiting for
> > internal resume.
> >
> > Soooo... I'll have to look at your patch 3 to understand why
> > dm-crypt is needing to initiate the suspend internally but then
> > userspace is initiating the resume... this imbalance is
> > concerning.
>
> Why not introduce a new message that allows you to wipe the key after
> suspend? Both initiated from userspace.
There is already message for wiping key and it will success only if dm
is suspended.
But this patch series is fixing another problem: wipe key before
suspend/hibernation action happend and to have it race free it must be
done after userspace is freezed!
--
Pali Rohár
pali.rohar@gmail.com
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 198 bytes --]
next prev parent reply other threads:[~2015-07-17 17:13 UTC|newest]
Thread overview: 60+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-05 17:20 [PATCH 0/3] dm-crypt: Adds support for wiping key when doing suspend/hibernation Pali Rohár
2015-04-05 17:20 ` [PATCH 1/3] PM suspend/hibernate: Call notifier after freezing processes Pali Rohár
2015-04-09 0:28 ` Rafael J. Wysocki
2015-04-09 6:36 ` Pali Rohár
2015-04-09 17:13 ` Rafael J. Wysocki
2015-04-09 16:55 ` Pali Rohár
2015-04-05 17:20 ` [PATCH 2/3] dm: Export function dm_suspend_md() Pali Rohár
2015-04-05 17:20 ` [PATCH 3/3] dm-crypt: Adds support for wiping key when doing suspend/hibernation Pali Rohár
2015-04-05 17:20 ` Pali Rohár
2015-04-07 13:55 ` [dm-devel] " Alasdair G Kergon
2015-04-06 13:00 ` [PATCH 0/3] " Mike Snitzer
2015-04-06 13:00 ` Mike Snitzer
2015-04-06 13:25 ` Pavel Machek
2015-04-06 20:51 ` Mike Snitzer
2015-04-06 21:13 ` Why wipe crypto keys during suspend (was Re: [PATCH 0/3] dm-crypt: Adds support for wiping key when doing suspend/hibernation) Pavel Machek
2015-04-06 13:29 ` [PATCH 0/3] dm-crypt: Adds support for wiping key when doing suspend/hibernation Pali Rohár
2015-04-06 18:17 ` Pavel Machek
2015-04-06 21:27 ` Pali Rohár
2015-04-09 13:12 ` Mike Snitzer
2015-04-09 13:28 ` Pali Rohár
2015-04-09 14:08 ` Mike Snitzer
2015-04-09 14:16 ` Pali Rohár
2015-04-09 14:16 ` Pali Rohár
2015-04-09 14:26 ` Mike Snitzer
2015-04-09 14:38 ` Pali Rohár
2015-04-14 6:50 ` Pavel Machek
2015-04-23 17:02 ` Pali Rohár
2015-04-16 9:23 ` Alex Elsayed
2015-04-17 7:52 ` Mike Snitzer
2015-04-17 8:52 ` Ondrej Kozina
2015-04-17 8:52 ` [dm-devel] " Ondrej Kozina
2015-04-17 15:53 ` Alex Elsayed
2015-04-14 6:41 ` Pavel Machek
2015-06-21 11:20 ` [PATCH v2 " Pali Rohár
2015-06-21 11:20 ` Pali Rohár
2015-06-21 11:20 ` [PATCH v2 1/3] PM suspend/hibernate: Call notifier after freezing processes Pali Rohár
2015-06-21 11:20 ` Pali Rohár
2015-07-16 1:02 ` Rafael J. Wysocki
2015-07-16 7:33 ` Pali Rohár
2015-07-17 23:27 ` Rafael J. Wysocki
2015-07-20 7:32 ` Pali Rohár
2015-07-20 21:46 ` Rafael J. Wysocki
2015-07-21 22:08 ` NeilBrown
2015-07-21 23:00 ` Rafael J. Wysocki
2015-07-21 23:03 ` Rafael J. Wysocki
2016-12-27 14:29 ` Pali Rohár
2015-06-21 11:20 ` [PATCH v2 2/3] dm: Export function dm_suspend_md() Pali Rohár
2015-06-21 11:20 ` Pali Rohár
2015-07-17 14:04 ` Mike Snitzer
2015-07-17 14:22 ` Pali Rohár
2015-07-17 15:22 ` Mike Snitzer
2015-07-17 15:30 ` Mike Snitzer
2015-07-17 17:13 ` Pali Rohár [this message]
2015-07-17 17:31 ` Mike Snitzer
2015-06-21 11:20 ` [PATCH v2 3/3] dm-crypt: Adds support for wiping key when doing suspend/hibernation Pali Rohár
2015-06-21 11:20 ` Pali Rohár
2015-07-28 14:44 ` Pavel Machek
2015-07-28 14:48 ` Pali Rohár
2015-07-07 7:59 ` [PATCH v2 0/3] " Pali Rohár
2015-07-07 7:59 ` Pali Rohár
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=201507171913.57104@pali \
--to=pali.rohar@gmail.com \
--cc=agk@redhat.com \
--cc=dm-devel@redhat.com \
--cc=len.brown@intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=pavel@ucw.cz \
--cc=rjw@rjwysocki.net \
--cc=snitzer@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.