Re: 2.6.20-mm2

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Monday, February 19, 2007 - 11:31 pm

On Tue, 20 Feb 2007 02:20:21 +0100 "Rafael J. Wysocki" <rjw@sisk.pl> wrote:


Yes, Rolf says this goes away when you stop using gcc-4.1.0.

I'm hoping that churning the code around like below makes things work
right.



From: Andrew Morton <akpm@linux-foundation.org>

Several people have reported failures in dynamic major device number handling
due to the recent changes in there to avoid handing out the local/experimental
majors.

Rolf reports that this is due to a gcc-4.1.0 bug.

The patch refactors that code a lot in an attempt to provoke the compiler into
behaving.

Cc: Rolf Eike Beer <eike-kernel@sf-tec.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---

 block/genhd.c          |    9 ++-------
 drivers/base/core.c    |   14 ++++++++++++++
 fs/char_dev.c          |    8 ++------
 include/linux/kdev_t.h |    1 +
 4 files changed, 19 insertions(+), 13 deletions(-)

diff -puN block/genhd.c~rework-reserved-major-handling block/genhd.c
--- a/block/genhd.c~rework-reserved-major-handling
+++ a/block/genhd.c
@@ -5,6 +5,7 @@
 #include <linux/module.h>
 #include <linux/fs.h>
 #include <linux/genhd.h>
+#include <linux/kdev_t.h>
 #include <linux/kernel.h>
 #include <linux/blkdev.h>
 #include <linux/init.h>
