aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid10.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2009-10-16 00:55:44 -0400
committerNeilBrown <neilb@suse.de>2009-10-16 00:55:44 -0400
commited9bfdf1a40952fd0f8094ec77f876b84ead69af (patch)
tree2b92f23e861fa2695a55a0cd797233d032634c9d /drivers/md/raid10.c
parentf5efd45ae597c96ed017afad5662b67d55b402a0 (diff)
md: raid1/raid10: handle allocation errors during array setup.
Both raid1 and raid10 create a mempool during startup. If the 'alloc' function for this mempool fails, unplug_slaves is called. If that happens when the pool is being initialised, unplug_slaves will try to use the 'conf' structure that isn't filled in yet, and badness will happen. So ensure that unplug_slaves doesn't get called unless we know that the conf structure if fully initialised. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/raid10.c')
-rw-r--r--drivers/md/raid10.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
index 69fc76caa469..c2cb7b87b440 100644
--- a/drivers/md/raid10.c
+++ b/drivers/md/raid10.c
@@ -68,7 +68,7 @@ static void * r10bio_pool_alloc(gfp_t gfp_flags, void *data)
68 68
69 /* allocate a r10bio with room for raid_disks entries in the bios array */ 69 /* allocate a r10bio with room for raid_disks entries in the bios array */
70 r10_bio = kzalloc(size, gfp_flags); 70 r10_bio = kzalloc(size, gfp_flags);
71 if (!r10_bio) 71 if (!r10_bio && conf->mddev)
72 unplug_slaves(conf->mddev); 72 unplug_slaves(conf->mddev);
73 73
74 return r10_bio; 74 return r10_bio;
@@ -2096,7 +2096,6 @@ static int run(mddev_t *mddev)
2096 if (!conf->tmppage) 2096 if (!conf->tmppage)
2097 goto out_free_conf; 2097 goto out_free_conf;
2098 2098
2099 conf->mddev = mddev;
2100 conf->raid_disks = mddev->raid_disks; 2099 conf->raid_disks = mddev->raid_disks;
2101 conf->near_copies = nc; 2100 conf->near_copies = nc;
2102 conf->far_copies = fc; 2101 conf->far_copies = fc;
@@ -2133,6 +2132,7 @@ static int run(mddev_t *mddev)
2133 goto out_free_conf; 2132 goto out_free_conf;
2134 } 2133 }
2135 2134
2135 conf->mddev = mddev;
2136 spin_lock_init(&conf->device_lock); 2136 spin_lock_init(&conf->device_lock);
2137 mddev->queue->queue_lock = &conf->device_lock; 2137 mddev->queue->queue_lock = &conf->device_lock;
2138 2138