aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions
diff options
context:
space:
mode:
Diffstat (limited to 'fs/partitions')
-rw-r--r--fs/partitions/check.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index 9a64045ff845..f2ec7f1b0ec5 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -18,6 +18,7 @@
18#include <linux/fs.h> 18#include <linux/fs.h>
19#include <linux/kmod.h> 19#include <linux/kmod.h>
20#include <linux/ctype.h> 20#include <linux/ctype.h>
21#include <linux/genhd.h>
21 22
22#include "check.h" 23#include "check.h"
23 24
@@ -273,6 +274,7 @@ static struct attribute_group *part_attr_groups[] = {
273static void part_release(struct device *dev) 274static void part_release(struct device *dev)
274{ 275{
275 struct hd_struct *p = dev_to_part(dev); 276 struct hd_struct *p = dev_to_part(dev);
277 free_part_stats(p);
276 kfree(p); 278 kfree(p);
277} 279}
278 280
@@ -314,6 +316,7 @@ void delete_partition(struct gendisk *disk, int part)
314 p->nr_sects = 0; 316 p->nr_sects = 0;
315 p->ios[0] = p->ios[1] = 0; 317 p->ios[0] = p->ios[1] = 0;
316 p->sectors[0] = p->sectors[1] = 0; 318 p->sectors[0] = p->sectors[1] = 0;
319 part_stat_set_all(p, 0);
317 kobject_put(p->holder_dir); 320 kobject_put(p->holder_dir);
318 device_del(&p->dev); 321 device_del(&p->dev);
319 put_device(&p->dev); 322 put_device(&p->dev);
@@ -336,6 +339,10 @@ void add_partition(struct gendisk *disk, int part, sector_t start, sector_t len,
336 if (!p) 339 if (!p)
337 return; 340 return;
338 341
342 if (!init_part_stats(p)) {
343 kfree(p);
344 return;
345 }
339 p->start_sect = start; 346 p->start_sect = start;
340 p->nr_sects = len; 347 p->nr_sects = len;
341 p->partno = part; 348 p->partno = part;