

On a really small memory machine (or one with a monstrous kernel memory leak)
we can end up calling blk_congestion_wait() before the waitqueue_heads are set
up.


---

 25-akpm/drivers/block/ll_rw_blk.c |   10 ++++------
 1 files changed, 4 insertions(+), 6 deletions(-)

diff -puN drivers/block/ll_rw_blk.c~congestion_wqh-init drivers/block/ll_rw_blk.c
--- 25/drivers/block/ll_rw_blk.c~congestion_wqh-init	2004-03-15 00:32:08.014535664 -0800
+++ 25-akpm/drivers/block/ll_rw_blk.c	2004-03-15 00:33:38.100840464 -0800
@@ -42,7 +42,10 @@ static void blk_unplug_timeout(unsigned 
  */
 static kmem_cache_t *request_cachep;
 
-static wait_queue_head_t congestion_wqh[2];
+static wait_queue_head_t congestion_wqh[2] = {
+		__WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[0]),
+		__WAIT_QUEUE_HEAD_INITIALIZER(congestion_wqh[1])
+	};
 
 /*
  * Controlling structure to kblockd
@@ -2825,8 +2828,6 @@ void kblockd_flush(void)
 
 int __init blk_dev_init(void)
 {
-	int i;
-
 	kblockd_workqueue = create_workqueue("kblockd");
 	if (!kblockd_workqueue)
 		panic("Failed to create kblockd\n");
@@ -2838,9 +2839,6 @@ int __init blk_dev_init(void)
 
 	blk_max_low_pfn = max_low_pfn;
 	blk_max_pfn = max_pfn;
-
-	for (i = 0; i < ARRAY_SIZE(congestion_wqh); i++)
-		init_waitqueue_head(&congestion_wqh[i]);
 	return 0;
 }
 

_
