On 4/20/23 03:46, Bart Van Assche wrote: > On 4/18/23 22:07, Christoph Hellwig wrote: >> On Tue, Apr 18, 2023 at 03:39:59PM -0700, Bart Van Assche wrote: >>> Let deadline_next_request() only consider the first zoned write per >>> zone. This patch fixes a race condition between deadline_next_request() >>> and completion of zoned writes. >> >> Can you explain the condition in a bit more detail? > > Hi Christoph, > > I'm concerned about the following scenario: > * deadline_next_request() starts iterating over the writes for a > particular zone. > * blk_req_can_dispatch_to_zone() returns false for the first zoned write > examined by deadline_next_request(). > * A write for the same zone completes. > * deadline_next_request() continues examining zoned writes and > blk_req_can_dispatch_to_zone() returns true for another write than the > first write for a zone. This would result in an UNALIGNED WRITE > COMMAND error for zoned SCSI devices. Examining zoned writes has to be done with deadline zone lock held, exactly to avoid this issue. > > Bart. >