Skip to content

Commit

Permalink
dm mpath: rdac fix init race
Browse files Browse the repository at this point in the history
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: Bryn M. Reeves <breeves@redhat.com>
Signed-off-by: Alasdair G Kergon <agk@redhat.com>
  • Loading branch information
Bryn M. Reeves authored and Alasdair G Kergon committed Oct 20, 2007
1 parent 60812a4 commit c7ac86d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions drivers/md/dm-mpath-rdac.c
Original file line number Diff line number Diff line change
Expand Up @@ -664,20 +664,21 @@ static struct hw_handler_type rdac_handler = {

static int __init rdac_init(void)
{
int r = dm_register_hw_handler(&rdac_handler);

if (r < 0) {
DMERR("%s: register failed %d", RDAC_DM_HWH_NAME, r);
return r;
}
int r;

rdac_wkqd = create_singlethread_workqueue("rdac_wkqd");
if (!rdac_wkqd) {
DMERR("Failed to create workqueue rdac_wkqd.");
dm_unregister_hw_handler(&rdac_handler);
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);
return 0;
}
Expand Down

0 comments on commit c7ac86d

Please sign in to comment.