isboot: help me understand what CAM is doing
- Reply: Warner Losh : "Re: isboot: help me understand what CAM is doing"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 15 May 2025 16:29:43 UTC
Hi all- I’m working on a cosmetic bug in isboot-kmod. There is a global string called isboot_boot_device which is printed for informational purposes and also available via the net.isboot.device sysctl. The string is populated in this function: https://github.com/jnielsendotnet/isboot/blob/master/src/iscsi.c#L1870. I don’t know when this changed but historically the string comparison on https://github.com/jnielsendotnet/isboot/blob/master/src/iscsi.c#L1904 would be called once with “pass” and once with “da” and the global isboot_boot_device would be correctly populated with e.g. “da0”. That sometimes happens in the current code as well, but on my test machine (running 14-STABLE) it is ONLY when I have enabled debug output (by setting bootverbose or net.isboot.debug to 1 or higher). Otherwise, the string comparison is called only once with “probe” rather than “pass” or “da”. Everything still works in this case; the disk is found (at da0 or whatever) and mounted, but the isboot_boot_device is never populated (or populated with the wrong name like “probe0” if I mess with what the string comparison is looking for. There is no functional change other than debug messages when debug output is enabled, so I’m guessing this is a race condition. But since I am still a rank amateur when it comes to kernel programming I don’t know where else to look. So my questions are twofold: 1) What is going on here? When does the “probe” name show up in ccb.cgdl.periph_name and why doesn’t the loop ever see “da” or “pass” when it does? Corollary: does isboot_cam_set_devices() operate in a safe/sane way for modern CAM? 2) What would be a safer or more reliable way to determine the correct device name so it can be written to the isboot_boot_device global variable? Thanks! JN