diff --git a/0030-fcoe.service-Add-foreground-to-prevent-fcoemon-to-be.patch b/0030-fcoe.service-Add-foreground-to-prevent-fcoemon-to-be.patch new file mode 100644 index 0000000..198c024 --- /dev/null +++ b/0030-fcoe.service-Add-foreground-to-prevent-fcoemon-to-be.patch @@ -0,0 +1,33 @@ +From 1b7dc959d70679a3536ccbeb6b3a8d0905606537 Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Wed, 16 Apr 2014 13:30:47 +0200 +Subject: fcoe.service: Add '--foreground' to prevent fcoemon to be killed + +fcoemon is running as a daemon per default, so when using +Type=simple in the service file systemd will kill the fcoemon +daemon immediately as it just sees the return code from the +first fork() call. + +References: bnc#873269 + +Signed-off-by: Hannes Reinecke +--- + etc/systemd/fcoe.service | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/etc/systemd/fcoe.service b/etc/systemd/fcoe.service +index 2e10bcd..b1d9567 100644 +--- a/etc/systemd/fcoe.service ++++ b/etc/systemd/fcoe.service +@@ -6,7 +6,7 @@ After=syslog.target network.target + Type=simple + EnvironmentFile=/etc/fcoe/config + ExecStartPre=/sbin/modprobe -qa $SUPPORTED_DRIVERS +-ExecStart=/usr/sbin/fcoemon --debug=$DEBUG --syslog=$SYSLOG ++ExecStart=/usr/sbin/fcoemon --foreground --debug=$DEBUG --syslog=$SYSLOG + + [Install] + WantedBy=multi-user.target +-- +1.7.12.4 + diff --git a/0031-fcoemon-Fix-IEEE-state-machine.patch b/0031-fcoemon-Fix-IEEE-state-machine.patch new file mode 100644 index 0000000..23c7fb7 --- /dev/null +++ b/0031-fcoemon-Fix-IEEE-state-machine.patch @@ -0,0 +1,107 @@ +From 95f4a92799627e791dc68eb49922f169409b5cd8 Mon Sep 17 00:00:00 2001 +From: Neerav Parikh +Date: Tue, 18 Mar 2014 08:34:18 +0000 +Subject: fcoemon: Fix IEEE state machine + +fcoemon on adapters that support only IEEE DCBX mode +doesn't enter into a state where it can proceed +doing FIP VLAN discovery or creating an FCoE instance. +This is because the current IEEE state machine is tied +with the CEE based state machine. It relies on some +CEE specific DCB netlink calls viz. getstate() to +proceed; which may not be available on drivers that +only support IEEE specific DCBNL calls. + +Hence, this patch aims to separate out the IEEE DCBX +mode specific state machine from the CEE one. + +Signed-off-by: Neerav Parikh +Tested-by: Jack Morgan +--- + fcoemon.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++++------ + 1 file changed, 48 insertions(+), 6 deletions(-) + +diff --git a/fcoemon.c b/fcoemon.c +index 23fc2f6..3ab1a98 100644 +--- a/fcoemon.c ++++ b/fcoemon.c +@@ -1357,12 +1357,8 @@ ieee_state_set(struct fcm_netif *ff, enum ieee_state new_state) + getstr(&ieee_states, new_state)); + } + +- if (new_state == IEEE_GET_STATE) { +- ff->ieee_state = new_state; ++ if (new_state == IEEE_GET_STATE) + clear_ieee_info(ff); +- ieee_get_req(ff); +- return; +- } + + ff->ieee_state = new_state; + ff->ieee_resp_pending = 0; +@@ -3035,6 +3031,50 @@ static void fcm_fcoe_action(struct fcoe_port *p) + + /* + * Called for all ports. For FCoE ports and candidates, ++ * get IEEE DCBX information and set the next action. ++ */ ++static void fcm_netif_ieee_advance(struct fcm_netif *ff) ++{ ++ enum fcp_action action; ++ ++ ASSERT(ff); ++ ASSERT(fcm_clif); ++ ++ if (fcm_clif->cl_busy) ++ return; ++ ++ if (ff->ieee_resp_pending) ++ return; ++ ++ switch (ff->ieee_state) { ++ case IEEE_INIT: ++ break; ++ case IEEE_GET_STATE: ++ ieee_get_req(ff); ++ break; ++ case IEEE_DONE: ++ action = validate_ieee_info(ff); ++ switch (action) { ++ case FCP_DESTROY_IF: ++ case FCP_ENABLE_IF: ++ case FCP_ACTIVATE_IF: ++ fcp_action_set(ff->ifname, action); ++ break; ++ case FCP_DISABLE_IF: ++ case FCP_ERROR: ++ fcp_action_set(ff->ifname, FCP_DISABLE_IF); ++ break; ++ case FCP_WAIT: ++ default: ++ break; ++ } ++ default: ++ break; ++ } ++} ++ ++/* ++ * Called for all ports. For FCoE ports and candidates, + * get information and send to dcbd. + */ + static void fcm_netif_advance(struct fcm_netif *ff) +@@ -3161,8 +3201,10 @@ static void fcm_handle_changes(void) + /* + * Perform pending actions (dcbd queries) on network interfaces. + */ +- TAILQ_FOREACH(ff, &fcm_netif_head, ff_list) ++ TAILQ_FOREACH(ff, &fcm_netif_head, ff_list) { + fcm_netif_advance(ff); ++ fcm_netif_ieee_advance(ff); ++ } + + /* + * Perform actions on FCoE ports +-- +1.7.12.4 + diff --git a/0032-fipvlan-Fix-crash-in-create_and_start_vlan.patch b/0032-fipvlan-Fix-crash-in-create_and_start_vlan.patch new file mode 100644 index 0000000..d50b487 --- /dev/null +++ b/0032-fipvlan-Fix-crash-in-create_and_start_vlan.patch @@ -0,0 +1,58 @@ +From 0d006642c34e360fb7d3c3adbbb1295e784c03bf Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Mon, 12 May 2014 14:55:50 +0200 +Subject: fipvlan: Fix crash in create_and_start_vlan() + +create_and_start_vlan() will issue a netlink command to create +a new VLAN device. As this device isn't present yet we need +to exit here and retry the vlan configuration once we get the +appropriate message from netlink. + +References: bnc#877275 + +Signed-off-by: Hannes Reinecke +--- + fipvlan.c | 25 +++++++++++++------------ + 1 file changed, 13 insertions(+), 12 deletions(-) + +diff --git a/fipvlan.c b/fipvlan.c +index cc71412..7202f03 100644 +--- a/fipvlan.c ++++ b/fipvlan.c +@@ -626,20 +626,21 @@ create_and_start_vlan(struct fcf *fcf, bool vn2vn) + vlan = real_dev; + } else { + vlan = lookup_vlan(fcf->ifindex, fcf->vlan); +- if (vlan) { +- FIP_LOG_DBG("VLAN %s.%d already exists as %s\n", +- real_dev->ifname, fcf->vlan, vlan->ifname); ++ if (!vlan) { ++ snprintf(vlan_name, IFNAMSIZ, "%s.%d%s", ++ real_dev->ifname, fcf->vlan, config.suffix); ++ rc = vlan_create(fcf->ifindex, fcf->vlan, vlan_name); ++ if (rc < 0) { ++ printf("Failed to create VLAN device %s\n" ++ "\t%s\n", ++ vlan_name, strerror(-rc)); ++ return rc; ++ } ++ printf("Created VLAN device %s\n", vlan_name); + return 0; + } +- snprintf(vlan_name, IFNAMSIZ, "%s.%d%s", +- real_dev->ifname, fcf->vlan, config.suffix); +- rc = vlan_create(fcf->ifindex, fcf->vlan, vlan_name); +- if (rc < 0) { +- printf("Failed to create VLAN device %s\n\t%s\n", +- vlan_name, strerror(-rc)); +- return rc; +- } +- printf("Created VLAN device %s\n", vlan_name); ++ FIP_LOG_DBG("VLAN %s.%d already exists as %s\n", ++ real_dev->ifname, fcf->vlan, vlan->ifname); + } + if (!config.start) + return rc; +-- +1.7.12.4 + diff --git a/0033-fipvlan-suppress-warning-interface-already-exists.patch b/0033-fipvlan-suppress-warning-interface-already-exists.patch new file mode 100644 index 0000000..81f10c3 --- /dev/null +++ b/0033-fipvlan-suppress-warning-interface-already-exists.patch @@ -0,0 +1,31 @@ +From 798a5ff4a205fa26d37447ff77fc27861103440a Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Mon, 12 May 2014 14:59:13 +0200 +Subject: fipvlan: suppress warning 'interface already exists' + +When fipvlan is called for just the parent interface we should +not select the vlan interface, too, otherwise we'll be getting +those annoying warning messages. + +Signed-off-by: Hannes Reinecke +--- + fipvlan.c | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/fipvlan.c b/fipvlan.c +index 7202f03..163d21e 100644 +--- a/fipvlan.c ++++ b/fipvlan.c +@@ -451,7 +451,8 @@ static void rtnl_recv_newlink(struct nlmsghdr *nh) + int i, iff_selected = 0; + + for (i = 0; i < config.namec; i++) { +- if (!strcmp(iff->ifname, config.namev[i])) ++ if (!strncmp(iff->ifname, config.namev[i], ++ strlen(config.namev[i]))) + iff_selected = 1; + } + if (!iff_selected) { +-- +1.7.12.4 + diff --git a/0034-fipvlan-do-not-crash-on-empty-MAC-address-in-lookup_.patch b/0034-fipvlan-do-not-crash-on-empty-MAC-address-in-lookup_.patch new file mode 100644 index 0000000..f3acd97 --- /dev/null +++ b/0034-fipvlan-do-not-crash-on-empty-MAC-address-in-lookup_.patch @@ -0,0 +1,31 @@ +From eb7451d0dcffb1c247e2b070b6101c2c878faee4 Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Mon, 12 May 2014 15:24:48 +0200 +Subject: fipvlan: do not crash on empty MAC address in lookup_fcf() + +We're calling lookup_fcf() with a NULL macaddress, so we need +to ensure we don't crash here. + +References: bnc#877275 + +Signed-off-by: Hannes Reinecke +--- + fipvlan.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/fipvlan.c b/fipvlan.c +index 163d21e..c5f3d3f 100644 +--- a/fipvlan.c ++++ b/fipvlan.c +@@ -169,7 +169,7 @@ static struct fcf *lookup_fcf(struct fcf_list_head *head, int ifindex, + + TAILQ_FOREACH(fcf, head, list_node) + if ((ifindex == fcf->ifindex) && (vlan == fcf->vlan) && +- (memcmp(mac, fcf->mac_addr, ETHER_ADDR_LEN) == 0)) ++ (!mac || memcmp(mac, fcf->mac_addr, ETHER_ADDR_LEN) == 0)) + return fcf; + return NULL; + } +-- +1.7.12.4 + diff --git a/0035-fipvlan-fixup-return-value-on-error.patch b/0035-fipvlan-fixup-return-value-on-error.patch new file mode 100644 index 0000000..209a662 --- /dev/null +++ b/0035-fipvlan-fixup-return-value-on-error.patch @@ -0,0 +1,38 @@ +From 16765b7b091f8130ae001af7693895ffe0886a0e Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Tue, 13 May 2014 09:44:17 +0200 +Subject: fipvlan: fixup return value on error + +fipvlan should return 1 on error or ENODEV (=19) if no interfaces +were found. + +Signed-off-by: Hannes Reinecke +--- + fipvlan.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/fipvlan.c b/fipvlan.c +index c5f3d3f..3300c68 100644 +--- a/fipvlan.c ++++ b/fipvlan.c +@@ -982,7 +982,7 @@ int main(int argc, char **argv) + + ns = rtnl_socket(); + if (ns < 0) { +- rc = ns; ++ rc = 1; + goto ns_err; + } + pfd_add(ns); +@@ -1002,7 +1002,7 @@ int main(int argc, char **argv) + "no interfaces to perform discovery on"); + else + FIP_LOG("no interfaces to perform discovery on"); +- exit(1); ++ exit(ENODEV); + } + + do_vlan_discovery(); +-- +1.7.12.4 + diff --git a/0036-fipvlan-clean-up-state-machine-for-pfd_add.patch b/0036-fipvlan-clean-up-state-machine-for-pfd_add.patch new file mode 100644 index 0000000..398461c --- /dev/null +++ b/0036-fipvlan-clean-up-state-machine-for-pfd_add.patch @@ -0,0 +1,67 @@ +From b19353bfa3186334611109456b232e596335c15e Mon Sep 17 00:00:00 2001 +From: Hannes Reinecke +Date: Wed, 14 May 2014 16:01:10 +0200 +Subject: fipvlan: clean up state machine for pfd_add + +pfd_add just adds the fd to the internal list without any checking. +So use the 'fip_ready' flag to track this. + +Signed-off-by: Hannes Reinecke +--- + fipvlan.c | 17 ++++++++++++++--- + 1 file changed, 14 insertions(+), 3 deletions(-) + +diff --git a/fipvlan.c b/fipvlan.c +index 3300c68..2211fd1 100644 +--- a/fipvlan.c ++++ b/fipvlan.c +@@ -397,10 +397,17 @@ static void rtnl_recv_newlink(struct nlmsghdr *nh) + /* already tracking, update operstate and return */ + iff->running = running; + if (!iff->running) { +- pfd_remove(iff->ps); ++ if (iff->fip_ready) { ++ pfd_remove(iff->ps); ++ iff->fip_ready = false; ++ } + return; + } +- pfd_add(iff->ps); ++ if (iff->ps >= 0 && !iff->fip_ready) { ++ pfd_add(iff->ps); ++ iff->fip_ready = true; ++ } ++ + if (!config.start) + return; + +@@ -440,6 +447,7 @@ static void rtnl_recv_newlink(struct nlmsghdr *nh) + iff->ifindex = ifm->ifi_index; + iff->running = running; + iff->fip_ready = false; ++ iff->ps = -1; + if (ifla[IFLA_LINK]) + iff->iflink = *(int *)RTA_DATA(ifla[IFLA_LINK]); + else +@@ -827,7 +835,8 @@ static int probe_fip_interface(struct iff *iff) + if (iff->req_sent) + return 0; + +- if (!iff->fip_ready) { ++ if (iff->ps < 0) { ++ iff->fip_ready = false; + iff->ps = fip_socket(iff->ifindex, FIP_NONE); + if (iff->ps < 0) { + FIP_LOG_DBG("if %d not ready\n", iff->ifindex); +@@ -835,6 +844,8 @@ static int probe_fip_interface(struct iff *iff) + } + setsockopt(iff->ps, SOL_PACKET, PACKET_ORIGDEV, + &origdev, sizeof(origdev)); ++ } ++ if (!iff->fip_ready) { + pfd_add(iff->ps); + iff->fip_ready = true; + } +-- +1.7.12.4 + diff --git a/fcoe-utils.changes b/fcoe-utils.changes index b46f46c..5ce436e 100644 --- a/fcoe-utils.changes +++ b/fcoe-utils.changes @@ -1,3 +1,23 @@ +------------------------------------------------------------------- +Thu May 15 09:15:54 CEST 2014 - hare@suse.de + +- Start fcoemon in foreground from service file (bnc#873269) + * Add 0030-fcoe.service-Add-foreground-to-prevent-fcoemon-to-be.patch +- Fixup IEEE state machine + * Add 0031-fcoemon-Fix-IEEE-state-machine.patch +- Fix fipvlan crash during booting (bnc#877275): + * Add 0032-fipvlan-Fix-crash-in-create_and_start_vlan.patch + * Add 0033-fipvlan-suppress-warning-interface-already-exists.patch + * Add 0034-fipvlan-do-not-crash-on-empty-MAC-address-in-lookup_.patch +- Fixup warning messages during booting: + * Add 0035-fipvlan-fixup-return-value-on-error.patch + * Add 0036-fipvlan-clean-up-state-machine-for-pfd_add.patch + +------------------------------------------------------------------- +Fri Apr 11 19:19:33 CEST 2014 - lchiquitto@suse.de + +- Remove obsolete file fcoe.config from sources + ------------------------------------------------------------------- Fri Apr 11 15:08:04 CEST 2014 - hare@suse.de diff --git a/fcoe-utils.spec b/fcoe-utils.spec index a0de9ce..5cc00e5 100644 --- a/fcoe-utils.spec +++ b/fcoe-utils.spec @@ -69,6 +69,13 @@ Patch27: 0027-man-Fix-typo-in-fcoemon-documentation.patch # Patches to be upstreamed Patch28: 0028-systemctl-cannot-start-fcoemon.socket.patch Patch29: 0029-fcoemon-Correctly-handle-options-in-the-service-file.patch +Patch30: 0030-fcoe.service-Add-foreground-to-prevent-fcoemon-to-be.patch +Patch31: 0031-fcoemon-Fix-IEEE-state-machine.patch +Patch32: 0032-fipvlan-Fix-crash-in-create_and_start_vlan.patch +Patch33: 0033-fipvlan-suppress-warning-interface-already-exists.patch +Patch34: 0034-fipvlan-do-not-crash-on-empty-MAC-address-in-lookup_.patch +Patch35: 0035-fipvlan-fixup-return-value-on-error.patch +Patch36: 0036-fipvlan-clean-up-state-machine-for-pfd_add.patch # Patches from Fedora Patch101: fcoe-utils-1.0.29-make.patch @@ -110,6 +117,13 @@ connections. %patch27 -p1 %patch28 -p1 %patch29 -p1 +%patch30 -p1 +%patch31 -p1 +%patch32 -p1 +%patch33 -p1 +%patch34 -p1 +%patch35 -p1 +%patch36 -p1 %patch101 -p1 %build diff --git a/fcoe.config b/fcoe.config deleted file mode 100644 index 9c63360..0000000 --- a/fcoe.config +++ /dev/null @@ -1,5 +0,0 @@ -# All supported drivers listed here are loaded when service starts -SUPPORTED_DRIVERS="libfc fcoe bnx2fc" - -# Add --debug to enable debug messages -FCOEMON_OPTS="--syslog"