Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 22 Oct 2013 12:58:22 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r256888 - head/sys/cam
Message-ID:  <201310221258.r9MCwMZp079205@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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);



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