diff options
author | trasz <trasz@FreeBSD.org> | 2014-11-15 05:50:14 +0000 |
---|---|---|
committer | trasz <trasz@FreeBSD.org> | 2014-11-15 05:50:14 +0000 |
commit | 93accf39994e57a88e68bf56cbc5ed2d2cf7d84b (patch) | |
tree | e14c2e4ed47de2d9499eae780d8d4f86008cf299 /sys/dev/iscsi/iscsi.c | |
parent | c1b4b35c7e4bad970b85bb047fc9e724499f6248 (diff) | |
download | FreeBSD-src-93accf39994e57a88e68bf56cbc5ed2d2cf7d84b.zip FreeBSD-src-93accf39994e57a88e68bf56cbc5ed2d2cf7d84b.tar.gz |
MFC r273164:
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
Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/dev/iscsi/iscsi.c')
-rw-r--r-- | sys/dev/iscsi/iscsi.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c index 0ba68e8..86ba82b 100644 --- a/sys/dev/iscsi/iscsi.c +++ b/sys/dev/iscsi/iscsi.c @@ -1757,18 +1757,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 |