aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/md/md.c41
-rw-r--r--drivers/md/raid5.c12
2 files changed, 41 insertions, 12 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index a9852dbdfd66..2a9b6a07e3a2 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1318,6 +1318,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1318 char b[BDEVNAME_SIZE]; 1318 char b[BDEVNAME_SIZE];
1319 struct kobject *ko; 1319 struct kobject *ko;
1320 char *s; 1320 char *s;
1321 int err;
1321 1322
1322 if (rdev->mddev) { 1323 if (rdev->mddev) {
1323 MD_BUG(); 1324 MD_BUG();
@@ -1352,20 +1353,29 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1352 while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL) 1353 while ( (s=strchr(rdev->kobj.k_name, '/')) != NULL)
1353 *s = '!'; 1354 *s = '!';
1354 1355
1355 list_add(&rdev->same_set, &mddev->disks);
1356 rdev->mddev = mddev; 1356 rdev->mddev = mddev;
1357 printk(KERN_INFO "md: bind<%s>\n", b); 1357 printk(KERN_INFO "md: bind<%s>\n", b);
1358 1358
1359 rdev->kobj.parent = &mddev->kobj; 1359 rdev->kobj.parent = &mddev->kobj;
1360 kobject_add(&rdev->kobj); 1360 if ((err = kobject_add(&rdev->kobj)))
1361 goto fail;
1361 1362
1362 if (rdev->bdev->bd_part) 1363 if (rdev->bdev->bd_part)
1363 ko = &rdev->bdev->bd_part->kobj; 1364 ko = &rdev->bdev->bd_part->kobj;
1364 else 1365 else
1365 ko = &rdev->bdev->bd_disk->kobj; 1366 ko = &rdev->bdev->bd_disk->kobj;
1366 sysfs_create_link(&rdev->kobj, ko, "block"); 1367 if ((err = sysfs_create_link(&rdev->kobj, ko, "block"))) {
1368 kobject_del(&rdev->kobj);
1369 goto fail;
1370 }
1371 list_add(&rdev->same_set, &mddev->disks);
1367 bd_claim_by_disk(rdev->bdev, rdev, mddev->gendisk); 1372 bd_claim_by_disk(rdev->bdev, rdev, mddev->gendisk);
1368 return 0; 1373 return 0;
1374
1375 fail:
1376 printk(KERN_WARNING "md: failed to register dev-%s for %s\n",
1377 b, mdname(mddev));
1378 return err;
1369} 1379}
1370 1380
1371static void unbind_rdev_from_array(mdk_rdev_t * rdev) 1381static void unbind_rdev_from_array(mdk_rdev_t * rdev)
@@ -2966,7 +2976,9 @@ static struct kobject *md_probe(dev_t dev, int *part, void *data)
2966 mddev->kobj.k_name = NULL; 2976 mddev->kobj.k_name = NULL;
2967 snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md"); 2977 snprintf(mddev->kobj.name, KOBJ_NAME_LEN, "%s", "md");
2968 mddev->kobj.ktype = &md_ktype; 2978 mddev->kobj.ktype = &md_ktype;
2969 kobject_register(&mddev->kobj); 2979 if (kobject_register(&mddev->kobj))
2980 printk(KERN_WARNING "md: cannot register %s/md - name in use\n",
2981 disk->disk_name);
2970 return NULL; 2982 return NULL;
2971} 2983}
2972 2984
@@ -3144,9 +3156,12 @@ static int do_md_run(mddev_t * mddev)
3144 bitmap_destroy(mddev); 3156 bitmap_destroy(mddev);
3145 return err; 3157 return err;
3146 } 3158 }
3147 if (mddev->pers->sync_request) 3159 if (mddev->pers->sync_request) {
3148 sysfs_create_group(&mddev->kobj, &md_redundancy_group); 3160 if (sysfs_create_group(&mddev->kobj, &md_redundancy_group))
3149 else if (mddev->ro == 2) /* auto-readonly not meaningful */ 3161 printk(KERN_WARNING
3162 "md: cannot register extra attributes for %s\n",
3163 mdname(mddev));
3164 } else if (mddev->ro == 2) /* auto-readonly not meaningful */
3150 mddev->ro = 0; 3165 mddev->ro = 0;
3151 3166
3152 atomic_set(&mddev->writes_pending,0); 3167 atomic_set(&mddev->writes_pending,0);
@@ -3160,7 +3175,9 @@ static int do_md_run(mddev_t * mddev)
3160 if (rdev->raid_disk >= 0) { 3175 if (rdev->raid_disk >= 0) {
3161 char nm[20]; 3176 char nm[20];
3162 sprintf(nm, "rd%d", rdev->raid_disk); 3177 sprintf(nm, "rd%d", rdev->raid_disk);
3163 sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); 3178 if (sysfs_create_link(&mddev->kobj, &rdev->kobj, nm))
3179 printk("md: cannot register %s for %s\n",
3180 nm, mdname(mddev));
3164 } 3181 }
3165 3182
3166 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery); 3183 set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);
@@ -5386,8 +5403,12 @@ static int remove_and_add_spares(mddev_t *mddev)
5386 if (mddev->pers->hot_add_disk(mddev,rdev)) { 5403 if (mddev->pers->hot_add_disk(mddev,rdev)) {
5387 char nm[20]; 5404 char nm[20];
5388 sprintf(nm, "rd%d", rdev->raid_disk); 5405 sprintf(nm, "rd%d", rdev->raid_disk);
5389 sysfs_create_link(&mddev->kobj, 5406 if (sysfs_create_link(&mddev->kobj,
5390 &rdev->kobj, nm); 5407 &rdev->kobj, nm))
5408 printk(KERN_WARNING
5409 "md: cannot register "
5410 "%s for %s\n",
5411 nm, mdname(mddev));
5391 spares++; 5412 spares++;
5392 md_new_event(mddev); 5413 md_new_event(mddev);
5393 } else 5414 } else
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
index 4dd252864f52..8d59914f2057 100644
--- a/drivers/md/raid5.c
+++ b/drivers/md/raid5.c
@@ -3642,7 +3642,10 @@ static int run(mddev_t *mddev)
3642 } 3642 }
3643 3643
3644 /* Ok, everything is just fine now */ 3644 /* Ok, everything is just fine now */
3645 sysfs_create_group(&mddev->kobj, &raid5_attrs_group); 3645 if (sysfs_create_group(&mddev->kobj, &raid5_attrs_group))
3646 printk(KERN_WARNING
3647 "raid5: failed to create sysfs attributes for %s\n",
3648 mdname(mddev));
3646 3649
3647 mddev->queue->unplug_fn = raid5_unplug_device; 3650 mddev->queue->unplug_fn = raid5_unplug_device;
3648 mddev->queue->issue_flush_fn = raid5_issue_flush; 3651 mddev->queue->issue_flush_fn = raid5_issue_flush;
@@ -3951,7 +3954,12 @@ static int raid5_start_reshape(mddev_t *mddev)
3951 added_devices++; 3954 added_devices++;
3952 rdev->recovery_offset = 0; 3955 rdev->recovery_offset = 0;
3953 sprintf(nm, "rd%d", rdev->raid_disk); 3956 sprintf(nm, "rd%d", rdev->raid_disk);
3954 sysfs_create_link(&mddev->kobj, &rdev->kobj, nm); 3957 if (sysfs_create_link(&mddev->kobj,
3958 &rdev->kobj, nm))
3959 printk(KERN_WARNING
3960 "raid5: failed to create "
3961 " link %s for %s\n",
3962 nm, mdname(mddev));
3955 } else 3963 } else
3956 break; 3964 break;
3957 } 3965 }