Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Apr 2014 11:28:05 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264537 - head/sys/dev/iscsi
Message-ID:  <201404161128.s3GBS55S085989@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Wed Apr 16 11:28:05 2014
New Revision: 264537
URL: http://svnweb.freebsd.org/changeset/base/264537

Log:
  Be more strict with locking for is_waiting_for_iscsid variable.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/dev/iscsi/iscsi.c

Modified: head/sys/dev/iscsi/iscsi.c
==============================================================================
--- head/sys/dev/iscsi/iscsi.c	Wed Apr 16 11:19:49 2014	(r264536)
+++ head/sys/dev/iscsi/iscsi.c	Wed Apr 16 11:28:05 2014	(r264537)
@@ -1202,8 +1202,10 @@ iscsi_ioctl_daemon_wait(struct iscsi_sof
 	sx_slock(&sc->sc_lock);
 	for (;;) {
 		TAILQ_FOREACH(is, &sc->sc_sessions, is_next) {
+			ISCSI_SESSION_LOCK(is);
 			if (is->is_waiting_for_iscsid)
 				break;
+			ISCSI_SESSION_UNLOCK(is);
 		}
 
 		if (is == NULL) {
@@ -1218,7 +1220,6 @@ iscsi_ioctl_daemon_wait(struct iscsi_sof
 			continue;
 		}
 
-		ISCSI_SESSION_LOCK(is);
 		is->is_waiting_for_iscsid = false;
 		is->is_login_phase = true;
 		is->is_reason[0] = '\0';
@@ -1651,8 +1652,10 @@ iscsi_ioctl_session_add(struct iscsi_sof
 	/*
 	 * Trigger immediate reconnection.
 	 */
+	ISCSI_SESSION_LOCK(is);
 	is->is_waiting_for_iscsid = true;
 	strlcpy(is->is_reason, "Waiting for iscsid(8)", sizeof(is->is_reason));
+	ISCSI_SESSION_UNLOCK(is);
 	cv_signal(&sc->sc_cv);
 
 	sx_xunlock(&sc->sc_lock);



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