From owner-svn-src-head@FreeBSD.ORG Wed Apr 16 11:28:06 2014 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 1358DAB1; Wed, 16 Apr 2014 11:28:06 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F349A1235; Wed, 16 Apr 2014 11:28:05 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s3GBS5gt085990; Wed, 16 Apr 2014 11:28:05 GMT (envelope-from trasz@svn.freebsd.org) Received: (from trasz@localhost) by svn.freebsd.org (8.14.8/8.14.8/Submit) id s3GBS55S085989; Wed, 16 Apr 2014 11:28:05 GMT (envelope-from trasz@svn.freebsd.org) Message-Id: <201404161128.s3GBS55S085989@svn.freebsd.org> From: Edward Tomasz Napierala Date: Wed, 16 Apr 2014 11:28:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r264537 - head/sys/dev/iscsi X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Apr 2014 11:28:06 -0000 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);