net/smc: free link group without pending free_work only

Make sure there is no pending or running free_work worker for the link
group when freeing the link group.

Signed-off-by: Ursula Braun <ubraun@linux.vnet.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Ursula Braun 2018-03-14 11:01:01 +01:00 committed by David S. Miller
parent c9f4c6cf53
commit 268ffcc4eb
2 changed files with 3 additions and 1 deletions

View File

@ -1477,6 +1477,7 @@ static void __exit smc_exit(void)
spin_unlock_bh(&smc_lgr_list.lock);
list_for_each_entry_safe(lgr, lg, &lgr_freeing_list, list) {
list_del_init(&lgr->list);
cancel_delayed_work_sync(&lgr->free_work);
smc_lgr_free(lgr); /* free link group */
}
static_branch_disable(&tcp_have_smc);

View File

@ -140,7 +140,8 @@ static void smc_lgr_free_work(struct work_struct *work)
list_del_init(&lgr->list); /* remove from smc_lgr_list */
free:
spin_unlock_bh(&smc_lgr_list.lock);
smc_lgr_free(lgr);
if (!delayed_work_pending(&lgr->free_work))
smc_lgr_free(lgr);
}
/* create a new SMC link group */