net/smc: schedule free_work when link group is terminated
authorKarsten Graul <kgraul@linux.vnet.ibm.com>
Wed, 14 Mar 2018 10:01:02 +0000 (11:01 +0100)
committerDavid S. Miller <davem@davemloft.net>
Wed, 14 Mar 2018 17:40:44 +0000 (13:40 -0400)
The free_work worker must be scheduled when the link group is
abnormally terminated.

Signed-off-by: Karsten Graul <kgraul@linux.vnet.ibm.com>
Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/smc/smc_core.c

index ec6189fe2a4858112dc62498f9325a069decb7f8..f44f6803f7ff2c8585caf555b7b4aea4168b680b 100644 (file)
 
 static u32 smc_lgr_num;                        /* unique link group number */
 
+static void smc_lgr_schedule_free_work(struct smc_link_group *lgr)
+{
+       /* client link group creation always follows the server link group
+        * creation. For client use a somewhat higher removal delay time,
+        * otherwise there is a risk of out-of-sync link groups.
+        */
+       mod_delayed_work(system_wq, &lgr->free_work,
+                        lgr->role == SMC_CLNT ? SMC_LGR_FREE_DELAY_CLNT :
+                                                SMC_LGR_FREE_DELAY_SERV);
+}
+
 /* Register connection's alert token in our lookup structure.
  * To use rbtrees we have to implement our own insert core.
  * Requires @conns_lock
@@ -111,13 +122,7 @@ static void smc_lgr_unregister_conn(struct smc_connection *conn)
        write_unlock_bh(&lgr->conns_lock);
        if (!reduced || lgr->conns_num)
                return;
-       /* client link group creation always follows the server link group
-        * creation. For client use a somewhat higher removal delay time,
-        * otherwise there is a risk of out-of-sync link groups.
-        */
-       mod_delayed_work(system_wq, &lgr->free_work,
-                        lgr->role == SMC_CLNT ? SMC_LGR_FREE_DELAY_CLNT :
-                                                SMC_LGR_FREE_DELAY_SERV);
+       smc_lgr_schedule_free_work(lgr);
 }
 
 static void smc_lgr_free_work(struct work_struct *work)
@@ -344,6 +349,7 @@ void smc_lgr_terminate(struct smc_link_group *lgr)
        }
        write_unlock_bh(&lgr->conns_lock);
        wake_up(&lgr->lnk[SMC_SINGLE_LINK].wr_reg_wait);
+       smc_lgr_schedule_free_work(lgr);
 }
 
 /* Determine vlan of internal TCP socket.