git: 28294dc92476 - main - Revert "ipsec: Drain async ipsec_offload work when destroying a vnet"

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Fri, 30 Aug 2024 15:01:10 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=28294dc92476031a3ce5228501f1429192cb3c8f

commit 28294dc92476031a3ce5228501f1429192cb3c8f
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-08-30 15:00:16 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-08-30 15:00:16 +0000

    Revert "ipsec: Drain async ipsec_offload work when destroying a vnet"
    
    This change can cause a deadlock in some cases, since it's possible for
    VNET teardown to happen in the context of taskqueue_thread, and
    ipsec_accel_sync() drains taskqueue_thread's work queue.
    
    This reverts commit e196b12f4d4d13982d42cf7841b77dca1405effa.
---
 sys/netipsec/ipsec_offload.c | 2 +-
 sys/netipsec/key.c           | 3 ---
 2 files changed, 1 insertion(+), 4 deletions(-)

diff --git a/sys/netipsec/ipsec_offload.c b/sys/netipsec/ipsec_offload.c
index 1ff91ec585c2..bbf98ac7a676 100644
--- a/sys/netipsec/ipsec_offload.c
+++ b/sys/netipsec/ipsec_offload.c
@@ -386,7 +386,7 @@ ipsec_accel_sa_newkey_impl(struct secasvar *sav)
 
 	TASK_INIT(&tq->install_task, 0, ipsec_accel_sa_newkey_act, tq);
 	tq->sav = sav;
-	tq->install_vnet = curthread->td_vnet;
+	tq->install_vnet = curthread->td_vnet;	/* XXXKIB liveness */
 	taskqueue_enqueue(taskqueue_thread, &tq->install_task);
 }
 
diff --git a/sys/netipsec/key.c b/sys/netipsec/key.c
index ad1d6164f158..5a3e5727bc2e 100644
--- a/sys/netipsec/key.c
+++ b/sys/netipsec/key.c
@@ -8713,9 +8713,6 @@ key_vnet_destroy(void *arg __unused)
 	}
 	SAHTREE_WUNLOCK();
 
-	/* Wait for async work referencing this VNET to finish. */
-	ipsec_accel_sync();
-
 	key_freesah_flushed(&sahdrainq);
 	hashdestroy(V_sphashtbl, M_IPSEC_SP, V_sphash_mask);
 	hashdestroy(V_savhashtbl, M_IPSEC_SA, V_savhash_mask);