public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hannes Reinecke <hare@suse.de>
To: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
	Michael Holzheu <HOLZHEU@de.ibm.com>
Subject: [PATCH] DASD: send 'change' uevents
Date: Fri, 24 Oct 2008 08:05:13 +0200	[thread overview]
Message-ID: <49016599.5030406@suse.de> (raw)

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

Hi Martin,

this patch modifies the DASD driver to sent out 'change' events
whenever the internal state machine transitions in or out of the
'ready' state. This is required for udev so that vol_id and friends
can actually read from the disk.

Please apply.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      zSeries & Storage
hare@suse.de			      +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Markus Rex, HRB 16746 (AG Nürnberg)

[-- Attachment #2: dasd-send-change-events --]
[-- Type: text/plain, Size: 1945 bytes --]

DASD: Send 'change' uevents

A DASD is only useable after the internal state machine transitioned
to 'ready', way after the device has been added to sysfs.
So we need to send out a 'change' event here to notify udev.

Signed-off-by: Hannes Reinecke <hare@suse.de>

diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 0a225cc..447fcdc 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -335,7 +335,9 @@ static int dasd_state_unfmt_to_basic(struct dasd_device *device)
 static int
 dasd_state_ready_to_online(struct dasd_device * device)
 {
-	int rc;
+	int rc, i;
+	struct gendisk *disk = device->bdev->bd_disk;
+	struct hd_struct *p;
 
 	if (device->discipline->ready_to_online) {
 		rc = device->discipline->ready_to_online(device);
@@ -345,6 +347,15 @@ dasd_state_ready_to_online(struct dasd_device * device)
 	device->state = DASD_STATE_ONLINE;
 	if (device->block)
 		dasd_schedule_block_bh(device->block);
+
+	kobject_uevent(&disk->kobj, KOBJ_CHANGE);
+	/* send uevents for all partitions */
+	for (i = 1; i < disk->minors; i++) {
+		p = disk->part[i-1];
+		if (!p || !p->nr_sects)
+			continue;
+		kobject_uevent(&p->kobj, KOBJ_CHANGE);
+	}
 	return 0;
 }
 
@@ -353,7 +364,9 @@ dasd_state_ready_to_online(struct dasd_device * device)
  */
 static int dasd_state_online_to_ready(struct dasd_device *device)
 {
-	int rc;
+	int rc, i;
+	struct gendisk *disk = device->bdev->bd_disk;
+	struct hd_struct *p;
 
 	if (device->discipline->online_to_ready) {
 		rc = device->discipline->online_to_ready(device);
@@ -361,6 +374,14 @@ static int dasd_state_online_to_ready(struct dasd_device *device)
 			return rc;
 	}
 	device->state = DASD_STATE_READY;
+	/* send uevents for all partitions */
+	for (i = 1; i < disk->minors; i++) {
+		p = disk->part[i-1];
+		if (!p || !p->nr_sects)
+			continue;
+		kobject_uevent(&p->kobj, KOBJ_CHANGE);
+	}
+	kobject_uevent(&disk->kobj, KOBJ_CHANGE);
 	return 0;
 }
 

             reply	other threads:[~2008-10-24  6:05 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-24  6:05 Hannes Reinecke [this message]
2008-10-26 18:29 ` [PATCH] DASD: send 'change' uevents Martin Schwidefsky

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=49016599.5030406@suse.de \
    --to=hare@suse.de \
    --cc=HOLZHEU@de.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwidefsky@de.ibm.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