diff options
author | NeilBrown <neilb@suse.de> | 2005-11-08 21:39:37 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-09 07:56:39 -0800 |
commit | f637b9f9fc195e4f4635faf495fd8b462c21b411 (patch) | |
tree | bcd71dc2e3c0a2fd97c5973d6a29010c3eab1990 /drivers | |
parent | f91de92ed6bfb70a3ff607558c910c7bf34d45e9 (diff) | |
download | op-kernel-dev-f637b9f9fc195e4f4635faf495fd8b462c21b411.zip op-kernel-dev-f637b9f9fc195e4f4635faf495fd8b462c21b411.tar.gz |
[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')
-rw-r--r-- | drivers/md/md.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/md/md.c b/drivers/md/md.c index d002b83..2b59289 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) { mdk_rdev_t *same_pdev; char b[BDEVNAME_SIZE], b2[BDEVNAME_SIZE]; + struct kobject *ko; if (rdev->mddev) { MD_BUG(); @@ -1221,7 +1222,11 @@ static int bind_rdev_to_array(mdk_rdev_t * rdev, mddev_t * mddev) rdev->kobj.parent = &mddev->kobj; kobject_add(&rdev->kobj); - sysfs_create_link(&rdev->kobj, &rdev->bdev->bd_disk->kobj, "block"); + if (rdev->bdev->bd_part) + ko = &rdev->bdev->bd_part->kobj; + else + ko = &rdev->bdev->bd_disk->kobj; + sysfs_create_link(&rdev->kobj, ko, "block"); return 0; } |