bridge: reset primary only after marking the member not present
authorAlex Oprea <alex.oprea@inteno.se>
Mon, 8 May 2017 14:30:13 +0000 (16:30 +0200)
committerFelix Fietkau <nbd@nbd.name>
Tue, 9 May 2017 10:51:03 +0000 (12:51 +0200)
Run the bridge_reset_primary function only after the member being removed
has been marked as not present.
This change prevents the bridge_reset_primary function from choosing the
member being removed as the new primary member.

Signed-off-by: Alex Oprea <alex.oprea@inteno.se>
bridge.c

index c46d44e2c362ead282778187abab9d9e5df27e05..96e0209141aea09df3627abe24c18b2a951c2119 100644 (file)
--- a/bridge.c
+++ b/bridge.c
@@ -240,15 +240,15 @@ bridge_remove_member(struct bridge_member *bm)
        if (!bm->present)
                return;
 
-       if (bm == bst->primary_port)
-               bridge_reset_primary(bst);
-
        if (bst->dev.active)
                bridge_disable_member(bm);
 
        bm->present = false;
        bm->bst->n_present--;
 
+       if (bm == bst->primary_port)
+               bridge_reset_primary(bst);
+
        if (bst->config.bridge_empty)
                return;