Re: data corruption: revalidating a (removable) hdd/flash on re-insert

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Kay Sievers
Date: Friday, October 31, 2008 - 11:49 am

On Fri, Oct 31, 2008 at 18:39, Michael Tokarev <mjt@tls.msk.ru> wrote:

The kernel does not cache, it's the device itself that reports a media
change, and the kernel asks every removable device before it is
accessing it.


It polls the device every few secomds, just like HAL does on most
Linux desktop installations. But in your case, when the reader does
not report the change correctly, even that might go wrong, just like
without polling.


That's how it already is. We just rely on the device to tell us. There
is no way to revalidate anything otherwise.


I can't think of a way to make that working, there is no cache in the
kernel, only a state in the device. You would need to checksum the
device to find out that it isn't the same media, even that might not
work, and it's definitely nothing you want to do.

You could trace with usbmon, or something and investigate the scsi
packets if the scsi unit attention really does not signify a media
change, which is what I expect.


If it works otherwise, use it, but I wouldn't change media while it is
connected.


That would still not work with your device, if you change the media
during the polling interval, which is usually between 2 and 16
seconds. If the device does not report any change, like it seem in
your case, you can not do anything. Polling helps only to reflect the
current state of a device while it is not accessed, to get the state
of the device into the kernel. Like on a desktop, where you want to
auto-mount card reader/cdrom media on insertion.

Kay
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: data corruption: revalidating a (removable) hdd/flash ..., Lennart Sorensen, (Fri Oct 31, 8:59 am)
Re: data corruption: revalidating a (removable) hdd/flash ..., Michael Tokarev, (Fri Oct 31, 10:39 am)
Re: data corruption: revalidating a (removable) hdd/flash ..., Lennart Sorensen, (Fri Oct 31, 11:28 am)
Re: data corruption: revalidating a (removable) hdd/flash ..., Kay Sievers, (Fri Oct 31, 11:49 am)