linux-raid.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* mdadm: ioctl(GET_DISK_INFO) question
@ 2012-04-27 14:14 Alexander Lyakas
  2012-04-27 22:09 ` NeilBrown
  0 siblings, 1 reply; 3+ messages in thread
From: Alexander Lyakas @ 2012-04-27 14:14 UTC (permalink / raw)
  To: linux-raid

Hello,

what is the reason that in some places (like Detail()), the code tests
for all desc_nrs possible (value read from superblock or MaxDisks
macro):
for (d = 0; d < max_disks; d++) {
    disc.number = d;
    ioctl(fd, GET_DISK_INFO, &disk)

and in other places (like Monitor()), the loop goes only up to :
array.raid_disks + array.nr_disks.

After all, disk.number (which is rdev->desc_nr in kernel) is merely a
position of the disk entry in the dev_roles[] array in the superblock,
and has no relation to the raid slot of the disk. Shouldn't the code
always check max_disks possible?

Thanks,
  Alex.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mdadm: ioctl(GET_DISK_INFO) question
  2012-04-27 14:14 mdadm: ioctl(GET_DISK_INFO) question Alexander Lyakas
@ 2012-04-27 22:09 ` NeilBrown
  2012-04-29 20:21   ` Alexander Lyakas
  0 siblings, 1 reply; 3+ messages in thread
From: NeilBrown @ 2012-04-27 22:09 UTC (permalink / raw)
  To: Alexander Lyakas; +Cc: linux-raid

[-- Attachment #1: Type: text/plain, Size: 767 bytes --]

On Fri, 27 Apr 2012 17:14:28 +0300 Alexander Lyakas <alex.bolshoy@gmail.com>
wrote:

> Hello,
> 
> what is the reason that in some places (like Detail()), the code tests
> for all desc_nrs possible (value read from superblock or MaxDisks
> macro):
> for (d = 0; d < max_disks; d++) {
>     disc.number = d;
>     ioctl(fd, GET_DISK_INFO, &disk)
> 
> and in other places (like Monitor()), the loop goes only up to :
> array.raid_disks + array.nr_disks.

Bug.

> 
> After all, disk.number (which is rdev->desc_nr in kernel) is merely a
> position of the disk entry in the dev_roles[] array in the superblock,
> and has no relation to the raid slot of the disk. Shouldn't the code
> always check max_disks possible?

Yes.

Thanks,
NeilBrown


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 828 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: mdadm: ioctl(GET_DISK_INFO) question
  2012-04-27 22:09 ` NeilBrown
@ 2012-04-29 20:21   ` Alexander Lyakas
  0 siblings, 0 replies; 3+ messages in thread
From: Alexander Lyakas @ 2012-04-29 20:21 UTC (permalink / raw)
  To: NeilBrown; +Cc: linux-raid

Thanks for the clarification, Neil. I will really try to provide (at
least a partial) patch, together with the other patch I promised to
test...

On Sat, Apr 28, 2012 at 1:09 AM, NeilBrown <neilb@suse.de> wrote:
> On Fri, 27 Apr 2012 17:14:28 +0300 Alexander Lyakas <alex.bolshoy@gmail.com>
> wrote:
>
>> Hello,
>>
>> what is the reason that in some places (like Detail()), the code tests
>> for all desc_nrs possible (value read from superblock or MaxDisks
>> macro):
>> for (d = 0; d < max_disks; d++) {
>>     disc.number = d;
>>     ioctl(fd, GET_DISK_INFO, &disk)
>>
>> and in other places (like Monitor()), the loop goes only up to :
>> array.raid_disks + array.nr_disks.
>
> Bug.
>
>>
>> After all, disk.number (which is rdev->desc_nr in kernel) is merely a
>> position of the disk entry in the dev_roles[] array in the superblock,
>> and has no relation to the raid slot of the disk. Shouldn't the code
>> always check max_disks possible?
>
> Yes.
>
> Thanks,
> NeilBrown
>
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-29 20:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-27 14:14 mdadm: ioctl(GET_DISK_INFO) question Alexander Lyakas
2012-04-27 22:09 ` NeilBrown
2012-04-29 20:21   ` Alexander Lyakas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).