aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/raid5.c
diff options
context:
space:
mode:
authorDan Williams <dan.j.williams@intel.com>2009-07-14 14:48:16 -0400
committerDan Williams <dan.j.williams@intel.com>2009-07-14 14:48:16 -0400
commita11034b4282515fd7d9f6fdc0a1380781da461c3 (patch)
tree31731cf11de0f1fbeaa3e818740b83221badee4c /drivers/md/raid5.c
parent04ce9ab385dc97eb55299d533cd3af79b8fc7529 (diff)
md/raid6: release spare page at ->stop()
Add missing call to safe_put_page from stop() by unifying open coded raid5_conf_t de-allocation under free_conf(). Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/md/raid5.c')
-rw-r--r--drivers/md/raid5.c26
1 files changed, 12 insertions, 14 deletions
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index e1920f23579f..9411466f71de 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -4309,6 +4309,15 @@ raid5_size(mddev_t *mddev, sector_t sectors, int raid_disks)
4309 return sectors * (raid_disks - conf->max_degraded); 4309 return sectors * (raid_disks - conf->max_degraded);
4310} 4310}
4311 4311
4312static void free_conf(raid5_conf_t *conf)
4313{
4314 shrink_stripes(conf);
4315 safe_put_page(conf->spare_page);
4316 kfree(conf->disks);
4317 kfree(conf->stripe_hashtbl);
4318 kfree(conf);
4319}
4320
4312static raid5_conf_t *setup_conf(mddev_t *mddev) 4321static raid5_conf_t *setup_conf(mddev_t *mddev)
4313{ 4322{
4314 raid5_conf_t *conf; 4323 raid5_conf_t *conf;
@@ -4438,11 +4447,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev)
4438 4447
4439 abort: 4448 abort:
4440 if (conf) { 4449 if (conf) {
4441 shrink_stripes(conf); 4450 free_conf(conf);
4442 safe_put_page(conf->spare_page);
4443 kfree(conf->disks);
4444 kfree(conf->stripe_hashtbl);
4445 kfree(conf);
4446 return ERR_PTR(-EIO); 4451 return ERR_PTR(-EIO);
4447 } else 4452 } else
4448 return ERR_PTR(-ENOMEM); 4453 return ERR_PTR(-ENOMEM);
@@ -4608,12 +4613,8 @@ abort:
4608 md_unregister_thread(mddev->thread); 4613 md_unregister_thread(mddev->thread);
4609 mddev->thread = NULL; 4614 mddev->thread = NULL;
4610 if (conf) { 4615 if (conf) {
4611 shrink_stripes(conf);
4612 print_raid5_conf(conf); 4616 print_raid5_conf(conf);
4613 safe_put_page(conf->spare_page); 4617 free_conf(conf);
4614 kfree(conf->disks);
4615 kfree(conf->stripe_hashtbl);
4616 kfree(conf);
4617 } 4618 }
4618 mddev->private = NULL; 4619 mddev->private = NULL;
4619 printk(KERN_ALERT "raid5: failed to run raid set %s\n", mdname(mddev)); 4620 printk(KERN_ALERT "raid5: failed to run raid set %s\n", mdname(mddev));
@@ -4628,13 +4629,10 @@ static int stop(mddev_t *mddev)
4628 4629
4629 md_unregister_thread(mddev->thread); 4630 md_unregister_thread(mddev->thread);
4630 mddev->thread = NULL; 4631 mddev->thread = NULL;
4631 shrink_stripes(conf);
4632 kfree(conf->stripe_hashtbl);
4633 mddev->queue->backing_dev_info.congested_fn = NULL; 4632 mddev->queue->backing_dev_info.congested_fn = NULL;
4634 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ 4633 blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
4635 sysfs_remove_group(&mddev->kobj, &raid5_attrs_group); 4634 sysfs_remove_group(&mddev->kobj, &raid5_attrs_group);
4636 kfree(conf->disks); 4635 free_conf(conf);
4637 kfree(conf);
4638 mddev->private = NULL; 4636 mddev->private = NULL;
4639 return 0; 4637 return 0;
4640} 4638}