From owner-cvs-src@FreeBSD.ORG Thu Sep 16 20:43:23 2004 Return-Path: Delivered-To: cvs-src@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 505A816A4CF; Thu, 16 Sep 2004 20:43:23 +0000 (GMT) Received: from darkness.comp.waw.pl (darkness.comp.waw.pl [195.117.238.136]) by mx1.FreeBSD.org (Postfix) with ESMTP id EC32343D1D; Thu, 16 Sep 2004 20:43:22 +0000 (GMT) (envelope-from pjd@darkness.comp.waw.pl) Received: by darkness.comp.waw.pl (Postfix, from userid 1009) id 56AF2ACAE0; Thu, 16 Sep 2004 22:43:21 +0200 (CEST) Date: Thu, 16 Sep 2004 22:43:21 +0200 From: Pawel Jakub Dawidek To: Nate Lawson Message-ID: <20040916204321.GE30151@darkness.comp.waw.pl> References: <20040916185923.2F92316A552@hub.freebsd.org> <4149EC27.9080200@root.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="NyJzvbHMNqj9cvKu" Content-Disposition: inline In-Reply-To: <4149EC27.9080200@root.org> User-Agent: Mutt/1.4.2i X-PGP-Key-URL: http://people.freebsd.org/~pjd/pjd.asc X-OS: FreeBSD 5.2.1-RC2 i386 cc: cvs-src@FreeBSD.org cc: src-committers@FreeBSD.org cc: cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/dev/md md.c X-BeenThere: cvs-src@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: CVS commit messages for the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2004 20:43:23 -0000 --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--