stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] sd: Unlock zone in case of error in sd_setup_write_same_cmnd()
@ 2017-05-08  5:59 damien.lemoal
  2017-05-12  3:12 ` Martin K. Petersen
  0 siblings, 1 reply; 2+ messages in thread
From: damien.lemoal @ 2017-05-08  5:59 UTC (permalink / raw)
  To: linux-scsi, Martin K . Petersen
  Cc: Hannes Reinecke, Christoph Hellwig, Bart Van Assche,
	Damien Le Moal, stable

From: Damien Le Moal <damien.lemoal@wdc.com>

scsi_io_init() may fail, leaving a zone of a zoned block device locked.
Fix this by properly unlocking the write same request target zone if
scsi_io_init() fails.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
Cc: stable@vger.kernel.org
---
 drivers/scsi/sd.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c
index f9d1432..e60a309 100644
--- a/drivers/scsi/sd.c
+++ b/drivers/scsi/sd.c
@@ -948,6 +948,10 @@ static int sd_setup_write_same_cmnd(struct scsi_cmnd *cmd)
 	rq->__data_len = sdp->sector_size;
 	ret = scsi_init_io(cmd);
 	rq->__data_len = nr_bytes;
+
+	if (sd_is_zoned(sdkp) && ret != BLKPREP_OK)
+		sd_zbc_write_unlock_zone(cmd);
+
 	return ret;
 }
 
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sd: Unlock zone in case of error in sd_setup_write_same_cmnd()
  2017-05-08  5:59 [PATCH] sd: Unlock zone in case of error in sd_setup_write_same_cmnd() damien.lemoal
@ 2017-05-12  3:12 ` Martin K. Petersen
  0 siblings, 0 replies; 2+ messages in thread
From: Martin K. Petersen @ 2017-05-12  3:12 UTC (permalink / raw)
  To: damien.lemoal
  Cc: linux-scsi, Martin K . Petersen, Hannes Reinecke,
	Christoph Hellwig, Bart Van Assche, stable


Damien,

> scsi_io_init() may fail, leaving a zone of a zoned block device locked.
> Fix this by properly unlocking the write same request target zone if
> scsi_io_init() fails.

Applied to 4.12/scsi-fixes.

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-05-12  3:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-05-08  5:59 [PATCH] sd: Unlock zone in case of error in sd_setup_write_same_cmnd() damien.lemoal
2017-05-12  3:12 ` Martin K. Petersen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).