Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 24 Sep 2015 15:59:09 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r288175 - head/sys/cam/ctl
Message-ID:  <201509241559.t8OFx9dv006047@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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++;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509241559.t8OFx9dv006047>