Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Oct 2014 09:09:43 +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: r273164 - head/sys/dev/iscsi
Message-ID:  <201410160909.s9G99hwq005015@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Thu Oct 16 09:09:43 2014
New Revision: 273164
URL: https://svnweb.freebsd.org/changeset/base/273164

Log:
  When removing an iSCSI session, check whether all conditions match,
  not if any of them matches.  This fixes "iscsictl -Rn" removing
  unrelated sessions.
  
  PR:		194034
  MFC after:	1 month
  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	Thu Oct 16 08:42:17 2014	(r273163)
+++ head/sys/dev/iscsi/iscsi.c	Thu Oct 16 09:09:43 2014	(r273164)
@@ -1752,18 +1752,16 @@ static bool
 iscsi_session_conf_matches(unsigned int id1, const struct iscsi_session_conf *c1,
     unsigned int id2, const struct iscsi_session_conf *c2)
 {
-	if (id2 == 0 && c2->isc_target[0] == '\0' &&
-	    c2->isc_target_addr[0] == '\0')
-		return (true);
-	if (id2 != 0 && id2 == id1)
-		return (true);
+
+	if (id2 != 0 && id2 != id1)
+		return (false);
 	if (c2->isc_target[0] != '\0' &&
-	    strcmp(c1->isc_target, c2->isc_target) == 0)
-		return (true);
+	    strcmp(c1->isc_target, c2->isc_target) != 0)
+		return (false);
 	if (c2->isc_target_addr[0] != '\0' &&
-	    strcmp(c1->isc_target_addr, c2->isc_target_addr) == 0)
-		return (true);
-	return (false);
+	    strcmp(c1->isc_target_addr, c2->isc_target_addr) != 0)
+		return (false);
+	return (true);
 }
 
 static int



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