patch-2.4.11-dontuse linux/drivers/block/genhd.c

Next file: linux/drivers/block/loop.c
Previous file: linux/arch/sparc64/prom/misc.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.4.10/linux/drivers/block/genhd.c linux/drivers/block/genhd.c
@@ -47,9 +47,27 @@
 void
 add_gendisk(struct gendisk *gp)
 {
+	struct gendisk *sgp;
+
 	write_lock(&gendisk_lock);
+
+	/*
+ 	 *	In 2.5 this will go away. Fix the drivers who rely on
+ 	 *	old behaviour.
+ 	 */
+
+	for (sgp = gendisk_head; sgp; sgp = sgp->next)
+	{
+		if (sgp == gp)
+		{
+//			printk(KERN_ERR "add_gendisk: device major %d is buggy and added a live gendisk!\n",
+//				sgp->major)
+			goto out;
+		}
+	}
 	gp->next = gendisk_head;
 	gendisk_head = gp;
+out:
 	write_unlock(&gendisk_lock);
 }
 

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)