diff options
author | mav <mav@FreeBSD.org> | 2015-10-05 10:57:50 +0000 |
---|---|---|
committer | mav <mav@FreeBSD.org> | 2015-10-05 10:57:50 +0000 |
commit | 44b21c856f762697e8c7929ee65f0f61134b0f28 (patch) | |
tree | e7e6d1153e50fe1befb0c4d4f882fc00b0c5ab9f /sys | |
parent | a7d49f5cb9bcfece1216815d7ca0e81eccbc0d05 (diff) | |
download | FreeBSD-src-44b21c856f762697e8c7929ee65f0f61134b0f28.zip FreeBSD-src-44b21c856f762697e8c7929ee65f0f61134b0f28.tar.gz |
MFC r288175: Allow WRITE SAME with NDOB bit set but without UNMAP.
This combination was originally forbidden, but allowed at spc4r3.
Diffstat (limited to 'sys')
-rw-r--r-- | sys/cam/ctl/ctl.c | 5 | ||||
-rw-r--r-- | sys/cam/ctl/ctl_backend_block.c | 7 |
2 files changed, 8 insertions, 4 deletions
diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c index 55ee89d..ca09500 100644 --- a/sys/cam/ctl/ctl.c +++ b/sys/cam/ctl/ctl.c @@ -5810,9 +5810,8 @@ ctl_write_same(struct ctl_scsiio *ctsio) break; /* NOTREACHED */ } - /* NDOB and ANCHOR flags can be used only together with UNMAP */ - if ((byte2 & SWS_UNMAP) == 0 && - (byte2 & (SWS_NDOB | SWS_ANCHOR)) != 0) { + /* ANCHOR flag can be used only together with UNMAP */ + if ((byte2 & SWS_UNMAP) == 0 && (byte2 & SWS_ANCHOR) != 0) { ctl_set_invalid_field(ctsio, /*sks_valid*/ 1, /*command*/ 1, /*field*/ 1, /*bit_valid*/ 1, /*bit*/ 0); ctl_done((union ctl_io *)ctsio); diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c index be50412..29009a9 100644 --- a/sys/cam/ctl/ctl_backend_block.c +++ b/sys/cam/ctl/ctl_backend_block.c @@ -1360,7 +1360,12 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *be_lun, buf = beio->sg_segs[i].addr; end = buf + seglen; for (; buf < end; buf += cbe_lun->blocksize) { - memcpy(buf, io->scsiio.kern_data_ptr, cbe_lun->blocksize); + if (lbalen->flags & SWS_NDOB) { + memset(buf, 0, cbe_lun->blocksize); + } else { + memcpy(buf, io->scsiio.kern_data_ptr, + cbe_lun->blocksize); + } if (lbalen->flags & SWS_LBDATA) scsi_ulto4b(lbalen->lba + lba, buf); lba++; |