Date: Fri, 17 Jan 2014 08:21:10 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r260808 - head/sys/dev/usb Message-ID: <201401170821.s0H8LA1C067699@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
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); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201401170821.s0H8LA1C067699>