Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Oct 2015 10:36:28 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r288769 - stable/10/sys/cam/ctl
Message-ID:  <201510051036.t95AaSSf068928@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Oct  5 10:36:28 2015
New Revision: 288769
URL: https://svnweb.freebsd.org/changeset/base/288769

Log:
  MFC r287933: Replicate port->init_devid to HA peer.

Modified:
  stable/10/sys/cam/ctl/ctl.c
  stable/10/sys/cam/ctl/ctl_io.h
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/cam/ctl/ctl.c
==============================================================================
--- stable/10/sys/cam/ctl/ctl.c	Mon Oct  5 10:35:36 2015	(r288768)
+++ stable/10/sys/cam/ctl/ctl.c	Mon Oct  5 10:36:28 2015	(r288769)
@@ -613,6 +613,8 @@ ctl_isc_announce_port(struct ctl_port *p
 		i += port->port_devid->len;
 	if (port->target_devid)
 		i += port->target_devid->len;
+	if (port->init_devid)
+		i += port->init_devid->len;
 	msg = malloc(i, M_CTL, M_WAITOK);
 	bzero(&msg->port, sizeof(msg->port));
 	msg->hdr.msg_type = CTL_MSG_PORT_SYNC;
@@ -643,6 +645,12 @@ ctl_isc_announce_port(struct ctl_port *p
 		    msg->port.target_devid_len);
 		i += msg->port.target_devid_len;
 	}
+	if (port->init_devid) {
+		msg->port.init_devid_len = port->init_devid->len;
+		memcpy(&msg->port.data[i], port->init_devid->data,
+		    msg->port.init_devid_len);
+		i += msg->port.init_devid_len;
+	}
 	ctl_ha_msg_send(CTL_HA_CHAN_CTL, &msg->port, sizeof(msg->port) + i,
 	    M_WAITOK);
 	free(msg, M_CTL);
@@ -867,8 +875,23 @@ ctl_isc_port_sync(struct ctl_softc *soft
 		port->target_devid->len = msg->port.target_devid_len;
 		i += msg->port.target_devid_len;
 	} else {
-		free(port->port_devid, M_CTL);
-		port->port_devid = NULL;
+		free(port->target_devid, M_CTL);
+		port->target_devid = NULL;
+	}
+	if (msg->port.init_devid_len != 0) {
+		if (port->init_devid == NULL ||
+		    port->init_devid->len != msg->port.init_devid_len) {
+			free(port->init_devid, M_CTL);
+			port->init_devid = malloc(sizeof(struct ctl_devid) +
+			    msg->port.init_devid_len, M_CTL, M_WAITOK);
+		}
+		memcpy(port->init_devid->data, &msg->port.data[i],
+		    msg->port.init_devid_len);
+		port->init_devid->len = msg->port.init_devid_len;
+		i += msg->port.init_devid_len;
+	} else {
+		free(port->init_devid, M_CTL);
+		port->init_devid = NULL;
 	}
 	if (new) {
 		if (ctl_port_register(port) != 0) {

Modified: stable/10/sys/cam/ctl/ctl_io.h
==============================================================================
--- stable/10/sys/cam/ctl/ctl_io.h	Mon Oct  5 10:35:36 2015	(r288768)
+++ stable/10/sys/cam/ctl/ctl_io.h	Mon Oct  5 10:36:28 2015	(r288769)
@@ -479,6 +479,7 @@ struct ctl_ha_msg_port {
 	int			lun_map_len;
 	int			port_devid_len;
 	int			target_devid_len;
+	int			init_devid_len;
 	uint8_t			data[];
 };
 



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