On 1/10/23 09:19, Bart Van Assche wrote: > On 1/9/23 15:56, Damien Le Moal wrote: >> But my point is that if a request goes through the block layer requeue, it >> will be out of order, and will be submitted out of order again, and will >> fail again. Unless you stall dispatching, wait for all requeues to come >> back in the scheduler, and then start trying again, I do not see how you >> can guarantee that retrying the unaligned writes will ever succeed. >> >> I am talking in the context of host-managed devices here. > > Hi Damien, > > How about changing the NEEDS_RETRY in patch 7/8 into another value than > SUCCESS, NEEDS_RETRY or ADD_TO_MLQUEUE? That will make the SCSI core > wait until all pending commands have finished before it starts its error > handling strategy and before it requeues any pending commands. Considering a sequence of sequential write requests, the request can be in: 1) The scheduler 2) The dispatch queue (out of the scheduler) 3) In the requeue list, waiting to be put back in the scheduler 4) in-flight being processed for dispatch by the scsi mid-layer & scsi disk driver 5) being processed by the driver 6) dispatched to the device already Requeue back to the scheduler can happen anywhere after (2) up to (5) (would need to check again to be 100% sure though). So I do not see how changes to the scsi layer only, adding a new state, can cover all possible cases resulting at some point to come back to a clean ordering. But if you have ideas to prove me wrong, I will be happy to review that :) So far, the only thing that I think could work is: stall everything and put back all write requests in the scheduler, and restart dispatching. That will definitively have a performance impact. How does that compare to the zone write locking performance impact, I am not sure... It may be way simpler to rely on: 1) none scheduler 2) some light re-ordering of write requests in the driver itself to avoid any requeue to higher level (essentially, handle requeueing in the driver itself). > > Thanks, > > Bart. -- Damien Le Moal Western Digital Research