--- old/usr/src/uts/common/fs/swapfs/swap_vnops.c	Sat May 16 00:16:26 2015
+++ new/usr/src/uts/common/fs/swapfs/swap_vnops.c	Sat May 16 00:16:26 2015
@@ -651,7 +651,8 @@
 	doff = off;
 	dlen = PAGESIZE;
 
-	if (err = swap_newphysname(vp, off, &doff, &dlen, &pvp, &poff)) {
+	/* All newphysname() failure types are treated the same. */
+	if (swap_newphysname(vp, off, &doff, &dlen, &pvp, &poff) != 0) {
 		err = (flags == (B_ASYNC | B_FREE) ? ENOMEM : 0);
 		hat_setmod(pp);
 		page_io_unlock(pp);
@@ -695,8 +696,7 @@
 		/* Get new physical backing store for the page */
 		doff = off;
 		dlen = PAGESIZE;
-		if (err = swap_newphysname(vp, off, &doff, &dlen,
-		    &pvp, &poff)) {
+		if (swap_newphysname(vp, off, &doff, &dlen, &pvp, &poff) != 0) {
 			swap_otherfail++;
 			swap_otherpages += btop(klsz);
 			hat_setmod(pp);
--- old/usr/src/uts/common/fs/tmpfs/tmp_vnops.c	Sat May 16 00:16:26 2015
+++ new/usr/src/uts/common/fs/tmpfs/tmp_vnops.c	Sat May 16 00:16:26 2015
@@ -2026,9 +2026,10 @@
 	 * is when we ask a page to be written to physical backing store
 	 * and there is none. Ignore this because we might be dealing
 	 * with a swap page which does not have any backing store
-	 * on disk. In any other case we won't get this error over here.
+	 * on disk, though the newer SE_NODEV error should cover that.
+	 * In any other case we won't get this error over here.
 	 */
-	if (err == SE_NOSWAP)
+	if (err == SE_NOSWAP || err == SE_NODEV)
 		err = 0;
 	return (err);
 }
@@ -2091,15 +2092,15 @@
 	err = swap_newphysname(vp, offset, &io_off, &io_len, &pvp, &pstart);
 	ASSERT(err != SE_NOANON); /* anon slot must have been filled */
 	if (err) {
-		pvn_write_done(pplist, B_ERROR | B_WRITE | flags);
+		ASSERT(err == SE_NOSWAP || err == SE_NODEV);
+		pvn_write_done(pplist, (err == SE_NODEV ? 0 : B_ERROR) |
+		    B_WRITE | flags);
 		/*
 		 * If this routine is called as a result of segvn_sync
 		 * operation and we have no physical swap then we can get an
 		 * error here. In such case we would return SE_NOSWAP as error.
-		 * At this point, we expect only SE_NOSWAP.
 		 */
-		ASSERT(err == SE_NOSWAP);
-		if (flags & B_INVAL)
+		if ((flags & B_INVAL) && err == SE_NOSWAP)
 			err = ENOMEM;
 		goto out;
 	}
@@ -2143,7 +2144,7 @@
 		tmp_putpagecnt++;
 		tmp_pagespushed += btop(io_len);
 	}
-	if (err && err != ENOMEM && err != SE_NOSWAP)
+	if (err && err != ENOMEM && err != SE_NOSWAP && err != SE_NODEV)
 		cmn_err(CE_WARN, "tmp_putapage: err %d\n", err);
 	return (err);
 }
--- old/usr/src/uts/common/sys/swap.h	Sat May 16 00:16:26 2015
+++ new/usr/src/uts/common/sys/swap.h	Sat May 16 00:16:26 2015
@@ -208,6 +208,7 @@
 /* Special error codes for swap_newphysname() */
 #define	SE_NOSWAP	-1	/* No physical swap slots available */
 #define	SE_NOANON	-2	/* No anon slot for swap slot */
+#define	SE_NODEV	-3	/* No swap devices on this machine. */
 
 #ifdef _KERNEL
 extern struct anon *swap_anon(struct vnode *vp, u_offset_t off);
--- old/usr/src/uts/common/vm/vm_swap.c	Sat May 16 00:16:26 2015
+++ new/usr/src/uts/common/vm/vm_swap.c	Sat May 16 00:16:26 2015
@@ -20,6 +20,7 @@
  */
 /*
  * Copyright (c) 1987, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
  */
 
 /*	Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T	*/
@@ -134,7 +135,8 @@
  * 		the one containing input (*vpp, *offp).
  * Less slots than requested may be returned. *lenp allocated slots are
  * returned starting at *offp on *vpp.
- * Returns 1 for a successful allocation, 0 for couldn't allocate any slots.
+ * Returns 1 for a successful allocation, 0 for couldn't allocate any slots,
+ * and -1 when there are no swap devices on this system.
  */
 int
 swap_phys_alloc(
@@ -148,6 +150,11 @@
 	size_t len;
 
 	mutex_enter(&swapinfo_lock);
+	if (swapinfo == NULL) {
+		/* NO SWAP DEVICES on this system currently. */
+		mutex_exit(&swapinfo_lock);
+		return (-1);
+	}
 	sip = silast;
 
 	/* Find a desirable physical device and allocate from it. */
@@ -1658,6 +1665,7 @@
  * Returns 	0 for success
  * 		SE_NOANON -- no anon slot for requested paged
  *		SE_NOSWAP -- no physical swap space available
+ *		SE_NODEV -- no swap devices on this system
  */
 int
 swap_newphysname(
@@ -1680,7 +1688,8 @@
 
 	/* Get new physical swap slots. */
 	plen = *lenp;
-	if (!swap_phys_alloc(&pvp, &pstart, &plen, 0)) {
+	error = swap_phys_alloc(&pvp, &pstart, &plen, 0);
+	if (error != 1) {
 		/*
 		 * No swap available so return error unless requested
 		 * offset is already backed in which case return that.
@@ -1692,7 +1701,7 @@
 			mutex_exit(ahm);
 			return (error);
 		}
-		error = (ap->an_pvp ? 0 : SE_NOSWAP);
+		error = (ap->an_pvp ? 0 : (error == 0) ? SE_NOSWAP : SE_NODEV);
 		*offp = offset;
 		*lenp = PAGESIZE;
 		*pvpp = ap->an_pvp;
