From: Matthew Dillon Date: Fri, 15 Apr 2011 15:24:55 +0000 (-0700) Subject: kernel - Change ccb state with lock held X-Git-Tag: v2.10.0~47 X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/dcdc077063c23b0b9c5ed1d8759cc01a09d36805 kernel - Change ccb state with lock held * When putting a CCB back into the ap_ccb_free list do not change the state until after ap_ccb_lock has been acquired. --- diff --git a/sys/dev/disk/ahci/ahci.c b/sys/dev/disk/ahci/ahci.c index ee86b1c..6ce365d 100644 --- a/sys/dev/disk/ahci/ahci.c +++ b/sys/dev/disk/ahci/ahci.c @@ -3091,8 +3091,8 @@ ahci_put_ccb(struct ahci_ccb *ccb) { struct ahci_port *ap = ccb->ccb_port; - ccb->ccb_xa.state = ATA_S_PUT; lockmgr(&ap->ap_ccb_lock, LK_EXCLUSIVE); + ccb->ccb_xa.state = ATA_S_PUT; TAILQ_INSERT_TAIL(&ap->ap_ccb_free, ccb, ccb_entry); lockmgr(&ap->ap_ccb_lock, LK_RELEASE); } diff --git a/sys/dev/disk/sili/sili.c b/sys/dev/disk/sili/sili.c index a3c2c65..cec896d 100644 --- a/sys/dev/disk/sili/sili.c +++ b/sys/dev/disk/sili/sili.c @@ -2022,8 +2022,8 @@ sili_put_ccb(struct sili_ccb *ccb) { struct sili_port *ap = ccb->ccb_port; - ccb->ccb_xa.state = ATA_S_PUT; lockmgr(&ap->ap_ccb_lock, LK_EXCLUSIVE); + ccb->ccb_xa.state = ATA_S_PUT; TAILQ_INSERT_TAIL(&ap->ap_ccb_free, ccb, ccb_entry); lockmgr(&ap->ap_ccb_lock, LK_RELEASE); }