diff options
author | Damien Le Moal <damien.lemoal@wdc.com> | 2017-05-08 14:59:02 +0900 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2017-05-11 23:10:03 -0400 |
commit | 29f6ca6916e29fc46f1418885374d9ed50430687 (patch) | |
tree | f34bd7a4d104c5bc646dd9d6a250db6dc15c033b /drivers/scsi/sd.c | |
parent | b77b36cb7272ec5b9fb000e2ff18e947d9586a22 (diff) |
scsi: sd: Unlock zone in case of error in sd_setup_write_same_cmnd()
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>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/sd.c')
-rw-r--r-- | drivers/scsi/sd.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index f9d1432d7cc5..e60a309b26bf 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; } |