mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* floppy issue also in 2.4.18 ?  / 2.5 solution
@ 2002-08-04  5:37 Nico Schottelius
  2002-08-04 21:32 ` Thunder from the hill
  0 siblings, 1 reply; 3+ messages in thread
From: Nico Schottelius @ 2002-08-04  5:37 UTC (permalink / raw)
  To: Linux Kernel Mailing List

[-- Attachment #1: Type: text/plain, Size: 966 bytes --]

Hello again!

The floppy driver and me just married...
Two questions [hopefully first last]:

1) Why does 2.4.18 kernel hangs when I try to boot it from floppy ?
   Symptoms: After 'Loading ... ' progress finished, the disk drive's
   led is still lighting and nothing happens anymore.
   What can be wrong ? CPU is correct (I even tried 386,586,p-classic,p-mmx,..),
   it's a P133. And howto fix it?

2) Somebody explain me what changed in vfs, where to find doc and give me some
   time to fix that damn 2.5 floppy driver. I'm gonna fight it.

3) oops, one more: Can somebody else please fix the apm issue ?

Sincerly,

Nico /* tired, but alive */

-- 
Changing mail address: please forget all known @pcsystems.de addresses.

Please send your messages pgp-signed and/or pgp-encrypted (don't encrypt mails
to mailing list!). If you don't know what pgp is visit www.gnupg.org.
(public pgp key: ftp.schottelius.org/pub/familiy/nico/pgp-key)

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: floppy issue also in 2.4.18 ?  / 2.5 solution
  2002-08-04  5:37 floppy issue also in 2.4.18 ? / 2.5 solution Nico Schottelius
@ 2002-08-04 21:32 ` Thunder from the hill
  2002-08-04 21:35   ` Thunder from the hill
  0 siblings, 1 reply; 3+ messages in thread
From: Thunder from the hill @ 2002-08-04 21:32 UTC (permalink / raw)
  To: Nico Schottelius; +Cc: Linux Kernel Mailing List

Hi,

On Sun, 4 Aug 2002, Nico Schottelius wrote:
> 1) Why does 2.4.18 kernel hangs when I try to boot it from floppy ?
>    Symptoms: After 'Loading ... ' progress finished, the disk drive's
>    led is still lighting and nothing happens anymore.
>    What can be wrong ? CPU is correct (I even tried 386,586,p-classic,p-mmx,..),
>    it's a P133. And howto fix it?

Yo. Some days ago there was a patch that fixed the floppy I/O driver. I'll 
append it, against 2.5.29.

> 2) Somebody explain me what changed in vfs, where to find doc and give me some
>    time to fix that damn 2.5 floppy driver. I'm gonna fight it.

It was in 2.5.12. Just look at the changes, I don't have a pointer right 
now. (I'm busy writing something about the downturn of the first ancient 
egypt empire...)

			Thunder
-- 
.-../../-./..-/-..- .-./..-/.-.././.../.-.-.-


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: floppy issue also in 2.4.18 ?  / 2.5 solution
  2002-08-04 21:32 ` Thunder from the hill
@ 2002-08-04 21:35   ` Thunder from the hill
  0 siblings, 0 replies; 3+ messages in thread
From: Thunder from the hill @ 2002-08-04 21:35 UTC (permalink / raw)
  To: Thunder from the hill; +Cc: Nico Schottelius, Linux Kernel Mailing List

diff -ruN linux-2.5.29/drivers/block/floppy.c linux-2.5.29.fix-floppy/drivers/block/floppy.c
--- linux-2.5.29/drivers/block/floppy.c	Thu Jul 25 01:27:30 2002
+++ linux-2.5.29.fix-floppy/drivers/block/floppy.c	Sat Jul 27 14:14:29 2002
@@ -3699,6 +3699,10 @@
 		UDRS->fd_ref = 0;
 	}
 	floppy_release_irq_and_dma();
+
+	/* undo ++bd_openers in floppy_open() */
+	--inode->i_bdev->bd_openers;
+
 	return 0;
 }
 
@@ -3791,6 +3795,43 @@
 		invalidate_buffers(mk_kdev(FLOPPY_MAJOR,old_dev));
 	}
 
+	/* Problems:
+	 * 1. floppy_open() triggers a call to submit_bio(), but
+	 *    bdev->bd_queue may be NULL since it is not set up until
+	 *    after floppy_open() has returned. Prior to 2.5.18, NULL
+	 *    queues were initialised when needed.
+	 * 2. fs/block_dev.c:do_open() changes bdev's block size
+	 *    after floppy_open() has returned. For some reason, this
+	 *    causes data corruption durings writes.
+	 * 3. fs/block_dev.c:do_open() sets bdev->bd_inode->i_size to 0
+	 *    after floppy_open() has returned. This cases ENOSPC errors
+	 *    on writes.
+	 * Workarounds:
+	 * 1. bdev->bd_queue is initialised here.
+	 * 2. Set bdev block size equal to the hardsect/queue size.
+	 *    This seems to cure the data corruption problem for raw
+	 *    accesses. VFS accesses to mounted floppies still cause
+	 *    data corruption for unknown reasons.
+	 * 3. Set i_size to 1.44M and bd_offset to 0.
+	 * 2&3. ++bdev->bd_openers to bypass do_open()'s changes.
+	 *    floppy_release() does a --bdev->bd_openers.
+	 */
+	{
+		struct block_device *bdev = inode->i_bdev;
+		kdev_t dev = inode->i_rdev;
+		struct blk_dev_struct *p = blk_dev + major(dev);
+
+		if (p->queue)
+			bdev->bd_queue = p->queue(dev);
+		else
+			bdev->bd_queue = &p->request_queue;
+		bdev->bd_block_size = bdev_hardsect_size(bdev);
+		bdev->bd_inode->i_blkbits = blksize_bits(block_size(bdev));
+		bdev->bd_offset = 0;
+		bdev->bd_inode->i_size = 1440 * 1024;
+		++bdev->bd_openers;
+	}
+
 	/* Allow ioctls if we have write-permissions even if read-only open.
 	 * Needed so that programs such as fdrawcmd still can work on write
 	 * protected disks */
@@ -4228,8 +4269,6 @@
 {
 	int i,unit,drive;
 
-	register_sys_device(&device_floppy);
-
 	raw_cmd = NULL;
 
 	devfs_handle = devfs_mk_dir (NULL, "floppy", NULL);
@@ -4356,6 +4395,9 @@
 			register_disk(NULL, mk_kdev(MAJOR_NR,TOMINOR(drive)+i*4),
 					1, &floppy_fops, 0);
 	}
+
+	register_sys_device(&device_floppy);
+
 	return have_no_fdc;
 }
 
@@ -4538,6 +4580,7 @@
 {
 	int dummy;
 		
+	unregister_sys_device(&device_floppy);
 	devfs_unregister (devfs_handle);
 	devfs_unregister_blkdev(MAJOR_NR, "fd");
 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-08-04 21:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-08-04  5:37 floppy issue also in 2.4.18 ? / 2.5 solution Nico Schottelius
2002-08-04 21:32 ` Thunder from the hill
2002-08-04 21:35   ` Thunder from the hill

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®