From cd36db67f9470c74ed7f5bbd57ec6eeb84f71fcd Mon Sep 17 00:00:00 2001 From: John Forte Date: Thu, 19 Nov 2009 22:08:32 -0800 Subject: 6900698 port providers should not passively participate in ALUA 6903022 stmfSetAluaState() is deleting non-active LUs when state is enabled --- usr/src/lib/libstmf/common/stmf.c | 2 +- usr/src/uts/common/io/comstar/port/fct/fct.c | 2 ++ usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c | 3 +++ usr/src/uts/common/io/comstar/stmf/stmf.c | 24 +++++++++++++++++----- usr/src/uts/common/sys/portif.h | 1 + 5 files changed, 26 insertions(+), 6 deletions(-) (limited to 'usr') diff --git a/usr/src/lib/libstmf/common/stmf.c b/usr/src/lib/libstmf/common/stmf.c index f38e52b224..f64396046b 100644 --- a/usr/src/lib/libstmf/common/stmf.c +++ b/usr/src/lib/libstmf/common/stmf.c @@ -5293,7 +5293,7 @@ stmfSetAluaState(boolean_t enabled, uint32_t node) break; } } - if (ret == STMF_STATUS_SUCCESS) { + if (!enabled && ret == STMF_STATUS_SUCCESS) { deleteNonActiveLus(); } diff --git a/usr/src/uts/common/io/comstar/port/fct/fct.c b/usr/src/uts/common/io/comstar/port/fct/fct.c index 577499e183..636191548d 100644 --- a/usr/src/uts/common/io/comstar/port/fct/fct.c +++ b/usr/src/uts/common/io/comstar/port/fct/fct.c @@ -1207,6 +1207,8 @@ fct_register_local_port(fct_local_port_t *port) lport->lport_ctl = fct_ctl; lport->lport_info = fct_info; lport->lport_event_handler = fct_event_handler; + /* set up as alua participating port */ + stmf_set_port_alua(lport); if (stmf_register_local_port(port->port_lport) != FCT_SUCCESS) { goto fct_regport_fail1; } diff --git a/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c b/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c index b9d957fadd..f64ac936de 100644 --- a/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c +++ b/usr/src/uts/common/io/comstar/port/srpt/srpt_stp.c @@ -364,6 +364,9 @@ srpt_stp_alloc_port(srpt_ioc_t *ioc, ib_guid_t guid) lport->lport_info = &srpt_stp_info; lport->lport_event_handler = &srpt_stp_event_handler; + /* set up as alua participating port */ + stmf_set_port_alua(lport); + SRPT_DPRINTF_L3("stp_alloc_port, register STMF LPORT"); retry_registration: diff --git a/usr/src/uts/common/io/comstar/stmf/stmf.c b/usr/src/uts/common/io/comstar/stmf/stmf.c index f7eddf7788..d348e60e0d 100644 --- a/usr/src/uts/common/io/comstar/stmf/stmf.c +++ b/usr/src/uts/common/io/comstar/stmf/stmf.c @@ -1975,8 +1975,9 @@ stmf_set_alua_state(stmf_alua_state_desc_t *alua_state) /* register existing local ports with ppp */ for (ilport = stmf_state.stmf_ilportlist; ilport != NULL; ilport = ilport->ilport_next) { - /* skip standby ports */ - if (ilport->ilport_standby == 1) { + /* skip standby ports and non-alua participants */ + if (ilport->ilport_standby == 1 || + ilport->ilport_alua == 0) { continue; } if (alua_state->alua_node != 0) { @@ -3093,6 +3094,14 @@ stmf_set_port_standby(stmf_local_port_t *lport, uint16_t rtpid) ilport->ilport_standby = 1; } +void +stmf_set_port_alua(stmf_local_port_t *lport) +{ + stmf_i_local_port_t *ilport = + (stmf_i_local_port_t *)lport->lport_stmf_private; + ilport->ilport_alua = 1; +} + stmf_status_t stmf_register_local_port(stmf_local_port_t *lport) { @@ -3125,13 +3134,15 @@ stmf_register_local_port(stmf_local_port_t *lport) /* * rtpid will/must be set if this is a standby port * only register ports that are not standby (proxy) ports + * and ports that are alua participants (ilport_alua == 1) */ if (ilport->ilport_standby == 0) { ilport->ilport_rtpid = atomic_add_16_nv(&stmf_rtpid_counter, 1); } if (stmf_state.stmf_alua_state == 1 && - ilport->ilport_standby == 0) { + ilport->ilport_standby == 0 && + ilport->ilport_alua == 1) { stmf_ic_msg_t *ic_reg_port; stmf_ic_msg_status_t ic_ret; stmf_local_port_t *lport; @@ -3189,7 +3200,8 @@ stmf_deregister_local_port(stmf_local_port_t *lport) * deregister ports that are not standby (proxy) */ if (stmf_state.stmf_alua_state == 1 && - ilport->ilport_standby == 0) { + ilport->ilport_standby == 0 && + ilport->ilport_alua == 1) { stmf_ic_msg_t *ic_dereg_port; stmf_ic_msg_status_t ic_ret; ic_dereg_port = ic_dereg_port_msg_alloc( @@ -3314,7 +3326,9 @@ try_dereg_ss_again: } /* dereg proxy session if not standby port */ - if (stmf_state.stmf_alua_state == 1 && ilport->ilport_standby == 0) { + if (stmf_state.stmf_alua_state == 1 && + ilport->ilport_standby == 0 && + ilport->ilport_alua == 1) { ic_session_dereg = ic_session_dereg_msg_alloc( ss, stmf_proxy_msg_id); if (ic_session_dereg) { diff --git a/usr/src/uts/common/sys/portif.h b/usr/src/uts/common/sys/portif.h index 690b501825..c4a806ecf3 100644 --- a/usr/src/uts/common/sys/portif.h +++ b/usr/src/uts/common/sys/portif.h @@ -113,6 +113,7 @@ stmf_status_t stmf_register_scsi_session(stmf_local_port_t *lport, void stmf_deregister_scsi_session(stmf_local_port_t *lport, stmf_scsi_session_t *ss); void stmf_set_port_standby(stmf_local_port_t *lport, uint16_t rtpid); +void stmf_set_port_alua(stmf_local_port_t *lport); #ifdef __cplusplus } -- cgit v1.2.3