On Wed, 23 Dec 2009, Andy Green wrote: > On 12/23/09 16:48, Somebody in the thread at some point said: > > Hi Alan - > > > It makes sense to add a mechanism for notifying userspace when the host > > ejects the medium. You don't need a uevent to do that; a simple > > sysfs_notify() on the "file" attribute would be enough. > > The uevent is there to provide the arbitration sync explicit handshake > action --> > > > There doesn't seem to be any reason for the whole arbitration thing. > > Instead of waiting for the host to access the medium, why not simply > > umount the shared partition as soon as the medium is loaded? Hosts > > typically do periodic scans for new media; you'd lose only a second or > > thereabouts. > > It's because the userspace may be holding open files in the mounted > filesystem, disallowing simple umount of it from kernel side. > > There may need to be an arbitrarily complicated app-specific action in > response to the event that the host wants to own the storage, involving > closing down / killing apps or other stuff that involves interaction > with the user. > > For these reasons an actual handshake that can return an accept or fail > response seems like the right way. But if you do all the arbitrarily complicated app-specific actions _before_ loading the new medium instead of _after_, there's no need to worry about arbitration. For example, you could try to unmount a filesystem and detect that the unmount failed because of open files. Then because of the failure, you could avoid loading the new medium. Alan Stern -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html