On 9/22/23 17:29, Damien Le Moal wrote:
Also delete the WAR_ON() call checking that the ATA_PFLAG_UNLOADING flag was cleared as that is done without holding the port lock.
Hmm ... I don't see any WARN_ON() statement being removed by this patch?
- /* tell EH we're leaving & flush EH */ + /* Wait for any ongoing EH */ + ata_port_wait_eh(ap); + + mutex_lock(&ap->scsi_scan_mutex); spin_lock_irqsave(ap->lock, flags); + + /* Remove scsi devices */ + ata_for_each_link(link, ap, HOST_FIRST) { + ata_for_each_dev(dev, link, ALL) { + if (dev->sdev) { + spin_unlock_irqrestore(ap->lock, flags); + scsi_remove_device(dev->sdev); + spin_lock_irqsave(ap->lock, flags); + dev->sdev = NULL; + } + } + }
Can the lists ata_for_each_link() and ata_for_each_dev() iterate over change while ap->lock is unlocked? If not, does this perhaps have to be explained in a comment? If these lists can be changed, should these lists perhaps be examined from the start after every unlock of ap->lock? Thanks, Bart.