]> git.baikalelectronics.ru Git - kernel.git/commit
scsi: sd_zbc: Write unlock zone from sd_uninit_cmnd()
authorDamien Le Moal <damien.lemoal@wdc.com>
Wed, 9 Aug 2017 03:00:22 +0000 (12:00 +0900)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 17 Aug 2017 00:01:31 +0000 (20:01 -0400)
commit19ffddef6806d9b47efbd8572186ac6cf011a854
tree2f59f796eb5a19d660f3277869042a9bf144d52a
parent213f40971b4bc3d0fc0a010950e2520e95737a53
scsi: sd_zbc: Write unlock zone from sd_uninit_cmnd()

Releasing a zone write lock only when the write commnand that acquired
the lock completes can cause deadlocks due to potential command
reordering if the lock owning request is requeued and not executed. This
problem exists only with the scsi-mq path as, unlike the legacy path,
requests are moved out of the dispatch queue before being prepared and
so before locking a zone for a write command.

Since sd_uninit_cmnd() is now always called when a request is requeued,
call sd_zbc_write_unlock_zone() from that function for write requests
that acquired a zone lock instead of from sd_done(). Acquisition of a zone
lock by a write command is indicated using the new command
flag SCMD_ZONE_WRITE_LOCK.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Bart Van Assche <Bart.VanAssche@wdc.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/sd.c
drivers/scsi/sd_zbc.c
include/scsi/scsi_cmnd.h