aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/dm-mpath-rdac.c
diff options
context:
space:
mode:
authorBryn M. Reeves <breeves@redhat.com>2007-10-19 17:29:32 -0400
committerAlasdair G Kergon <agk@redhat.com>2007-10-19 21:00:57 -0400
commitc7ac86de6a1bcb1b59c83e19b0d0d64a59604ade (patch)
tree6dba24ddd057340ce8fe8ce6b887b7d6ce4f4193 /drivers/md/dm-mpath-rdac.c
parent60812a4a99b796d894d2522dc63cb0fafc3be25e (diff)
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: Bryn M. Reeves <breeves@redhat.com> Signed-off-by: Alasdair G Kergon <agk@redhat.com>
Diffstat (limited to 'drivers/md/dm-mpath-rdac.c')
-rw-r--r--drivers/md/dm-mpath-rdac.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/drivers/md/dm-mpath-rdac.c b/drivers/md/dm-mpath-rdac.c
index 16b161345775..e04eb5c697fb 100644
--- a/drivers/md/dm-mpath-rdac.c
+++ b/drivers/md/dm-mpath-rdac.c
@@ -664,20 +664,21 @@ static struct hw_handler_type rdac_handler = {
664 664
665static int __init rdac_init(void) 665static int __init rdac_init(void)
666{ 666{
667 int r = dm_register_hw_handler(&rdac_handler); 667 int r;
668
669 if (r < 0) {
670 DMERR("%s: register failed %d", RDAC_DM_HWH_NAME, r);
671 return r;
672 }
673 668
674 rdac_wkqd = create_singlethread_workqueue("rdac_wkqd"); 669 rdac_wkqd = create_singlethread_workqueue("rdac_wkqd");
675 if (!rdac_wkqd) { 670 if (!rdac_wkqd) {
676 DMERR("Failed to create workqueue rdac_wkqd."); 671 DMERR("Failed to create workqueue rdac_wkqd.");
677 dm_unregister_hw_handler(&rdac_handler);
678 return -ENOMEM; 672 return -ENOMEM;
679 } 673 }
680 674
675 r = dm_register_hw_handler(&rdac_handler);
676 if (r < 0) {
677 DMERR("%s: register failed %d", RDAC_DM_HWH_NAME, r);
678 destroy_workqueue(rdac_wkqd);
679 return r;
680 }
681
681 DMINFO("%s: version %s loaded", RDAC_DM_HWH_NAME, RDAC_DM_HWH_VER); 682 DMINFO("%s: version %s loaded", RDAC_DM_HWH_NAME, RDAC_DM_HWH_VER);
682 return 0; 683 return 0;
683} 684}