Re: kernel behaviour at media-changed

Albert D. Cahalan (acahalan@cs.uml.edu)
Thu, 8 Jul 1999 22:26:52 -0400 (EDT)


Giuliano Pochini writes:

>> Yesterday after 1 hour (or so) of non disk activity my mounted
>> Iomega Zip 250 turned into a power-safe state. A few hours later
>> I typed "umout /zip". Mount complained with "/zip: device is busy".
>
> Hmm.
>
>> Yet I noticed that umount had not umounted correctly... But the
>> zip's ext2 was corrupted already ;-(!
>
> That's becouse you ejected the disk w/o umount !

I don't see that, but maybe you trimmed that out.

>> My question: What about throwing all cache-data away and auto-umount,
>> in the case the kernel gets a media-change at device-xy and
>> this device-xy is mounted??
>
> But if the disk isn't in the drive, how can it flush the buffers ??

ARRRGH!!!!

Why is it that so many people have trouble with this concept?

First of all, an idle disk should be clean. If it isn't, then I ask
why your OS was wasting all that idle disk bandwidth? You will need
to flush the disk eventually, and the delayed IO may conflict with
future IO. You also tie up your memory with dirty pages. Ugh.

Second of all, "how can it flush the buffers ??" is a silly question
to ask when the disk is simply GONE. Answer: you don't. You junk them.
You free memory. You kill processes that were paged out to the disk.

If desired, one may add a hook for userspace "put disk back" dialogs.
This is very nice, but the basic behavior (free mem, kill procs) is
far more important. Last I heard, Linux got a D- on this, but I don't
want to risk a test right now. I'd most likely end up with a process
that can only be killed via "emacs /proc/kcore".

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