changeset 2051:50a87bae0c3a

5083170 need mechanism to report non-recoverable ESTALE error
author prabahar
date Wed, 24 May 2006 12:01:59 -0700
parents 6648ed7f9bd5
children 57f471a118c3
files usr/src/uts/common/fs/fs_subr.c usr/src/uts/common/fs/fs_subr.h usr/src/uts/common/fs/vnode.c usr/src/uts/common/syscall/access.c usr/src/uts/common/syscall/acl.c usr/src/uts/common/syscall/chdir.c usr/src/uts/common/syscall/pathconf.c usr/src/uts/common/syscall/readlink.c usr/src/uts/common/syscall/stat.c usr/src/uts/common/syscall/statfs.c usr/src/uts/common/syscall/statvfs.c usr/src/uts/common/syscall/symlink.c
diffstat 12 files changed, 123 insertions(+), 77 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/fs/fs_subr.c	Wed May 24 11:43:15 2006 -0700
+++ b/usr/src/uts/common/fs/fs_subr.c	Wed May 24 12:01:59 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -24,7 +23,7 @@
 
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -62,6 +61,11 @@
 static callb_cpr_t *frlock_serialize_blocked(flk_cb_when_t, void *);
 
 /*
+ * Tunable to limit the number of retry to recover from STALE error.
+ */
+int fs_estale_retry = 5;
+
+/*
  * The associated operation is not supported by the file system.
  */
 int
@@ -714,3 +718,15 @@
 	}
 	return (isnontrivial);
 }
+
+/*
+ * Check whether we need a retry to recover from STALE error.
+ */
+int
+fs_need_estale_retry(int retry_count)
+{
+	if (retry_count < fs_estale_retry)
+		return (1);
+	else
+		return (0);
+}
--- a/usr/src/uts/common/fs/fs_subr.h	Wed May 24 11:43:15 2006 -0700
+++ b/usr/src/uts/common/fs/fs_subr.h	Wed May 24 12:01:59 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -23,7 +22,7 @@
 /*	  All Rights Reserved  	*/
 
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -82,6 +81,7 @@
 extern int	fs_vnevent_nosupport(vnode_t *, vnevent_t);
 extern int	fs_vnevent_support(vnode_t *, vnevent_t);
 extern int	fs_acl_nontrivial(struct vnode *vp, struct cred *cr);
+extern int	fs_need_estale_retry(int);
 
 #endif	/* _KERNEL */
 
--- a/usr/src/uts/common/fs/vnode.c	Wed May 24 11:43:15 2006 -0700
+++ b/usr/src/uts/common/fs/vnode.c	Wed May 24 12:01:59 2006 -0700
@@ -808,6 +808,7 @@
 	int in_crit = 0;
 	struct vattr vattr;
 	enum symfollow follow;
+	int estale_retry = 0;
 
 	mode = 0;
 	if (filemode & FREAD)
@@ -851,7 +852,8 @@
 		 */
 		if (error = lookupnameat(pnamep, seg, follow,
 		    NULLVPP, &vp, startvp)) {
-			if (error == ESTALE)
+			if ((error == ESTALE) &&
+			    fs_need_estale_retry(estale_retry++))
 				goto top;
 			return (error);
 		}
@@ -1011,7 +1013,7 @@
 		 * above instead of looping around from here.
 		 */
 		VN_RELE(vp);
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto top;
 	} else
 		*vpp = vp;
@@ -1057,6 +1059,7 @@
 	int in_crit = 0;
 	struct vattr vattr;
 	enum symfollow follow;
+	int estale_retry = 0;
 
 	ASSERT((vap->va_mask & (AT_TYPE|AT_MODE)) == (AT_TYPE|AT_MODE));
 
@@ -1096,7 +1099,7 @@
 	    (excl == EXCL) ? NULLVPP : vpp, startvp);
 	if (error) {
 		pn_free(&pn);
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto top;
 		if (why == CRMKDIR && error == EINVAL)
 			error = EEXIST;		/* SVID */
@@ -1309,7 +1312,7 @@
 	 * of the file will fail and the error will be returned
 	 * above instead of looping around from here.
 	 */
-	if (error == ESTALE)
+	if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 		goto top;
 	return (error);
 }
@@ -1323,6 +1326,7 @@
 	int error;
 	struct vattr vattr;
 	dev_t fsid;
+	int estale_retry = 0;
 
 top:
 	fvp = tdvp = NULL;
@@ -1362,7 +1366,7 @@
 		VN_RELE(fvp);
 	if (tdvp)
 		VN_RELE(tdvp);
-	if (error == ESTALE)
+	if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 		goto top;
 	return (error);
 }
@@ -1385,6 +1389,7 @@
 	int in_crit = 0;
 	vnode_t *fromvp, *fvp;
 	vnode_t *tovp;
