[UPDATE PATCH 9/many] acrypto: crypto_lb.c

Nishanth Aravamudan nacc at us.ibm.com
Tue Mar 8 19:02:50 CET 2005


On Mon, Mar 07, 2005 at 11:37:34PM +0300, Evgeniy Polyakov wrote:
> --- /tmp/empty/crypto_lb.c	1970-01-01 03:00:00.000000000 +0300
> +++ ./acrypto/crypto_lb.c	2005-03-07 20:35:36.000000000 +0300
> @@ -0,0 +1,634 @@
> +/*
> + * 	crypto_lb.c
> + *
> + * Copyright (c) 2004 Evgeniy Polyakov <johnpol at 2ka.mipt.ru>

<snip>

> +void crypto_lb_unregister(struct crypto_lb *lb)
> +{
> +	struct crypto_lb *__lb, *n;
> +
> +	if (lb_num == 1) {
> +		dprintk(KERN_INFO "You are removing crypto load balancer %s which is current and default.\n"
> +			"There is no other crypto load balancers. "
> +			"Removing %s delayed untill new load balancer is registered.\n",
> +			lb->name, (force_lb_remove) ? "is not" : "is");
> +		while (lb_num == 1 && !force_lb_remove) {
> +			set_current_state(TASK_INTERRUPTIBLE);
> +			schedule_timeout(HZ);
> +
> +			if (signal_pending(current))
> +				flush_signals(current);
> +		}
> +	}

Description: Use msleep_interruptible() instead of schedule_timeout() to
guarantee the task delays as expected. Using msleep*() also leads to a
more human-understandable interface and allows for virtualized systems
(jiffy-less) to function correctly (with appropriate extensions).

Signed-off-by: Nishanth Aravamudan <nacc at us.ibm.com>

--- 2.6.11-v/acrypto/crypto_lb.c	2005-03-08 09:58:56.000000000 -0800
+++ 2.6.11/acrypto/crypto_lb.c	2005-03-08 09:59:38.000000000 -0800
@@ -29,6 +29,7 @@
 #include <linux/spinlock.h>
 #include <linux/workqueue.h>
 #include <linux/err.h>
+#include <linux/delay.h>
 
 #include "acrypto.h"
 #include "crypto_lb.h"
@@ -397,8 +398,7 @@ void crypto_lb_unregister(struct crypto_
 			"Removing %s delayed untill new load balancer is registered.\n",
 			lb->name, (force_lb_remove) ? "is not" : "is");
 		while (lb_num == 1 && !force_lb_remove) {
-			set_current_state(TASK_INTERRUPTIBLE);
-			schedule_timeout(HZ);
+			msleep_interruptible(1000);
 
 			if (signal_pending(current))
 				flush_signals(current);


More information about the CryptoAPI mailing list