@@ -61,13 +62,7 @@ int register_blkdev(unsigned int major, 
 	/* temporary */
 	if (major == 0) {
 		for (index = ARRAY_SIZE(major_names)-1; index > 0; index--) {
-			/*
-			 * Disallow the LANANA-assigned LOCAL/EXPERIMENTAL
-			 * majors
-			 */
-			if ((60 <= index && index <= 63) ||
-					(120 <= index && index <= 127) ||
-					(240 <= index && index <= 254))
+			if (is_lanana_major(index))
 				continue;
 			if (major_names[index] == NULL)
 				break;
diff -puN fs/char_dev.c~rework-reserved-major-handling fs/char_dev.c
--- a/fs/char_dev.c~rework-reserved-major-handling
+++ a/fs/char_dev.c
@@ -6,6 +6,7 @@
 
 #include <linux/init.h>
 #include <linux/fs.h>
+#include <linux/kdev_t.h>
 #include <linux/slab.h>
 #include <linux/string.h>
 
@@ -108,12 +109,7 @@ __register_chrdev_region(unsigned int ma
 	/* temporary */
 	if (major == 0) {
 		for (i = ARRAY_SIZE(chrdevs)-1; i > 0; i--) {
-			/*
-			 * Disallow the LANANA-assigned LOCAL/EXPERIMENTAL
-			 * majors
-			 */
-			if ((60 <= i && i <= 63) || (120 <= i && i <= 127) ||
-					(240 <= i && i <= 254))
+			if (is_lanana_major(i))
 				continue;
 			if (chrdevs[i] == NULL)
 				break;
diff -puN drivers/base/core.c~rework-reserved-major-handling drivers/base/core.c
--- a/drivers/base/core.c~rework-reserved-major-handling
+++ a/drivers/base/core.c
@@ -28,6 +28,20 @@ int (*platform_notify)(struct device * d
 int (*platform_notify_remove)(struct device * dev) = NULL;
 
 /*
+ * Detect the LANANA-assigned LOCAL/EXPERIMENTAL majors
+ */
+bool is_lanana_major(unsigned int major)
+{
+	if (major >= 60 && major <= 63)
+		return 1;
+	if (major >= 120 && major <= 127)
+		return 1;
+	if (major >= 240 && major <= 254)
+		return 1;
+	return 0;
+}
+
+/*
  * sysfs bindings for devices.
  */
 
diff -puN include/linux/kdev_t.h~rework-reserved-major-handling include/linux/kdev_t.h
--- a/include/linux/kdev_t.h~rework-reserved-major-handling
+++ a/include/linux/kdev_t.h
@@ -87,6 +87,7 @@ static inline unsigned sysv_minor(u32 de
 	return dev & 0x3ffff;
 }
 
+bool is_lanana_major(unsigned int major);
 
 #else /* __KERNEL__ */
 
_

-
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
2.6.20-mm2, Andrew Morton, (Sat Feb 17, 10:51 pm)
Re: 2.6.20-mm2, Dave Airlie, (Sat Feb 17, 11:18 pm)
Re: 2.6.20-mm2, Andrew Morton, (Sat Feb 17, 11:34 pm)
Re: 2.6.20-mm2, Rafael J. Wysocki, (Sun Feb 18, 5:44 am)
Re: 2.6.20-mm2: Oops in generic_make_request, Laurent Riffard, (Sun Feb 18, 6:06 am)
Re: 2.6.20-mm2: Oops in generic_make_request, Mattia Dongili, (Sun Feb 18, 10:58 am)
Re: 2.6.20-mm2, Michal Piotrowski, (Sun Feb 18, 11:20 am)
Re: 2.6.20-mm2, Andrew Morton, (Sun Feb 18, 12:43 pm)
Re: 2.6.20-mm2: Oops in generic_make_request, Andrew Morton, (Sun Feb 18, 12:49 pm)
Re: 2.6.20-mm2: Oops in generic_make_request, Michal Piotrowski, (Sun Feb 18, 1:05 pm)
Re: 2.6.20-mm2, Rafael J. Wysocki, (Sun Feb 18, 4:25 pm)
Re: 2.6.20-mm2, Rafael J. Wysocki, (Sun Feb 18, 4:32 pm)
Re: 2.6.20-mm2: compilation fix, Rafael J. Wysocki, (Sun Feb 18, 4:33 pm)
Re: 2.6.20-mm2, Michal Piotrowski, (Sun Feb 18, 4:39 pm)
Re: 2.6.20-mm2, Andrew Morton, (Sun Feb 18, 5:00 pm)
Re: 2.6.20-mm2, Andrew Morton, (Sun Feb 18, 5:28 pm)
Re: 2.6.20-mm2: compilation fix, Andrew Morton, (Sun Feb 18, 5:29 pm)
Re: 2.6.20-mm2, David Brownell, (Sun Feb 18, 10:13 pm)
Re: 2.6.20-mm2, Rafael J. Wysocki, (Mon Feb 19, 4:28 am)
Re: 2.6.20-mm2: compilation fix, Rafael J. Wysocki, (Mon Feb 19, 4:33 am)
Re: 2.6.20-mm2, Michal Piotrowski, (Mon Feb 19, 4:45 am)
Re: [-mm patch] fix locking in __make_request (was Re: 2.6 ..., Michal Piotrowski, (Mon Feb 19, 6:52 am)
Re: [-mm patch] fix locking in __make_request (was Re: 2.6 ..., Michal Piotrowski, (Mon Feb 19, 7:08 am)
Re: 2.6.20-mm2, Rafael J. Wysocki, (Mon Feb 19, 11:28 am)
Re: 2.6.20-mm2, Rafael J. Wysocki, (Mon Feb 19, 5:04 pm)
[-mm patch] fs/9p/vfs_addr.c: make 2 functions static, Adrian Bunk, (Mon Feb 19, 5:07 pm)
2.6.20-mm2: BLOCK=n compile error, Adrian Bunk, (Mon Feb 19, 5:08 pm)
[-mm patch] UNION_FS must depend on SLAB, Adrian Bunk, (Mon Feb 19, 5:08 pm)
Re: 2.6.20-mm2, Rafael J. Wysocki, (Mon Feb 19, 5:43 pm)
Re: [-mm patch] fs/9p/vfs_addr.c: make 2 functions static, Eric Van Hensbergen, (Mon Feb 19, 5:54 pm)
Re: 2.6.20-mm2, Rafael J. Wysocki, (Mon Feb 19, 6:20 pm)
Re: 2.6.20-mm2, Andrew Morton, (Mon Feb 19, 11:31 pm)
Re: [-mm patch] UNION_FS must depend on SLAB, Pekka Enberg, (Mon Feb 19, 11:37 pm)
Re: 2.6.20-mm2, KAMEZAWA Hiroyuki, (Tue Feb 20, 12:39 am)
Re: 2.6.20-mm2, Andy Whitcroft, (Tue Feb 20, 3:06 am)
Re: 2.6.20-mm2, Maciej Rutecki, (Tue Feb 20, 4:14 am)
Re: 2.6.20-mm2, Maciej Rutecki, (Tue Feb 20, 4:38 am)
[-mm patch] fix locking in __make_request (was Re: 2.6.20- ..., Frederik Deweerdt, (Tue Feb 20, 6:04 am)
Re: [-mm patch] fix locking in __make_request (was Re: 2.6 ..., Frederik Deweerdt, (Tue Feb 20, 7:29 am)
Re: [-mm patch] fix locking in __make_request (was Re: 2.6 ..., Frederik Deweerdt, (Tue Feb 20, 7:32 am)
Re: [-mm patch] UNION_FS must depend on SLAB, Josef Sipek, (Tue Feb 20, 8:13 am)
Re: 2.6.20-mm2, Rafael J. Wysocki, (Tue Feb 20, 2:16 pm)
Re: 2.6.20-mm2: possible recursive locking detected (reise ..., Rafael J. Wysocki, (Tue Feb 20, 2:23 pm)
Re: 2.6.20-mm2, Jeff Garzik, (Tue Feb 20, 2:46 pm)
Re: 2.6.20-mm2, Rafael J. Wysocki, (Tue Feb 20, 3:07 pm)
Re: 2.6.20-mm2, Rafael J. Wysocki, (Tue Feb 20, 3:12 pm)
Re: [-mm patch] UNION_FS must depend on SLAB, Josef Sipek, (Tue Feb 20, 10:19 pm)
[-mm patch] MTD_UBI_DEBUG must depend on SYSFS, Adrian Bunk, (Wed Feb 21, 3:52 am)
[-mm patch] i386 mpparse.c: remove an unused variable, Adrian Bunk, (Wed Feb 21, 4:57 am)
Re: [-mm patch] UNION_FS must depend on SLAB, Andrew Morton, (Wed Feb 21, 3:19 pm)
Re: [-mm patch] UNION_FS must depend on SLAB, Josef Sipek, (Wed Feb 21, 7:00 pm)
Re: [-mm patch] UNION_FS must depend on SLAB, Andrew Morton, (Wed Feb 21, 7:26 pm)
Re: [-mm patch] UNION_FS must depend on SLAB, Josef Sipek, (Wed Feb 21, 8:10 pm)
Re: 2.6.20-mm2, David Brownell, (Wed Feb 21, 8:57 pm)
Re: [-mm patch] UNION_FS must depend on SLAB, Pekka Enberg, (Wed Feb 21, 11:17 pm)
Re: [-mm patch] UNION_FS must depend on SLAB, Pekka Enberg, (Wed Feb 21, 11:18 pm)
Re: [-mm patch] UNION_FS must depend on SLAB, Josef Sipek, (Wed Feb 21, 11:28 pm)
Re: [-mm patch] UNION_FS must depend on SLAB, Christoph Lameter, (Wed Feb 21, 11:42 pm)
Re: 2.6.20-mm2, Rafael J. Wysocki, (Thu Feb 22, 1:33 am)
Re: 2.6.20-mm2, David Brownell, (Thu Feb 22, 3:17 pm)
Re: 2.6.20-mm2, David Brownell, (Fri Feb 23, 9:36 am)
Re: 2.6.20-mm2, Jean Delvare, (Sun Feb 25, 6:15 am)
[-mm patch] LGUEST must depend on NET, Adrian Bunk, (Mon Feb 26, 3:23 pm)
Re: [-mm patch] LGUEST must depend on NET, Rusty Russell, (Mon Feb 26, 4:42 pm)
Re: 2.6.20-mm2, Andrew Morton, (Tue Feb 27, 1:25 pm)
Re: 2.6.20-mm2, Jean Delvare, (Wed Feb 28, 2:07 am)
[-mm patch] arch/i386/xen/: possible cleanups, Adrian Bunk, (Thu Mar 1, 3:48 am)
Re: [-mm patch] arch/i386/xen/: possible cleanups, Jeremy Fitzhardinge, (Thu Mar 1, 3:53 am)
Re: [-mm patch] arch/i386/xen/: possible cleanups, Adrian Bunk, (Thu Mar 1, 4:55 am)
Re: 2.6.20-mm2, Rafael J. Wysocki, (Sun Mar 4, 3:36 pm)