summaryrefslogtreecommitdiffstats
path: root/sys/dev/iscsi
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2013-12-13 15:25:51 +0000
committertrasz <trasz@FreeBSD.org>2013-12-13 15:25:51 +0000
commit30ec0085c3e4a61e49fee229dd17f89372c22720 (patch)
tree89454cf784d2562a6ace9da17ec71a38ff2e871a /sys/dev/iscsi
parent77844c8786da077ce333d27f0bc596d05bb8dc2e (diff)
downloadFreeBSD-src-30ec0085c3e4a61e49fee229dd17f89372c22720.zip
FreeBSD-src-30ec0085c3e4a61e49fee229dd17f89372c22720.tar.gz
MFC r259183:
Properly refuse handoff requests on already connected sessions. Previously this would result in dropping the session. Sponsored by: The FreeBSD Foundation
Diffstat (limited to 'sys/dev/iscsi')
-rw-r--r--sys/dev/iscsi/iscsi.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/sys/dev/iscsi/iscsi.c b/sys/dev/iscsi/iscsi.c
index 2f5328d..395c8bb 100644
--- a/sys/dev/iscsi/iscsi.c
+++ b/sys/dev/iscsi/iscsi.c
@@ -1247,6 +1247,18 @@ iscsi_ioctl_daemon_handoff(struct iscsi_softc *sc,
sx_sunlock(&sc->sc_lock);
return (EINVAL);
}
+ if (is->is_connected) {
+ /*
+ * This might have happened because another iscsid(8)
+ * instance handed off the connection in the meantime.
+ * Just return.
+ */
+ ISCSI_SESSION_WARN(is, "handoff on already connected "
+ "session");
+ ISCSI_SESSION_UNLOCK(is);
+ sx_sunlock(&sc->sc_lock);
+ return (EBUSY);
+ }
strlcpy(is->is_target_alias, handoff->idh_target_alias,
sizeof(is->is_target_alias));
OpenPOWER on IntegriCloud