diff options
author | mav <mav@FreeBSD.org> | 2015-10-05 09:11:46 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-10-05 09:11:46 +0000 |
commit | a0bb28fd76883d01fec2b92729cfde5c334b2ddf (patch) | |
tree | d5c789bd71aa513c16553f0bb3f4a4a6f4c8ebff | |
parent | 985ffcba7f216148e92f5ccbf06fd8f79976b5e2 (diff) | |
download | FreeBSD-src-a0bb28fd76883d01fec2b92729cfde5c334b2ddf.zip FreeBSD-src-a0bb28fd76883d01fec2b92729cfde5c334b2ddf.tar.gz |
MFC r287757: When updating port, apply only change of LUN map, not whole.
-rw-r--r-- | usr.sbin/ctld/ctld.c | 2 | ||||
-rw-r--r-- | usr.sbin/ctld/ctld.h | 2 | ||||
-rw-r--r-- | usr.sbin/ctld/kernel.c | 10 |
3 files changed, 11 insertions, 3 deletions
diff --git a/usr.sbin/ctld/ctld.c b/usr.sbin/ctld/ctld.c index 90b74bf..114deb1 100644 --- a/usr.sbin/ctld/ctld.c +++ b/usr.sbin/ctld/ctld.c @@ -1985,7 +1985,7 @@ conf_apply(struct conf *oldconf, struct conf *newconf) } 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", diff --git a/usr.sbin/ctld/ctld.h b/usr.sbin/ctld/ctld.h index 9d2465c..8faa556 100644 --- a/usr.sbin/ctld/ctld.h +++ b/usr.sbin/ctld/ctld.h @@ -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); diff --git a/usr.sbin/ctld/kernel.c b/usr.sbin/ctld/kernel.c index 914d027..4ed9a41 100644 --- a/usr.sbin/ctld/kernel.c +++ b/usr.sbin/ctld/kernel.c @@ -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"); |