Re: ftape / floppy conflict

Alain Knaff (Alain.Knaff@imag.fr)
Mon, 02 Sep 1996 08:55:49 +0200


[...]
>Ok, I just tried the following experiment, something I don't think
>I've ever done before:
>
>vt #1:
> % modprobe floppy
>
>vt #2:
> % modprobe ftape
> % afio -t /dev/ftape # lengthy directory listing starts
>
>vt #1:
> % mount -text2 -rv /dev/fd0H1743 /mnt
> floppy0: Unable to grab IRQ6 for the floppy driver # ok with me
> mount: /dev/fd0H1743 already mounted or /mnt busy # huh ?
> #
> # -- Taken at face value, this mount message isn't true
>
>vt #2:
> Ctrl-C # killed afio
> % rmmod ftape # removed without error
>
> % mount -text2 -rv /dev/fd0H1743 /mnt # failed with lots of error
> # messages (see below)
> % umount /mnt
> umount: /mnt: not mounted # true enough
>
> % rmmod floppy
> floppy: Device or resource busy # Ouch!
>
>
>So, my system isn't frozen, but floppy.o is stuck solid.

I just checked, and noticed that a few usage counter incrementations
were not correctly undone in the floppy driver when resource
allocation failed.

The following patch should fix the problems:

diff -ur 2.0.16/linux/drivers/block/floppy.c linux/drivers/block/floppy.c
--- 2.0.16/linux/drivers/block/floppy.c Mon Sep 2 08:38:15 1996
+++ linux/drivers/block/floppy.c Mon Sep 2 08:47:08 1996
@@ -4067,12 +4067,16 @@
if (fd_request_irq()) {
DPRINT("Unable to grab IRQ%d for the floppy driver\n",
FLOPPY_IRQ);
+ MOD_DEC_USE_COUNT;
+ usage_count--;
return -1;
}
if (fd_request_dma()) {
DPRINT("Unable to grab DMA%d for the floppy driver\n",
FLOPPY_DMA);
fd_free_irq();
+ MOD_DEC_USE_COUNT;
+ usage_count--;
return -1;
}
for (fdc = 0; fdc < N_FDC; fdc++)
@@ -4098,7 +4102,6 @@
return;
}
INT_ON;
- MOD_DEC_USE_COUNT;
fd_disable_dma();
fd_free_dma();
fd_disable_irq();
@@ -4131,6 +4134,7 @@
if (floppy_tq.sync)
printk("task queue still active\n");
#endif
+ MOD_DEC_USE_COUNT;
}

Regards,

Alain