Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 12 Apr 2016 20:50:26 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r297870 - in projects/pnfs-server/sys: amd64/amd64 cddl/contrib/opensolaris/uts/common/fs/zfs dev/cxgbe/common dev/hyperv/vmbus dev/isp dev/mn dev/mpt dev/mrsas dev/mvs dev/nxge/xgehal ...
Message-ID:  <201604122050.u3CKoQ7Y037560@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Tue Apr 12 20:50:25 2016
New Revision: 297870
URL: https://svnweb.freebsd.org/changeset/base/297870

Log:
  Bring kernel up to date.

Modified:
  projects/pnfs-server/sys/amd64/amd64/exception.S
  projects/pnfs-server/sys/amd64/amd64/mp_machdep.c
  projects/pnfs-server/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  projects/pnfs-server/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
  projects/pnfs-server/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
  projects/pnfs-server/sys/dev/cxgbe/common/t4_regs.h
  projects/pnfs-server/sys/dev/hyperv/vmbus/hv_hv.c
  projects/pnfs-server/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
  projects/pnfs-server/sys/dev/isp/isp.c
  projects/pnfs-server/sys/dev/isp/isp_freebsd.c
  projects/pnfs-server/sys/dev/isp/isp_freebsd.h
  projects/pnfs-server/sys/dev/isp/isp_pci.c
  projects/pnfs-server/sys/dev/isp/ispvar.h
  projects/pnfs-server/sys/dev/mn/if_mn.c
  projects/pnfs-server/sys/dev/mpt/mpt_raid.c
  projects/pnfs-server/sys/dev/mrsas/mrsas_ioctl.c
  projects/pnfs-server/sys/dev/mvs/mvs_pci.c
  projects/pnfs-server/sys/dev/mvs/mvs_soc.c
  projects/pnfs-server/sys/dev/nxge/xgehal/xgehal-device.c
  projects/pnfs-server/sys/dev/sound/isa/ad1816.c
  projects/pnfs-server/sys/dev/sound/isa/ess.c
  projects/pnfs-server/sys/dev/sound/isa/mss.c
  projects/pnfs-server/sys/dev/sound/isa/sb16.c
  projects/pnfs-server/sys/dev/sound/isa/sb8.c
  projects/pnfs-server/sys/dev/sound/midi/midi.c
  projects/pnfs-server/sys/dev/sound/pci/als4000.c
  projects/pnfs-server/sys/dev/sound/pci/aureal.c
  projects/pnfs-server/sys/dev/sound/pci/cmi.c
  projects/pnfs-server/sys/dev/sound/pci/emu10k1.c
  projects/pnfs-server/sys/dev/sound/pci/emu10kx.c
  projects/pnfs-server/sys/dev/sound/pci/fm801.c
  projects/pnfs-server/sys/dev/sound/pci/neomagic.c
  projects/pnfs-server/sys/dev/sound/pci/solo.c
  projects/pnfs-server/sys/dev/sound/pci/t4dwave.c
  projects/pnfs-server/sys/dev/sound/pci/via8233.c
  projects/pnfs-server/sys/dev/sound/pci/via82c686.c
  projects/pnfs-server/sys/dev/vxge/vxgehal/vxgehal-fifo.c
  projects/pnfs-server/sys/dev/vxge/vxgehal/vxgehal-mrpcim.c
  projects/pnfs-server/sys/fs/nfsserver/nfs_nfsdport.c
  projects/pnfs-server/sys/i386/i386/mp_machdep.c
  projects/pnfs-server/sys/kern/kern_rctl.c
  projects/pnfs-server/sys/mips/include/resource.h
  projects/pnfs-server/sys/mips/mediatek/mtk_pcie.c
  projects/pnfs-server/sys/mips/mediatek/mtk_pcie.h
  projects/pnfs-server/sys/netinet/sctp_usrreq.c
  projects/pnfs-server/sys/netinet/sctp_var.h
  projects/pnfs-server/sys/x86/include/specialreg.h
  projects/pnfs-server/sys/x86/include/x86_var.h
  projects/pnfs-server/sys/x86/x86/identcpu.c
Directory Properties:
  projects/pnfs-server/sys/   (props changed)
  projects/pnfs-server/sys/cddl/contrib/opensolaris/   (props changed)
  projects/pnfs-server/sys/dev/hyperv/   (props changed)

Modified: projects/pnfs-server/sys/amd64/amd64/exception.S
==============================================================================
--- projects/pnfs-server/sys/amd64/amd64/exception.S	Tue Apr 12 20:23:09 2016	(r297869)
+++ projects/pnfs-server/sys/amd64/amd64/exception.S	Tue Apr 12 20:50:25 2016	(r297870)
@@ -211,6 +211,8 @@ alltraps_pushregs_no_rdi:
 	 * interrupt. For all other trap types, just handle them in
 	 * the usual way.
 	 */
+	testb	$SEL_RPL_MASK,TF_CS(%rsp) /* Did we come from kernel? */
+	jnz	calltrap		/* ignore userland traps */
 	cmpl	$T_BPTFLT,TF_TRAPNO(%rsp)
 	jne	calltrap
 

Modified: projects/pnfs-server/sys/amd64/amd64/mp_machdep.c
==============================================================================
--- projects/pnfs-server/sys/amd64/amd64/mp_machdep.c	Tue Apr 12 20:23:09 2016	(r297869)
+++ projects/pnfs-server/sys/amd64/amd64/mp_machdep.c	Tue Apr 12 20:50:25 2016	(r297870)
@@ -247,7 +247,7 @@ init_secondary(void)
 	wrmsr(MSR_FSBASE, 0);		/* User value */
 	wrmsr(MSR_GSBASE, (u_int64_t)pc);
 	wrmsr(MSR_KGSBASE, (u_int64_t)pc);	/* XXX User value while we're in the kernel */
-	intel_fix_cpuid();
+	fix_cpuid();
 
 	lidt(&r_idt);
 

