Commit c7ac86de authored by Bryn M. Reeves's avatar Bryn M. Reeves Committed by Alasdair G Kergon

dm mpath: rdac fix init race

Re-order the initialisation of dm-rdac to avoid registering the hw
handler before the workqueue has been initialised. Closes a race
that would potentially give an oops.
Signed-off-by: default avatarBryn M. Reeves <breeves@redhat.com>
Signed-off-by: default avatarAlasdair G Kergon <agk@redhat.com>
parent 60812a4a
...@@ -664,20 +664,21 @@ static struct hw_handler_type rdac_handler = { ...@@ -664,20 +664,21 @@ static struct hw_handler_type rdac_handler = {
static int __init rdac_init(void) static int __init rdac_init(void)
{ {
int r = dm_register_hw_handler(&rdac_handler); int r;
if (r < 0) {
DMERR("%s: register failed %d", RDAC_DM_HWH_NAME, r);
return r;
}
rdac_wkqd = create_singlethread_workqueue("rdac_wkqd"); rdac_wkqd = create_singlethread_workqueue("rdac_wkqd");
if (!rdac_wkqd) { if (!rdac_wkqd) {
DMERR("Failed to create workqueue rdac_wkqd."); DMERR("Failed to create workqueue rdac_wkqd.");
dm_unregister_hw_handler(&rdac_handler);
return -ENOMEM; return -ENOMEM;
} }
r = dm_register_hw_handler(&rdac_handler);
if (r < 0) {
DMERR("%s: register failed %d", RDAC_DM_HWH_NAME, r);
destroy_workqueue(rdac_wkqd);
return r;
}
DMINFO("%s: version %s loaded", RDAC_DM_HWH_NAME, RDAC_DM_HWH_VER); DMINFO("%s: version %s loaded", RDAC_DM_HWH_NAME, RDAC_DM_HWH_VER);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment