From: David Zeuthen Date: Thu, 13 Sep 2012 19:57:52 +0000 (-0400) Subject: Skip partitions of MD-RAID devices X-Git-Tag: upstream/2.1.2~147 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf8d5b05921449418c23d28b1d1b46422f1437af;p=platform%2Fupstream%2Fudisks2.git Skip partitions of MD-RAID devices Signed-off-by: David Zeuthen --- diff --git a/src/udiskslinuxmdraid.c b/src/udiskslinuxmdraid.c index 3e0fcac..b92cee3 100644 --- a/src/udiskslinuxmdraid.c +++ b/src/udiskslinuxmdraid.c @@ -279,9 +279,11 @@ udisks_linux_mdraid_update (UDisksLinuxMDRaid *mdraid, /* Can't use GUdevDevice methods as they cache the result and these variables vary */ degraded = read_sysfs_attr_as_int (raid_device, "md/degraded"); sync_action = read_sysfs_attr (raid_device, "md/sync_action"); - g_strstrip (sync_action); + if (sync_action != NULL) + g_strstrip (sync_action); sync_completed = read_sysfs_attr (raid_device, "md/sync_completed"); - g_strstrip (sync_completed); + if (sync_completed != NULL) + g_strstrip (sync_completed); } udisks_mdraid_set_degraded (iface, degraded); udisks_mdraid_set_sync_action (iface, sync_action); diff --git a/src/udiskslinuxmdraidobject.c b/src/udiskslinuxmdraidobject.c index 4c0775a..c5055dc 100644 --- a/src/udiskslinuxmdraidobject.c +++ b/src/udiskslinuxmdraidobject.c @@ -592,10 +592,21 @@ udisks_linux_mdraid_object_uevent (UDisksLinuxMDRaidObject *object, { GList *link; gboolean conf_changed = FALSE; + gboolean is_md_device = FALSE; g_return_if_fail (UDISKS_IS_LINUX_MDRAID_OBJECT (object)); g_return_if_fail (device == NULL || G_UDEV_IS_DEVICE (device)); + if (device != NULL && + g_str_has_prefix (g_udev_device_get_name (device), "md")) /* TODO: better heuristic */ + is_md_device = TRUE; + + /* Skip partitions of md devices */ + if (is_md_device && device != NULL && + g_strcmp0 (g_udev_device_get_devtype (device), "disk") != 0) + goto out; + + link = NULL; if (device != NULL) link = find_link_for_sysfs_path (object, g_udev_device_get_sysfs_path (device)); @@ -603,7 +614,7 @@ udisks_linux_mdraid_object_uevent (UDisksLinuxMDRaidObject *object, { if (link != NULL) { - if (g_str_has_prefix (g_udev_device_get_name (device), "md")) + if (is_md_device) md_device_removed (object, device); g_object_unref (G_UDEV_DEVICE (link->data)); object->devices = g_list_delete_link (object->devices, link); @@ -626,7 +637,7 @@ udisks_linux_mdraid_object_uevent (UDisksLinuxMDRaidObject *object, if (device != NULL) { object->devices = g_list_append (object->devices, g_object_ref (device)); - if (g_str_has_prefix (g_udev_device_get_name (device), "md")) + if (is_md_device) md_device_added (object, device); } } @@ -635,6 +646,8 @@ udisks_linux_mdraid_object_uevent (UDisksLinuxMDRaidObject *object, conf_changed = FALSE; conf_changed |= update_iface (object, action, mdraid_check, mdraid_connect, mdraid_update, UDISKS_TYPE_LINUX_MDRAID, &object->iface_mdraid); + out: + ; } /* ---------------------------------------------------------------------------------------------------- */