All of lore.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: device-mapper development <dm-devel@redhat.com>
Subject: [PATCH] Add events for dm suspend / resume
Date: Mon, 29 May 2006 10:04:09 +0200	[thread overview]
Message-ID: <447AAAF9.2070704@suse.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 869 bytes --]

Hi all,

currently device-mapper doesn't play well with udev & hotplug events.
The event is sent out on the initial device create; only at this stage
the device is not usable. Only after one did a 'table load' and a
'resume' the device is actually accessible from userland.
And thus it is purely coincidental if any 'dmsetup' call from udev
(which is triggered by the device create events) will return any useful
data.

This patch adds two additional events 'online' and 'offline' which get
send after 'resume' and 'suspend', respectively.
With this patch udev can hook on the 'online' event and will always get
valid data via the dmsetup call.

Comments etc. are welcome.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke			hare@suse.de
SuSE Linux Products GmbH		S390 & zSeries
Maxfeldstraße 5				+49 911 74053 688
90409 Nürnberg				http://www.suse.de

[-- Attachment #2: dm-suspend-resume-events --]
[-- Type: text/plain, Size: 504 bytes --]

--- linux-2.6.16/drivers/md/dm.c.orig	2006-05-23 12:18:09.000000000 +0200
+++ linux-2.6.16/drivers/md/dm.c	2006-05-26 14:09:16.000000000 +0200
@@ -1201,6 +1201,7 @@ int dm_suspend(struct mapped_device *md,
 	dm_table_postsuspend_targets(map);
 
 	set_bit(DMF_SUSPENDED, &md->flags);
+	kobject_uevent(&md->disk->kobj, KOBJ_OFFLINE);
 
 	r = 0;
 
@@ -1247,6 +1248,7 @@ int dm_resume(struct mapped_device *md)
 
 	dm_table_unplug_all(map);
 
+	kobject_uevent(&md->disk->kobj, KOBJ_ONLINE);
 	r = 0;
 
 out:

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



             reply	other threads:[~2006-05-29  8:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-05-29  8:04 Hannes Reinecke [this message]
2006-06-01 15:07 ` [PATCH] Add events for dm suspend / resume Alasdair G Kergon

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=447AAAF9.2070704@suse.de \
    --to=hare@suse.de \
    --cc=dm-devel@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.