Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 5 Oct 2015 09:11:47 +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: r288748 - stable/10/usr.sbin/ctld
Message-ID:  <201510050911.t959Blui027367@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Oct  5 09:11:46 2015
New Revision: 288748
URL: https://svnweb.freebsd.org/changeset/base/288748

Log:
  MFC r287757: When updating port, apply only change of LUN map, not whole.

Modified:
  stable/10/usr.sbin/ctld/ctld.c
  stable/10/usr.sbin/ctld/ctld.h
  stable/10/usr.sbin/ctld/kernel.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/usr.sbin/ctld/ctld.c
==============================================================================
--- stable/10/usr.sbin/ctld/ctld.c	Mon Oct  5 09:10:58 2015	(r288747)
+++ stable/10/usr.sbin/ctld/ctld.c	Mon Oct  5 09:11:46 2015	(r288748)
@@ -1985,7 +1985,7 @@ conf_apply(struct conf *oldconf, struct 
 		} else {
 			log_debugx("updating port \"%s\"", newport->p_name);
 			newport->p_ctl_port = oldport->p_ctl_port;
-			error = kernel_port_update(newport);
+			error = kernel_port_update(newport, oldport);
 		}
 		if (error != 0) {
 			log_warnx("failed to %s port %s",

Modified: stable/10/usr.sbin/ctld/ctld.h
==============================================================================
--- stable/10/usr.sbin/ctld/ctld.h	Mon Oct  5 09:10:58 2015	(r288747)
+++ stable/10/usr.sbin/ctld/ctld.h	Mon Oct  5 09:11:46 2015	(r288748)
@@ -393,7 +393,7 @@ int			kernel_lun_modify(struct lun *lun)
 int			kernel_lun_remove(struct lun *lun);
 void			kernel_handoff(struct connection *conn);
 int			kernel_port_add(struct port *port);
-int			kernel_port_update(struct port *port);
+int			kernel_port_update(struct port *port, struct port *old);
 int			kernel_port_remove(struct port *port);
 void			kernel_capsicate(void);
 

Modified: stable/10/usr.sbin/ctld/kernel.c
==============================================================================
--- stable/10/usr.sbin/ctld/kernel.c	Mon Oct  5 09:10:58 2015	(r288747)
+++ stable/10/usr.sbin/ctld/kernel.c	Mon Oct  5 09:11:46 2015	(r288748)
@@ -986,11 +986,13 @@ kernel_port_add(struct port *port)
 }
 
 int
-kernel_port_update(struct port *port)
+kernel_port_update(struct port *port, struct port *oport)
 {
 	struct ctl_lun_map lm;
 	struct target *targ = port->p_target;
+	struct target *otarg = oport->p_target;
 	int error, i;
+	uint32_t olun;
 
 	/* Map configured LUNs and unmap others */
 	for (i = 0; i < MAX_LUNS; i++) {
@@ -1000,6 +1002,12 @@ kernel_port_update(struct port *port)
 			lm.lun = UINT32_MAX;
 		else
 			lm.lun = targ->t_luns[i]->l_ctl_lun;
+		if (otarg->t_luns[i] == NULL)
+			olun = UINT32_MAX;
+		else
+			olun = otarg->t_luns[i]->l_ctl_lun;
+		if (lm.lun == olun)
+			continue;
 		error = ioctl(ctl_fd, CTL_LUN_MAP, &lm);
 		if (error != 0)
 			log_warn("CTL_LUN_MAP ioctl failed");



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