On Sun, 2020-05-10 at 14:32 -0400, Douglas Gilbert wrote: > This gem is in scsi_scan.c in the documentation of that function's > first argument. "need not be a scsi host" should read "it damn well > better be a scsi host" otherwise that function will crash and burn! It shouldn't: several transport classes, like SAS and FC have intermediate devices between the host and the target and they all work just fine using the non-host parent. Since you don't give the error this is just guesswork, but the host has to be somewhere in the parent chain otherwise dev_to_shost(parent) will return NULL ... is that your problem? > I'm trying to work out why the function: starget_for_each_device() in > scsi.c does _not_ use that collection right in front of it (i.e. > scsi_target::devices). Instead, it step up to the host level, and > iterates over all devices (LUs) on that host and only calls the given > function for those devices that match the channel and target numbers. > That is bizarrely wasteful if scsi_target::devices could be iterated > over instead. > > Anyone know why this is? Best guess would be it wasn't converted over when the target list was introduced. James