Re: [RFC/BUG?] ide_cs's removable status

From: Richard Purdie
Date: Thu Sep 22 2005 - 09:21:58 EST


Lets try a different way of illustrating the problem. We'll hopefully
all agree that my ide CDROM drive is a removable device.

When my system boots, it creates a /dev/hdd entry for the cdrom. When I
insert a disk and mount it, udev doesn't touch the device node as its
already there and ready to go. If the media changes, this is detected
and the same device node is used to present the new data.

/dev/hdd *always* exists and may or may not have media present.

When I boot a system with an empty PCMCIA slot, no ide device exists.
ide-cs knows nothing about the PCMCIA slot and therefore no device nodes
exist. When you insert the CF card, PCMCIA realises its an ide device,
tells ide-cs which creates the appropriate devices through the ide
layer. When the card is removed, the devices and controller are removed.

The /dev/* entries only exist when the ide controller is present. There
is no state where the controller is present with no media.

Under Linux, removable is defined to mean the device can exist with no
media. That is clearly not the case for CF and therefore it shouldn't be
marked as such.

If it were removable, ide-cs should be informed of every card slot in
the system and should create ide controllers for each of them whether
they have cards in or not. We could then correctly check for media
changes. Yes, this would be ridiculous but it illustrates that CF cards
should not have the removable flag set.


There are other bugs which this issue is getting confused with. In
summary, I see the following separate issues:

1. Are ide-cs devices removable or not. See above.
2. The following loop exists for removable devices:

Device node is created (by udev).
An attempt to mount the device results in a media change check.
The media change check defaults to media changed.
The device node is removed and recreated (by udev).

Technically, the device node you mounted is now invalid and has changed
so you should remount it. You then have a loop.

This can be solved by having the media change check look at serial
numbers as mentioned by Alan in a previous email.

3. ide-cs sometimes can't/doesn't detect the removal of an ide
controller.

Using media_change events to see if the controller has changed/been
unplugged is incorrect.


Each of the above are separate bugs. I'm trying to fix one of them (and
might try and work on the others if I can).

Richard


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