diff options
author | Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> | 2015-08-14 15:57:55 +1000 |
---|---|---|
committer | Samuel Mendoza-Jonas <sam.mj@au1.ibm.com> | 2015-08-18 15:30:58 +1000 |
commit | 61e30136d88c1e2cef353e09789dbb969be64f55 (patch) | |
tree | dbb58e84fe53dbe46ae211934639da3f2290cda6 | |
parent | 185676316b4bd3192131a5419604a6a9cfd1d3d1 (diff) | |
download | talos-petitboot-61e30136d88c1e2cef353e09789dbb969be64f55.tar.gz talos-petitboot-61e30136d88c1e2cef353e09789dbb969be64f55.zip |
discover/udev: Additional checks in udev_handle_block_add
- Several filesystem types can appear that we won't be able to mount.
Instead of waiting to fail mounting them in device_handler_discover(),
skip processing them at all.
- Do not create dm-snapshots on top of raid arrays until we have a
reliable way of determining the sector count for a md raid device.
- Turn down the verbosity on skipping dm-devices.
Signed-off-by: Samuel Mendoza-Jonas <sam.mj@au1.ibm.com>
-rw-r--r-- | discover/udev.c | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/discover/udev.c b/discover/udev.c index 75393d5..87a3748 100644 --- a/discover/udev.c +++ b/discover/udev.c @@ -74,12 +74,20 @@ static int udev_handle_block_add(struct pb_udev *udev, struct udev_device *dev, const char *name) { struct discover_device *ddev; + unsigned int i = 0; const char *typestr; const char *uuid; const char *path; const char *node; const char *prop; const char *type; + const char *devname; + const char *ignored_types[] = { + "linux_raid_member", + "swap", + "LVM2_member", + NULL, + }; bool cdrom; typestr = udev_device_get_devtype(dev); @@ -118,9 +126,9 @@ static int udev_handle_block_add(struct pb_udev *udev, struct udev_device *dev, /* If our environment's udev can recognise them explictly skip any * device mapper devices we encounter */ - const char *devname = udev_device_get_property_value(dev, "DM_NAME"); + devname = udev_device_get_property_value(dev, "DM_NAME"); if (devname) { - pb_log("SKIP: dm-device %s\n", devname); + pb_debug("SKIP: dm-device %s\n", devname); return 0; } @@ -130,6 +138,14 @@ static int udev_handle_block_add(struct pb_udev *udev, struct udev_device *dev, return 0; } + while (ignored_types[i]) { + if (!strncmp(type, ignored_types[i], strlen(ignored_types[i]))) { + pb_log("SKIP: %s: ignore '%s' filesystem\n", name, type); + return 0; + } + i++; + } + /* We may see multipath devices; they'll have the same uuid as an * existing device, so only parse the first. */ uuid = udev_device_get_property_value(dev, "ID_FS_UUID"); @@ -155,7 +171,9 @@ static int udev_handle_block_add(struct pb_udev *udev, struct udev_device *dev, udev_setup_device_params(dev, ddev); - if (ddev->device->type == DEVICE_TYPE_DISK) + /* Create a snapshot for all disks, unless it is an assembled RAID array */ + if (ddev->device->type == DEVICE_TYPE_DISK && + !udev_device_get_property_value(dev, "MD_LEVEL")) devmapper_init_snapshot(udev->handler, ddev); device_handler_discover(udev->handler, ddev); |