diff options
author | Arnout Vandecappelle <arnout@mind.be> | 2009-08-07 10:44:48 +0200 |
---|---|---|
committer | Danny Kukawka <danny.kukawka@web.de> | 2009-08-07 10:44:48 +0200 |
commit | 195146f263e193dc80a4094b4750999657734243 (patch) | |
tree | 53b80266e1cd43dca6029cf35e61034ca6cece7b | |
parent | 62e80cfc72e07036e188bf847b366e4f812a7944 (diff) |
don't remove scsi_host if there are still targets using it
When a scsi device is removed, the host it is connected to is also
removed by missing_scsi_host(). However, it is possible that other
targets still exist that are connected to the same host. In that case,
the scsi_host should not be removed. We check if the scsi_host has
more than one child, and if so it is not removed.
fd.o#20712
-rw-r--r-- | hald/linux/device.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/hald/linux/device.c b/hald/linux/device.c index 3bd13831..2eca1ef3 100644 --- a/hald/linux/device.c +++ b/hald/linux/device.c @@ -3069,6 +3069,22 @@ missing_scsi_host (const gchar *sysfs_path, HotplugEvent *device_event, HotplugA if (action == HOTPLUG_ACTION_REMOVE && d == NULL) goto out; + /* skip "remove" if more than one child still exists */ + if (action == HOTPLUG_ACTION_REMOVE && d != NULL) + { + GSList *siblings; + + siblings = hal_device_store_match_multiple_key_value_string (hald_get_gdl(), + "info.parent", + hal_device_get_udi(d)); + if (siblings && g_slist_next(siblings) != NULL) + { + g_slist_free(siblings); + goto out; + } + g_slist_free(siblings); + } + /* fake host event */ rc = TRUE; host_event = g_slice_new0 (HotplugEvent); |