On Tue, 14 Mar 2006, Rafael J. Wysocki wrote: > > The situation becomes much more problematic when the SCSI device itself is > > powered off. In that case (which includes the "hardware doesn't support > > USB power during suspend" problem discussed at great length earlier), the > > kernel has only two choices. Either assume that the medium _has_ been > > changed -- or more generally, that a new device is present -- or else try > > to verify somehow that the current medium is the same as the old medium. > > > > This verification can't be certain, so there would always be a chance for > > error. Besides, right now the kernel contains no code for making such > > verifications. > > The question here, as far as I understand it, is whether we can write such a > code and, if so, whether it's worth doing. I'm not sure of any of these now, > but the problem is interesting. :-) I'm pretty sure that we _can_, but it would be a fair amount of work. (I'm not at all sure whether it's worth doing.) Such a verification would have to take place at several different levels. For instance, with a USB device: The USB stack would have to verify that the transport was still the same (same USB descriptors); The SCSI stack would have to verify that the device was still the same (same INQUIRY data, same device type, same LUNs, same total capacity); The gendisk driver would have to verify that the partition table was still the same; The filesystem driver would have to verify that the filesystem was still the same (same superblock, journal file ends in the same place, maybe also some other checksums of important data structures). In the end, this could affect all the transport drivers and all the filesystem drivers. Of course, it's not necessary to do _all_ of them -- we can be conservative and assume that the device has changed if the necessary verification routines don't exist. Andrew Morton pointed out that some of this work could be performed in userspace instead of in the kernel. It's still a lot of work, and even just exporting to userspace the data needed for doing the checking would be nontrivial. Alan Stern