Commit 95fc17aa authored by Dan Williams's avatar Dan Williams Committed by NeilBrown

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().

Cc: <stable@kernel.org>
Signed-off-by: default avatarDan Williams <dan.j.williams@intel.com>
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
parent 7d3e91b8
...@@ -4316,6 +4316,15 @@ raid5_size(mddev_t *mddev, sector_t sectors, int raid_disks) ...@@ -4316,6 +4316,15 @@ raid5_size(mddev_t *mddev, sector_t sectors, int raid_disks)
return sectors * (raid_disks - conf->max_degraded); return sectors * (raid_disks - conf->max_degraded);
} }
static void free_conf(raid5_conf_t *conf)
{
shrink_stripes(conf);
safe_put_page(conf->spare_page);
kfree(conf->disks);
kfree(conf->stripe_hashtbl);
kfree(conf);
}
static raid5_conf_t *setup_conf(mddev_t *mddev) static raid5_conf_t *setup_conf(mddev_t *mddev)
{ {
raid5_conf_t *conf; raid5_conf_t *conf;
...@@ -4447,11 +4456,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev) ...@@ -4447,11 +4456,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev)
abort: abort:
if (conf) { if (conf) {
shrink_stripes(conf); free_conf(conf);
safe_put_page(conf->spare_page);
kfree(conf->disks);
kfree(conf->stripe_hashtbl);
kfree(conf);
return ERR_PTR(-EIO); return ERR_PTR(-EIO);
} else } else
return ERR_PTR(-ENOMEM); return ERR_PTR(-ENOMEM);
...@@ -4629,12 +4634,8 @@ static int run(mddev_t *mddev) ...@@ -4629,12 +4634,8 @@ static int run(mddev_t *mddev)
md_unregister_thread(mddev->thread); md_unregister_thread(mddev->thread);
mddev->thread = NULL; mddev->thread = NULL;
if (conf) { if (conf) {
shrink_stripes(conf);
print_raid5_conf(conf); print_raid5_conf(conf);
safe_put_page(conf->spare_page); free_conf(conf);
kfree(conf->disks);
kfree(conf->stripe_hashtbl);
kfree(conf);
} }
mddev->private = NULL; mddev->private = NULL;
printk(KERN_ALERT "raid5: failed to run raid set %s\n", mdname(mddev)); printk(KERN_ALERT "raid5: failed to run raid set %s\n", mdname(mddev));
...@@ -4649,13 +4650,10 @@ static int stop(mddev_t *mddev) ...@@ -4649,13 +4650,10 @@ static int stop(mddev_t *mddev)
md_unregister_thread(mddev->thread); md_unregister_thread(mddev->thread);
mddev->thread = NULL; mddev->thread = NULL;
shrink_stripes(conf);
kfree(conf->stripe_hashtbl);
mddev->queue->backing_dev_info.congested_fn = NULL; mddev->queue->backing_dev_info.congested_fn = NULL;
blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/ blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
sysfs_remove_group(&mddev->kobj, &raid5_attrs_group); sysfs_remove_group(&mddev->kobj, &raid5_attrs_group);
kfree(conf->disks); free_conf(conf);
kfree(conf);
mddev->private = NULL; mddev->private = NULL;
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