Author: trasz
Date: Fri Dec 13 21:41:23 2013
New Revision: 259336
URL: http://svnweb.freebsd.org/changeset/base/259336

Log:
  MFC r259183:
  
  Properly refuse handoff requests on already connected sessions.  Previously
  this would result in dropping the session.
  
  Approved by:  re (gjb)
  Sponsored by: The FreeBSD Foundation

Modified:
  releng/10.0/sys/dev/iscsi/iscsi.c
Directory Properties:
  releng/10.0/   (props changed)

Modified: releng/10.0/sys/dev/iscsi/iscsi.c
==============================================================================
--- releng/10.0/sys/dev/iscsi/iscsi.c   Fri Dec 13 21:40:12 2013        
(r259335)
+++ releng/10.0/sys/dev/iscsi/iscsi.c   Fri Dec 13 21:41:23 2013        
(r259336)
@@ -1247,6 +1247,18 @@ iscsi_ioctl_daemon_handoff(struct iscsi_
                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));
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to