diff options
author | majianpeng <majianpeng@gmail.com> | 2012-04-02 09:48:38 +1000 |
---|---|---|
committer | NeilBrown <neilb@suse.de> | 2012-04-02 09:48:38 +1000 |
commit | 5220ea1e640869e70f894837678315c878c651fd (patch) | |
tree | b18af9d438b634e81bd5d87c2323ae58d52eaf73 /drivers/md | |
parent | 0366ef847581d692e197b88825867ca9ee00e358 (diff) | |
download | linux-3.10-5220ea1e640869e70f894837678315c878c651fd.tar.gz linux-3.10-5220ea1e640869e70f894837678315c878c651fd.tar.bz2 linux-3.10-5220ea1e640869e70f894837678315c878c651fd.zip |
md/raid1: If md_integrity_register() failed,run() must free the mem
Signed-off-by: majianpeng <majianpeng@gmail.com>
Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/raid1.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 4a40a200d76..242440831b2 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c @@ -2636,11 +2636,13 @@ static struct r1conf *setup_conf(struct mddev *mddev) return ERR_PTR(err); } +static int stop(struct mddev *mddev); static int run(struct mddev *mddev) { struct r1conf *conf; int i; struct md_rdev *rdev; + int ret; if (mddev->level != 1) { printk(KERN_ERR "md/raid1:%s: raid level not set to mirroring (%d)\n", @@ -2705,7 +2707,11 @@ static int run(struct mddev *mddev) mddev->queue->backing_dev_info.congested_data = mddev; blk_queue_merge_bvec(mddev->queue, raid1_mergeable_bvec); } - return md_integrity_register(mddev); + + ret = md_integrity_register(mddev); + if (ret) + stop(mddev); + return ret; } static int stop(struct mddev *mddev) |