fcoe-utils/0007-fipvlan-clean-up-state-machine-for-pfd_add.patch
Hannes Reinecke 5ac0391a2f - Update to version 1.0.30 (FATE#318849)
* Remove merged patches:
    + 0001-man-Fix-small-typo-regarding-fcf-option.patch
    + 0002-Don-t-call-AM_INIT_AUTOMAKE-twice.patch
    + 0003-fipvlan-fails-on-powerpc.patch
    + 0004-fipvlan-Only-shutdown-interfaces-if-no-vlans-are-cre.patch
    + 0005-fipvlan-start-VLAN-interface-from-netlink-handler.patch
    + 0006-fipvlan-Extract-create_missing_vlan-function-from-lo.patch
    + 0007-fipvlan-create-VLANs-from-netlink-handler.patch
    + 0008-fipvlan-Start-FCoE-from-netlink-handler.patch
    + 0009-fipvlan-Update-wait-loop-to-wait-for-VLANs.patch
    + 0010-fipvlan-Re-send-VLAN-discovery.patch
    + 0011-fipvlan-update-manpage.patch
    + 0012-fipvlan-Leave-link-up-if-requested.patch
    + 0013-fipvlan-Update-manpage-to-reflect-correct-timeout.patch
    + 0014-fipvlan-Do-not-shut-down-FCoE-connections-on-physica.patch
    + 0015-fipvlan-break-out-of-receive-loop-on-error.patch
    + 0016-fipvlan-handle-errors-from-fip-socket-creation.patch
    + 0017-fipvlan-filter-interfaces-from-rtnl_getlink.patch
    + 0018-Add-missing-DESTDIR-when-installing-bash-completion.patch
    + 0019-Fix-build-with-Wl-as-needed.patch
    + 0020-Fix-integer-formatting.patch
    + 0021-fcnsq-Fixup-help-text.patch
    + 0022-fcnsq-Fixup-64bit-integer-handling.patch
    + 0023-fcoemon-add-systemd-service-file.patch
    + 0024-fcoemon-systemd-socket-activation.patch
    + 0025-doc-Update-QUICKSTART-INSTALL-docs-for-systemd-init-.patch
    + 0026-FIPVLAN-Really-break-out-of-the-recv_loop-upon-fip_r.patch
    + 0027-man-Fix-typo-in-fcoemon-documentation.patch
    + 0032-fipvlan-Fix-crash-in-create_and_start_vlan.patch

OBS-URL: https://build.opensuse.org/package/show/network:fcoe/fcoe-utils?expand=0&rev=22
2015-08-04 10:18:41 +00:00

68 lines
1.8 KiB
Diff

From 53a1a696c33fc64c76bd29831ed61c8e50fbc495 Mon Sep 17 00:00:00 2001
From: Hannes Reinecke <hare@suse.de>
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 <hare@suse.de>
---
fipvlan.c | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/fipvlan.c b/fipvlan.c
index 9f3b07d..a183233 100644
--- a/fipvlan.c
+++ b/fipvlan.c
@@ -398,10 +398,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;
@@ -441,6 +448,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
@@ -814,7 +822,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);
@@ -822,6 +831,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.8.4.5