aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/md/md.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2005-11-09 00:39:37 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-09 10:56:39 -0500
commitf637b9f9fc195e4f4635faf495fd8b462c21b411 (patch)
treebcd71dc2e3c0a2fd97c5973d6a29010c3eab1990 /drivers/md/md.c
parentf91de92ed6bfb70a3ff607558c910c7bf34d45e9 (diff)
[PATCH] md: make sure /block link in /sys/.../md/ goes to correct devices
If a block_device is a partition, then it's kobject is bdev->bd_part->kobj otherwise (if it is a full device), the kobject is bdev->bd_disk->kobj As md wants back-links to the correct object (whether partition or not), we need to respect this difference... (Thus current code shows a link to the whole device, whether we are using a partition or not, which is wrong). Signed-off-by: Neil Brown <neilb@suse.de> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/md/md.c')
-rw-r--r--drivers/md/md.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c
index d002b8301fc2..2b5928976095 100644
--- a/drivers/md/md.c
+++ b/drivers/md/md.c
@@ -1182,6 +1182,7 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1182{ 1182{
1183 mdk_rdev_t *same_pdev; 1183 mdk_rdev_t *same_pdev;
1184 char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE]; 1184 char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE];
1185 struct kobject *ko;
1185 1186
1186 if (rdev->mddev) { 1187 if (rdev->mddev) {
1187 MD_BUG(); 1188 MD_BUG();
@@ -1221,7 +1222,11 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev)
1221 rdev->kobj.parent = &mddev->kobj; 1222 rdev->kobj.parent = &mddev->kobj;
1222 kobject_add(&rdev->kobj); 1223 kobject_add(&rdev->kobj);
1223 1224
1224 sysfs_create_link(&rdev->kobj, &rdev->bdev->bd_disk->kobj, "block"); 1225 if (rdev->bdev->bd_part)
1226 ko = &rdev->bdev->bd_part->kobj;
1227 else
1228 ko = &rdev->bdev->bd_disk->kobj;
1229 sysfs_create_link(&rdev->kobj, ko, "block");
1225 return 0; 1230 return 0;
1226} 1231}
1227 1232