mirror of
https://github.com/torvalds/linux.git
synced 2024-11-10 06:01:57 +00:00
ata: libata-scsi: Improve ata_scsi_handle_link_detach()
A struct ata_device flags should always be set and cleared with the device port locked. Testing for a flag should thus also be done while holding the device port lock. In accordance to this principle, modify ata_scsi_handle_link_detach() to test and clear the ATA_DFLAG_DETACHED flag while holding the device port lock. Signed-off-by: Damien Le Moal <dlemoal@kernel.org> Reviewed-by: Niklas Cassel <cassel@kernel.org>
This commit is contained in:
parent
c494708d1f
commit
a16951510f
@ -4605,10 +4605,12 @@ static void ata_scsi_handle_link_detach(struct ata_link *link)
|
||||
ata_for_each_dev(dev, link, ALL) {
|
||||
unsigned long flags;
|
||||
|
||||
if (!(dev->flags & ATA_DFLAG_DETACHED))
|
||||
continue;
|
||||
|
||||
spin_lock_irqsave(ap->lock, flags);
|
||||
if (!(dev->flags & ATA_DFLAG_DETACHED)) {
|
||||
spin_unlock_irqrestore(ap->lock, flags);
|
||||
continue;
|
||||
}
|
||||
|
||||
dev->flags &= ~ATA_DFLAG_DETACHED;
|
||||
spin_unlock_irqrestore(ap->lock, flags);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user