changeset 4324:696de332c6cf

6538758 Sporadic I/O error will cause data corruption in Veritas CFS with VMODSORT mode on.
author qiao
date Fri, 25 May 2007 07:26:17 -0700
parents c2d671276f97
children bf0932baf75c
files usr/src/uts/common/vm/hat.h usr/src/uts/common/vm/vm_pvn.c usr/src/uts/i86pc/vm/hat_i86.c usr/src/uts/sfmmu/vm/hat_sfmmu.c
diffstat 4 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/vm/hat.h	Fri May 25 06:08:28 2007 -0700
+++ b/usr/src/uts/common/vm/hat.h	Fri May 25 07:26:17 2007 -0700
@@ -19,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -465,12 +465,14 @@
 #define	P_MOD	0x1		/* the modified bit */
 #define	P_REF	0x2		/* the referenced bit */
 #define	P_RO	0x4		/* Read only page */
+#define	P_NSH	0x8		/* Not to shuffle v_pages */
 
 #define	hat_ismod(pp)		(hat_page_getattr(pp, P_MOD))
 #define	hat_isref(pp)		(hat_page_getattr(pp, P_REF))
 #define	hat_isro(pp)		(hat_page_getattr(pp, P_RO))
 
 #define	hat_setmod(pp)		(hat_page_setattr(pp, P_MOD))
+#define	hat_setmod_only(pp)	(hat_page_setattr(pp, P_MOD|P_NSH))
 #define	hat_setref(pp)		(hat_page_setattr(pp, P_REF))
 #define	hat_setrefmod(pp)	(hat_page_setattr(pp, P_REF|P_MOD))
 
--- a/usr/src/uts/common/vm/vm_pvn.c	Fri May 25 06:08:28 2007 -0700
+++ b/usr/src/uts/common/vm/vm_pvn.c	Fri May 25 07:26:17 2007 -0700
@@ -401,7 +401,7 @@
 		if (vp == NULL)
 			vp = pp->p_vnode;
 
-		if (IS_VMODSORT(vp)) {
+		if (((flags & B_ERROR) == 0) && IS_VMODSORT(vp)) {
 			/*
 			 * Move page to the top of the v_page list.
 			 * Skip pages modified during IO.
@@ -431,7 +431,7 @@
 				/*LINTED: constant in conditional context*/
 				VN_DISPOSE(pp, B_INVAL, 0, kcred);
 			} else {
-				hat_setmod(pp);
+				hat_setmod_only(pp);
 				page_io_unlock(pp);
 				page_unlock(pp);
 			}
--- a/usr/src/uts/i86pc/vm/hat_i86.c	Fri May 25 06:08:28 2007 -0700
+++ b/usr/src/uts/i86pc/vm/hat_i86.c	Fri May 25 07:26:17 2007 -0700
@@ -2935,11 +2935,16 @@
 	vnode_t		*vp = pp->p_vnode;
 	kmutex_t	*vphm = NULL;
 	page_t		**listp;
+	int		noshuffle;
+
+	noshuffle = flag & P_NSH;
+	flag &= ~P_NSH;
 
 	if (PP_GETRM(pp, flag) == flag)
 		return;
 
-	if ((flag & P_MOD) != 0 && vp != NULL && IS_VMODSORT(vp)) {
+	if ((flag & P_MOD) != 0 && vp != NULL && IS_VMODSORT(vp) &&
+	    !noshuffle) {
 		vphm = page_vnode_mutex(vp);
 		mutex_enter(vphm);
 	}
--- a/usr/src/uts/sfmmu/vm/hat_sfmmu.c	Fri May 25 06:08:28 2007 -0700
+++ b/usr/src/uts/sfmmu/vm/hat_sfmmu.c	Fri May 25 07:26:17 2007 -0700
@@ -7003,6 +7003,10 @@
 	page_t		**listp;
 	kmutex_t	*pmtx;
 	kmutex_t	*vphm = NULL;
+	int		noshuffle;
+
+	noshuffle = flag & P_NSH;
+	flag &= ~P_NSH;
 
 	ASSERT(!(flag & ~(P_MOD | P_REF | P_RO)));
 
@@ -7012,7 +7016,8 @@
 	if ((pp->p_nrm & flag) == flag)
 		return;
 
-	if ((flag & P_MOD) != 0 && vp != NULL && IS_VMODSORT(vp)) {
+	if ((flag & P_MOD) != 0 && vp != NULL && IS_VMODSORT(vp) &&
+	    !noshuffle) {
 		vphm = page_vnode_mutex(vp);
 		mutex_enter(vphm);
 	}