On Tue, Aug 11, 2020 at 09:55:54AM +0200, Martin Kepplinger wrote: > On 10.08.20 16:13, Alan Stern wrote: > > This may not matter... but it's worth pointing out that > > expecting_media_change doesn't get cleared if ++scmd->retries > > > scmd->allowed. > > absolutely worth pointing out and I'm not yet sure about that one. > > > > > It also doesn't get cleared in cases where the device _doesn't_ > > report a Unit Attention. > > true. but don't we set the flag for a future UA we don't yet know of? If > we would want to clear it outside of a UA, I think we'd need to keep > track of a suspend/resume cycle and if we see that we *had* successfully > "done requests" after resuming, we could clear it... The point is that expecting_media_change should apply only to the _next_ command. It should be cleared after _every_ command. You do not want to leave it hanging around -- if you do then you will miss real media changes. There's a potential issue when a bunch of commands get sent and completed all at once, but hopefully it won't matter here. Alan Stern