When updating port, apply only change of LUN map, not whole.
This commit is contained in:
parent
cfa0987386
commit
828524c137
@ -2002,7 +2002,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",
|
||||
|
@ -399,7 +399,7 @@ void kernel_handoff(struct connection *conn);
|
||||
void kernel_limits(const char *offload,
|
||||
size_t *max_data_segment_length);
|
||||
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);
|
||||
|
||||
|
@ -1024,11 +1024,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++) {
|
||||
@ -1038,6 +1040,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");
|
||||
|
Loading…
Reference in New Issue
Block a user