md: reduce dependence on sysfs.

We will want md devices to live as dm targets where sysfs is not
visible.  So allow md to not connect to sysfs.

Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown
2010-06-01 19:37:23 +10:00
parent d0c6f62584
commit 00bcb4ac7e
3 changed files with 62 additions and 59 deletions

View File

@@ -5158,7 +5158,8 @@ static int run(mddev_t *mddev)
/* Ok, everything is just fine now */
if (mddev->to_remove == &raid5_attrs_group)
mddev->to_remove = NULL;
else if (sysfs_create_group(&mddev->kobj, &raid5_attrs_group))
else if (mddev->kobj.sd &&
sysfs_create_group(&mddev->kobj, &raid5_attrs_group))
printk(KERN_WARNING
"md/raid:%s: failed to create sysfs attributes.\n",
mdname(mddev));
@@ -5545,10 +5546,7 @@ static int raid5_start_reshape(mddev_t *mddev)
sprintf(nm, "rd%d", rdev->raid_disk);
if (sysfs_create_link(&mddev->kobj,
&rdev->kobj, nm))
printk(KERN_WARNING
"md/raid:%s: failed to create "
" link %s\n",
mdname(mddev), nm);
/* Failure here is OK */;
} else
break;
}