svn commit: r256888 - head/sys/cam

Alexander Motin mav at FreeBSD.org
Tue Oct 22 12:58:22 UTC 2013


Author: mav
Date: Tue Oct 22 12:58:22 2013
New Revision: 256888
URL: http://svnweb.freebsd.org/changeset/base/256888

Log:
  Unconditionally acquire periph reference on CCB allocation failure.
  
  cam_periph_acquire() can return error if periph already invalidated, but
  that may be unacceptable and cause deadlock if the invalidated periph can't
  be destroyed without "executing" the scheduled request.
  
  Coverity CID:	1109822
  MFC after:	2 months

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c	Tue Oct 22 12:42:49 2013	(r256887)
+++ head/sys/cam/cam_xpt.c	Tue Oct 22 12:58:22 2013	(r256888)
@@ -3163,10 +3163,11 @@ restart:
 				ccb = xpt_get_ccb(periph);
 				goto restart;
 			}
-			if (periph->flags & CAM_PERIPH_RUN_TASK) {
+			if (periph->flags & CAM_PERIPH_RUN_TASK)
 				break;
-			}
-			cam_periph_acquire(periph);
+			xpt_lock_buses();
+			periph->refcount++;	/* Unconditionally acquire */
+			xpt_unlock_buses();
 			periph->flags |= CAM_PERIPH_RUN_TASK;
 			taskqueue_enqueue(xsoftc.xpt_taskq,
 			    &periph->periph_run_task);


More information about the svn-src-head mailing list