Basics of LUN and Target discovery on Windows
I thought to pen down some of the scenarios on how the LUN / target disovery happens
What happens when you remove/add cable from HBA to switch?
- HBA(miniport) driver raises "BusChangeDetected" notification to storport driver.
- Port driver generates "IoInvalidateDeviceRelations" which asks PNP to delete current device list
- Bus rescan happens and fresh list of LUNs is rebuilt for every target by sending a REPORT_LUNS request to LUN 0 of each target.
- If the above request fails then storport sends an INQUIRY to LUN 0.
- If inquiry is successful, INQUIRY will be sent to other luns as well and the list will be built.
- If INQUIRY fails on LUN 0 then storport moves to next target.
- Storport then compares this new list with the old and finds out the difference.
- For the difference of LUNs a PNP is generated to communicate that change to upper layer drivers on the stack.
To know more email: blog@calsoftinc.com
Contributed by: Himanshu Sonkar|CalsoftInc.