diff options
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r-- | drivers/md/md.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index cef9ebd5a046..c28a120b4161 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -231,7 +231,7 @@ static void mddev_put(mddev_t *mddev) | |||
231 | list_del(&mddev->all_mddevs); | 231 | list_del(&mddev->all_mddevs); |
232 | spin_unlock(&all_mddevs_lock); | 232 | spin_unlock(&all_mddevs_lock); |
233 | blk_cleanup_queue(mddev->queue); | 233 | blk_cleanup_queue(mddev->queue); |
234 | kobject_unregister(&mddev->kobj); | 234 | kobject_put(&mddev->kobj); |
235 | } else | 235 | } else |
236 | spin_unlock(&all_mddevs_lock); | 236 | spin_unlock(&all_mddevs_lock); |
237 | } | 237 | } |
@@ -1383,22 +1383,19 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) | |||
1383 | return -EBUSY; | 1383 | return -EBUSY; |
1384 | } | 1384 | } |
1385 | bdevname(rdev->bdev,b); | 1385 | bdevname(rdev->bdev,b); |
1386 | if (kobject_set_name(&rdev->kobj, "dev-%s", b) < 0) | 1386 | while ( (s=strchr(b, '/')) != NULL) |
1387 | return -ENOMEM; | ||
1388 | while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL) | ||
1389 | *s = '!'; | 1387 | *s = '!'; |
1390 | 1388 | ||
1391 | rdev->mddev = mddev; | 1389 | rdev->mddev = mddev; |
1392 | printk(KERN_INFO "md: bind<%s>\n", b); | 1390 | printk(KERN_INFO "md: bind<%s>\n", b); |
1393 | 1391 | ||
1394 | rdev->kobj.parent = &mddev->kobj; | 1392 | if ((err = kobject_add(&rdev->kobj, &mddev->kobj, "dev-%s", b))) |
1395 | if ((err = kobject_add(&rdev->kobj))) | ||
1396 | goto fail; | 1393 | goto fail; |
1397 | 1394 | ||
1398 | if (rdev->bdev->bd_part) | 1395 | if (rdev->bdev->bd_part) |
1399 | ko = &rdev->bdev->bd_part->kobj; | 1396 | ko = &rdev->bdev->bd_part->dev.kobj; |
1400 | else | 1397 | else |
1401 | ko = &rdev->bdev->bd_disk->kobj; | 1398 | ko = &rdev->bdev->bd_disk->dev.kobj; |
1402 | if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) { | 1399 | if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) { |
1403 | kobject_del(&rdev->kobj); | 1400 | kobject_del(&rdev->kobj); |
1404 | goto fail; | 1401 | goto fail; |
@@ -2036,9 +2033,7 @@ static mdk_rdev_t *md_import_device(dev_t newdev, int super_format, int super_mi | |||
2036 | if (err) | 2033 | if (err) |
2037 | goto abort_free; | 2034 | goto abort_free; |
2038 | 2035 | ||
2039 | rdev->kobj.parent = NULL; | 2036 | kobject_init(&rdev->kobj, &rdev_ktype); |
2040 | rdev->kobj.ktype = &rdev_ktype; | ||
2041 | kobject_init(&rdev->kobj); | ||
2042 | 2037 | ||
2043 | rdev->desc_nr = -1; | 2038 | rdev->desc_nr = -1; |
2044 | rdev->saved_raid_disk = -1; | 2039 | rdev->saved_raid_disk = -1; |
@@ -3054,6 +3049,7 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data) | |||
3054 | int partitioned = (MAJOR(dev) != MD_MAJOR); | 3049 | int partitioned = (MAJOR(dev) != MD_MAJOR); |
3055 | int shift = partitioned ? MdpMinorShift : 0; | 3050 | int shift = partitioned ? MdpMinorShift : 0; |
3056 | int unit = MINOR(dev) >> shift; | 3051 | int unit = MINOR(dev) >> shift; |
3052 | int error; | ||
3057 | 3053 | ||
3058 | if (!mddev) | 3054 | if (!mddev) |
3059 | return NULL; | 3055 | return NULL; |
@@ -3082,12 +3078,13 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data) | |||
3082 | add_disk(disk); | 3078 | add_disk(disk); |
3083 | mddev->gendisk = disk; | 3079 | mddev->gendisk = disk; |
3084 | mutex_unlock(&disks_mutex); | 3080 | mutex_unlock(&disks_mutex); |
3085 | mddev->kobj.parent = &disk->kobj; | 3081 | error = kobject_init_and_add(&mddev->kobj, &md_ktype, &disk->dev.kobj, |
3086 | kobject_set_name(&mddev->kobj, "%s", "md"); | 3082 | "%s", "md"); |
3087 | mddev->kobj.ktype = &md_ktype; | 3083 | if (error) |
3088 | if (kobject_register(&mddev->kobj)) | ||
3089 | printk(KERN_WARNING "md: cannot register %s/md - name in use\n", | 3084 | printk(KERN_WARNING "md: cannot register %s/md - name in use\n", |
3090 | disk->disk_name); | 3085 | disk->disk_name); |
3086 | else | ||
3087 | kobject_uevent(&mddev->kobj, KOBJ_ADD); | ||
3091 | return NULL; | 3088 | return NULL; |
3092 | } | 3089 | } |
3093 | 3090 | ||
@@ -3359,7 +3356,7 @@ static int do_md_run(mddev_t * mddev) | |||
3359 | 3356 | ||
3360 | mddev->changed = 1; | 3357 | mddev->changed = 1; |
3361 | md_new_event(mddev); | 3358 | md_new_event(mddev); |
3362 | kobject_uevent(&mddev->gendisk->kobj, KOBJ_CHANGE); | 3359 | kobject_uevent(&mddev->gendisk->dev.kobj, KOBJ_CHANGE); |
3363 | return 0; | 3360 | return 0; |
3364 | } | 3361 | } |
3365 | 3362 | ||