svn commit: r260808 - head/sys/dev/usb

Hans Petter Selasky hselasky at FreeBSD.org
Fri Jan 17 08:21:10 UTC 2014


Author: hselasky
Date: Fri Jan 17 08:21:09 2014
New Revision: 260808
URL: http://svnweb.freebsd.org/changeset/base/260808

Log:
  Close a minor deadlock.
  
  MFC after:	1 week

Modified:
  head/sys/dev/usb/usb_dev.c

Modified: head/sys/dev/usb/usb_dev.c
==============================================================================
--- head/sys/dev/usb/usb_dev.c	Fri Jan 17 06:43:35 2014	(r260807)
+++ head/sys/dev/usb/usb_dev.c	Fri Jan 17 08:21:09 2014	(r260808)
@@ -597,6 +597,13 @@ usb_fifo_free(struct usb_fifo *f)
 		mtx_unlock(f->priv_mtx);
 		mtx_lock(&usb_ref_lock);
 
+		/*
+		 * Check if the "f->refcount" variable reached zero
+		 * during the unlocked time before entering wait:
+		 */
+		if (f->refcount == 0)
+			break;
+
 		/* wait for sync */
 		cv_wait(&f->cv_drain, &usb_ref_lock);
 	}


More information about the svn-src-head mailing list