FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian Development

 
 
LinkBack Thread Tools
 
Old 03-16-2009, 05:31 PM
David Lehman
 
Default devicetree: fix slave addition of incomplete dm / md devices

On Mon, 2009-03-16 at 16:22 +0100, Hans de Goede wrote:
> The code to add all slaves to the tree for a (potential) incomplete
> devicemapper or mdraid device, has 2 bugs:

Looks good.

> 1) It resolves a dm-x to a devicemapper name and then looks for
> /sys/class/block/foo/slaves/devicemapper-name
> instead of:
> /sys/class/block/foo/slaves/dm-x
>
> 2) It checks to see if the device was added by adding the slaves after
> adding the first slave instead of after adding all the slaves.
>
> This patch fixes both.
> ---
> storage/devicetree.py | 32 ++++++++++++++++++++------------
> 1 files changed, 20 insertions(+), 12 deletions(-)
>
> diff --git a/storage/devicetree.py b/storage/devicetree.py
> index 8ae91ee..765c857 100644
> --- a/storage/devicetree.py
> +++ b/storage/devicetree.py
> @@ -864,8 +864,10 @@ class DeviceTree(object):
> for slave_name in slave_names:
> # if it's a dm-X name, resolve it to a map name first
> if slave_name.startswith("dm-"):
> - slave_name = dm.name_from_dm_node(slave_name)
> - slave_dev = self.getDeviceByName(slave_name)
> + dev_name = dm.name_from_dm_node(slave_name)
> + else:
> + dev_name = slave_name
> + slave_dev = self.getDeviceByName(dev_name)
> if slave_dev:
> slaves.append(slave_dev)
> else:
> @@ -874,13 +876,15 @@ class DeviceTree(object):
> new_info = udev_get_block_device(os.path.realpath(path))
> if new_info:
> self.addUdevDevice(new_info)
> - device = self.getDeviceByName(name)
> - if device is None:
> - # if the current device is still not in
> + if self.getDeviceByName(dev_name) is None:
> + # if the current slave is still not in
> # the tree, something has gone wrong
> - log.error("failure scanning device %s" % name)
> + log.error("failure scanning device %s: could not add slave %s" % (name, dev_name))
> return
>
> + # try to get the device again now that we've got all the slaves
> + device = self.getDeviceByName(name)
> +
> if device is None and
> udev_device_is_dmraid_partition(info, self):
> diskname = udev_device_get_dmraid_partition_disk(info)
> @@ -919,8 +923,10 @@ class DeviceTree(object):
> for slave_name in slave_names:
> # if it's a dm-X name, resolve it to a map name
> if slave_name.startswith("dm-"):
> - slave_name = dm.name_from_dm_node(slave_name)
> - slave_dev = self.getDeviceByName(slave_name)
> + dev_name = dm.name_from_dm_node(slave_name)
> + else:
> + dev_name = slave_name
> + slave_dev = self.getDeviceByName(dev_name)
> if slave_dev:
> slaves.append(slave_dev)
> else:
> @@ -929,13 +935,15 @@ class DeviceTree(object):
> new_info = udev_get_block_device(os.path.realpath(path))
> if new_info:
> self.addUdevDevice(new_info)
> - device = self.getDeviceByName(name)
> - if device is None:
> - # if the current device is still not in
> + if self.getDeviceByName(dev_name) is None:
> + # if the current slave is still not in
> # the tree, something has gone wrong
> - log.error("failure scanning device %s" % name)
> + log.error("failure scanning device %s: could not add slave %s" % (name, dev_name))
> return
>
> + # try to get the device again now that we've got all the slaves
> + device = self.getDeviceByName(name)
> +
> # if we get here, we found all of the slave devices and
> # something must be wrong -- if all of the slaves we in
> # the tree, this device should be as well

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@redhat.com
https://www.redhat.com/mailman/listinfo/anaconda-devel-list
 

Thread Tools




All times are GMT. The time now is 04:20 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org