diff options
-rw-r--r-- | drivers/md/md.c | 8 | ||||
-rw-r--r-- | drivers/md/raid5.c | 2 |
2 files changed, 7 insertions, 3 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index e58d61d9f31b..fe0137a5b002 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -805,7 +805,11 @@ static void super_90_sync(mddev_t *mddev, mdk_rdev_t *rdev) | |||
805 | if (fixdesc & (1<<rdev2->desc_nr)) { | 805 | if (fixdesc & (1<<rdev2->desc_nr)) { |
806 | snprintf(rdev2->kobj.name, KOBJ_NAME_LEN, "dev%d", | 806 | snprintf(rdev2->kobj.name, KOBJ_NAME_LEN, "dev%d", |
807 | rdev2->desc_nr); | 807 | rdev2->desc_nr); |
808 | /* kobject_add gets a ref on the parent, so | ||
809 | * we have to drop the one we already have | ||
810 | */ | ||
808 | kobject_add(&rdev2->kobj); | 811 | kobject_add(&rdev2->kobj); |
812 | kobject_put(rdev->kobj.parent); | ||
809 | sysfs_create_link(&rdev2->kobj, | 813 | sysfs_create_link(&rdev2->kobj, |
810 | &rdev2->bdev->bd_disk->kobj, | 814 | &rdev2->bdev->bd_disk->kobj, |
811 | "block"); | 815 | "block"); |
@@ -1178,7 +1182,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) | |||
1178 | 1182 | ||
1179 | rdev->kobj.k_name = NULL; | 1183 | rdev->kobj.k_name = NULL; |
1180 | snprintf(rdev->kobj.name, KOBJ_NAME_LEN, "dev%d", rdev->desc_nr); | 1184 | snprintf(rdev->kobj.name, KOBJ_NAME_LEN, "dev%d", rdev->desc_nr); |
1181 | rdev->kobj.parent = kobject_get(&mddev->kobj); | 1185 | rdev->kobj.parent = &mddev->kobj; |
1182 | kobject_add(&rdev->kobj); | 1186 | kobject_add(&rdev->kobj); |
1183 | 1187 | ||
1184 | sysfs_create_link(&rdev->kobj, &rdev->bdev->bd_disk->kobj, "block"); | 1188 | sysfs_create_link(&rdev->kobj, &rdev->bdev->bd_disk->kobj, "block"); |
@@ -1864,7 +1868,7 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data) | |||
1864 | add_disk(disk); | 1868 | add_disk(disk); |
1865 | mddev->gendisk = disk; | 1869 | mddev->gendisk = disk; |
1866 | up(&disks_sem); | 1870 | up(&disks_sem); |
1867 | mddev->kobj.parent = kobject_get(&disk->kobj); | 1871 | mddev->kobj.parent = &disk->kobj; |
1868 | mddev->kobj.k_name = NULL; | 1872 | mddev->kobj.k_name = NULL; |
1869 | snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md"); | 1873 | snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md"); |
1870 | mddev->kobj.ktype = &md_ktype; | 1874 | mddev->kobj.ktype = &md_ktype; |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 061d265ed94e..246c9b1cc4a3 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -1975,7 +1975,7 @@ memory = conf->max_nr_stripes * (sizeof(struct stripe_head) + | |||
1975 | } | 1975 | } |
1976 | 1976 | ||
1977 | /* Ok, everything is just fine now */ | 1977 | /* Ok, everything is just fine now */ |
1978 | conf->kobj.parent = kobject_get(&mddev->kobj); | 1978 | conf->kobj.parent = &mddev->kobj; |
1979 | strcpy(conf->kobj.name, "raid5"); | 1979 | strcpy(conf->kobj.name, "raid5"); |
1980 | conf->kobj.ktype = &raid5_ktype; | 1980 | conf->kobj.ktype = &raid5_ktype; |
1981 | kobject_register(&conf->kobj); | 1981 | kobject_register(&conf->kobj); |