ida_alloc result as scsi host_no

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

Today I was reading documentation on struct Scsi_Host,
as I was interested in possible values for host_no.

The documentation says that:
> host_no - system wide unique number that is used for
identifying this host. Issued in ascending order from 0.

In the code (scsi/hosts.c: scsi_host_alloc()) host_no is set
as non-error result of ida_alloc() call (as added in
Commit 126a4fe010fd ("scsi: Use ida for host number management")
with a good reason of reusing invalidated host_no ids).

My question is about implications of using ida_alloc().
As I understand, ida does not guarantee the order of id issuing,
only that id is unclaimed in the pool and is within limits (which is
0 - INT_MAX for ida_alloc). Given that, my questions are:

1) Should it be mentioned in the documentation, that host_no is now
reclaimable? The current wording is not clear about it;

2) The documentation mentions
> sh_list - a double linked list of pointers to all struct Scsi_Host
instances (currently ordered by ascending host_no)
I could not find what it would be now in the code, but it seems that
maintaining such a thing ordered should be a little less trivial with
reclaimable ids;

3) Does ida_alloc() ensure ascending order? Is there a possibility
of some new-more-effective ida implementation in the future,
that honors id uniqueness and limits, but does not guarantee
any particular ordering of id issuing? If it is possible, what would it break?

4) Should host_no really be limited only by int capacity (as it is now)
or maybe some additional limits would make sense?
There is at least one case in the current code with a buffer overrun
if huge host_no is used (which led me to the research on host_no).

Any clarification on the matter would be appreciated!




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]

  Powered by Linux