Re: [patch] floppy: suspend/resume fix

Russell King
2006-11-12T19:40:12Z

On Sun, Nov 12, 2006 at 07:09:53PM +0100, Ingo Molnar wrote:
>
> * Mikael Pettersson <mikpe@it.uu.se> wrote:
>
> > Sorry, no joy. The first access post-resume still fails and generates:
>
> ok, then someone who knows the floppy driver better than me should put
> the right stuff into the suspend/resume hooks :-)

At a guess, what's probably happening is that the floppy drive, when
powered on after resume, reports "disk changed" because it doesn't
know any better.

We interpret "disk changed" to mean the disk has been removed and
possibly changed (which _is_ correct) and thereby abort any further
IO (irrespective of resume.)

Now, consider the following two scenarios:

1. You suspend and then resume, leaving the disk in the floppy drive.

2. You suspend, remove the floppy disk, insert a totally different disk
in the same drive, and then resume.

What should you do? (Hint: without reading the disk and comparing it
with what you have cached you don't know if the disk has been changed
or not.)

If you argue that in case (1) you should continue to allow IO, then
you potentially end up scribbling over a disk when someone does (2).

So I'd argue that the behaviour being seen by Mikael is the _safest_
behaviour, and the most correct behaviour given the limitations of
the hardware.

--
Russell King
Linux kernel 2.6 ARM Linux - http://www.arm.linux.org.uk/
maintainer of: 2.6 Serial core