Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Oct 2012 18:24:53 +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: r241510 - head/sys/cam
Message-ID:  <201210131824.q9DIOrVg079528@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Sat Oct 13 18:24:52 2012
New Revision: 241510
URL: http://svn.freebsd.org/changeset/base/241510

Log:
  Don't exclude XPT SIM from locking in xpt_create_path_unlocked().
  We don't want xpt periph, device, target or bus disappeared because of
  incorrect reference counting.

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c	Sat Oct 13 18:11:50 2012	(r241509)
+++ head/sys/cam/cam_xpt.c	Sat Oct 13 18:24:52 2012	(r241510)
@@ -3441,19 +3441,14 @@ xpt_create_path_unlocked(struct cam_path
 	struct	   cam_path *path;
 	struct	   cam_eb *bus = NULL;
 	cam_status status;
-	int	   need_unlock = 0;
 
 	path = (struct cam_path *)malloc(sizeof(*path), M_CAMPATH, M_WAITOK);
 
-	if (path_id != CAM_BUS_WILDCARD) {
-		bus = xpt_find_bus(path_id);
-		if (bus != NULL) {
-			need_unlock = 1;
-			CAM_SIM_LOCK(bus->sim);
-		}
-	}
+	bus = xpt_find_bus(path_id);
+	if (bus != NULL)
+		CAM_SIM_LOCK(bus->sim);
 	status = xpt_compile_path(path, periph, path_id, target_id, lun_id);
-	if (need_unlock) {
+	if (bus != NULL) {
 		CAM_SIM_UNLOCK(bus->sim);
 		xpt_release_bus(bus);
 	}



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