On Sun, 9 Jul 2017, Mark Kettenis wrote: > > there are some open issues that usb devices do not flush their caches fast > > enough (at least on some boards). And my mail about shortening the wait > > times in reboot(8) brought up that issue again. > > > > My suggestion would be to have a global variable that takes the minimum > > delay for the next shutdown/reboot and affected devices could set that > > value in their DVACT_SUSPEND hook. That way, if a device is removed before > > the shudown, the delay won't trigger. > > > > The diff below is only compile tested by I think it demonstrates the idea. > > > > One could also do something more fancy like using different delays for > > reboot and powerdown, or making umass only set a new SDEV_ flag and then > > have the scsi layer only call set_powerdown_delay() if the device has been > > written to. > > > > Opinions? > > Such devices should make sure they flush their caches and properly > wait for that operation to complete.
That would be preferable, but there is some evidence that not all usb thumbdrives implement cache flush correctly: http://marc.info/?l=openbsd-misc&m=144237305322074&w=2 http://marc.info/?l=openbsd-tech&m=147688940628911&w=2 The fact that it only happens on a few mainboards could be explained if it depends on how quickly the mainboard powers off the usb bus on shutdown (and reset).