Date: Mon, 8 Dec 1997 12:07:56 GMT
From: Roman Hodek <rnhodek@faui22c.informatik.uni-erlangen.de>
To: linux-m68k@lists.linux-m68k.org
In-Reply-To: <199712051833.TAA11183@valhall.cern.ch> (message from Jes
	Sorensen on Fri, 5 Dec 1997 19:33:09 +0100)
Subject: Re: L68K: forwarded message from Andrzej M. Krzysztofowicz
Sender: owner-linux-m68k@phil.uni-sb.de


> Anybody care to comment on this one.

He's perfectly right. Below is the patch.

BTW, is there any other block driver with the same problem? Affected
are only drivers for partitioned media, i.e. those that have a struct
gendisk. z2ram is not affected. ide has the thing in it.

Roman

------------------------------------------------------------------------------
--- src/linux-2.1.64/drivers/block/acsi.c~	Wed Nov 19 22:28:46 1997
+++ src/linux-2.1.64/drivers/block/acsi.c	Mon Dec  8 13:03:58 1997
@@ -1841,12 +1841,22 @@
 
 void cleanup_module(void)
 {
+	struct gendisk ** gdp;
+
 	del_timer( &acsi_timer );
 	blk_dev[MAJOR_NR].request_fn = 0;
 	atari_stram_free( acsi_buffer );
 
 	if (unregister_blkdev( MAJOR_NR, "ad" ) != 0)
 		printk( KERN_ERR "acsi: cleanup_module failed\n");
+	
+	for (gdp = &gendisk_head; *gdp; gdp = &((*gdp)->next))
+		if (*gdp == &acsi_gendisk)
+			break;
+	if (!*gdp)
+		printk( KERN_ERR "acsi: entry in disk chain missing!\n" );
+	else
+		*gdp = (*gdp)->next;
 }
 #endif
 
