Re: [linux-usb-devel] [BUG] USB_PERSIST

From: Alan Stern
Date: Mon Nov 26 2007 - 10:16:19 EST


On Sun, 25 Nov 2007, Raymano Garibaldi wrote:

> The device which has the root fs is a READ-ONLY device. There is no
> way for it to change between getting detached and reattached to the
> computer which is suspended.

You might think so at first. But suppose another device of the same
type got plugged in instead -- with different data stored on it. That
would be just as bad.

> I understand that this is currently considered a feature but I am
> arguing here that there should also be another feature that allows
> this to work under suspend to ram the same as it does with suspend to
> disk (hibernation).
...
> This scenario is not currently possible with the any kernel after
> 2.6.22. It is a very important missing feature.

This has nothing to do with USB particularly; it applies to all forms
of hot-pluggable or removable storage. Even floppy disks.

> And yes. This feature does work under the 2.6.21 kernel, exactly
> because the kernel did not have the USB suspend and persist feature
> available.

Wait a minute. You're saying that USB Persist worked under 2.6.21
because it wasn't available? That makes no sense. Besides, if you
don't like USB Persist under 2.6.23, you can always eliminate it by
turning off CONFIG_USB_PERSIST.

> Under the 2.6.21 kernel, during suspend, the kernel is
> totally unaware of what is happening to the USB device so nothing
> happens when the USB device is detached and reattached while the
> computer is suspended, hence making the described scenario above
> possible. I currently, and very frequently, use this feature on my
> live USB distro, FaunOS which uses kernel 2.6.21.

It may be the case that _your_ particular computer wasn't aware of
unplug or replug events during suspend, but if so then it was a bug and
it isn't true in general. The fact that your computer is now aware of
these things proves this.

In short, you aren't reporting a bug -- you're asking for a new feature
to be added.

>From the point of view of the kernel, being suspended is in some
respects like remaining awake. Hotplug events are detected in either
case. Would you also want the ability to unplug and replug your root
fs while the computer was running? Would it make sense to add such an
ability?

There was a time during the 2.4 kernel series when usb-storage would
try to keep track of devices after they had been unplugged and
recognize them when they were re-attached. Linus himself said it was
a bad idea and consequently it was removed. Now you're saying you want
it back. I think you'll have to convince Linus before anyone else will
pay attention. It's worth a try -- he might think your airport
scenario is common enough to be worth supporting.

Alan Stern

-
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/