aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-05-21 23:55:01 -0400
committerNeilBrown <neilb@suse.de>2012-05-21 23:55:01 -0400
commit4fa2f327681808f653711e14203a42cf4644bda0 (patch)
tree0fdbe3ffa37dac453401b2d9afed4929194d6176 /drivers/md
parent545c87957f4d53867b62921625f36df8c4b1bc08 (diff)
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')
-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)
816 put_page(rdev->bb_page); 816 put_page(rdev->bb_page);
817 rdev->bb_page = NULL; 817 rdev->bb_page = NULL;
818 } 818 }
819 kfree(rdev->badblocks.page);
820 rdev->badblocks.page = NULL;
819} 821}
820EXPORT_SYMBOL_GPL(md_rdev_clear); 822EXPORT_SYMBOL_GPL(md_rdev_clear);
821 823
@@ -2191,9 +2193,7 @@ static void unbind_rdev_from_array(struct md_rdev * rdev)
2191 sysfs_remove_link(&rdev->kobj, "block"); 2193 sysfs_remove_link(&rdev->kobj, "block");
2192 sysfs_put(rdev->sysfs_state); 2194 sysfs_put(rdev->sysfs_state);
2193 rdev->sysfs_state = NULL; 2195 rdev->sysfs_state = NULL;
2194 kfree(rdev->badblocks.page);
2195 rdev->badblocks.count = 0; 2196 rdev->badblocks.count = 0;
2196 rdev->badblocks.page = NULL;
2197 /* We need to delay this, otherwise we can deadlock when 2197 /* We need to delay this, otherwise we can deadlock when
2198 * writing to 'remove' to "dev/state". We also need 2198 * writing to 'remove' to "dev/state". We also need
2199 * to delay it due to rcu usage. 2199 * to delay it due to rcu usage.
@@ -3325,7 +3325,6 @@ abort_free:
3325 if (rdev->bdev) 3325 if (rdev->bdev)
3326 unlock_rdev(rdev); 3326 unlock_rdev(rdev);
3327 md_rdev_clear(rdev); 3327 md_rdev_clear(rdev);
3328 kfree(rdev->badblocks.page);
3329 kfree(rdev); 3328 kfree(rdev);
3330 return ERR_PTR(err); 3329 return ERR_PTR(err);
3331} 3330}