2.5.32 floppy init and misc fixes
Subsystems (5)
PATCH 1/1 2.5.32 floppy init and misc fixes
The floppy driver doesn't clean up it's register_sys_device if it fails to init correctly. The below patch adds the appropriate unregister_sys_device in the various failure paths, and also includes Ewan MacMahon's one-liner for working VCs on devfs-only machines, and a couple of missing #includes. Minimum required to get 2.5.32 working on my Portege.
m.
drivers/char/console.c renamed from drivers/char/console.c.orig +1 -0
@@ -2526,6 +2526,7 @@kbd_init ();console_map_init (); +con_init_devfs ();vcs_init ();return 0 ; }
drivers/block/floppy.c renamed from drivers/block/floppy.c.orig +4 -0
@@ -4235,6 +4235,7 @@ devfs_handle =devfs_mk_dir (NULL ,"floppy" ,NULL );if (register_blkdev (MAJOR_NR ,"fd" ,&floppy_fops)) {printk ("Unable to get major %d for floppy\n" ,MAJOR_NR ); +unregister_sys_device (&device_floppy);return -EBUSY ; }
@@ -4269,6 +4270,7 @@unregister_blkdev (MAJOR_NR ,"fd" );del_timer (&fd_timeout);blk_cleanup_queue (BLK_DEFAULT_QUEUE (MAJOR_NR )); +unregister_sys_device (&device_floppy);return -ENODEV ; }#if N_FDC >1
@@ -4280,6 +4282,7 @@del_timer (&fd_timeout);blk_cleanup_queue (BLK_DEFAULT_QUEUE (MAJOR_NR ));unregister_blkdev (MAJOR_NR ,"fd" ); +unregister_sys_device (&device_floppy);return -EBUSY ; }
@@ -4343,6 +4346,7 @@floppy_release_irq_and_dma ();blk_cleanup_queue (BLK_DEFAULT_QUEUE (MAJOR_NR ));unregister_blkdev (MAJOR_NR ,"fd" ); +unregister_sys_device (&device_floppy); }for (drive =0 ; drive <N_DRIVE ; drive++) {
drivers/net/wireless/hermes.c renamed from drivers/net/wireless/hermes.c.orig +1 -0
@@ -45,6 +45,7 @@#include <linux/threads.h> #include <linux/smp.h> #include <asm/io.h> +#include <linux/sched.h> #include <linux/ptrace.h> #include <linux/delay.h> #include <linux/init.h>
drivers/char/toshiba.c renamed from drivers/char/toshiba.c.orig +1 -0
@@ -69,6 +69,7 @@#include <linux/init.h> #include <linux/stat.h> #include <linux/proc_fs.h> +#include <linux/interrupt.h> #include <linux/toshiba.h>
Quoted 6 lines · Mikolaj J. Habryn
The floppy driver doesn't clean up it's
register_sys_deviceif it fails to init correctly. The below patch adds the appropriateunregister_sys_devicein the various failure paths, and also includes Ewan MacMahon's one-liner for working VCs on devfs-only machines, and a couple of missing #includes. Minimum required to get 2.5.32 working on my Portege.
...
drivers/block/floppy.c line 4241
Quoted 10 lines
drivers/block/floppy.c renamed from drivers/block/floppy.c.orig +1
-0@@ -4235,6 +4235,7 @@ devfs_handle =devfs_mk_dir (NULL ,"floppy" ,NULL );if (register_blkdev (MAJOR_NR ,"fd" ,&floppy_fops)) {printk ("Unable to get major %d for floppy\n" ,MAJOR_NR ); +unregister_sys_device (&device_floppy);return -EBUSY ; }
etc.
Floppy has many more problems.
Repeadedly loading and unloading the floppy.o module corrupts sys_device data structures.
Writing to floppy can give ENOSPC errors even though space exists. Writing to floppy can OOPS the kernel due to a NULL pointer error. VFS-over-floppy corrupts data since 2.5.13.
Putting lilo on ext2 on floppy can cause a kernel hang due to an infinite loop of "buffer layer error".
I have a patch which fixes the {,un}register_sys_device() bugs, NULL queue bug, zero i_size bug, and fixes read/write enough that raw media access (e.g. tar or dd to/from /dev/fd0) works. It's in the 2.5-dj tree, and separately in <http://www.csd.uu.se/~mikpe/linux/patches/2.5/>.
I havent' pushed this to Linus since it's meaningless as long as the VFS data corruption exists. It was broken by blkdev/VFS changes, but those responsible haven't yet bothered to repair it.
/Mikael
On Thu, 29 Aug 2002, Mikael Pettersson wrote:
| Floppy has many more problems.
| Repeadedly loading and unloading the floppy.o module corrupts
| sys_device data structures.
| Writing to floppy can give ENOSPC errors even though space exists.
| Writing to floppy can OOPS the kernel due to a NULL pointer error.
| VFS-over-floppy corrupts data since 2.5.13.
| Putting lilo on ext2 on floppy can cause a kernel hang due to an
| infinite loop of "buffer layer error".
|
| I have a patch which fixes the {,un}register_sys_device() bugs, NULL
| queue bug, zero i_size bug, and fixes read/write enough that raw media
| access (e.g. tar or dd to/from /dev/fd0) works. It's in the 2.5-dj tree,
| and separately in <http://www.csd.uu.se/~mikpe/linux/patches/2.5/>.
|
| I havent' pushed this to Linus since it's meaningless as long as
| the VFS data corruption exists. It was broken by blkdev/VFS changes,
| but those responsible haven't yet bothered to repair it.I would add one more: select delay timings are same as in 2.4:
#define SEL_DLY (2*HZ/100)
but HZ is not the same as in 2.4...
Signature · 1 line
~Randy