Date: Thu, 16 Sep 2004 22:43:21 +0200 From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: Nate Lawson <nate@root.org> Cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/md md.c Message-ID: <20040916204321.GE30151@darkness.comp.waw.pl> In-Reply-To: <4149EC27.9080200@root.org> References: <20040916185923.2F92316A552@hub.freebsd.org> <4149EC27.9080200@root.org>
next in thread | previous in thread | raw e-mail | index | archive | help
--NyJzvbHMNqj9cvKu Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 16, 2004 at 12:40:23PM -0700, Nate Lawson wrote: +> >@@ -379,9 +379,8 @@ +> > bp->bio_bcount =3D bp->bio_length; +> > mtx_lock(&sc->queue_mtx); +> > bioq_disksort(&sc->bio_queue, bp); +> >- mtx_unlock(&sc->queue_mtx); +> >- +> > wakeup(sc); +> >+ mtx_unlock(&sc->queue_mtx); +> > } +>=20 +> I think the original order is correct since you can occur 2 switches if= =20 +> you wakeup first and then unlock. Nope, this order was wrong: thread1 thread2 ----------------------- mtx_lock(mtx) =2E.. mtx_unlock(mtx) mtx_lock(mtx) wakeup(ptr) msleep(ptr, mtx) <- Race, it will be never woken up. --=20 Pawel Jakub Dawidek http://www.FreeBSD.org pjd@FreeBSD.org http://garage.freebsd.pl FreeBSD committer Am I Evil? Yes, I Am! --NyJzvbHMNqj9cvKu Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (FreeBSD) iD8DBQFBSfrpForvXbEpPzQRAiW7AKCATRlxBIj3yrPHqN4vGcIYjUkRuACeJB1j xFsDVwqimF/y2XhJfD4kqG0= =QSdU -----END PGP SIGNATURE----- --NyJzvbHMNqj9cvKu--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20040916204321.GE30151>