+	int estale_retry = 0;
 
 top:
 	fvp = fromvp = tovp = NULL;
@@ -1486,7 +1491,7 @@
 		VN_RELE(tovp);
 	if (fvp)
 		VN_RELE(fvp);
-	if (error == ESTALE)
+	if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 		goto top;
 	return (error);
 }
@@ -1512,6 +1517,7 @@
 	struct vfs *vfsp;
 	struct vfs *dvfsp;	/* ptr to parent dir vfs */
 	int in_crit = 0;
+	int estale_retry = 0;
 
 top:
 	if (error = pn_get(fnamep, seg, &pn))
@@ -1519,7 +1525,7 @@
 	dvp = vp = NULL;
 	if (error = lookuppnat(&pn, NULL, NO_FOLLOW, &dvp, &vp, startvp)) {
 		pn_free(&pn);
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto top;
 		return (error);
 	}
@@ -1648,7 +1654,7 @@
 		VN_RELE(vp);
 	if (dvp != NULL)
 		VN_RELE(dvp);
-	if (error == ESTALE)
+	if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 		goto top;
 	return (error);
 }
--- a/usr/src/uts/common/syscall/access.c	Wed May 24 11:43:15 2006 -0700
+++ b/usr/src/uts/common/syscall/access.c	Wed May 24 12:01:59 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -46,6 +45,7 @@
 #include <sys/uio.h>
 #include <sys/cmn_err.h>
 #include <sys/debug.h>
+#include <fs/fs_subr.h>
 
 /*
  * Determine accessibility of file.
@@ -65,6 +65,7 @@
 	int mode;
 	int eok;
 	cred_t *cr;
+	int estale_retry = 0;
 
 	if (fmode & ~(E_OK|R_OK|W_OK|X_OK))
 		return (set_errno(EINVAL));
@@ -89,7 +90,7 @@
 
 lookup:
 	if (error = lookupname(fname, UIO_USERSPACE, FOLLOW, NULLVPP, &vp)) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		if (!eok)
 			crfree(tmpcr);
@@ -99,7 +100,8 @@
 	if (mode) {
 		error = VOP_ACCESS(vp, mode, 0, tmpcr);
 		if (error) {
-			if (error == ESTALE) {
+			if ((error == ESTALE) &&
+			    fs_need_estale_retry(estale_retry++)) {
 				VN_RELE(vp);
 				goto lookup;
 			}
--- a/usr/src/uts/common/syscall/acl.c	Wed May 24 11:43:15 2006 -0700
+++ b/usr/src/uts/common/syscall/acl.c	Wed May 24 12:01:59 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -56,6 +55,7 @@
 
 #include <sys/unistd.h>
 #include <sys/debug.h>
+#include <fs/fs_subr.h>
 
 static int cacl(int cmd, int nentries, void *aclbufp,
     vnode_t *vp, int *rv);
@@ -69,6 +69,7 @@
 	struct vnode *vp;
 	int error;
 	int rv = 0;
+	int estale_retry = 0;
 
 	/* Sanity check arguments */
 	if (fname == NULL)
@@ -76,7 +77,7 @@
 lookup:
 	error = lookupname((char *)fname, UIO_USERSPACE, FOLLOW, NULLVPP, &vp);
 	if (error) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
@@ -84,7 +85,7 @@
 	error = cacl(cmd, nentries, aclbufp, vp, &rv);
 	VN_RELE(vp);
 	if (error) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
--- a/usr/src/uts/common/syscall/chdir.c	Wed May 24 11:43:15 2006 -0700
+++ b/usr/src/uts/common/syscall/chdir.c	Wed May 24 12:01:59 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -60,6 +59,7 @@
 
 #include <sys/debug.h>
 #include <c2/audit.h>
