Re: [PATCH 3/5] devicetree: fix slave addition of incomplete dm / md devices

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

 



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@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux