Module Name: src Committed By: sborrill Date: Wed Mar 21 13:19:12 UTC 2012
Modified Files: src/sys/dev/ic: mfi.c Log Message: >From OpenBSD. Fixes a deadlock during autoconf. scrub more fields in the ccb when returning them to the free list after theyve been used, in particular the mfi header flags which has a bit that specifies if a command should be completed via the interrupt path. if we use a ccb during boot we set that bit, but it isnt necessarily cleared by things that use it later on. this means a ccb we expected to complete via an interrupt never actually generates an interrupt or appears in the reply queue. this obviously stalls the io. To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/dev/ic/mfi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/sys/dev/ic/mfi.c diff -u src/sys/dev/ic/mfi.c:1.36 src/sys/dev/ic/mfi.c:1.37 --- src/sys/dev/ic/mfi.c:1.36 Mon Jun 20 22:02:55 2011 +++ src/sys/dev/ic/mfi.c Wed Mar 21 13:19:11 2012 @@ -1,4 +1,4 @@ -/* $NetBSD: mfi.c,v 1.36 2011/06/20 22:02:55 pgoyette Exp $ */ +/* $NetBSD: mfi.c,v 1.37 2012/03/21 13:19:11 sborrill Exp $ */ /* $OpenBSD: mfi.c,v 1.66 2006/11/28 23:59:45 dlg Exp $ */ /* * Copyright (c) 2006 Marco Peereboom <ma...@peereboom.us> @@ -17,7 +17,7 @@ */ #include <sys/cdefs.h> -__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.36 2011/06/20 22:02:55 pgoyette Exp $"); +__KERNEL_RCSID(0, "$NetBSD: mfi.c,v 1.37 2012/03/21 13:19:11 sborrill Exp $"); #include "bio.h" @@ -180,11 +180,13 @@ static void mfi_put_ccb(struct mfi_ccb *ccb) { struct mfi_softc *sc = ccb->ccb_sc; + struct mfi_frame_header *hdr = &ccb->ccb_frame->mfr_header; int s; DNPRINTF(MFI_D_CCB, "%s: mfi_put_ccb: %p\n", DEVNAME(sc), ccb); - s = splbio(); + hdr->mfh_cmd_status = 0x0; + hdr->mfh_flags = 0x0; ccb->ccb_state = MFI_CCB_FREE; ccb->ccb_xs = NULL; ccb->ccb_flags = 0; @@ -195,6 +197,8 @@ mfi_put_ccb(struct mfi_ccb *ccb) ccb->ccb_sgl = NULL; ccb->ccb_data = NULL; ccb->ccb_len = 0; + + s = splbio(); TAILQ_INSERT_TAIL(&sc->sc_ccb_freeq, ccb, ccb_link); splx(s); }