+#include <fs/fs_subr.h>
 
 /*
  * Change current working directory (".").
@@ -71,17 +71,18 @@
 {
 	vnode_t *vp;
 	int error;
+	int estale_retry = 0;
 
 lookup:
 	if (error = lookupname(fname, UIO_USERSPACE, FOLLOW, NULLVPP, &vp)) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
 
 	error = chdirec(vp, 0, 1);
 	if (error) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
@@ -117,17 +118,18 @@
 {
 	vnode_t *vp;
 	int error;
+	int estale_retry = 0;
 
 lookup:
 	if (error = lookupname(fname, UIO_USERSPACE, FOLLOW, NULLVPP, &vp)) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
 
 	error = chdirec(vp, 1, 1);
 	if (error) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
--- a/usr/src/uts/common/syscall/pathconf.c	Wed May 24 11:43:15 2006 -0700
+++ b/usr/src/uts/common/syscall/pathconf.c	Wed May 24 12:01:59 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -47,6 +46,7 @@
 #include <sys/file.h>
 #include <sys/uio.h>
 #include <sys/debug.h>
+#include <fs/fs_subr.h>
 
 /*
  * Common code for pathconf(), fpathconf() system calls
@@ -113,10 +113,11 @@
 	vnode_t *vp;
 	long	retval;
 	int	error;
+	int 	estale_retry = 0;
 
 lookup:
 	if (error = lookupname(fname, UIO_USERSPACE, FOLLOW, NULLVPP, &vp)) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return ((long)set_errno(error));
 	}
--- a/usr/src/uts/common/syscall/readlink.c	Wed May 24 11:43:15 2006 -0700
+++ b/usr/src/uts/common/syscall/readlink.c	Wed May 24 12:01:59 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -46,6 +45,7 @@
 #include <sys/file.h>
 #include <sys/uio.h>
 #include <sys/debug.h>
+#include <fs/fs_subr.h>
 
 /*
  * Read the contents of a symbolic link.
@@ -59,13 +59,14 @@
 	int error;
 	struct vattr vattr;
 	ssize_t cnt;
+	int estale_retry = 0;
 
 	if ((cnt = (ssize_t)count) < 0)
 		return (set_errno(EINVAL));
 
 lookup:
 	if (error = lookupname(name, UIO_USERSPACE, NO_FOLLOW, NULLVPP, &vp)) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
@@ -79,7 +80,8 @@
 		error = VOP_GETATTR(vp, &vattr, 0, CRED());
 		if (error || vattr.va_type != VLNK) {
 			VN_RELE(vp);
-			if (error == ESTALE)
+			if ((error == ESTALE) &&
+			    fs_need_estale_retry(estale_retry++))
 				goto lookup;
 			return (set_errno(EINVAL));
 		}
@@ -95,7 +97,7 @@
 	error = VOP_READLINK(vp, &auio, CRED());
 	VN_RELE(vp);
 	if (error) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
--- a/usr/src/uts/common/syscall/stat.c	Wed May 24 11:43:15 2006 -0700
+++ b/usr/src/uts/common/syscall/stat.c	Wed May 24 12:01:59 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -57,6 +56,7 @@
 #include <sys/debug.h>
 #include <sys/cmn_err.h>
 #include <c2/audit.h>
+#include <fs/fs_subr.h>
 
 /*
  * Get the vp to be stated and the cred to be used for the call
@@ -79,6 +79,7 @@
 	file_t *fp;
 	int error;
 	cred_t *cr;
+	int estale_retry = 0;
 
 	*vp = NULL;
 
@@ -129,7 +130,8 @@
 lookup:
 		if (error = lookupnameat(name, UIO_USERSPACE, follow, NULLVPP,
 		    vp, startvp)) {
-			if (error == ESTALE)
+			if ((error == ESTALE) &&
+			    fs_need_estale_retry(estale_retry++))
 				goto lookup;
 			if (startvp != NULL)
 				VN_RELE(startvp);
@@ -308,6 +310,7 @@
 	int error;
 	cred_t *cred;
 	int link_follow;
+	int estale_retry = 0;
 
 	link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW;
 lookup:
@@ -319,6 +322,7 @@
 out:
 	if (error != 0) {
 		if (error == ESTALE &&
+		    fs_need_estale_retry(estale_retry++) &&
 		    (nmflag == 1 || (nmflag == 2 && name != NULL)))
 			goto lookup;
 		return (set_errno(error));
@@ -446,6 +450,7 @@
 	int error;
 	cred_t *cred;
 	int link_follow;
+	int estale_retry = 0;
 
 	link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW;
 lookup:
@@ -457,6 +462,7 @@
 out:
 	if (error != 0) {
 		if (error == ESTALE &&
+		    fs_need_estale_retry(estale_retry++) &&
 		    (nmflag == 1 || (nmflag == 2 && name != NULL)))
 			goto lookup;
 		return (set_errno(error));
@@ -544,6 +550,7 @@
 	int error;
 	cred_t *cred;
 	int link_follow;
+	int estale_retry = 0;
 
 	link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW;
 lookup:
@@ -555,6 +562,7 @@
 out:
 	if (error != 0) {
 		if (error == ESTALE &&
+		    fs_need_estale_retry(estale_retry++) &&
 		    (nmflag == 1 || (nmflag == 2 && name != NULL)))
 			goto lookup;
 		return (set_errno(error));
@@ -653,6 +661,7 @@
 	int error;
 	cred_t *cred;
 	int link_follow;
+	int estale_retry = 0;
 
 	link_follow = (follow == AT_SYMLINK_NOFOLLOW) ? NO_FOLLOW : FOLLOW;
 lookup:
@@ -664,6 +673,7 @@
 out:
 	if (error != 0) {
 		if (error == ESTALE &&
+		    fs_need_estale_retry(estale_retry++) &&
 		    (nmflag == 1 || (nmflag == 2 && name != NULL)))
 			goto lookup;
 		return (set_errno(error));
--- a/usr/src/uts/common/syscall/statfs.c	Wed May 24 11:43:15 2006 -0700
+++ b/usr/src/uts/common/syscall/statfs.c	Wed May 24 12:01:59 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -50,6 +49,7 @@
 #include <sys/pathname.h>
 
 #include <vm/page.h>
+#include <fs/fs_subr.h>
 
 #if defined(_SYSCALL32_IMPL) || defined(_ILP32)
 
@@ -68,10 +68,11 @@
 {
 	vnode_t *vp;
 	int error;
+	int estale_retry = 0;
 
 lookup:
 	if (error = lookupname(fname, UIO_USERSPACE, FOLLOW, NULLVPP, &vp)) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
@@ -81,7 +82,7 @@
 		error = cstatfs(vp->v_vfsp, sbp, len);
 	VN_RELE(vp);
 	if (error) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
--- a/usr/src/uts/common/syscall/statvfs.c	Wed May 24 11:43:15 2006 -0700
+++ b/usr/src/uts/common/syscall/statvfs.c	Wed May 24 12:01:59 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2001 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -54,6 +53,7 @@
 #include <sys/pathname.h>
 
 #include <vm/page.h>
+#include <fs/fs_subr.h>
 
 #define	STATVFSCOPY(dst, src)					\
 	(dst)->f_bsize	= (src)->f_bsize;			\
@@ -164,10 +164,11 @@
 {
 	vnode_t *vp;
 	int error;
+	int estale_retry = 0;
 
 lookup:
 	if (error = lookupname(fname, UIO_USERSPACE, FOLLOW, NULLVPP, &vp)) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
@@ -178,7 +179,7 @@
 #endif
 	VN_RELE(vp);
 	if (error) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
@@ -218,17 +219,18 @@
 {
 	vnode_t *vp;
 	int error;
+	int estale_retry = 0;
 
 lookup:
 	if (error = lookupname(fname, UIO_USERSPACE, FOLLOW, NULLVPP, &vp)) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
 	error = cstatvfs64(vp->v_vfsp, sbp);
 	VN_RELE(vp);
 	if (error) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
@@ -291,17 +293,18 @@
 {
 	vnode_t *vp;
 	int error;
+	int estale_retry = 0;
 
 lookup:
 	if (error = lookupname(fname, UIO_USERSPACE, FOLLOW, NULLVPP, &vp)) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
 	error = cstatvfs32(vp->v_vfsp, sbp);
 	VN_RELE(vp);
 	if (error) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
@@ -331,17 +334,18 @@
 {
 	vnode_t *vp;
 	int error;
+	int estale_retry = 0;
 
 lookup:
 	if (error = lookupname(fname, UIO_USERSPACE, FOLLOW, NULLVPP, &vp)) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
 	error = cstatvfs64_32(vp->v_vfsp, sbp);
 	VN_RELE(vp);
 	if (error) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto lookup;
 		return (set_errno(error));
 	}
--- a/usr/src/uts/common/syscall/symlink.c	Wed May 24 11:43:15 2006 -0700
+++ b/usr/src/uts/common/syscall/symlink.c	Wed May 24 12:01:59 2006 -0700
@@ -2,9 +2,8 @@
  * CDDL HEADER START
  *
  * The contents of this file are subject to the terms of the
- * Common Development and Distribution License, Version 1.0 only
- * (the "License").  You may not use this file except in compliance
- * with the License.
+ * Common Development and Distribution License (the "License").
+ * You may not use this file except in compliance with the License.
  *
  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
  * or http://www.opensolaris.org/os/licensing.
@@ -20,7 +19,7 @@
  * CDDL HEADER END
  */
 /*
- * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -47,6 +46,7 @@
 #include <sys/uio.h>
 #include <sys/debug.h>
 #include <c2/audit.h>
+#include <fs/fs_subr.h>
 
 /*
  * Create a symbolic link.  Similar to link or rename except target
@@ -61,13 +61,14 @@
 	char *tbuf;
 	size_t tlen;
 	int error;
+	int estale_retry = 0;
 
 top:
 	if (error = pn_get(linkname, UIO_USERSPACE, &lpn))
 		return (set_errno(error));
 	if (error = lookuppn(&lpn, NULL, NO_FOLLOW, &dvp, NULLVPP)) {
 		pn_free(&lpn);
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto top;
 		return (set_errno(error));
 	}
@@ -94,7 +95,7 @@
 	pn_free(&lpn);
 	VN_RELE(dvp);
 	if (error) {
-		if (error == ESTALE)
+		if ((error == ESTALE) && fs_need_estale_retry(estale_retry++))
 			goto top;
 		return (set_errno(error));
 	}