On 2/24/21 3:31 PM, John Garry wrote: > On 24/02/2021 14:24, Hannes Reinecke wrote: >> On 2/24/21 2:12 PM, John Garry wrote: >>> On 22/02/2021 13:23, Hannes Reinecke wrote: >>>> void scsi_forget_host(struct Scsi_Host *shost) >>>> { >>>> - struct scsi_device *sdev; >>>> + struct scsi_device *sdev, *host_sdev = NULL; >>>> unsigned long flags; >>>> restart: >>>> spin_lock_irqsave(shost->host_lock, flags); >>>> list_for_each_entry(sdev, &shost->__devices, siblings) { >>>> + if (scsi_device_is_host_dev(sdev)) { >>>> + host_sdev = sdev; >>> Is there actually a limit of 1x host_sdev always? >>> >> I would have thought so, as the whole point of having a host device is >> that you have a (virtual) device which simulates access to the host >> itself. >> And as such has a 1:1 relationship to the HBA. > > Sure, but I think that each call to scsi_get_host_dev() for the same > host will give a new sdev each time, right? > > We should protect against what is sensible and what is possible - not > always the same :) > The original implementation, yes. With my patch series, no. Cheers, Hannes -- Dr. Hannes Reinecke Kernel Storage Architect hare@xxxxxxx +49 911 74053 688 SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg HRB 36809 (AG Nürnberg), GF: Felix Imendörffer