Mercurial > illumos > illumos-gate
changeset 10290:ecc1578c5db2
6869771 IPMP standby interface may be left activated
author | meem <Peter.Memishian@Sun.COM> |
---|---|
date | Tue, 11 Aug 2009 04:55:17 -0400 |
parents | 5b71405fc453 |
children | 87d599b1efb6 |
files | usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_probe.c usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_tables.c usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_tables.h |
diffstat | 3 files changed, 31 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_probe.c Mon Aug 10 16:36:38 2009 -0700 +++ b/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_probe.c Tue Aug 11 04:55:17 2009 -0400 @@ -1,3 +1,4 @@ + /* * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. @@ -103,11 +104,11 @@ * The state of a phyint that is capable of being probed, is completely * specified by the 3-tuple <pi_state, pg_state, I>. * - * A phyint starts in either PI_RUNNING or PI_FAILED, depending on the state - * of the link (according to the driver). If the phyint is also configured - * with a test address (the common case) and probe targets, then a phyint must - * also successfully be able to send and receive probes in order to remain in - * the PI_RUNNING state (otherwise, it transitions to PI_FAILED). + * A phyint starts in either PI_RUNNING or PI_OFFLINE, depending on whether + * IFF_OFFLINE is set. If the phyint is also configured with a test address + * (the common case) and probe targets, then a phyint must also successfully + * be able to send and receive probes in order to remain in the PI_RUNNING + * state (otherwise, it transitions to PI_FAILED). * * Further, if a PI_RUNNING phyint is configured with a test address but is * unable to find any probe targets, it will transition to the PI_NOTARGETS @@ -1360,11 +1361,11 @@ } /* - * Transition a phyint back to PI_RUNNING (from PI_FAILED or PI_OFFLINE). The - * caller must ensure that the transition is appropriate. Clears IFF_OFFLINE - * or IFF_FAILED, as appropriate. Also sets IFF_INACTIVE on this or other - * interfaces as appropriate (see comment below). Finally, also updates the - * phyint's group state to account for the change. + * Transition a phyint to PI_RUNNING. The caller must ensure that the + * transition is appropriate. Clears IFF_OFFLINE or IFF_FAILED if + * appropriate. Also sets IFF_INACTIVE on this or other interfaces as + * appropriate (see comment below). Finally, also updates the phyint's group + * state to account for the change. */ void phyint_transition_to_running(struct phyint *pi) @@ -1373,6 +1374,7 @@ struct phyint *actstandbypi = NULL; uint_t nactive = 0, nnonstandby = 0; boolean_t onlining = (pi->pi_state == PI_OFFLINE); + boolean_t initial = (pi->pi_state == PI_INIT); uint64_t set, clear; /* @@ -1422,7 +1424,7 @@ } else if (onlining || failback_enabled) { /* case 2 */ if (nactive >= nnonstandby && actstandbypi != NULL) (void) change_pif_flags(actstandbypi, IFF_INACTIVE, 0); - } else if (!GROUP_FAILED(pi->pi_group)) { /* case 3 */ + } else if (!initial && !GROUP_FAILED(pi->pi_group)) { /* case 3 */ set |= IFF_INACTIVE; } (void) change_pif_flags(pi, set, clear);
--- a/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_tables.c Mon Aug 10 16:36:38 2009 -0700 +++ b/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_tables.c Tue Aug 11 04:55:17 2009 -0400 @@ -386,15 +386,7 @@ pi->pi_ifindex = ifindex; pi->pi_icmpid = htons(((getpid() & 0xFF) << 8) | (ifindex & 0xFF)); - /* - * If the interface is offline, we set the state to PI_OFFLINE. - * Otherwise, we optimistically start in the PI_RUNNING state. Later - * (in process_link_state_changes()), we will adjust this to match the - * current state of the link. Further, if test addresses are - * subsequently assigned, we will transition to PI_NOTARGETS and then - * to either PI_RUNNING or PI_FAILED depending on the probe results. - */ - pi->pi_state = (flags & IFF_OFFLINE) ? PI_OFFLINE : PI_RUNNING; + pi->pi_state = PI_INIT; pi->pi_flags = PHYINT_FLAGS(flags); /* @@ -417,6 +409,19 @@ */ phyint_insert(pi, pg); + /* + * If the interface is offline, we set the state to PI_OFFLINE. + * Otherwise, optimistically consider this interface running. Later + * (in process_link_state_changes()), we will adjust this to match the + * current state of the link. Further, if test addresses are + * subsequently assigned, we will transition to PI_NOTARGETS and then + * to either PI_RUNNING or PI_FAILED depending on the probe results. + */ + if (flags & IFF_OFFLINE) + phyint_chstate(pi, PI_OFFLINE); + else + phyint_transition_to_running(pi); /* calls phyint_chstate() */ + return (pi); } @@ -2677,6 +2682,9 @@ ifstate(struct phyint *pi) { switch (pi->pi_state) { + case PI_INIT: + return (IPMP_IF_UNKNOWN); + case PI_NOTARGETS: if (pi->pi_flags & IFF_FAILED) return (IPMP_IF_FAILED);
--- a/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_tables.h Mon Aug 10 16:36:38 2009 -0700 +++ b/usr/src/cmd/cmd-inet/usr.lib/in.mpathd/mpd_tables.h Tue Aug 11 04:55:17 2009 -0400 @@ -167,6 +167,7 @@ * Phyint states; see below for the phyint definition. */ enum pi_state { + PI_INIT = 0, /* Phyint is being initialized */ PI_NOTARGETS = 1, /* Phyint has no targets */ PI_RUNNING = 2, /* Phyint is functioning */ PI_FAILED = 3, /* Phyint is failed */