summaryrefslogtreecommitdiffstats
path: root/sys/opencrypto
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2006-04-11 18:01:04 +0000
committerpjd <pjd@FreeBSD.org>2006-04-11 18:01:04 +0000
commit4b73dab2505e0d0798d58c4b0c497890075a928c (patch)
treea55753775433adbd2c4ca98ec2a9a936ce03dd93 /sys/opencrypto
parenteab270d045cc9f18d1d5de342d3c3c3f516c7801 (diff)
downloadFreeBSD-src-4b73dab2505e0d0798d58c4b0c497890075a928c.zip
FreeBSD-src-4b73dab2505e0d0798d58c4b0c497890075a928c.tar.gz
Be sure to wakeup the crypto thread when new request was queued.
This should fix a hang when starting cryptokeytest (and more). MFC after: 1 month
Diffstat (limited to 'sys/opencrypto')
-rw-r--r--sys/opencrypto/crypto.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/opencrypto/crypto.c b/sys/opencrypto/crypto.c
index a67f524..62aa250 100644
--- a/sys/opencrypto/crypto.c
+++ b/sys/opencrypto/crypto.c
@@ -658,7 +658,7 @@ int
crypto_dispatch(struct cryptop *crp)
{
u_int32_t hid = CRYPTO_SESID2HID(crp->crp_sid);
- int result;
+ int result, wasempty;
cryptostats.cs_ops++;
@@ -668,6 +668,7 @@ crypto_dispatch(struct cryptop *crp)
#endif
CRYPTO_Q_LOCK();
+ wasempty = TAILQ_EMPTY(&crp_q);
if ((crp->crp_flags & CRYPTO_F_BATCH) == 0) {
struct cryptocap *cap;
/*
@@ -702,19 +703,17 @@ crypto_dispatch(struct cryptop *crp)
result = 0;
}
} else {
- int wasempty;
/*
* Caller marked the request as ``ok to delay'';
* queue it for the dispatch thread. This is desirable
* when the operation is low priority and/or suitable
* for batching.
*/
- wasempty = TAILQ_EMPTY(&crp_q);
TAILQ_INSERT_TAIL(&crp_q, crp, crp_next);
- if (wasempty)
- wakeup_one(&crp_q);
result = 0;
}
+ if (wasempty && !TAILQ_EMPTY(&crp_q))
+ wakeup_one(&crp_q);
CRYPTO_Q_UNLOCK();
return result;
@@ -728,11 +727,12 @@ int
crypto_kdispatch(struct cryptkop *krp)
{
struct cryptocap *cap;
- int result;
+ int result, wasempty;
cryptostats.cs_kops++;
CRYPTO_Q_LOCK();
+ wasempty = TAILQ_EMPTY(&crp_q);
cap = crypto_checkdriver(krp->krp_hid);
if (cap && !cap->cc_kqblocked) {
result = crypto_kinvoke(krp, 0);
@@ -758,6 +758,8 @@ crypto_kdispatch(struct cryptkop *krp)
TAILQ_INSERT_TAIL(&crp_kq, krp, krp_next);
result = 0;
}
+ if (wasempty && !TAILQ_EMPTY(&crp_kq))
+ wakeup_one(&crp_q);
CRYPTO_Q_UNLOCK();
return result;
OpenPOWER on IntegriCloud