aboutsummaryrefslogtreecommitdiffstats
path: root/fs/partitions
diff options
context:
space:
mode:
Diffstat (limited to 'fs/partitions')
-rw-r--r--fs/partitions/check.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index bdf8d3cc95a4..48209f58522b 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -381,6 +381,13 @@ static void delete_partition_rcu_cb(struct rcu_head *head)
381 put_device(part_to_dev(part)); 381 put_device(part_to_dev(part));
382} 382}
383 383
384void __delete_partition(struct kref *ref)
385{
386 struct hd_struct *part = container_of(ref, struct hd_struct, ref);
387
388 call_rcu(&part->rcu_head, delete_partition_rcu_cb);
389}
390
384void delete_partition(struct gendisk *disk, int partno) 391void delete_partition(struct gendisk *disk, int partno)
385{ 392{
386 struct disk_part_tbl *ptbl = disk->part_tbl; 393 struct disk_part_tbl *ptbl = disk->part_tbl;
@@ -399,7 +406,7 @@ void delete_partition(struct gendisk *disk, int partno)
399 kobject_put(part->holder_dir); 406 kobject_put(part->holder_dir);
400 device_del(part_to_dev(part)); 407 device_del(part_to_dev(part));
401 408
402 call_rcu(&part->rcu_head, delete_partition_rcu_cb); 409 kref_put(&part->ref, __delete_partition);
403} 410}
404 411
405static ssize_t whole_disk_show(struct device *dev, 412static ssize_t whole_disk_show(struct device *dev,
@@ -498,6 +505,7 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
498 if (!dev_get_uevent_suppress(ddev)) 505 if (!dev_get_uevent_suppress(ddev))
499 kobject_uevent(&pdev->kobj, KOBJ_ADD); 506 kobject_uevent(&pdev->kobj, KOBJ_ADD);
500 507
508 kref_init(&p->ref);
501 return p; 509 return p;
502 510
503out_free_info: 511out_free_info: