summaryrefslogtreecommitdiffstats
path: root/sys/dev/iscsi
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2014-05-07 07:46:23 +0000
committertrasz <trasz@FreeBSD.org>2014-05-07 07:46:23 +0000
commit85e3b0d2dc3f94a9cf66cf1c16a731adefbd2468 (patch)
treee79e493a8c08460c7d5a9557e20952d14dfaab6e /sys/dev/iscsi
parent6dac0bfb6895c34e176675fa57bd197cf9c72d1b (diff)
downloadFreeBSD-src-85e3b0d2dc3f94a9cf66cf1c16a731adefbd2468.zip
FreeBSD-src-85e3b0d2dc3f94a9cf66cf1c16a731adefbd2468.tar.gz
MFC r264537:
Be more strict with locking for is_waiting_for_iscsid variable. Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/dev/iscsi')
-rw-r--r--sys/dev/iscsi/iscsi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c
index 33ce181..3b75da5 100644
--- a/sys/dev/iscsi/iscsi.c
+++ b/sys/dev/iscsi/iscsi.c
@@ -1201,8 +1201,10 @@ iscsi_ioctl_daemon_wait(struct iscsi_softc *sc,
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) {
@@ -1217,7 +1219,6 @@ iscsi_ioctl_daemon_wait(struct iscsi_softc *sc,
continue;
}
- ISCSI_SESSION_LOCK(is);
is->is_waiting_for_iscsid = false;
is->is_login_phase = true;
is->is_reason[0] = '\0';
@@ -1650,8 +1651,10 @@ iscsi_ioctl_session_add(struct iscsi_softc *sc, struct iscsi_session_add *isa)
/*
* 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);
OpenPOWER on IntegriCloud