svn commit: r288175 - head/sys/cam/ctl
Alexander Motin
mav at FreeBSD.org
Thu Sep 24 15:59:09 UTC 2015
Author: mav
Date: Thu Sep 24 15:59:08 2015
New Revision: 288175
URL: https://svnweb.freebsd.org/changeset/base/288175
Log:
Allow WRITE SAME with NDOB bit set but without UNMAP.
This combination was originally forbidden, but allowed at spc4r3.
Modified:
head/sys/cam/ctl/ctl.c
head/sys/cam/ctl/ctl_backend_block.c
Modified: head/sys/cam/ctl/ctl.c
==============================================================================
--- head/sys/cam/ctl/ctl.c Thu Sep 24 13:06:19 2015 (r288174)
+++ head/sys/cam/ctl/ctl.c Thu Sep 24 15:59:08 2015 (r288175)
@@ -5808,9 +5808,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);
Modified: head/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- head/sys/cam/ctl/ctl_backend_block.c Thu Sep 24 13:06:19 2015 (r288174)
+++ head/sys/cam/ctl/ctl_backend_block.c Thu Sep 24 15:59:08 2015 (r288175)
@@ -1357,7 +1357,12 @@ ctl_be_block_cw_dispatch_ws(struct ctl_b
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++;
More information about the svn-src-all
mailing list