Modified: projects/pnfs-server/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- projects/pnfs-server/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Tue Apr 12 20:23:09 2016	(r297869)
+++ projects/pnfs-server/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Tue Apr 12 20:50:25 2016	(r297870)
@@ -563,6 +563,7 @@ typedef struct arc_stats {
 	kstat_named_t arcstat_l2_compress_successes;
 	kstat_named_t arcstat_l2_compress_zeros;
 	kstat_named_t arcstat_l2_compress_failures;
+	kstat_named_t arcstat_l2_padding_needed;
 	kstat_named_t arcstat_l2_write_trylock_fail;
 	kstat_named_t arcstat_l2_write_passed_headroom;
 	kstat_named_t arcstat_l2_write_spa_mismatch;
@@ -664,6 +665,7 @@ static arc_stats_t arc_stats = {
 	{ "l2_compress_successes",	KSTAT_DATA_UINT64 },
 	{ "l2_compress_zeros",		KSTAT_DATA_UINT64 },
 	{ "l2_compress_failures",	KSTAT_DATA_UINT64 },
+	{ "l2_padding_needed",		KSTAT_DATA_UINT64 },
 	{ "l2_write_trylock_fail",	KSTAT_DATA_UINT64 },
 	{ "l2_write_passed_headroom",	KSTAT_DATA_UINT64 },
 	{ "l2_write_spa_mismatch",	KSTAT_DATA_UINT64 },
@@ -837,7 +839,7 @@ typedef struct l1arc_buf_hdr {
 	refcount_t		b_refcnt;
 
 	arc_callback_t		*b_acb;
-	/* temporary buffer holder for in-flight compressed data */
+	/* temporary buffer holder for in-flight compressed or padded data */
 	void			*b_tmp_cdata;
 } l1arc_buf_hdr_t;
 
@@ -1098,6 +1100,7 @@ typedef struct l2arc_read_callback {
 	zbookmark_phys_t	l2rcb_zb;		/* original bookmark */
 	int			l2rcb_flags;		/* original flags */
 	enum zio_compress	l2rcb_compress;		/* applied compress */
+	void			*l2rcb_data;		/* temporary buffer */
 } l2arc_read_callback_t;
 
 typedef struct l2arc_write_callback {
@@ -1128,7 +1131,7 @@ static uint32_t arc_bufc_to_flags(arc_bu
 static boolean_t l2arc_write_eligible(uint64_t, arc_buf_hdr_t *);
 static void l2arc_read_done(zio_t *);
 
-static boolean_t l2arc_compress_buf(arc_buf_hdr_t *);
+static boolean_t l2arc_transform_buf(arc_buf_hdr_t *, boolean_t);
 static void l2arc_decompress_zio(zio_t *, arc_buf_hdr_t *, enum zio_compress);
 static void l2arc_release_cdata_buf(arc_buf_hdr_t *);
 
@@ -2215,6 +2218,8 @@ arc_buf_data_free(arc_buf_t *buf, void (
 static void
 arc_buf_l2_cdata_free(arc_buf_hdr_t *hdr)
 {
+	size_t align, asize, len;
+
 	ASSERT(HDR_HAS_L2HDR(hdr));
 	ASSERT(MUTEX_HELD(&hdr->b_l2hdr.b_dev->l2ad_mtx));
 
@@ -2236,16 +2241,15 @@ arc_buf_l2_cdata_free(arc_buf_hdr_t *hdr
 	}
 
 	/*
-	 * The header does not have compression enabled. This can be due
-	 * to the buffer not being compressible, or because we're
-	 * freeing the buffer before the second phase of
-	 * l2arc_write_buffer() has started (which does the compression
-	 * step). In either case, b_tmp_cdata does not point to a
-	 * separately compressed buffer, so there's nothing to free (it
-	 * points to the same buffer as the arc_buf_t's b_data field).
-	 */
-	if (hdr->b_l2hdr.b_compress == ZIO_COMPRESS_OFF) {
-		hdr->b_l1hdr.b_tmp_cdata = NULL;
+	 * The bufer has been chosen for writing to L2ARC, but it's
+	 * not being written just yet.  In other words,
+	 * b_tmp_cdata points to exactly the same buffer as b_data,
+	 * l2arc_transform_buf hasn't been called.
+	 */
+	if (hdr->b_l2hdr.b_daddr == L2ARC_ADDR_UNSET) {
+		ASSERT3P(hdr->b_l1hdr.b_tmp_cdata, ==,
+		    hdr->b_l1hdr.b_buf->b_data);
+		ASSERT3U(hdr->b_l2hdr.b_compress, ==, ZIO_COMPRESS_OFF);
 		return;
 	}
 
@@ -2258,12 +2262,18 @@ arc_buf_l2_cdata_free(arc_buf_hdr_t *hdr
 		return;
 	}
 
-	ASSERT(L2ARC_IS_VALID_COMPRESS(hdr->b_l2hdr.b_compress));
-
-	arc_buf_free_on_write(hdr->b_l1hdr.b_tmp_cdata,
-	    hdr->b_size, zio_data_buf_free);
+	/*
+	 * Nothing to do if the temporary buffer was not required.
+	 */
+	if (hdr->b_l1hdr.b_tmp_cdata == NULL)
+		return;
 
 	ARCSTAT_BUMP(arcstat_l2_cdata_free_on_write);
+	len = hdr->b_size;
+	align = (size_t)1 << hdr->b_l2hdr.b_dev->l2ad_vdev->vdev_ashift;
+	asize = P2ROUNDUP(len, align);
+	arc_buf_free_on_write(hdr->b_l1hdr.b_tmp_cdata, asize,
+	    zio_data_buf_free);
 	hdr->b_l1hdr.b_tmp_cdata = NULL;
 }
 
@@ -4534,6 +4544,7 @@ top:
 			    !HDR_L2_WRITING(hdr) && !HDR_L2_EVICTED(hdr) &&
 			    !(l2arc_noprefetch && HDR_PREFETCH(hdr))) {
 				l2arc_read_callback_t *cb;
+				void* b_data;
 
 				DTRACE_PROBE1(l2arc__hit, arc_buf_hdr_t *, hdr);
 				ARCSTAT_BUMP(arcstat_l2_hits);
@@ -4546,6 +4557,14 @@ top:
 				cb->l2rcb_zb = *zb;
 				cb->l2rcb_flags = zio_flags;
 				cb->l2rcb_compress = b_compress;
+				if (b_asize > hdr->b_size) {
+					ASSERT3U(b_compress, ==,
+					    ZIO_COMPRESS_OFF);
+					b_data = zio_data_buf_alloc(b_asize);
+					cb->l2rcb_data = b_data;
+				} else {
+					b_data = buf->b_data;
+				}
 
 				ASSERT(addr >= VDEV_LABEL_START_SIZE &&
 				    addr + size < vd->vdev_psize -
@@ -4558,6 +4577,7 @@ top:
 				 * was squashed to zero size by compression.
 				 */
 				if (b_compress == ZIO_COMPRESS_EMPTY) {
+					ASSERT3U(b_asize, ==, 0);
 					rzio = zio_null(pio, spa, vd,
 					    l2arc_read_done, cb,
 					    zio_flags | ZIO_FLAG_DONT_CACHE |
@@ -4566,7 +4586,7 @@ top:
 					    ZIO_FLAG_DONT_RETRY);
 				} else {
 					rzio = zio_read_phys(pio, vd, addr,
-					    b_asize, buf->b_data,
+					    b_asize, b_data,
 					    ZIO_CHECKSUM_OFF,
 					    l2arc_read_done, cb, priority,
 					    zio_flags | ZIO_FLAG_DONT_CACHE |
@@ -6051,6 +6071,32 @@ l2arc_read_done(zio_t *zio)
 	ASSERT3P(hash_lock, ==, HDR_LOCK(hdr));
 
 	/*
+	 * If the data was read into a temporary buffer,
+	 * move it and free the buffer.
+	 */
+	if (cb->l2rcb_data != NULL) {
+		ASSERT3U(hdr->b_size, <, zio->io_size);
+		ASSERT3U(cb->l2rcb_compress, ==, ZIO_COMPRESS_OFF);
+		if (zio->io_error == 0)
+			bcopy(cb->l2rcb_data, buf->b_data, hdr->b_size);
+
+		/*
+		 * The following must be done regardless of whether
+		 * there was an error:
+		 * - free the temporary buffer
+		 * - point zio to the real ARC buffer
+		 * - set zio size accordingly
+		 * These are required because zio is either re-used for
+		 * an I/O of the block in the case of the error
+		 * or the zio is passed to arc_read_done() and it
+		 * needs real data.
+		 */
+		zio_data_buf_free(cb->l2rcb_data, zio->io_size);
+		zio->io_size = zio->io_orig_size = hdr->b_size;
+		zio->io_data = zio->io_orig_data = buf->b_data;
+	}
+
+	/*
 	 * If the buffer was compressed, decompress it first.
 	 */
 	if (cb->l2rcb_compress != ZIO_COMPRESS_OFF)
@@ -6334,6 +6380,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 			kmutex_t *hash_lock;
 			uint64_t buf_sz;
 			uint64_t buf_a_sz;
+			size_t align;
 
 			if (arc_warm == B_FALSE)
 				hdr_prev = multilist_sublist_next(mls, hdr);
@@ -6371,7 +6418,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 			 * disk block size.
 			 */
 			buf_sz = hdr->b_size;
-			buf_a_sz = vdev_psize_to_asize(dev->l2ad_vdev, buf_sz);
+			align = (size_t)1 << dev->l2ad_vdev->vdev_ashift;
+			buf_a_sz = P2ROUNDUP(buf_sz, align);
 
 			if ((write_asize + buf_a_sz) > target_sz) {
 				full = B_TRUE;
@@ -6475,26 +6523,15 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 	mutex_enter(&dev->l2ad_mtx);
 
 	/*
-	 * Note that elsewhere in this file arcstat_l2_asize
-	 * and the used space on l2ad_vdev are updated using b_asize,
-	 * which is not necessarily rounded up to the device block size.
-	 * Too keep accounting consistent we do the same here as well:
-	 * stats_size accumulates the sum of b_asize of the written buffers,
-	 * while write_asize accumulates the sum of b_asize rounded up
-	 * to the device block size.
-	 * The latter sum is used only to validate the corectness of the code.
-	 */
-	uint64_t stats_size = 0;
-	write_asize = 0;
-
-	/*
 	 * Now start writing the buffers. We're starting at the write head
 	 * and work backwards, retracing the course of the buffer selector
 	 * loop above.
 	 */
+	write_asize = 0;
 	for (hdr = list_prev(&dev->l2ad_buflist, head); hdr;
 	    hdr = list_prev(&dev->l2ad_buflist, hdr)) {
 		uint64_t buf_sz;
+		boolean_t compress;
 
 		/*
 		 * We rely on the L1 portion of the header below, so
@@ -6513,22 +6550,26 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 		 */
 		hdr->b_l2hdr.b_daddr = dev->l2ad_hand;
 
-		if ((HDR_L2COMPRESS(hdr)) &&
-		    hdr->b_l2hdr.b_asize >= buf_compress_minsz) {
-			if (l2arc_compress_buf(hdr)) {
-				/*
-				 * If compression succeeded, enable headroom
-				 * boost on the next scan cycle.
-				 */
-				*headroom_boost = B_TRUE;
-			}
+		/*
+		 * Save a pointer to the original buffer data we had previously
+		 * stashed away.
+		 */
+		buf_data = hdr->b_l1hdr.b_tmp_cdata;
+
+		compress = HDR_L2COMPRESS(hdr) &&
+		    hdr->b_l2hdr.b_asize >= buf_compress_minsz;
+		if (l2arc_transform_buf(hdr, compress)) {
+			/*
+			 * If compression succeeded, enable headroom
+			 * boost on the next scan cycle.
+			 */
+			*headroom_boost = B_TRUE;
 		}
 
 		/*
-		 * Pick up the buffer data we had previously stashed away
-		 * (and now potentially also compressed).
+		 * Get the new buffer size that accounts for compression
+		 * and padding.
 		 */
-		buf_data = hdr->b_l1hdr.b_tmp_cdata;
 		buf_sz = hdr->b_l2hdr.b_asize;
 
 		/*
@@ -6540,8 +6581,12 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 
 		/* Compression may have squashed the buffer to zero length. */
 		if (buf_sz != 0) {
-			uint64_t buf_a_sz;
-
+			/*
+			 * If the data was padded or compressed, then it
+			 * it is in a new buffer.
+			 */
+			if (hdr->b_l1hdr.b_tmp_cdata != NULL)
+				buf_data = hdr->b_l1hdr.b_tmp_cdata;
 			wzio = zio_write_phys(pio, dev->l2ad_vdev,
 			    dev->l2ad_hand, buf_sz, buf_data, ZIO_CHECKSUM_OFF,
 			    NULL, NULL, ZIO_PRIORITY_ASYNC_WRITE,
@@ -6551,14 +6596,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 			    zio_t *, wzio);
 			(void) zio_nowait(wzio);
 
-			stats_size += buf_sz;
-
-			/*
-			 * Keep the clock hand suitably device-aligned.
-			 */
-			buf_a_sz = vdev_psize_to_asize(dev->l2ad_vdev, buf_sz);
-			write_asize += buf_a_sz;
-			dev->l2ad_hand += buf_a_sz;
+			write_asize += buf_sz;
+			dev->l2ad_hand += buf_sz;
 		}
 	}
 
@@ -6568,8 +6607,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 	ARCSTAT_BUMP(arcstat_l2_writes_sent);
 	ARCSTAT_INCR(arcstat_l2_write_bytes, write_asize);
 	ARCSTAT_INCR(arcstat_l2_size, write_sz);
-	ARCSTAT_INCR(arcstat_l2_asize, stats_size);
-	vdev_space_update(dev->l2ad_vdev, stats_size, 0, 0);
+	ARCSTAT_INCR(arcstat_l2_asize, write_asize);
+	vdev_space_update(dev->l2ad_vdev, write_asize, 0, 0);
 
 	/*
 	 * Bump device hand to the device start if it is approaching the end.
@@ -6588,12 +6627,18 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 }
 
 /*
- * Compresses an L2ARC buffer.
+ * Transforms, possibly compresses and pads, an L2ARC buffer.
  * The data to be compressed must be prefilled in l1hdr.b_tmp_cdata and its
  * size in l2hdr->b_asize. This routine tries to compress the data and
  * depending on the compression result there are three possible outcomes:
- * *) The buffer was incompressible. The original l2hdr contents were left
- *    untouched and are ready for writing to an L2 device.
+ * *) The buffer was incompressible. The buffer size was already ashift aligned.
+ *    The original hdr contents were left untouched except for b_tmp_cdata,
+ *    which is reset to NULL. The caller must keep a pointer to the original
+ *    data.
+ * *) The buffer was incompressible. The buffer size was not ashift aligned.
+ *    b_tmp_cdata was replaced with a temporary data buffer which holds a padded
+ *    (aligned) copy of the data. Once writing is done, invoke
+ *    l2arc_release_cdata_buf on this hdr to free the temporary buffer.
  * *) The buffer was all-zeros, so there is no need to write it to an L2
  *    device. To indicate this situation b_tmp_cdata is NULL'ed, b_asize is
  *    set to zero and b_compress is set to ZIO_COMPRESS_EMPTY.
@@ -6607,10 +6652,11 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
  * buffer was incompressible).
  */
 static boolean_t
-l2arc_compress_buf(arc_buf_hdr_t *hdr)
+l2arc_transform_buf(arc_buf_hdr_t *hdr, boolean_t compress)
 {
 	void *cdata;
-	size_t csize, len, rounded;
+	size_t align, asize, csize, len, rounded;
+
 	ASSERT(HDR_HAS_L2HDR(hdr));
 	l2arc_buf_hdr_t *l2hdr = &hdr->b_l2hdr;
 
@@ -6619,14 +6665,19 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr)
 	ASSERT(hdr->b_l1hdr.b_tmp_cdata != NULL);
 
 	len = l2hdr->b_asize;
-	cdata = zio_data_buf_alloc(len);
+	align = (size_t)1 << l2hdr->b_dev->l2ad_vdev->vdev_ashift;
+	asize = P2ROUNDUP(len, align);
+	cdata = zio_data_buf_alloc(asize);
 	ASSERT3P(cdata, !=, NULL);
-	csize = zio_compress_data(ZIO_COMPRESS_LZ4, hdr->b_l1hdr.b_tmp_cdata,
-	    cdata, l2hdr->b_asize);
+	if (compress)
+		csize = zio_compress_data(ZIO_COMPRESS_LZ4,
+		    hdr->b_l1hdr.b_tmp_cdata, cdata, len);
+	else
+		csize = len;
 
 	if (csize == 0) {
 		/* zero block, indicate that there's nothing to write */
-		zio_data_buf_free(cdata, len);
+		zio_data_buf_free(cdata, asize);
 		l2hdr->b_compress = ZIO_COMPRESS_EMPTY;
 		l2hdr->b_asize = 0;
 		hdr->b_l1hdr.b_tmp_cdata = NULL;
@@ -6634,8 +6685,8 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr)
 		return (B_TRUE);
 	}
 
-	rounded = P2ROUNDUP(csize,
-	    (size_t)1 << l2hdr->b_dev->l2ad_vdev->vdev_ashift);
+	rounded = P2ROUNDUP(csize, align);
+	ASSERT3U(rounded, <=, asize);
 	if (rounded < len) {
 		/*
 		 * Compression succeeded, we'll keep the cdata around for
@@ -6652,11 +6703,32 @@ l2arc_compress_buf(arc_buf_hdr_t *hdr)
 		return (B_TRUE);
 	} else {
 		/*
-		 * Compression failed, release the compressed buffer.
-		 * l2hdr will be left unmodified.
+		 * Compression did not save space.
 		 */
-		zio_data_buf_free(cdata, len);
-		ARCSTAT_BUMP(arcstat_l2_compress_failures);
+		if (P2PHASE(len, align) != 0) {
+			/*
+			 * Use compression buffer for a copy of data padded to
+			 * the proper size.  Compression algorithm remains set
+			 * to ZIO_COMPRESS_OFF.
+			 */
+			ASSERT3U(len, <, asize);
+			bcopy(hdr->b_l1hdr.b_tmp_cdata, cdata, len);
+			bzero((char *)cdata + len, asize - len);
+			l2hdr->b_asize = asize;
+			hdr->b_l1hdr.b_tmp_cdata = cdata;
+			ARCSTAT_BUMP(arcstat_l2_padding_needed);
+		} else {
+			ASSERT3U(len, ==, asize);
+			/*
+			 * The original buffer is good as is,
+			 * release the compressed buffer.
+			 * l2hdr will be left unmodified except for b_tmp_cdata.
+			 */
+			zio_data_buf_free(cdata, asize);
+			hdr->b_l1hdr.b_tmp_cdata = NULL;
+		}
+		if (compress)
+			ARCSTAT_BUMP(arcstat_l2_compress_failures);
 		return (B_FALSE);
 	}
 }
@@ -6725,44 +6797,30 @@ l2arc_decompress_zio(zio_t *zio, arc_buf
 
 /*
  * Releases the temporary b_tmp_cdata buffer in an l2arc header structure.
- * This buffer serves as a temporary holder of compressed data while
+ * This buffer serves as a temporary holder of compressed or padded data while
  * the buffer entry is being written to an l2arc device. Once that is
  * done, we can dispose of it.
  */
 static void
 l2arc_release_cdata_buf(arc_buf_hdr_t *hdr)
 {
-	ASSERT(HDR_HAS_L2HDR(hdr));
+	size_t align, asize, len;
 	enum zio_compress comp = hdr->b_l2hdr.b_compress;
 
+	ASSERT(HDR_HAS_L2HDR(hdr));
 	ASSERT(HDR_HAS_L1HDR(hdr));
 	ASSERT(comp == ZIO_COMPRESS_OFF || L2ARC_IS_VALID_COMPRESS(comp));
 
-	if (comp == ZIO_COMPRESS_OFF) {
-		/*
-		 * In this case, b_tmp_cdata points to the same buffer
-		 * as the arc_buf_t's b_data field. We don't want to
-		 * free it, since the arc_buf_t will handle that.
-		 */
+	if (hdr->b_l1hdr.b_tmp_cdata != NULL) {
+		ASSERT(comp != ZIO_COMPRESS_EMPTY);
+		len = hdr->b_size;
+		align = (size_t)1 << hdr->b_l2hdr.b_dev->l2ad_vdev->vdev_ashift;
+		asize = P2ROUNDUP(len, align);
+		zio_data_buf_free(hdr->b_l1hdr.b_tmp_cdata, asize);
 		hdr->b_l1hdr.b_tmp_cdata = NULL;
-	} else if (comp == ZIO_COMPRESS_EMPTY) {
-		/*
-		 * In this case, b_tmp_cdata was compressed to an empty
-		 * buffer, thus there's nothing to free and b_tmp_cdata
-		 * should have been set to NULL in l2arc_write_buffers().
-		 */
-		ASSERT3P(hdr->b_l1hdr.b_tmp_cdata, ==, NULL);
 	} else {
-		/*
-		 * If the data was compressed, then we've allocated a
-		 * temporary buffer for it, so now we need to release it.
-		 */
-		ASSERT(hdr->b_l1hdr.b_tmp_cdata != NULL);
-		zio_data_buf_free(hdr->b_l1hdr.b_tmp_cdata,
-		    hdr->b_size);
-		hdr->b_l1hdr.b_tmp_cdata = NULL;
+		ASSERT(comp == ZIO_COMPRESS_OFF || comp == ZIO_COMPRESS_EMPTY);
 	}
-
 }
 
 /*

Modified: projects/pnfs-server/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c
==============================================================================
--- projects/pnfs-server/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c	Tue Apr 12 20:23:09 2016	(r297869)
+++ projects/pnfs-server/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c	Tue Apr 12 20:50:25 2016	(r297870)
@@ -115,27 +115,14 @@ vdev_geom_attrchanged(struct g_consumer 
 	if (error == 0) {
 		char *old_physpath;
 
+		/* g_topology lock ensures that vdev has not been closed */
+		g_topology_assert();
 		old_physpath = vd->vdev_physpath;
 		vd->vdev_physpath = spa_strdup(physpath);
 		spa_async_request(spa, SPA_ASYNC_CONFIG_UPDATE);
 
-		if (old_physpath != NULL) {
-			int held_lock;
-
-			held_lock = spa_config_held(spa, SCL_STATE, RW_WRITER);
-			if (held_lock == 0) {
-				g_topology_unlock();
-				spa_config_enter(spa, SCL_STATE, FTAG,
-				    RW_WRITER);
-			}
-
+		if (old_physpath != NULL)
 			spa_strfree(old_physpath);
-
-			if (held_lock == 0) {
-				spa_config_exit(spa, SCL_STATE, FTAG);
-				g_topology_lock();
-			}
-		}
 	}
 	g_free(physpath);
 }

Modified: projects/pnfs-server/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
==============================================================================
--- projects/pnfs-server/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Tue Apr 12 20:23:09 2016	(r297869)
+++ projects/pnfs-server/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c	Tue Apr 12 20:50:25 2016	(r297870)
@@ -2777,19 +2777,10 @@ zio_vdev_io_start(zio_t *zio)
 			(void) atomic_cas_64(&spa->spa_last_io, old, new);
 	}
 
-#ifdef illumos
 	align = 1ULL << vd->vdev_top->vdev_ashift;
 
 	if (!(zio->io_flags & ZIO_FLAG_PHYSICAL) &&
 	    P2PHASE(zio->io_size, align) != 0) {
-#else
-	if (zio->io_flags & ZIO_FLAG_PHYSICAL)
-		align = 1ULL << vd->vdev_top->vdev_logical_ashift;
-	else
-		align = 1ULL << vd->vdev_top->vdev_ashift;
-
-	if (P2PHASE(zio->io_size, align) != 0) {
-#endif
 		/* Transform logical writes to be a full physical block size. */
 		uint64_t asize = P2ROUNDUP(zio->io_size, align);
 		char *abuf = NULL;
@@ -2805,7 +2796,6 @@ zio_vdev_io_start(zio_t *zio)
 		    zio_subblock);
 	}
 
-#ifdef illumos
 	/*
 	 * If this is not a physical io, make sure that it is properly aligned
 	 * before proceeding.
@@ -2815,16 +2805,14 @@ zio_vdev_io_start(zio_t *zio)
 		ASSERT0(P2PHASE(zio->io_size, align));
 	} else {
 		/*
-		 * For physical writes, we allow 512b aligned writes and assume
-		 * the device will perform a read-modify-write as necessary.
+		 * For the physical io we allow alignment
+		 * to a logical block size.
 		 */
-		ASSERT0(P2PHASE(zio->io_offset, SPA_MINBLOCKSIZE));
-		ASSERT0(P2PHASE(zio->io_size, SPA_MINBLOCKSIZE));
+		uint64_t log_align =
+		    1ULL << vd->vdev_top->vdev_logical_ashift;
+		ASSERT0(P2PHASE(zio->io_offset, log_align));
+		ASSERT0(P2PHASE(zio->io_size, log_align));
 	}
-#else
-	ASSERT0(P2PHASE(zio->io_offset, align));
-	ASSERT0(P2PHASE(zio->io_size, align));
-#endif
 
 	VERIFY(zio->io_type == ZIO_TYPE_READ || spa_writeable(spa));
 

Modified: projects/pnfs-server/sys/dev/cxgbe/common/t4_regs.h
==============================================================================
--- projects/pnfs-server/sys/dev/cxgbe/common/t4_regs.h	Tue Apr 12 20:23:09 2016	(r297869)
+++ projects/pnfs-server/sys/dev/cxgbe/common/t4_regs.h	Tue Apr 12 20:50:25 2016	(r297870)
@@ -47301,9 +47301,9 @@
 #define A_MAC_PORT_PTP_OFFSET_ADJUST_FINE 0x9a4
 
 #define S_B    16
-#define M_B    0xffffU
+#define CXGBE_M_B    0xffffU
 #define V_B(x) ((x) << S_B)
-#define G_B(x) (((x) >> S_B) & M_B)
+#define G_B(x) (((x) >> S_B) & CXGBE_M_B)
 
 #define S_A    0
 #define M_A    0xffffU

Modified: projects/pnfs-server/sys/dev/hyperv/vmbus/hv_hv.c
==============================================================================
--- projects/pnfs-server/sys/dev/hyperv/vmbus/hv_hv.c	Tue Apr 12 20:23:09 2016	(r297869)
+++ projects/pnfs-server/sys/dev/hyperv/vmbus/hv_hv.c	Tue Apr 12 20:50:25 2016	(r297870)
@@ -127,7 +127,7 @@ int
 hv_vmbus_init(void) 
 {
 	hv_vmbus_x64_msr_hypercall_contents	hypercall_msr;
-	void* 					virt_addr = 0;
+	void* 					virt_addr = NULL;
 
 	memset(
 	    hv_vmbus_g_context.syn_ic_event_page,

Modified: projects/pnfs-server/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c
==============================================================================
--- projects/pnfs-server/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c	Tue Apr 12 20:23:09 2016	(r297869)
+++ projects/pnfs-server/sys/dev/hyperv/vmbus/hv_vmbus_drv_freebsd.c	Tue Apr 12 20:50:25 2016	(r297870)
@@ -581,7 +581,7 @@ vmbus_bus_exit(void)
 	smp_rendezvous(NULL, hv_vmbus_synic_cleanup, NULL, NULL);
 
 	for(i = 0; i < 2 * MAXCPU; i++) {
-		if (setup_args.page_buffers[i] != 0)
+		if (setup_args.page_buffers[i] != NULL)
 			free(setup_args.page_buffers[i], M_DEVBUF);
 	}
 

Modified: projects/pnfs-server/sys/dev/isp/isp.c
==============================================================================
--- projects/pnfs-server/sys/dev/isp/isp.c	Tue Apr 12 20:23:09 2016	(r297869)
+++ projects/pnfs-server/sys/dev/isp/isp.c	Tue Apr 12 20:50:25 2016	(r297870)
@@ -2776,7 +2776,6 @@ isp_port_logout(ispsoftc_t *isp, uint16_
 static int
 isp_getpdb(ispsoftc_t *isp, int chan, uint16_t id, isp_pdb_t *pdb)
 {
-	fcparam *fcp = FCPARAM(isp, chan);
 	mbreg_t mbs;
 	union {
 		isp_pdb_21xx_t fred;
@@ -2794,22 +2793,19 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui
 	} else {
 		mbs.param[1] = id << 8;
 	}
-	mbs.param[2] = DMA_WD1(fcp->isp_scdma);
-	mbs.param[3] = DMA_WD0(fcp->isp_scdma);
-	mbs.param[6] = DMA_WD3(fcp->isp_scdma);
-	mbs.param[7] = DMA_WD2(fcp->isp_scdma);
-	if (FC_SCRATCH_ACQUIRE(isp, chan)) {
-		isp_prt(isp, ISP_LOGERR, sacq);
-		return (-1);
-	}
-	MEMORYBARRIER(isp, SYNC_SFORDEV, 0, sizeof (un), chan);
+	mbs.param[2] = DMA_WD1(isp->isp_iocb_dma);
+	mbs.param[3] = DMA_WD0(isp->isp_iocb_dma);
+	mbs.param[6] = DMA_WD3(isp->isp_iocb_dma);
+	mbs.param[7] = DMA_WD2(isp->isp_iocb_dma);
+	MEMORYBARRIER(isp, SYNC_IFORDEV, 0, sizeof(un), chan);
+
 	isp_mboxcmd(isp, &mbs);
-	if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
-		FC_SCRATCH_RELEASE(isp, chan);
+	if (mbs.param[0] != MBOX_COMMAND_COMPLETE)
 		return (mbs.param[0] | (mbs.param[1] << 16));
-	}
+
+	MEMORYBARRIER(isp, SYNC_IFORCPU, 0, sizeof(un), chan);
 	if (IS_24XX(isp)) {
-		isp_get_pdb_24xx(isp, fcp->isp_scratch, &un.bill);
+		isp_get_pdb_24xx(isp, isp->isp_iocb, &un.bill);
 		pdb->handle = un.bill.pdb_handle;
 		pdb->prli_word3 = un.bill.pdb_prli_svc3;
 		pdb->portid = BITS2WORD_24XX(un.bill.pdb_portid_bits);
@@ -2821,11 +2817,10 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui
 		    un.bill.pdb_curstate);
 		if (un.bill.pdb_curstate < PDB2400_STATE_PLOGI_DONE || un.bill.pdb_curstate > PDB2400_STATE_LOGGED_IN) {
 			mbs.param[0] = MBOX_NOT_LOGGED_IN;
-			FC_SCRATCH_RELEASE(isp, chan);
 			return (mbs.param[0]);
 		}
 	} else {
-		isp_get_pdb_21xx(isp, fcp->isp_scratch, &un.fred);
+		isp_get_pdb_21xx(isp, isp->isp_iocb, &un.fred);
 		pdb->handle = un.fred.pdb_loopid;
 		pdb->prli_word3 = un.fred.pdb_prli_svc3;
 		pdb->portid = BITS2WORD(un.fred.pdb_portid_bits);
@@ -2834,7 +2829,6 @@ isp_getpdb(ispsoftc_t *isp, int chan, ui
 		isp_prt(isp, ISP_LOGDEBUG1,
 		    "Chan %d handle 0x%x Port 0x%06x", chan, id, pdb->portid);
 	}
-	FC_SCRATCH_RELEASE(isp, chan);
 	return (0);
 }
 
@@ -2875,6 +2869,7 @@ isp_gethandles(ispsoftc_t *isp, int chan
 		FC_SCRATCH_RELEASE(isp, chan);
 		return (mbs.param[0] | (mbs.param[1] << 16));
 	}
+	MEMORYBARRIER(isp, SYNC_SFORCPU, 0, ISP_FC_SCRLEN, chan);
 	elp1 = fcp->isp_scratch;
 	elp3 = fcp->isp_scratch;
 	elp4 = fcp->isp_scratch;
@@ -3083,20 +3078,31 @@ isp_fclink_test(ispsoftc_t *isp, int cha
 			fcp->isp_fabric_params = mbs.param[7];
 			fcp->isp_sns_hdl = NPH_SNS_ID;
 			r = isp_register_fc4_type_24xx(isp, chan);
-			if (r == 0)
-				isp_register_fc4_features_24xx(isp, chan);
-			isp_register_port_name_24xx(isp, chan);
+			if (fcp->isp_loopstate < LOOP_TESTING_LINK)
+				goto abort;
+			if (r != 0)
+				goto not_on_fabric;
+			r = isp_register_fc4_features_24xx(isp, chan);
+			if (fcp->isp_loopstate < LOOP_TESTING_LINK)
+				goto abort;
+			if (r != 0)
+				goto not_on_fabric;
+			r = isp_register_port_name_24xx(isp, chan);
+			if (fcp->isp_loopstate < LOOP_TESTING_LINK)
+				goto abort;
+			if (r != 0)
+				goto not_on_fabric;
 			isp_register_node_name_24xx(isp, chan);
+			if (fcp->isp_loopstate < LOOP_TESTING_LINK)
+				goto abort;
 		} else {
 			fcp->isp_sns_hdl = SNS_ID;
 			r = isp_register_fc4_type(isp, chan);
-			if (r == 0 && fcp->role == ISP_ROLE_TARGET)
+			if (r != 0)
+				goto not_on_fabric;
+			if (fcp->role == ISP_ROLE_TARGET)
 				isp_send_change_request(isp, chan);
 		}
-		if (r) {
-			isp_prt(isp, ISP_LOGWARN|ISP_LOG_SANCFG, "%s: register fc4 type failed", __func__);
-			return (-1);
-		}
 	}
 
 not_on_fabric:
@@ -3510,65 +3516,66 @@ isp_gid_ft_sns(ispsoftc_t *isp, int chan
 static int
 isp_ct_passthru(ispsoftc_t *isp, int chan, uint32_t cmd_bcnt, uint32_t rsp_bcnt)
 {
-	mbreg_t mbs;
 	fcparam *fcp = FCPARAM(isp, chan);
-	union {
-		isp_ct_pt_t plocal;
-		uint8_t q[QENTRY_LEN];
-	} un;
-	isp_ct_pt_t *pt;
-	uint8_t *scp = fcp->isp_scratch;
+	isp_ct_pt_t pt;
+	void *reqp;
+	uint8_t resp[QENTRY_LEN];
 
 	/*
 	 * Build a Passthrough IOCB in memory.
 	 */
-	pt = &un.plocal;
-	ISP_MEMZERO(un.q, QENTRY_LEN);
-	pt->ctp_header.rqs_entry_count = 1;
-	pt->ctp_header.rqs_entry_type = RQSTYPE_CT_PASSTHRU;
-	pt->ctp_handle = 0xffffffff;
-	pt->ctp_nphdl = fcp->isp_sns_hdl;
-	pt->ctp_cmd_cnt = 1;
-	pt->ctp_vpidx = ISP_GET_VPIDX(isp, chan);
-	pt->ctp_time = 10;
-	pt->ctp_rsp_cnt = 1;
-	pt->ctp_rsp_bcnt = rsp_bcnt;
-	pt->ctp_cmd_bcnt = cmd_bcnt;
-	pt->ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF);
-	pt->ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF);
-	pt->ctp_dataseg[0].ds_count = cmd_bcnt;
-	pt->ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma);
-	pt->ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma);
-	pt->ctp_dataseg[1].ds_count = rsp_bcnt;
-	isp_put_ct_pt(isp, pt, (isp_ct_pt_t *)&scp[CTXOFF]);
-	if (isp->isp_dblev & ISP_LOGDEBUG1)
-		isp_print_bytes(isp, "CT IOCB request", QENTRY_LEN, &scp[CTXOFF]);
+	ISP_MEMZERO(&pt, sizeof(pt));
+	pt.ctp_header.rqs_entry_count = 1;
+	pt.ctp_header.rqs_entry_type = RQSTYPE_CT_PASSTHRU;
+	pt.ctp_nphdl = fcp->isp_sns_hdl;
+	pt.ctp_cmd_cnt = 1;
+	pt.ctp_vpidx = ISP_GET_VPIDX(isp, chan);
+	pt.ctp_time = 10;
+	pt.ctp_rsp_cnt = 1;
+	pt.ctp_rsp_bcnt = rsp_bcnt;
+	pt.ctp_cmd_bcnt = cmd_bcnt;
+	pt.ctp_dataseg[0].ds_base = DMA_LO32(fcp->isp_scdma+XTXOFF);
+	pt.ctp_dataseg[0].ds_basehi = DMA_HI32(fcp->isp_scdma+XTXOFF);
+	pt.ctp_dataseg[0].ds_count = cmd_bcnt;
+	pt.ctp_dataseg[1].ds_base = DMA_LO32(fcp->isp_scdma);
+	pt.ctp_dataseg[1].ds_basehi = DMA_HI32(fcp->isp_scdma);
+	pt.ctp_dataseg[1].ds_count = rsp_bcnt;
+
+	/* Prepare space for response in memory */
+	memset(resp, 0xff, sizeof(resp));
+	pt.ctp_handle = isp_allocate_handle(isp, resp, ISP_HANDLE_CTRL);
+	if (pt.ctp_handle == 0) {
+		isp_prt(isp, ISP_LOGERR,
+		    "%s: CTP of Chan %d out of handles", __func__, chan);
+		return (-1);
+	}
 
-	/*
-	 * Execute the Passthrough IOCB.
-	 */
-	ISP_MEMZERO(&scp[ZTXOFF], QENTRY_LEN);
-	MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL,
-	    MBCMD_DEFAULT_TIMEOUT + pt->ctp_time * 1000000);
-	mbs.param[1] = QENTRY_LEN;
-	mbs.param[2] = DMA_WD1(fcp->isp_scdma + CTXOFF);
-	mbs.param[3] = DMA_WD0(fcp->isp_scdma + CTXOFF);
-	mbs.param[6] = DMA_WD3(fcp->isp_scdma + CTXOFF);
-	mbs.param[7] = DMA_WD2(fcp->isp_scdma + CTXOFF);
-	MEMORYBARRIER(isp, SYNC_SFORDEV, XTXOFF, 2 * QENTRY_LEN, chan);
-	isp_mboxcmd(isp, &mbs);
-	if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
+	/* Send request and wait for response. */
+	reqp = isp_getrqentry(isp);
+	if (reqp == NULL) {
+		isp_prt(isp, ISP_LOGERR,
+		    "%s: CTP of Chan %d out of rqent", __func__, chan);
+		isp_destroy_handle(isp, pt.ctp_handle);
+		return (-1);
+	}
+	isp_put_ct_pt(isp, &pt, (isp_ct_pt_t *)reqp);
+	if (isp->isp_dblev & ISP_LOGDEBUG1)
+		isp_print_bytes(isp, "CT IOCB request", QENTRY_LEN, reqp);
+	ISP_SYNC_REQUEST(isp);
+	if (msleep(resp, &isp->isp_lock, 0, "CTP", pt.ctp_time*hz) == EWOULDBLOCK) {
+		isp_prt(isp, ISP_LOGERR,
+		    "%s: CTP of Chan %d timed out", __func__, chan);
+		isp_destroy_handle(isp, pt.ctp_handle);
 		return (-1);
 	}
-	MEMORYBARRIER(isp, SYNC_SFORCPU, 0, ISP_FC_SCRLEN, chan);
 	if (isp->isp_dblev & ISP_LOGDEBUG1)
-		isp_print_bytes(isp, "CT IOCB response", QENTRY_LEN, &scp[ZTXOFF]);
-	pt = &un.plocal;
-	isp_get_ct_pt(isp, (isp_ct_pt_t *) &scp[ZTXOFF], pt);
-	if (pt->ctp_status && pt->ctp_status != RQCS_DATA_UNDERRUN) {
+		isp_print_bytes(isp, "CT IOCB response", QENTRY_LEN, resp);
+
+	isp_get_ct_pt(isp, (isp_ct_pt_t *)resp, &pt);
+	if (pt.ctp_status && pt.ctp_status != RQCS_DATA_UNDERRUN) {
 		isp_prt(isp, ISP_LOGWARN,
 		    "Chan %d GID_FT CT Passthrough returned 0x%x",
-		    chan, pt->ctp_status);
+		    chan, pt.ctp_status);
 		return (-1);
 	}
 
@@ -3936,7 +3943,13 @@ isp_send_change_request(ispsoftc_t *isp,
 	mbs.param[1] = 0x03;
 	mbs.param[9] = chan;
 	isp_mboxcmd(isp, &mbs);
-	return (mbs.param[0] == MBOX_COMMAND_COMPLETE ? 0 : -1);
+	if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
+		return (0);
+	} else {
+		isp_prt(isp, ISP_LOGWARN, "Chan %d Send Change Request: 0x%x",
+		    chan, mbs.param[0]);
+		return (-1);
+	}
 }
 
 static int
@@ -3975,6 +3988,8 @@ isp_register_fc4_type(ispsoftc_t *isp, i
 	if (mbs.param[0] == MBOX_COMMAND_COMPLETE) {
 		return (0);
 	} else {
+		isp_prt(isp, ISP_LOGWARN, "Chan %d Register FC4 Type: 0x%x",
+		    chan, mbs.param[0]);
 		return (-1);
 	}
 }
@@ -4665,31 +4680,25 @@ isp_control(ispsoftc_t *isp, ispctl_t ct
 			tmf->tmf_tidlo = lp->portid;
 			tmf->tmf_tidhi = lp->portid >> 16;
 			tmf->tmf_vpidx = ISP_GET_VPIDX(isp, chan);
+			isp_put_24xx_tmf(isp, tmf, isp->isp_iocb);
+			MEMORYBARRIER(isp, SYNC_IFORDEV, 0, QENTRY_LEN, chan);
+			fcp->sendmarker = 1;
+
 			isp_prt(isp, ISP_LOGALL, "Chan %d Reset N-Port Handle 0x%04x @ Port 0x%06x", chan, lp->handle, lp->portid);
 			MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL,
 			    MBCMD_DEFAULT_TIMEOUT + tmf->tmf_timeout * 1000000);
 			mbs.param[1] = QENTRY_LEN;
-			mbs.param[2] = DMA_WD1(fcp->isp_scdma);
-			mbs.param[3] = DMA_WD0(fcp->isp_scdma);
-			mbs.param[6] = DMA_WD3(fcp->isp_scdma);
-			mbs.param[7] = DMA_WD2(fcp->isp_scdma);
-
-			if (FC_SCRATCH_ACQUIRE(isp, chan)) {
-				isp_prt(isp, ISP_LOGERR, sacq);
-				break;
-			}
-			isp_put_24xx_tmf(isp, tmf, fcp->isp_scratch);
-			MEMORYBARRIER(isp, SYNC_SFORDEV, 0, QENTRY_LEN, chan);
-			fcp->sendmarker = 1;
+			mbs.param[2] = DMA_WD1(isp->isp_iocb_dma);
+			mbs.param[3] = DMA_WD0(isp->isp_iocb_dma);
+			mbs.param[6] = DMA_WD3(isp->isp_iocb_dma);
+			mbs.param[7] = DMA_WD2(isp->isp_iocb_dma);
 			isp_mboxcmd(isp, &mbs);
-			if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
-				FC_SCRATCH_RELEASE(isp, chan);
+			if (mbs.param[0] != MBOX_COMMAND_COMPLETE)
 				break;
-			}
-			MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan);
+
+			MEMORYBARRIER(isp, SYNC_IFORCPU, QENTRY_LEN, QENTRY_LEN, chan);
 			sp = (isp24xx_statusreq_t *) local;
-			isp_get_24xx_response(isp, &((isp24xx_statusreq_t *)fcp->isp_scratch)[1], sp);
-			FC_SCRATCH_RELEASE(isp, chan);
+			isp_get_24xx_response(isp, &((isp24xx_statusreq_t *)isp->isp_iocb)[1], sp);
 			if (sp->req_completion_status == 0) {
 				return (0);
 			}
@@ -4729,7 +4738,7 @@ isp_control(ispsoftc_t *isp, ispctl_t ct
 			break;
 		}
 		if (IS_24XX(isp)) {
-			isp24xx_abrt_t local, *ab = &local, *ab2;
+			isp24xx_abrt_t local, *ab = &local;
 			fcparam *fcp;
 			fcportdb_t *lp;
 
@@ -4753,31 +4762,23 @@ isp_control(ispsoftc_t *isp, ispctl_t ct
 			ab->abrt_tidlo = lp->portid;
 			ab->abrt_tidhi = lp->portid >> 16;
 			ab->abrt_vpidx = ISP_GET_VPIDX(isp, chan);
+			isp_put_24xx_abrt(isp, ab, isp->isp_iocb);
+			MEMORYBARRIER(isp, SYNC_IFORDEV, 0, 2 * QENTRY_LEN, chan);
 
 			ISP_MEMZERO(&mbs, sizeof (mbs));
 			MBSINIT(&mbs, MBOX_EXEC_COMMAND_IOCB_A64, MBLOGALL, 5000000);
 			mbs.param[1] = QENTRY_LEN;
-			mbs.param[2] = DMA_WD1(fcp->isp_scdma);
-			mbs.param[3] = DMA_WD0(fcp->isp_scdma);
-			mbs.param[6] = DMA_WD3(fcp->isp_scdma);
-			mbs.param[7] = DMA_WD2(fcp->isp_scdma);
+			mbs.param[2] = DMA_WD1(isp->isp_iocb_dma);
+			mbs.param[3] = DMA_WD0(isp->isp_iocb_dma);
+			mbs.param[6] = DMA_WD3(isp->isp_iocb_dma);
+			mbs.param[7] = DMA_WD2(isp->isp_iocb_dma);
 
-			if (FC_SCRATCH_ACQUIRE(isp, chan)) {
-				isp_prt(isp, ISP_LOGERR, sacq);
-				break;
-			}
-			isp_put_24xx_abrt(isp, ab, fcp->isp_scratch);
-			ab2 = (isp24xx_abrt_t *) &((uint8_t *)fcp->isp_scratch)[QENTRY_LEN];
-			ab2->abrt_nphdl = 0xdeaf;
-			MEMORYBARRIER(isp, SYNC_SFORDEV, 0, 2 * QENTRY_LEN, chan);
 			isp_mboxcmd(isp, &mbs);
-			if (mbs.param[0] != MBOX_COMMAND_COMPLETE) {
-				FC_SCRATCH_RELEASE(isp, chan);
+			if (mbs.param[0] != MBOX_COMMAND_COMPLETE)
 				break;
-			}
-			MEMORYBARRIER(isp, SYNC_SFORCPU, QENTRY_LEN, QENTRY_LEN, chan);
-			isp_get_24xx_abrt(isp, ab2, ab);
-			FC_SCRATCH_RELEASE(isp, chan);
+
+			MEMORYBARRIER(isp, SYNC_IFORCPU, QENTRY_LEN, QENTRY_LEN, chan);
+			isp_get_24xx_abrt(isp, &((isp24xx_abrt_t *)isp->isp_iocb)[1], ab);
 			if (ab->abrt_nphdl == ISP24XX_ABRT_OKAY) {
 				return (0);
 			}
@@ -6159,6 +6160,7 @@ isp_handle_other_response(ispsoftc_t *is
 			}
 		}
 		return (1);
+	case RQSTYPE_CT_PASSTHRU:
 	case RQSTYPE_VP_MODIFY:
 	case RQSTYPE_VP_CTRL:
 	case RQSTYPE_LOGIN:

Modified: projects/pnfs-server/sys/dev/isp/isp_freebsd.c
==============================================================================
--- projects/pnfs-server/sys/dev/isp/isp_freebsd.c	Tue Apr 12 20:23:09 2016	(r297869)
+++ projects/pnfs-server/sys/dev/isp/isp_freebsd.c	Tue Apr 12 20:50:25 2016	(r297870)
@@ -607,9 +607,10 @@ ispioctl(struct cdev *dev, u_long c, cad
 		nphdl = fct->loopid;
 		ISP_LOCK(isp);
 		if (IS_24XX(isp)) {
-			uint8_t local[QENTRY_LEN];
-			isp24xx_tmf_t *tmf;
-			isp24xx_statusreq_t *sp;
+			void *reqp;
+			uint8_t resp[QENTRY_LEN];
+			isp24xx_tmf_t tmf;
+			isp24xx_statusreq_t sp;
 			fcparam *fcp = FCPARAM(isp, chan);
 			fcportdb_t *lp;
 			int i;
@@ -625,39 +626,37 @@ ispioctl(struct cdev *dev, u_long c, cad
 				ISP_UNLOCK(isp);
 				break;
 			}
-			/* XXX VALIDATE LP XXX */
-			tmf = (isp24xx_tmf_t *) local;
-			ISP_MEMZERO(tmf, QENTRY_LEN);
-			tmf->tmf_header.rqs_entry_type = RQSTYPE_TSK_MGMT;
-			tmf->tmf_header.rqs_entry_count = 1;
-			tmf->tmf_nphdl = lp->handle;
-			tmf->tmf_delay = 2;
-			tmf->tmf_timeout = 4;
-			tmf->tmf_tidlo = lp->portid;
-			tmf->tmf_tidhi = lp->portid >> 16;
-			tmf->tmf_vpidx = ISP_GET_VPIDX(isp, chan);
-			tmf->tmf_lun[1] = fct->lun & 0xff;
+			ISP_MEMZERO(&tmf, sizeof(tmf));
+			tmf.tmf_header.rqs_entry_type = RQSTYPE_TSK_MGMT;
+			tmf.tmf_header.rqs_entry_count = 1;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



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