Commit c045ebb7 authored by James Bottomley's avatar James Bottomley Committed by James Bottomley

aic7xxx and aic79xx: fix sleeping while holding a lock

From: Luben Tuikov <luben_tuikov@adaptec.com>

Fix sleeping while holding a lock on host removal and on
killing the DV thread.
Signed-off-by: default avatarLuben Tuikov <luben_tuikov@adaptec.com>
Signed-off-by: default avatarJames Bottomley <James.Bottomley@SteelEye.com>
parent 2207252b
......@@ -5270,7 +5270,6 @@ ahd_free(struct ahd_softc *ahd)
default:
case 5:
ahd_shutdown(ahd);
TAILQ_REMOVE(&ahd_tailq, ahd, links);
/* FALLTHROUGH */
case 4:
ahd_dmamap_unload(ahd, ahd->shared_data_dmat,
......
......@@ -5032,7 +5032,6 @@ static void __exit
ahd_linux_exit(void)
{
struct ahd_softc *ahd;
u_long l;
/*
* Shutdown DV threads before going into the SCSI mid-layer.
......@@ -5040,12 +5039,11 @@ ahd_linux_exit(void)
* kernel so that waiting for our DV threads to exit leads
* to deadlock.
*/
ahd_list_lock(&l);
TAILQ_FOREACH(ahd, &ahd_tailq, links) {
ahd_linux_kill_dv_thread(ahd);
}
ahd_list_unlock(&l);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
/*
* In 2.4 we have to unregister from the PCI core _after_
......
......@@ -105,11 +105,13 @@ ahd_linux_pci_dev_remove(struct pci_dev *pdev)
if (ahd != NULL) {
u_long s;
TAILQ_REMOVE(&ahd_tailq, ahd, links);
ahd_list_unlock(&l);
ahd_lock(ahd, &s);
ahd_intr_enable(ahd, FALSE);
ahd_unlock(ahd, &s);
ahd_free(ahd);
}
} else
ahd_list_unlock(&l);
}
......
......@@ -3973,7 +3973,6 @@ ahc_free(struct ahc_softc *ahc)
default:
case 5:
ahc_shutdown(ahc);
TAILQ_REMOVE(&ahc_tailq, ahc, links);
/* FALLTHROUGH */
case 4:
ahc_dmamap_unload(ahc, ahc->shared_data_dmat,
......
......@@ -5033,7 +5033,6 @@ static void
ahc_linux_exit(void)
{
struct ahc_softc *ahc;
u_long l;
/*
* Shutdown DV threads before going into the SCSI mid-layer.
......@@ -5041,12 +5040,10 @@ ahc_linux_exit(void)
* kernel so that waiting for our DV threads to exit leads
* to deadlock.
*/
ahc_list_lock(&l);
TAILQ_FOREACH(ahc, &ahc_tailq, links) {
ahc_linux_kill_dv_thread(ahc);
}
ahc_list_unlock(&l);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0)
/*
......
......@@ -160,11 +160,13 @@ ahc_linux_pci_dev_remove(struct pci_dev *pdev)
if (ahc != NULL) {
u_long s;
TAILQ_REMOVE(&ahc_tailq, ahc, links);
ahc_list_unlock(&l);
ahc_lock(ahc, &s);
ahc_intr_enable(ahc, FALSE);
ahc_unlock(ahc, &s);
ahc_free(ahc);
}
} else
ahc_list_unlock(&l);
}
#endif /* !LINUX_VERSION_CODE < KERNEL_VERSION(2,4,0) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment