Re: RFC - device names and mdadm with some reference to udev.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday October 28, kay.sievers@xxxxxxxx wrote:
> On Tue, Oct 28, 2008 at 00:23, Neil Brown <neilb@xxxxxxx> wrote:
> > I notice that 'md'
> > devices don't seem to disappear.  Maybe that is because /sys/block/mdX
> > never disappears (last time I tried it was too racy).
> 
> It stays because the md kernel device lifetime rules are kind of
> broken regarding hotplug setups. Similar issue why md needs all the
> static nodes in /dev too to create a device.
> 
> > Would there be any way to get udev to delete devices when
> >  /sys/block/mdX/md/array_state
> > becomes 'clear' (presumably on a CHANGE event) ??
> 
> What would be the reason to leave the kernel block device around?
> Can't you just remove it like any other subsytem in the kernel does.
> That would just remove the node, all links and update userspace to
> reflect the change.
> 
> There is currently no "change" event that could tell to remove a
> device node in /dev while we still have a kernel device around. And
> you would need to convince me that this is really needed, and why md
> is so special here. :)

I've just done a bit of experimentation...

If create an array /dev/md0 and we get a symlink
  /dev/disk/by-id/md-uuid-XXXXX -> ../../md0
I stop the array and the symlink stays there
I create a new array as /dev/md0 (hence new uuid)
and I get an new symlink
  /dev/disk/by-id/md-uuid-YYYY -> ../../md0
but also, the first symlink goes away.

So somehow that first symlink is being removed even though the device
isn't being stopped.
I guess I need a 
   kobject_uevent(...., KOBJ_CHANGE)
when the array is stopped.... [tries that].

Better.  But it looks like I need to get rid of the partitions too...

Yes.  Putting

		bdev = bdget_disk(mddev->gendisk, 0);
		if (bdev) {
			blkdev_ioctl(bdev, 0, BLKRRPART, 0);
			bdput(bdev);
		}
		kobject_uevent(&disk_to_dev(mddev->gendisk)->kobj, KOBJ_CHANGE);

at a suitable place in do_md_stop causes all the symlinks created by
udev to disappear when I stop the array, only the /dev/mdX remains.
That should do for 2.6.28.  Something better maybe for .29.

NeilBrown
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux