lkml.org 
[lkml]   [2009]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH v3 05/14] md/raid6: release spare page at ->stop()
    From
    Date
    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>
    ---
    drivers/md/raid5.c | 26 ++++++++++++--------------
    1 files changed, 12 insertions(+), 14 deletions(-)

    diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
    index e1920f2..9411466 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)
    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)
    {
    raid5_conf_t *conf;
    @@ -4438,11 +4447,7 @@ static raid5_conf_t *setup_conf(mddev_t *mddev)

    abort:
    if (conf) {
    - shrink_stripes(conf);
    - safe_put_page(conf->spare_page);
    - kfree(conf->disks);
    - kfree(conf->stripe_hashtbl);
    - kfree(conf);
    + free_conf(conf);
    return ERR_PTR(-EIO);
    } else
    return ERR_PTR(-ENOMEM);
    @@ -4608,12 +4613,8 @@ abort:
    md_unregister_thread(mddev->thread);
    mddev->thread = NULL;
    if (conf) {
    - shrink_stripes(conf);
    print_raid5_conf(conf);
    - safe_put_page(conf->spare_page);
    - kfree(conf->disks);
    - kfree(conf->stripe_hashtbl);
    - kfree(conf);
    + free_conf(conf);
    }
    mddev->private = NULL;
    printk(KERN_ALERT "raid5: failed to run raid set %s\n", mdname(mddev));
    @@ -4628,13 +4629,10 @@ static int stop(mddev_t *mddev)

    md_unregister_thread(mddev->thread);
    mddev->thread = NULL;
    - shrink_stripes(conf);
    - kfree(conf->stripe_hashtbl);
    mddev->queue->backing_dev_info.congested_fn = NULL;
    blk_sync_queue(mddev->queue); /* the unplug fn references 'conf'*/
    sysfs_remove_group(&mddev->kobj, &raid5_attrs_group);
    - kfree(conf->disks);
    - kfree(conf);
    + free_conf(conf);
    mddev->private = NULL;
    return 0;
    }


    \
     
     \ /
      Last update: 2009-08-30 04:57    [W:0.026 / U:0.488 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site