Skip to content

Commit

Permalink
libata: ata_dev_disable() should be called from EH context
Browse files Browse the repository at this point in the history
ata_port_detach() calls ata_dev_disable() with host lock held but
ata_dev_disable() should be called from EH context.  ata_port_detach()
steals EH context by setting ATA_PFLAG_UNLOADAING and flushing EH.
Drop locking around ata_dev_disable() and note that ata_port_detach()
owns EH context at that point.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
  • Loading branch information
Tejun Heo authored and Jeff Garzik committed Dec 18, 2007
1 parent ce2e0ab commit 7f9ad9b
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions drivers/ata/libata-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -7210,18 +7210,14 @@ static void ata_port_detach(struct ata_port *ap)

ata_port_wait_eh(ap);

/* EH is now guaranteed to see UNLOADING, so no new device
* will be attached. Disable all existing devices.
/* EH is now guaranteed to see UNLOADING - EH context belongs
* to us. Disable all existing devices.
*/
spin_lock_irqsave(ap->lock, flags);

ata_port_for_each_link(link, ap) {
ata_link_for_each_dev(dev, link)
ata_dev_disable(dev);
}

spin_unlock_irqrestore(ap->lock, flags);

/* Final freeze & EH. All in-flight commands are aborted. EH
* will be skipped and retrials will be terminated with bad
* target.
Expand Down

0 comments on commit 7f9ad9b

Please sign in to comment.