summaryrefslogtreecommitdiff
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-05-22 07:55:01 +0400
committerNeilBrown <neilb@suse.de>2012-05-22 07:55:01 +0400
commit4fa2f327681808f653711e14203a42cf4644bda0 (patch)
tree0fdbe3ffa37dac453401b2d9afed4929194d6176 /drivers/md/md.c
parent545c87957f4d53867b62921625f36df8c4b1bc08 (diff)
downloadlinux-4fa2f327681808f653711e14203a42cf4644bda0.tar.xz
md: move freeing of badblocks.page into md_rdev_clear
This ensures that it is always freed - there were case where we failed to free the page. Reported-by: majianpeng <majianpeng@gmail.com> Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index d557e557ff8f..ac99616f48d4 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -816,6 +816,8 @@ void md_rdev_clear(struct md_rdev *rdev)
put_page(rdev->bb_page);
rdev->bb_page = NULL;
}
+ kfree(rdev->badblocks.page);
+ rdev->badblocks.page = NULL;
}
EXPORT_SYMBOL_GPL(md_rdev_clear);
@@ -2191,9 +2193,7 @@ static void unbind_rdev_from_array(struct md_rdev * rdev)
sysfs_remove_link(&rdev->kobj, "block");
sysfs_put(rdev->sysfs_state);
rdev->sysfs_state = NULL;
- kfree(rdev->badblocks.page);
rdev->badblocks.count = 0;
- rdev->badblocks.page = NULL;
/* We need to delay this, otherwise we can deadlock when
* writing to 'remove' to "dev/state". We also need
* to delay it due to rcu usage.
@@ -3325,7 +3325,6 @@ abort_free:
if (rdev->bdev)
unlock_rdev(rdev);
md_rdev_clear(rdev);
- kfree(rdev->badblocks.page);
kfree(rdev);
return ERR_PTR(err);
}