Re: Oops when loading floppy.o

From: Paul Gortmaker (p_gortmaker@yahoo.com)
Date: Sun Aug 26 2001 - 05:40:02 EST


Alan Cox wrote:

> I can reproduce it to order. The floppy driver has done this since before
> 2.4.0 in this specific case I think. It actual stops installs working on
> the problem box I have
>
> > >>EIP; c0117602 <__run_task_queue+12/60> <=====
> > Trace; c011a2f6 <immediate_bh+16/20>
> > Trace; c011756a <bh_action+1a/50>
>
> Thats the important bit I think, its not killing off all the stuff it set up
> when it exits. Its not an XFS triggered bug, so the trace is useful

It does a reset and as part of that it registers an empty task which may not
be completed before the module disappears. Also noticed an extra del_timer
and that it should return ENODEV (not EIO) when a controller is not present.

Sensible fix would be to not queue these empty tasks at all, but minimal fix
(2.4.x) is to just make sure they are off the queue before module vanishes.

Please test as the code in floppy.c is showing 10+yrs of moss growth and
is not 100% clear to follow :)

Paul.

--- drivers/block/floppy.c~ Sun Aug 12 06:06:25 2001
+++ drivers/block/floppy.c Sun Aug 26 06:24:12 2001
@@ -124,6 +124,11 @@
  * - s/suser/capable/
  */
 
+/*
+ * 2001/08/26 -- Paul Gortmaker - fix insmod oops on machines with no
+ * floppy controller (lingering task on list after module is gone... boom.)
+ */
+
 #define FLOPPY_SANITY_CHECK
 #undef FLOPPY_SILENT_DCL_CLEAR
 
@@ -4144,7 +4149,7 @@
         return 0;
 }
 
-static int have_no_fdc= -EIO;
+static int have_no_fdc= -ENODEV;
 
 
 int __init floppy_init(void)
@@ -4200,7 +4205,6 @@
                 del_timer(&fd_timeout);
                 blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));
                 devfs_unregister_blkdev(MAJOR_NR,"fd");
- del_timer(&fd_timeout);
                 return -EBUSY;
         }
 
@@ -4259,9 +4263,7 @@
         if (have_no_fdc)
         {
                 DPRINT("no floppy controllers found\n");
- floppy_tq.routine = (void *)(void *) empty;
- mark_bh(IMMEDIATE_BH);
- schedule();
+ run_task_queue(&tq_immediate);
                 if (usage_count)
                         floppy_release_irq_and_dma();
                 blk_cleanup_queue(BLK_DEFAULT_QUEUE(MAJOR_NR));

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Aug 31 2001 - 21:00:20 EST