Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Jul 2016 21:56:55 +0000 (UTC)
From:      "Conrad E. Meyer" <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r302682 - head/sys/dev/ioat
Message-ID:  <201607122156.u6CLutcF028877@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Tue Jul 12 21:56:55 2016
New Revision: 302682
URL: https://svnweb.freebsd.org/changeset/base/302682

Log:
  ioat_reserve_space: Recheck quiescing flag after dropping submit lock
  
  Fix a minor bound check error while here (ring can only hold 1 <<
  MAX_ORDER - 1 entries).

Modified:
  head/sys/dev/ioat/ioat.c

Modified: head/sys/dev/ioat/ioat.c
==============================================================================
--- head/sys/dev/ioat/ioat.c	Tue Jul 12 21:56:52 2016	(r302681)
+++ head/sys/dev/ioat/ioat.c	Tue Jul 12 21:56:55 2016	(r302682)
@@ -1382,16 +1382,17 @@ ioat_reserve_space(struct ioat_softc *io
 	error = 0;
 	dug = FALSE;
 
-	if (num_descs < 1 || num_descs > (1 << IOAT_MAX_ORDER)) {
+	if (num_descs < 1 || num_descs >= (1 << IOAT_MAX_ORDER)) {
 		error = EINVAL;
 		goto out;
 	}
-	if (ioat->quiescing) {
-		error = ENXIO;
-		goto out;
-	}
 
 	for (;;) {
+		if (ioat->quiescing) {
+			error = ENXIO;
+			goto out;
+		}
+
 		if (ioat_get_ring_space(ioat) >= num_descs)
 			goto out;
 
@@ -1453,6 +1454,8 @@ ioat_reserve_space(struct ioat_softc *io
 
 out:
 	mtx_assert(&ioat->submit_lock, MA_OWNED);
+	KASSERT(!ioat->quiescing || error == ENXIO,
+	    ("reserved during quiesce"));
 	return (error);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201607122156.u6CLutcF028877>