From owner-svn-src-stable-7@FreeBSD.ORG  Mon Dec 15 03:56:55 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id D24051065670;
	Mon, 15 Dec 2008 03:56:55 +0000 (UTC)
	(envelope-from daichi@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BB3048FC14;
	Mon, 15 Dec 2008 03:56:55 +0000 (UTC)
	(envelope-from daichi@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBF3usX5083431;
	Mon, 15 Dec 2008 03:56:54 GMT (envelope-from daichi@svn.freebsd.org)
Received: (from daichi@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBF3usVA083427;
	Mon, 15 Dec 2008 03:56:54 GMT (envelope-from daichi@svn.freebsd.org)
Message-Id: <200812150356.mBF3usVA083427@svn.freebsd.org>
From: Daichi GOTO <daichi@FreeBSD.org>
Date: Mon, 15 Dec 2008 03:56:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186110 - stable/7/sys/fs/unionfs
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Dec 2008 03:56:56 -0000

Author: daichi
Date: Mon Dec 15 03:56:54 2008
New Revision: 186110
URL: http://svn.freebsd.org/changeset/base/186110

Log:
  MFC r185284, r185283
  
  PR:		118346
  Submitted by:	Masanori OZAWA <ozawa@ongs.co.jp>, trasz
  Discussed at:	devsummit Strassburg, EuroBSDCon2008
  Discussed with:	rwatson, gnn, hrs
  Approved by:	re (gnn)

Modified:
  stable/7/sys/fs/unionfs/union.h
  stable/7/sys/fs/unionfs/union_subr.c
  stable/7/sys/fs/unionfs/union_vfsops.c
  stable/7/sys/fs/unionfs/union_vnops.c

Modified: stable/7/sys/fs/unionfs/union.h
==============================================================================
--- stable/7/sys/fs/unionfs/union.h	Mon Dec 15 02:06:02 2008	(r186109)
+++ stable/7/sys/fs/unionfs/union.h	Mon Dec 15 03:56:54 2008	(r186110)
@@ -117,6 +117,7 @@ void unionfs_create_uppervattr_core(stru
 int unionfs_create_uppervattr(struct unionfs_mount *ump, struct vnode *lvp, struct vattr *uva, struct ucred *cred, struct thread *td);
 int unionfs_mkshadowdir(struct unionfs_mount *ump, struct vnode *duvp, struct unionfs_node *unp, struct componentname *cnp, struct thread *td);
 int unionfs_mkwhiteout(struct vnode *dvp, struct componentname *cnp, struct thread *td, char *path);
+int unionfs_relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, struct componentname *cn, struct thread *td, char *path, int pathlen, u_long nameiop);
 int unionfs_relookup_for_create(struct vnode *dvp, struct componentname *cnp, struct thread *td);
 int unionfs_relookup_for_delete(struct vnode *dvp, struct componentname *cnp, struct thread *td);
 int unionfs_relookup_for_rename(struct vnode *dvp, struct componentname *cnp, struct thread *td);

Modified: stable/7/sys/fs/unionfs/union_subr.c
==============================================================================
--- stable/7/sys/fs/unionfs/union_subr.c	Mon Dec 15 02:06:02 2008	(r186109)
+++ stable/7/sys/fs/unionfs/union_subr.c	Mon Dec 15 03:56:54 2008	(r186110)
@@ -103,10 +103,10 @@ unionfs_get_hashhead(struct vnode *dvp, 
 }
 
 /*
- * Get the cached vnode. (only VDIR)
+ * Get the cached vnode.
  */
 static struct vnode *
-unionfs_get_cached_vdir(struct vnode *uvp, struct vnode *lvp,
+unionfs_get_cached_vnode(struct vnode *uvp, struct vnode *lvp,
 			struct vnode *dvp, char *path)
 {
 	struct unionfs_node_hashhead *hd;
@@ -114,9 +114,9 @@ unionfs_get_cached_vdir(struct vnode *uv
 	struct vnode   *vp;
 
 	KASSERT((uvp == NULLVP || uvp->v_type == VDIR),
-	        ("unionfs_get_cached_vdir: v_type != VDIR"));
+	    ("unionfs_get_cached_vnode: v_type != VDIR"));
 	KASSERT((lvp == NULLVP || lvp->v_type == VDIR),
-	        ("unionfs_get_cached_vdir: v_type != VDIR"));
+	    ("unionfs_get_cached_vnode: v_type != VDIR"));
 
 	VI_LOCK(dvp);
 	hd = unionfs_get_hashhead(dvp, path);
@@ -140,10 +140,10 @@ unionfs_get_cached_vdir(struct vnode *uv
 }
 
 /*
- * Add the new vnode into cache. (only VDIR)
+ * Add the new vnode into cache.
  */
 static struct vnode *
-unionfs_ins_cached_vdir(struct unionfs_node *uncp,
+unionfs_ins_cached_vnode(struct unionfs_node *uncp,
 			struct vnode *dvp, char *path)
 {
 	struct unionfs_node_hashhead *hd;
@@ -151,9 +151,9 @@ unionfs_ins_cached_vdir(struct unionfs_n
 	struct vnode   *vp;
 
 	KASSERT((uncp->un_uppervp==NULLVP || uncp->un_uppervp->v_type==VDIR),
-	        ("unionfs_ins_cached_vdir: v_type != VDIR"));
+	    ("unionfs_ins_cached_vnode: v_type != VDIR"));
 	KASSERT((uncp->un_lowervp==NULLVP || uncp->un_lowervp->v_type==VDIR),
-	        ("unionfs_ins_cached_vdir: v_type != VDIR"));
+	    ("unionfs_ins_cached_vnode: v_type != VDIR"));
 
 	VI_LOCK(dvp);
 	hd = unionfs_get_hashhead(dvp, path);
@@ -180,16 +180,16 @@ unionfs_ins_cached_vdir(struct unionfs_n
 }
 
 /*
- * Remove the vnode. (only VDIR)
+ * Remove the vnode.
  */
 static void
-unionfs_rem_cached_vdir(struct unionfs_node *unp, struct vnode *dvp)
+unionfs_rem_cached_vnode(struct unionfs_node *unp, struct vnode *dvp)
 {
-	KASSERT((unp != NULL), ("unionfs_rem_cached_vdir: null node"));
+	KASSERT((unp != NULL), ("unionfs_rem_cached_vnode: null node"));
 	KASSERT((dvp != NULLVP),
-	    ("unionfs_rem_cached_vdir: null parent vnode"));
+	    ("unionfs_rem_cached_vnode: null parent vnode"));
 	KASSERT((unp->un_hash.le_prev != NULL),
-	    ("unionfs_rem_cached_vdir: null hash"));
+	    ("unionfs_rem_cached_vnode: null hash"));
 
 	VI_LOCK(dvp);
 	LIST_REMOVE(unp, un_hash);
@@ -233,9 +233,9 @@ unionfs_nodeget(struct mount *mp, struct
 	if (cnp && !(cnp->cn_flags & ISLASTCN))
 		path = NULL;
 
-	/* check the vdir cache */
+	/* check the cache */
 	if (path != NULL && dvp != NULLVP && vt == VDIR) {
-		vp = unionfs_get_cached_vdir(uppervp, lowervp, dvp, path);
+		vp = unionfs_get_cached_vnode(uppervp, lowervp, dvp, path);
 		if (vp != NULLVP) {
 			vref(vp);
 			*vpp = vp;
@@ -255,17 +255,17 @@ unionfs_nodeget(struct mount *mp, struct
 	 * might cause a bogus v_data pointer to get dereferenced elsewhere
 	 * if MALLOC should block.
 	 */
-	MALLOC(unp, struct unionfs_node *, sizeof(struct unionfs_node),
+	unp = malloc(sizeof(struct unionfs_node),
 	    M_UNIONFSNODE, M_WAITOK | M_ZERO);
 
 	error = getnewvnode("unionfs", mp, &unionfs_vnodeops, &vp);
 	if (error != 0) {
-		FREE(unp, M_UNIONFSNODE);
+		free(unp, M_UNIONFSNODE);
 		return (error);
 	}
 	error = insmntque(vp, mp);	/* XXX: Too early for mpsafe fs */
 	if (error != 0) {
-		FREE(unp, M_UNIONFSNODE);
+		free(unp, M_UNIONFSNODE);
 		return (error);
 	}
 	if (dvp != NULLVP)
@@ -302,7 +302,7 @@ unionfs_nodeget(struct mount *mp, struct
 		vp->v_vflag |= VV_ROOT;
 
 	if (path != NULL && dvp != NULLVP && vt == VDIR)
-		*vpp = unionfs_ins_cached_vdir(unp, dvp, path);
+		*vpp = unionfs_ins_cached_vnode(unp, dvp, path);
 	if ((*vpp) != NULLVP) {
 		if (dvp != NULLVP)
 			vrele(dvp);
@@ -363,7 +363,7 @@ unionfs_noderem(struct vnode *vp, struct
 	vp->v_object = NULL;
 
 	if (dvp != NULLVP && unp->un_hash.le_prev != NULL)
-		unionfs_rem_cached_vdir(unp, dvp);
+		unionfs_rem_cached_vnode(unp, dvp);
 
 	if (lvp != NULLVP) {
 		vfslocked = VFS_LOCK_GIANT(lvp->v_mount);
@@ -402,7 +402,7 @@ unionfs_noderem(struct vnode *vp, struct
 		LIST_REMOVE(unsp, uns_list);
 		free(unsp, M_TEMP);
 	}
-	FREE(unp, M_UNIONFSNODE);
+	free(unp, M_UNIONFSNODE);
 }
 
 /*
@@ -427,8 +427,8 @@ unionfs_get_node_status(struct unionfs_n
 	}
 
 	/* create a new unionfs node status */
-	MALLOC(unsp, struct unionfs_node_status *,
-	    sizeof(struct unionfs_node_status), M_TEMP, M_WAITOK | M_ZERO);
+	unsp = malloc(sizeof(struct unionfs_node_status),
+	    M_TEMP, M_WAITOK | M_ZERO);
 
 	unsp->uns_pid = pid;
 	LIST_INSERT_HEAD(&(unp->un_unshead), unsp, uns_list);
@@ -527,7 +527,7 @@ unionfs_create_uppervattr(struct unionfs
  * locked, referenced vnode. If *vpp == dvp then remember that only one
  * LK_EXCLUSIVE lock is held.
  */
-static int
+int
 unionfs_relookup(struct vnode *dvp, struct vnode **vpp,
 		 struct componentname *cnp, struct componentname *cn,
 		 struct thread *td, char *path, int pathlen, u_long nameiop)
@@ -718,6 +718,7 @@ unionfs_node_update(struct unionfs_node 
 
 	vp = UNIONFSTOV(unp);
 	lvp = unp->un_lowervp;
+	ASSERT_VOP_ELOCKED(lvp, "unionfs_node_update");
 	dvp = unp->un_dvp;
 
 	/*

Modified: stable/7/sys/fs/unionfs/union_vfsops.c
==============================================================================
--- stable/7/sys/fs/unionfs/union_vfsops.c	Mon Dec 15 02:06:02 2008	(r186109)
+++ stable/7/sys/fs/unionfs/union_vfsops.c	Mon Dec 15 03:56:54 2008	(r186110)
@@ -66,43 +66,6 @@ static vfs_extattrctl_t	unionfs_extattrc
 static struct vfsops unionfs_vfsops;
 
 /*
- * Exchange from userland file mode to vmode.
- */
-static u_short 
-mode2vmode(mode_t mode)
-{
-	u_short		ret;
-
-	ret = 0;
-
-	/* other */
-	if (mode & S_IXOTH)
-		ret |= VEXEC >> 6;
-	if (mode & S_IWOTH)
-		ret |= VWRITE >> 6;
-	if (mode & S_IROTH)
-		ret |= VREAD >> 6;
-
-	/* group */
-	if (mode & S_IXGRP)
-		ret |= VEXEC >> 3;
-	if (mode & S_IWGRP)
-		ret |= VWRITE >> 3;
-	if (mode & S_IRGRP)
-		ret |= VREAD >> 3;
-
-	/* owner */
-	if (mode & S_IXUSR)
-		ret |= VEXEC;
-	if (mode & S_IWUSR)
-		ret |= VWRITE;
-	if (mode & S_IRUSR)
-		ret |= VREAD;
-
-	return (ret);
-}
-
-/*
  * Mount unionfs layer.
  */
 static int
@@ -173,7 +136,7 @@ unionfs_domount(struct mount *mp, struct
 			vfs_mount_error(mp, "Invalid udir");
 			return (EINVAL);
 		}
-		udir = mode2vmode(udir);
+		udir &= S_IRWXU | S_IRWXG | S_IRWXO;
 	}
 	if (vfs_getopt(mp->mnt_optnew, "ufile", (void **)&tmp, NULL) == 0) {
 		if (tmp != NULL)
@@ -182,7 +145,7 @@ unionfs_domount(struct mount *mp, struct
 			vfs_mount_error(mp, "Invalid ufile");
 			return (EINVAL);
 		}
-		ufile = mode2vmode(ufile);
+		ufile &= S_IRWXU | S_IRWXG | S_IRWXO;
 	}
 	/* check umask, uid and gid */
 	if (udir == 0 && ufile != 0)
@@ -267,7 +230,7 @@ unionfs_domount(struct mount *mp, struct
 	/*
 	 * Find upper node
 	 */
-	NDINIT(ndp, LOOKUP, FOLLOW | WANTPARENT | LOCKLEAF, UIO_SYSSPACE, target, td);
+	NDINIT(ndp, LOOKUP, FOLLOW | LOCKLEAF, UIO_SYSSPACE, target, td);
 	if ((error = namei(ndp)))
 		return (error);
 
@@ -277,9 +240,6 @@ unionfs_domount(struct mount *mp, struct
 	lowerrootvp = mp->mnt_vnodecovered;
 	upperrootvp = ndp->ni_vp;
 
-	vrele(ndp->ni_dvp);
-	ndp->ni_dvp = NULLVP;
-
 	/* create unionfs_mount */
 	ump = (struct unionfs_mount *)malloc(sizeof(struct unionfs_mount),
 	    M_UNIONFSMNT, M_WAITOK | M_ZERO);
@@ -309,7 +269,7 @@ unionfs_domount(struct mount *mp, struct
 	    (upperrootvp->v_mount->mnt_kern_flag & MNTK_MPSAFE))
 		mp->mnt_kern_flag |= MNTK_MPSAFE;
 	MNT_IUNLOCK(mp);
-	mp->mnt_data = (qaddr_t)ump;
+	mp->mnt_data = ump;
 
 	/*
 	 * Copy upper layer's RDONLY flag.

Modified: stable/7/sys/fs/unionfs/union_vnops.c
==============================================================================
--- stable/7/sys/fs/unionfs/union_vnops.c	Mon Dec 15 02:06:02 2008	(r186109)
+++ stable/7/sys/fs/unionfs/union_vnops.c	Mon Dec 15 03:56:54 2008	(r186110)
@@ -71,6 +71,10 @@
 #define UNIONFS_INTERNAL_DEBUG(msg, args...)
 #endif
 
+#define KASSERT_UNIONFS_VNODE(vp) \
+	KASSERT(((vp)->v_op == &unionfs_vnodeops), \
+	    ("unionfs: it is not unionfs-vnode"))
+
 /* lockmgr lock <-> reverse table */
 struct lk_lr_table {
 	int	lock;
@@ -307,8 +311,27 @@ unionfs_lookup(struct vop_cachedlookup_a
 			error = lerror;
 		if (error != 0)
 			goto unionfs_lookup_out;
-		error = unionfs_nodeget(dvp->v_mount, uvp, lvp, dvp, &vp,
-		    cnp, td);
+		/*
+		 * get socket vnode.
+		 */
+		if (uvp != NULLVP && uvp->v_type == VSOCK) {
+			vp = uvp;
+			vref(vp);
+			if (cnp->cn_lkflags & LK_TYPE_MASK)
+				vn_lock(vp, cnp->cn_lkflags | LK_RETRY, td);
+		}
+		else if (lvp != NULLVP && lvp->v_type == VSOCK) {
+			vp = lvp;
+			vref(vp);
+			if (cnp->cn_lkflags & LK_TYPE_MASK)
+				vn_lock(vp, cnp->cn_lkflags | LK_RETRY, td);
+		}
+		/*
+		 * get unionfs vnode.
+		 */
+		else
+			error = unionfs_nodeget(dvp->v_mount, uvp, lvp,
+			    dvp, &vp, cnp, td);
 		if (error != 0) {
 			UNIONFSDEBUG("unionfs_lookup: Unable to create unionfs vnode.");
 			goto unionfs_lookup_out;
@@ -320,7 +343,7 @@ unionfs_lookup(struct vop_cachedlookup_a
 
 	*(ap->a_vpp) = vp;
 
-	if (cnflags & MAKEENTRY)
+	if ((cnflags & MAKEENTRY) && vp->v_type != VSOCK)
 		cache_enter(dvp, vp, cnp);
 
 unionfs_lookup_out:
@@ -349,6 +372,8 @@ unionfs_create(struct vop_create_args *a
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_create: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_dvp);
+
 	dunp = VTOUNIONFS(ap->a_dvp);
 	cnp = ap->a_cnp;
 	td = curthread;
@@ -356,7 +381,13 @@ unionfs_create(struct vop_create_args *a
 	error = EROFS;
 
 	if (udvp != NULLVP) {
-		if ((error = VOP_CREATE(udvp, &vp, cnp, ap->a_vap)) == 0) {
+		error = VOP_CREATE(udvp, &vp, cnp, ap->a_vap);
+		if (error != 0)
+			goto unionfs_create_abort;
+
+		if (vp->v_type == VSOCK)
+			*(ap->a_vpp) = vp;
+		else {
 			VOP_UNLOCK(vp, 0, td);
 			error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP,
 			    ap->a_dvp, ap->a_vpp, cnp, td);
@@ -364,6 +395,7 @@ unionfs_create(struct vop_create_args *a
 		}
 	}
 
+unionfs_create_abort:
 	UNIONFS_INTERNAL_DEBUG("unionfs_create: leave (%d)\n", error);
 
 	return (error);
@@ -379,6 +411,8 @@ unionfs_whiteout(struct vop_whiteout_arg
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_whiteout: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_dvp);
+
 	dunp = VTOUNIONFS(ap->a_dvp);
 	cnp = ap->a_cnp;
 	udvp = dunp->un_uppervp;
@@ -414,6 +448,8 @@ unionfs_mknod(struct vop_mknod_args *ap)
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_mknod: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_dvp);
+
 	dunp = VTOUNIONFS(ap->a_dvp);
 	cnp = ap->a_cnp;
 	td = curthread;
@@ -421,7 +457,13 @@ unionfs_mknod(struct vop_mknod_args *ap)
 	error = EROFS;
 
 	if (udvp != NULLVP) {
-		if ((error = VOP_MKNOD(udvp, &vp, cnp, ap->a_vap)) == 0) {
+		error = VOP_MKNOD(udvp, &vp, cnp, ap->a_vap);
+		if (error != 0)
+			goto unionfs_mknod_abort;
+
+		if (vp->v_type == VSOCK)
+			*(ap->a_vpp) = vp;
+		else {
 			VOP_UNLOCK(vp, 0, td);
 			error = unionfs_nodeget(ap->a_dvp->v_mount, vp, NULLVP,
 			    ap->a_dvp, ap->a_vpp, cnp, td);
@@ -429,6 +471,7 @@ unionfs_mknod(struct vop_mknod_args *ap)
 		}
 	}
 
+unionfs_mknod_abort:
 	UNIONFS_INTERNAL_DEBUG("unionfs_mknod: leave (%d)\n", error);
 
 	return (error);
@@ -448,6 +491,8 @@ unionfs_open(struct vop_open_args *ap)
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_open: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	error = 0;
 	unp = VTOUNIONFS(ap->a_vp);
 	uvp = unp->un_uppervp;
@@ -527,6 +572,8 @@ unionfs_close(struct vop_close_args *ap)
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_close: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	locked = 0;
 	unp = VTOUNIONFS(ap->a_vp);
 	cred = ap->a_cred;
@@ -654,6 +701,8 @@ unionfs_access(struct vop_access_args *a
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_access: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount);
 	unp = VTOUNIONFS(ap->a_vp);
 	uvp = unp->un_uppervp;
@@ -731,6 +780,8 @@ unionfs_getattr(struct vop_getattr_args 
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_getattr: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	unp = VTOUNIONFS(ap->a_vp);
 	ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount);
 	uvp = unp->un_uppervp;
@@ -781,6 +832,8 @@ unionfs_setattr(struct vop_setattr_args 
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_setattr: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	error = EROFS;
 	unp = VTOUNIONFS(ap->a_vp);
 	uvp = unp->un_uppervp;
@@ -819,6 +872,8 @@ unionfs_read(struct vop_read_args *ap)
 
 	/* UNIONFS_INTERNAL_DEBUG("unionfs_read: enter\n"); */
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	unp = VTOUNIONFS(ap->a_vp);
 	tvp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp);
 
@@ -838,6 +893,8 @@ unionfs_write(struct vop_write_args *ap)
 
 	/* UNIONFS_INTERNAL_DEBUG("unionfs_write: enter\n"); */
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	unp = VTOUNIONFS(ap->a_vp);
 	tvp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp);
 
@@ -857,6 +914,8 @@ unionfs_lease(struct vop_lease_args *ap)
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_lease: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	unp = VTOUNIONFS(ap->a_vp);
 	vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp);
 
@@ -877,6 +936,8 @@ unionfs_ioctl(struct vop_ioctl_args *ap)
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_ioctl: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
  	vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, ap->a_td);
 	unp = VTOUNIONFS(ap->a_vp);
 	unionfs_get_node_status(unp, ap->a_td, &unsp);
@@ -902,6 +963,8 @@ unionfs_poll(struct vop_poll_args *ap)
 	struct unionfs_node_status *unsp;
 	struct vnode   *ovp;
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
  	vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, ap->a_td);
 	unp = VTOUNIONFS(ap->a_vp);
 	unionfs_get_node_status(unp, ap->a_td, &unsp);
@@ -922,6 +985,8 @@ unionfs_fsync(struct vop_fsync_args *ap)
 	struct unionfs_node_status *unsp;
 	struct vnode   *ovp;
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	unp = VTOUNIONFS(ap->a_vp);
 	unionfs_get_node_status(unp, ap->a_td, &unsp);
 	ovp = (unsp->uns_upper_opencnt ? unp->un_uppervp : unp->un_lowervp);
@@ -937,36 +1002,81 @@ static int
 unionfs_remove(struct vop_remove_args *ap)
 {
 	int		error;
+	char	       *path;
 	struct unionfs_node *dunp;
 	struct unionfs_node *unp;
 	struct unionfs_mount *ump;
 	struct vnode   *udvp;
 	struct vnode   *uvp;
 	struct vnode   *lvp;
+	struct vnode   *vp;
 	struct componentname *cnp;
+	struct componentname cn;
 	struct thread  *td;
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_remove: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_dvp);
+
 	error = 0;
 	dunp = VTOUNIONFS(ap->a_dvp);
-	unp = VTOUNIONFS(ap->a_vp);
 	udvp = dunp->un_uppervp;
-	uvp = unp->un_uppervp;
-	lvp = unp->un_lowervp;
 	cnp = ap->a_cnp;
 	td = curthread;
 
+	if (ap->a_vp->v_op != &unionfs_vnodeops) {
+		if (ap->a_vp->v_type != VSOCK)
+			return (EINVAL);
+		ump = NULL;
+		vp = uvp = lvp = NULLVP;
+		/* search vnode */
+		VOP_UNLOCK(ap->a_vp, 0, td);
+		error = unionfs_relookup(udvp, &vp, cnp, &cn, td,
+		    cnp->cn_nameptr, strlen(cnp->cn_nameptr), DELETE);
+		if (error != 0 && error != ENOENT) {
+			vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, td);
+			return (error);
+		}
+
+		if (error == 0 && vp == ap->a_vp) {
+			/* target vnode in upper */
+			uvp = vp;
+			vrele(vp);
+			path = NULL;
+		} else {
+			/* target vnode in lower */
+			if (vp != NULLVP) {
+				if (udvp == vp)
+					vrele(vp);
+				else
+					vput(vp);
+			}
+			vn_lock(ap->a_vp, LK_EXCLUSIVE | LK_RETRY, td);
+			lvp = ap->a_vp;
+			path = ap->a_cnp->cn_nameptr;
+		}
+	} else {
+		ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount);
+		unp = VTOUNIONFS(ap->a_vp);
+		uvp = unp->un_uppervp;
+		lvp = unp->un_lowervp;
+		path = unp->un_path;
+	}
+
 	if (udvp == NULLVP)
 		return (EROFS);
 
 	if (uvp != NULLVP) {
-		ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount);
-		if (ump->um_whitemode == UNIONFS_WHITE_ALWAYS || lvp != NULLVP)
+		/*
+		 * XXX: if the vnode type is VSOCK, it will create whiteout
+		 *      after remove.
+		 */
+		if (ump == NULL || ump->um_whitemode == UNIONFS_WHITE_ALWAYS ||
+		    lvp != NULLVP)
 			cnp->cn_flags |= DOWHITEOUT;
 		error = VOP_REMOVE(udvp, uvp, cnp);
 	} else if (lvp != NULLVP)
-		error = unionfs_mkwhiteout(udvp, cnp, td, unp->un_path);
+		error = unionfs_mkwhiteout(udvp, cnp, td, path);
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_remove: leave (%d)\n", error);
 
@@ -987,6 +1097,9 @@ unionfs_link(struct vop_link_args *ap)
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_link: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_tdvp);
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	error = 0;
 	needrelookup = 0;
 	dunp = VTOUNIONFS(ap->a_tdvp);
@@ -1077,7 +1190,10 @@ unionfs_rename(struct vop_rename_args *a
 	/* check for cross device rename */
 	if (fvp->v_mount != tdvp->v_mount ||
 	    (tvp != NULLVP && fvp->v_mount != tvp->v_mount)) {
-		error = EXDEV;
+		if (fvp->v_op != &unionfs_vnodeops)
+			error = ENODEV;
+		else
+			error = EXDEV;
 		goto unionfs_rename_abort;
 	}
 
@@ -1089,6 +1205,12 @@ unionfs_rename(struct vop_rename_args *a
 	 * from/to vnode is unionfs node.
 	 */
 
+	KASSERT_UNIONFS_VNODE(fdvp);
+	KASSERT_UNIONFS_VNODE(fvp);
+	KASSERT_UNIONFS_VNODE(tdvp);
+	if (tvp != NULLVP)
+		KASSERT_UNIONFS_VNODE(tvp);
+
 	unp = VTOUNIONFS(fdvp);
 #ifdef UNIONFS_IDBG_RENAME
 	UNIONFS_INTERNAL_DEBUG("fdvp=%p, ufdvp=%p, lfdvp=%p\n", fdvp, unp->un_uppervp, unp->un_lowervp);
@@ -1258,6 +1380,8 @@ unionfs_mkdir(struct vop_mkdir_args *ap)
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_mkdir: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_dvp);
+
 	error = EROFS;
 	dunp = VTOUNIONFS(ap->a_dvp);
 	cnp = ap->a_cnp;
@@ -1305,6 +1429,9 @@ unionfs_rmdir(struct vop_rmdir_args *ap)
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_rmdir: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_dvp);
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	error = 0;
 	dunp = VTOUNIONFS(ap->a_dvp);
 	unp = VTOUNIONFS(ap->a_vp);
@@ -1357,6 +1484,8 @@ unionfs_symlink(struct vop_symlink_args 
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_symlink: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_dvp);
+
 	error = EROFS;
 	dunp = VTOUNIONFS(ap->a_dvp);
 	cnp = ap->a_cnp;
@@ -1400,6 +1529,8 @@ unionfs_readdir(struct vop_readdir_args 
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_readdir: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	error = 0;
 	eofflag = 0;
 	locked = 0;
@@ -1547,6 +1678,8 @@ unionfs_readlink(struct vop_readlink_arg
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_readlink: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	unp = VTOUNIONFS(ap->a_vp);
 	vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp);
 
@@ -1572,6 +1705,8 @@ unionfs_getwritemount(struct vop_getwrit
 	if (vp == NULLVP || (vp->v_mount->mnt_flag & MNT_RDONLY))
 		return (EACCES);
 
+	KASSERT_UNIONFS_VNODE(vp);
+
 	uvp = UNIONFSVPTOUPPERVP(vp);
 	if (uvp == NULLVP && VREG == vp->v_type)
 		uvp = UNIONFSVPTOUPPERVP(VTOUNIONFS(vp)->un_dvp);
@@ -1666,6 +1801,8 @@ unionfs_lock(struct vop_lock1_args *ap)
 	struct vnode   *lvp;
 	struct thread  *td;
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	error = 0;
 	uhold = 0;
 	flags = ap->a_flags;
@@ -1787,6 +1924,8 @@ unionfs_unlock(struct vop_unlock_args *a
 	struct vnode   *uvp;
 	struct unionfs_node *unp;
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	error = 0;
 	mtxlkflag = 0;
 	uhold = 0;
@@ -1855,6 +1994,8 @@ unionfs_pathconf(struct vop_pathconf_arg
 	struct unionfs_node *unp;
 	struct vnode   *vp;
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	unp = VTOUNIONFS(ap->a_vp);
 	vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp);
 
@@ -1873,6 +2014,8 @@ unionfs_advlock(struct vop_advlock_args 
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_advlock: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	vp = ap->a_vp;
 	td = curthread;
 
@@ -1923,6 +2066,8 @@ unionfs_strategy(struct vop_strategy_arg
 	struct unionfs_node *unp;
 	struct vnode   *vp;
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	unp = VTOUNIONFS(ap->a_vp);
 	vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp);
 
@@ -1944,6 +2089,8 @@ unionfs_getacl(struct vop_getacl_args *a
 	struct unionfs_node *unp;
 	struct vnode   *vp;
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	unp = VTOUNIONFS(ap->a_vp);
 	vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp);
 
@@ -1967,6 +2114,8 @@ unionfs_setacl(struct vop_setacl_args *a
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_setacl: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	error = EROFS;
 	unp = VTOUNIONFS(ap->a_vp);
 	uvp = unp->un_uppervp;
@@ -1999,6 +2148,8 @@ unionfs_aclcheck(struct vop_aclcheck_arg
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_aclcheck: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	unp = VTOUNIONFS(ap->a_vp);
 	vp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp);
 
@@ -2017,6 +2168,8 @@ unionfs_openextattr(struct vop_openextat
 	struct vnode   *vp;
 	struct vnode   *tvp;
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	vp = ap->a_vp;
 	unp = VTOUNIONFS(vp);
 	tvp = (unp->un_uppervp != NULLVP ? unp->un_uppervp : unp->un_lowervp);
@@ -2047,6 +2200,8 @@ unionfs_closeextattr(struct vop_closeext
 	struct vnode   *vp;
 	struct vnode   *tvp;
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	vp = ap->a_vp;
 	unp = VTOUNIONFS(vp);
 	tvp = NULLVP;
@@ -2079,6 +2234,8 @@ unionfs_getextattr(struct vop_getextattr
 	struct unionfs_node *unp;
 	struct vnode   *vp;
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	unp = VTOUNIONFS(ap->a_vp);
 	vp = NULLVP;
 
@@ -2105,6 +2262,8 @@ unionfs_setextattr(struct vop_setextattr
 	struct ucred   *cred;
 	struct thread  *td;
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	error = EROFS;
 	unp = VTOUNIONFS(ap->a_vp);
 	uvp = unp->un_uppervp;
@@ -2164,6 +2323,8 @@ unionfs_listextattr(struct vop_listextat
 	struct unionfs_node *unp;
 	struct vnode   *vp;
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	unp = VTOUNIONFS(ap->a_vp);
 	vp = NULLVP;
 
@@ -2190,6 +2351,8 @@ unionfs_deleteextattr(struct vop_deletee
 	struct ucred   *cred;
 	struct thread  *td;
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	error = EROFS;
 	unp = VTOUNIONFS(ap->a_vp);
 	uvp = unp->un_uppervp;
@@ -2254,6 +2417,8 @@ unionfs_setlabel(struct vop_setlabel_arg
 
 	UNIONFS_INTERNAL_DEBUG("unionfs_setlabel: enter\n");
 
+	KASSERT_UNIONFS_VNODE(ap->a_vp);
+
 	error = EROFS;
 	unp = VTOUNIONFS(ap->a_vp);
 	uvp = unp->un_uppervp;

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Dec 15 05:54:28 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9CC651065670;
	Mon, 15 Dec 2008 05:54:28 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 87BF38FC14;
	Mon, 15 Dec 2008 05:54:28 +0000 (UTC)
	(envelope-from yongari@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBF5sSUu085876;
	Mon, 15 Dec 2008 05:54:28 GMT (envelope-from yongari@svn.freebsd.org)
Received: (from yongari@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBF5sSQZ085875;
	Mon, 15 Dec 2008 05:54:28 GMT (envelope-from yongari@svn.freebsd.org)
Message-Id: <200812150554.mBF5sSQZ085875@svn.freebsd.org>
From: Pyun YongHyeon <yongari@FreeBSD.org>
Date: Mon, 15 Dec 2008 05:54:28 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186116 - in stable/7/sys: . contrib/pf dev/cxgb dev/vr
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Dec 2008 05:54:28 -0000

Author: yongari
Date: Mon Dec 15 05:54:27 2008
New Revision: 186116
URL: http://svn.freebsd.org/changeset/base/186116

Log:
  MFC r185962:
    It seems there are still issues on multicast perfect filtering.
    Disable it until I find spare time to analyze the issue.
  
  Approved by:	re (kensmith)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/dev/vr/if_vr.c

Modified: stable/7/sys/dev/vr/if_vr.c
==============================================================================
--- stable/7/sys/dev/vr/if_vr.c	Mon Dec 15 04:20:42 2008	(r186115)
+++ stable/7/sys/dev/vr/if_vr.c	Mon Dec 15 05:54:27 2008	(r186116)
@@ -133,7 +133,7 @@ static struct vr_type {
 	    0,
 	    "VIA VT6105 Rhine III 10/100BaseTX" },
 	{ VIA_VENDORID, VIA_DEVICEID_RHINE_III_M,
-	    VR_Q_CSUM | VR_Q_CAM,
+	    VR_Q_CSUM,
 	    "VIA VT6105M Rhine III 10/100BaseTX" },
 	{ DELTA_VENDORID, DELTA_DEVICEID_RHINE_II,
 	    VR_Q_NEEDALIGN,

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Dec 15 20:32:16 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C7D131065672;
	Mon, 15 Dec 2008 20:32:16 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B5E358FC1A;
	Mon, 15 Dec 2008 20:32:16 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBFKWGhu015972;
	Mon, 15 Dec 2008 20:32:16 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBFKWGhv015971;
	Mon, 15 Dec 2008 20:32:16 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200812152032.mBFKWGhv015971@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Mon, 15 Dec 2008 20:32:16 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186134 - in stable/7/sys: . dev/bge
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Dec 2008 20:32:16 -0000

Author: marius
Date: Mon Dec 15 20:32:16 2008
New Revision: 186134
URL: http://svn.freebsd.org/changeset/base/186134

Log:
  - Limit BCM5701 B5 to 32-bit mode as a workaround for a bug which
    causes data corruption in combination with certain bridges.
    Information about this problem was kindly provided by davidch. [1]
  - As BGE_FLAG_PCIX is meant to indicate that the controller is in
    PCI-X mode, revert to the pre __FreeBSD_version 602101 method of
    reading the bus mode register rather than checking the mere
    existence of a PCI-X capability, which is also there when the
    NIC f.e. is put into a 32-bit slot causing it not to be in PCI-X
    mode. Setting BGE_FLAG_PCIX inappropriately could cause the NIC
    to be tuned incorrectly.
  
  PR:		128833 [1]
  Reviewed by:	jhb
  Approved by:	re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/dev/bge/if_bge.c

Modified: stable/7/sys/dev/bge/if_bge.c
==============================================================================
--- stable/7/sys/dev/bge/if_bge.c	Mon Dec 15 18:20:59 2008	(r186133)
+++ stable/7/sys/dev/bge/if_bge.c	Mon Dec 15 20:32:16 2008	(r186134)
@@ -1370,6 +1370,16 @@ bge_chipinit(struct bge_softc *sc)
 	    BGE_MODECTL_TX_NO_PHDR_CSUM);
 
 	/*
+	 * BCM5701 B5 have a bug causing data corruption when using
+	 * 64-bit DMA reads, which can be terminated early and then
+	 * completed later as 32-bit accesses, in combination with
+	 * certain bridges.
+	 */
+	if (sc->bge_asicrev == BGE_ASICREV_BCM5701 &&
+	    sc->bge_chipid == BGE_CHIPID_BCM5701_B5)
+		BGE_SETBIT(sc, BGE_MODE_CTL, BGE_MODECTL_FORCE_PCI32);
+
+	/*
 	 * Tell the firmware the driver is running
 	 */
 	if (sc->bge_asf_mode & ASF_STACKUP)
@@ -2465,26 +2475,21 @@ bge_attach(device_t dev)
 		 */
 		if (reg != 0)
 			sc->bge_flags |= BGE_FLAG_PCIE;
-	} else if (pci_find_extcap(dev, PCIY_PCIX, &reg) == 0) {
-		if (reg != 0)
-			sc->bge_flags |= BGE_FLAG_PCIX;
-	}
-			
 #else
 	if (BGE_IS_5705_PLUS(sc)) {
 		reg = pci_read_config(dev, BGE_PCIE_CAPID_REG, 4);
 		if ((reg & 0xFF) == BGE_PCIE_CAPID)
 			sc->bge_flags |= BGE_FLAG_PCIE;
+#endif
 	} else {
 		/*
 		 * Check if the device is in PCI-X Mode.
 		 * (This bit is not valid on PCI Express controllers.)
 		 */
-		if ((pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE, 4) &
+		if ((pci_read_config(dev, BGE_PCI_PCISTATE, 4) &
 		    BGE_PCISTATE_PCI_BUSMODE) == 0)
 			sc->bge_flags |= BGE_FLAG_PCIX;
 	}
-#endif
 
 #if __FreeBSD_version > 602105
 	{

From owner-svn-src-stable-7@FreeBSD.ORG  Mon Dec 15 21:36:15 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 0259A1065672;
	Mon, 15 Dec 2008 21:36:15 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E2AF38FC16;
	Mon, 15 Dec 2008 21:36:14 +0000 (UTC)
	(envelope-from marius@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBFLaEsH017353;
	Mon, 15 Dec 2008 21:36:14 GMT (envelope-from marius@svn.freebsd.org)
Received: (from marius@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBFLaEOA017351;
	Mon, 15 Dec 2008 21:36:14 GMT (envelope-from marius@svn.freebsd.org)
Message-Id: <200812152136.mBFLaEOA017351@svn.freebsd.org>
From: Marius Strobl <marius@FreeBSD.org>
Date: Mon, 15 Dec 2008 21:36:14 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186137 - in stable/7/sys: . contrib/pf dev/cxgb dev/dc
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 15 Dec 2008 21:36:15 -0000

Author: marius
Date: Mon Dec 15 21:36:14 2008
New Revision: 186137
URL: http://svn.freebsd.org/changeset/base/186137

Log:
  MFC: 185750
  
  - According to the corresponding Linux, NetBSD and OpenSolaris
    drivers, there should be a 1us delay after every write when
    bit-banging the MII. Also insert barriers in order to ensure
    the intended ordering. These changes hopefully will solve the
    bus wedging occasionally experienced with DM9102A since r182461.
  - Deobfuscate dc_mii_readreg() a bit.
  
  Approved by:	re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/dev/dc/if_dc.c
  stable/7/sys/dev/dc/if_dcreg.h

Modified: stable/7/sys/dev/dc/if_dc.c
==============================================================================
--- stable/7/sys/dev/dc/if_dc.c	Mon Dec 15 20:40:06 2008	(r186136)
+++ stable/7/sys/dev/dc/if_dc.c	Mon Dec 15 21:36:14 2008	(r186137)
@@ -607,15 +607,22 @@ dc_read_eeprom(struct dc_softc *sc, cadd
 static void
 dc_mii_writebit(struct dc_softc *sc, int bit)
 {
+	uint32_t reg;
 
-	if (bit)
-		CSR_WRITE_4(sc, DC_SIO,
-		    DC_SIO_ROMCTL_WRITE | DC_SIO_MII_DATAOUT);
-	else
-		CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_WRITE);
-
-	DC_SETBIT(sc, DC_SIO, DC_SIO_MII_CLK);
-	DC_CLRBIT(sc, DC_SIO, DC_SIO_MII_CLK);
+	reg = DC_SIO_ROMCTL_WRITE | (bit != 0 ? DC_SIO_MII_DATAOUT : 0);
+	CSR_WRITE_4(sc, DC_SIO, reg);
+	CSR_BARRIER_4(sc, DC_SIO,
+	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+	DELAY(1);
+
+	CSR_WRITE_4(sc, DC_SIO, reg | DC_SIO_MII_CLK);
+	CSR_BARRIER_4(sc, DC_SIO,
+	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+	DELAY(1);
+	CSR_WRITE_4(sc, DC_SIO, reg);
+	CSR_BARRIER_4(sc, DC_SIO,
+	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+	DELAY(1);
 }
 
 /*
@@ -624,11 +631,22 @@ dc_mii_writebit(struct dc_softc *sc, int
 static int
 dc_mii_readbit(struct dc_softc *sc)
 {
+	uint32_t reg;
 
-	CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_READ | DC_SIO_MII_DIR);
-	CSR_READ_4(sc, DC_SIO);
-	DC_SETBIT(sc, DC_SIO, DC_SIO_MII_CLK);
-	DC_CLRBIT(sc, DC_SIO, DC_SIO_MII_CLK);
+	reg = DC_SIO_ROMCTL_READ | DC_SIO_MII_DIR;
+	CSR_WRITE_4(sc, DC_SIO, reg);
+	CSR_BARRIER_4(sc, DC_SIO,
+	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+	DELAY(1);
+	(void)CSR_READ_4(sc, DC_SIO);
+	CSR_WRITE_4(sc, DC_SIO, reg | DC_SIO_MII_CLK);
+	CSR_BARRIER_4(sc, DC_SIO,
+	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+	DELAY(1);
+	CSR_WRITE_4(sc, DC_SIO, reg);
+	CSR_BARRIER_4(sc, DC_SIO,
+	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+	DELAY(1);
 	if (CSR_READ_4(sc, DC_SIO) & DC_SIO_MII_DATAIN)
 		return (1);
 
@@ -644,6 +662,9 @@ dc_mii_sync(struct dc_softc *sc)
 	int i;
 
 	CSR_WRITE_4(sc, DC_SIO, DC_SIO_ROMCTL_WRITE);
+	CSR_BARRIER_4(sc, DC_SIO,
+	    BUS_SPACE_BARRIER_READ | BUS_SPACE_BARRIER_WRITE);
+	DELAY(1);
 
 	for (i = 0; i < 32; i++)
 		dc_mii_writebit(sc, 1);
@@ -667,15 +688,13 @@ dc_mii_send(struct dc_softc *sc, u_int32
 static int
 dc_mii_readreg(struct dc_softc *sc, struct dc_mii_frame *frame)
 {
-	int i, ack;
+	int i;
 
 	/*
 	 * Set up frame for RX.
 	 */
 	frame->mii_stdelim = DC_MII_STARTDELIM;
 	frame->mii_opcode = DC_MII_READOP;
-	frame->mii_turnaround = 0;
-	frame->mii_data = 0;
 
 	/*
 	 * Sync the PHYs.
@@ -690,38 +709,28 @@ dc_mii_readreg(struct dc_softc *sc, stru
 	dc_mii_send(sc, frame->mii_phyaddr, 5);
 	dc_mii_send(sc, frame->mii_regaddr, 5);
 
-#ifdef notdef
-	/* Idle bit */
-	dc_mii_writebit(sc, 1);
-	dc_mii_writebit(sc, 0);
-#endif
-
-	/* Check for ack. */
-	ack = dc_mii_readbit(sc);
-
 	/*
-	 * Now try reading data bits. If the ack failed, we still
+	 * Now try reading data bits.  If the turnaround failed, we still
 	 * need to clock through 16 cycles to keep the PHY(s) in sync.
 	 */
-	if (ack) {
+	frame->mii_turnaround = dc_mii_readbit(sc);
+	if (frame->mii_turnaround != 0) {
 		for (i = 0; i < 16; i++)
 			dc_mii_readbit(sc);
 		goto fail;
 	}
-
 	for (i = 0x8000; i; i >>= 1) {
-		if (!ack) {
-			if (dc_mii_readbit(sc))
-				frame->mii_data |= i;
-		}
+		if (dc_mii_readbit(sc))
+			frame->mii_data |= i;
 	}
 
 fail:
 
+	/* Clock the idle bits. */
 	dc_mii_writebit(sc, 0);
 	dc_mii_writebit(sc, 0);
 
-	if (ack)
+	if (frame->mii_turnaround != 0)
 		return (1);
 	return (0);
 }
@@ -736,7 +745,6 @@ dc_mii_writereg(struct dc_softc *sc, str
 	/*
 	 * Set up frame for TX.
 	 */
-
 	frame->mii_stdelim = DC_MII_STARTDELIM;
 	frame->mii_opcode = DC_MII_WRITEOP;
 	frame->mii_turnaround = DC_MII_TURNAROUND;
@@ -753,7 +761,7 @@ dc_mii_writereg(struct dc_softc *sc, str
 	dc_mii_send(sc, frame->mii_turnaround, 2);
 	dc_mii_send(sc, frame->mii_data, 16);
 
-	/* Idle bit. */
+	/* Clock the idle bits. */
 	dc_mii_writebit(sc, 0);
 	dc_mii_writebit(sc, 0);
 

Modified: stable/7/sys/dev/dc/if_dcreg.h
==============================================================================
--- stable/7/sys/dev/dc/if_dcreg.h	Mon Dec 15 20:40:06 2008	(r186136)
+++ stable/7/sys/dev/dc/if_dcreg.h	Mon Dec 15 21:36:14 2008	(r186137)
@@ -791,6 +791,9 @@ struct dc_softc {
 #define CSR_READ_4(sc, reg)		\
 	bus_space_read_4(sc->dc_btag, sc->dc_bhandle, reg)
 
+#define CSR_BARRIER_4(sc, reg, flags)		\
+	bus_space_barrier(sc->dc_btag, sc->dc_bhandle, reg, 4, flags)
+
 #define DC_TIMEOUT		1000
 #define ETHER_ALIGN		2
 

From owner-svn-src-stable-7@FreeBSD.ORG  Tue Dec 16 20:48:38 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id A902F106564A;
	Tue, 16 Dec 2008 20:48:38 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9B1748FC1B;
	Tue, 16 Dec 2008 20:48:38 +0000 (UTC) (envelope-from ru@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBGKmcOb047318;
	Tue, 16 Dec 2008 20:48:38 GMT (envelope-from ru@svn.freebsd.org)
Received: (from ru@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBGKmcaS047317;
	Tue, 16 Dec 2008 20:48:38 GMT (envelope-from ru@svn.freebsd.org)
Message-Id: <200812162048.mBGKmcaS047317@svn.freebsd.org>
From: Ruslan Ermilov <ru@FreeBSD.org>
Date: Tue, 16 Dec 2008 20:48:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186192 - releng/7.1/usr.bin/ipcs stable/7/usr.bin/ipcs
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 16 Dec 2008 20:48:38 -0000

Author: ru
Date: Tue Dec 16 20:48:38 2008
New Revision: 186192
URL: http://svn.freebsd.org/changeset/base/186192

Log:
  MFC: Fix printing of shared memory limits.
  
  Approved by:	re (kib)

Modified:
  stable/7/usr.bin/ipcs/   (props changed)
  stable/7/usr.bin/ipcs/ipcs.c

Changes in other areas also in this revision:
Modified:
  releng/7.1/usr.bin/ipcs/   (props changed)
  releng/7.1/usr.bin/ipcs/ipcs.c

Modified: stable/7/usr.bin/ipcs/ipcs.c
==============================================================================
--- stable/7/usr.bin/ipcs/ipcs.c	Tue Dec 16 20:07:47 2008	(r186191)
+++ stable/7/usr.bin/ipcs/ipcs.c	Tue Dec 16 20:48:38 2008	(r186192)
@@ -394,15 +394,15 @@ print_kshmtotal(struct shminfo shminfo)
 {
 
 	printf("shminfo:\n");
-	printf("\tshmmax: %12d\t(max shared memory segment size)\n",
+	printf("\tshmmax: %12lu\t(max shared memory segment size)\n",
 	    shminfo.shmmax);
-	printf("\tshmmin: %12d\t(min shared memory segment size)\n",
+	printf("\tshmmin: %12lu\t(min shared memory segment size)\n",
 	    shminfo.shmmin);
-	printf("\tshmmni: %12d\t(max number of shared memory identifiers)\n",
+	printf("\tshmmni: %12lu\t(max number of shared memory identifiers)\n",
 	    shminfo.shmmni);
-	printf("\tshmseg: %12d\t(max shared memory segments per process)\n",
+	printf("\tshmseg: %12lu\t(max shared memory segments per process)\n",
 	    shminfo.shmseg);
-	printf("\tshmall: %12d\t(max amount of shared memory in pages)\n\n",
+	printf("\tshmall: %12lu\t(max amount of shared memory in pages)\n\n",
 	    shminfo.shmall);
 }
 

From owner-svn-src-stable-7@FreeBSD.ORG  Wed Dec 17 03:48:35 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 809FD1065673;
	Wed, 17 Dec 2008 03:48:35 +0000 (UTC)
	(envelope-from murray@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 6DAD68FC12;
	Wed, 17 Dec 2008 03:48:35 +0000 (UTC)
	(envelope-from murray@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBH3mZd5056499;
	Wed, 17 Dec 2008 03:48:35 GMT (envelope-from murray@svn.freebsd.org)
Received: (from murray@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBH3mZ6m056498;
	Wed, 17 Dec 2008 03:48:35 GMT (envelope-from murray@svn.freebsd.org)
Message-Id: <200812170348.mBH3mZ6m056498@svn.freebsd.org>
From: Murray Stokely <murray@FreeBSD.org>
Date: Wed, 17 Dec 2008 03:48:35 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186205 - stable/7/release/doc/en_US.ISO8859-1/hardware
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 17 Dec 2008 03:48:35 -0000

Author: murray
Date: Wed Dec 17 03:48:35 2008
New Revision: 186205
URL: http://svn.freebsd.org/changeset/base/186205

Log:
  MFC: r186204
  
  Update the list of Intel chips with EM64T for FreeBSD/amd64 and
  increase the known maximum memory configuration from 8gb to 32gb.
  
  Approved by:	re (hrs)

Modified:
  stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml

Modified: stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml
==============================================================================
--- stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml	Wed Dec 17 03:24:55 2008	(r186204)
+++ stable/7/release/doc/en_US.ISO8859-1/hardware/article.sgml	Wed Dec 17 03:48:35 2008	(r186205)
@@ -92,21 +92,40 @@
     </listitem>
 
     <listitem>
-      <para>&intel; 64-bit &xeon; (<quote>Nocona</quote>).
-	This processor is fabricated on 90nm process technology, and operates
-	with 2.80 to 3.60 GHz (FSB 800MHz) and &intel; E7520/E7525/E7320 chipsets.</para>
+      <para>All multi-core &intel; &xeon; processors except
+        Sossaman have EM64T support.</para>
     </listitem>
 
     <listitem>
-      <para>&intel; &pentium; 4 Processor supporting &intel; EM64T
-	(<quote>Prescott</quote>).
-	This is fabricated on 90nm process technology,
-	uses FC-LGA775 package, and operates with 3.20F/3.40F/3.60F GHz
-	and &intel; 925X Express chipsets.
-	The corresponding S-Spec numbers are SL7L9, SL7L8, SL7LA, SL7NZ, SL7PZ,
-	and SL7PX.  Note that processors marked as 5xx numbers do not support
-	EM64T.</para>
+      <para>The single-core &intel; &xeon;
+        processors <quote>Nocona</quote>, <quote>Irwindale</quote>,
+        <quote>Potomac</quote>, and <quote>Cranford</quote> have
+        EM64T support.</para>
     </listitem>
+
+    <listitem>
+      <para>All &intel; Core 2 (not Core Duo) and later
+        processors</para>
+    </listitem>
+
+    <listitem>
+      <para>All &intel; &pentium; D processors</para>
+    </listitem>
+
+    <listitem>
+      <para>&intel; &pentium; 4s and Celeron Ds using
+        the <quote>Cedar Mill</quote> core have EM64T
+        support.</para>
+    </listitem>
+
+    <listitem>
+      <para>Some &intel; &pentium; 4s and Celeron Ds using
+        the <quote>Prescott</quote> core have EM64T support.  See
+        the <ulink url="http://processorfinder.intel.com">Intel
+        Processor Spec Finder</ulink> for the definitive answer about
+        EM64T support in Intel processors.</para>
+    </listitem>
+
   </itemizedlist>
 
   <para>&intel; EM64T is an extended version of IA-32 (x86) and
@@ -115,7 +134,7 @@
     <quote>64-bit extension technology</quote> or <quote>IA-32e</quote>.</para>
 
   <para>The largest tested
-    memory configuration to date is 8GB.  SMP support has been
+    memory configuration to date is 32GB.  SMP support has been
     recently completed and is reasonably robust.</para>
 
   <para>In many respects, &os;/&arch.amd64; is similar to &os;/&arch.i386;, in

From owner-svn-src-stable-7@FreeBSD.ORG  Wed Dec 17 12:31:04 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9AF411065670;
	Wed, 17 Dec 2008 12:31:04 +0000 (UTC) (envelope-from ume@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 879A48FC16;
	Wed, 17 Dec 2008 12:31:04 +0000 (UTC) (envelope-from ume@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBHCV4lY003916;
	Wed, 17 Dec 2008 12:31:04 GMT (envelope-from ume@svn.freebsd.org)
Received: (from ume@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBHCV4bL003905;
	Wed, 17 Dec 2008 12:31:04 GMT (envelope-from ume@svn.freebsd.org)
Message-Id: <200812171231.mBHCV4bL003905@svn.freebsd.org>
From: Hajimu UMEMOTO <ume@FreeBSD.org>
Date: Wed, 17 Dec 2008 12:31:04 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186220 - in stable/7: include include/arpa lib/libc
	lib/libc/include/isc lib/libc/inet lib/libc/resolv
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 17 Dec 2008 12:31:04 -0000

Author: ume
Date: Wed Dec 17 12:31:04 2008
New Revision: 186220
URL: http://svn.freebsd.org/changeset/base/186220

Log:
  MFC 186090
  
  Update our resolver to BIND 9.4.3.
  
  Merge the resolver part of BIND 9.4.3 into HEAD.
  It includes the following fix:
  
    2426.   [bug]           libbind: inet_net_pton() can sometimes return the
                            wrong value if excessively large netmasks are
                            supplied. [RT #18512]
  
  Reported by:	Maksymilian Arciemowicz <cxib__at__securityreason.com>
  Approved by:	re (kib)

Added:
  stable/7/lib/libc/include/isc/platform.h
     - copied unchanged from r186090, head/lib/libc/include/isc/platform.h
Modified:
  stable/7/include/   (props changed)
  stable/7/include/arpa/nameser.h
  stable/7/include/resolv.h
  stable/7/lib/libc/   (props changed)
  stable/7/lib/libc/include/isc/eventlib.h   (contents, props changed)
  stable/7/lib/libc/inet/inet_net_pton.c
  stable/7/lib/libc/resolv/res_debug.c
  stable/7/lib/libc/resolv/res_mkquery.c
  stable/7/lib/libc/resolv/res_query.c
  stable/7/lib/libc/resolv/res_send.c

Modified: stable/7/include/arpa/nameser.h
==============================================================================
--- stable/7/include/arpa/nameser.h	Wed Dec 17 10:49:03 2008	(r186219)
+++ stable/7/include/arpa/nameser.h	Wed Dec 17 12:31:04 2008	(r186220)
@@ -49,7 +49,7 @@
  */
 
 /*
- *	$Id: nameser.h,v 1.7.18.1 2005/04/27 05:00:50 sra Exp $
+ *	$Id: nameser.h,v 1.7.18.2 2008/04/03 23:15:15 marka Exp $
  * $FreeBSD$
  */
 
@@ -424,9 +424,10 @@ typedef enum __ns_cert_types {
 #define NS_NXT_MAX 127
 
 /*%
- * EDNS0 extended flags, host order.
+ * EDNS0 extended flags and option codes, host order.
  */
 #define NS_OPT_DNSSEC_OK	0x8000U
+#define NS_OPT_NSID             3
 
 /*%
  * Inline versions of get/put short/long.  Pointer is advanced.

Modified: stable/7/include/resolv.h
==============================================================================
--- stable/7/include/resolv.h	Wed Dec 17 10:49:03 2008	(r186219)
+++ stable/7/include/resolv.h	Wed Dec 17 12:31:04 2008	(r186220)
@@ -50,7 +50,7 @@
 
 /*%
  *	@(#)resolv.h	8.1 (Berkeley) 6/2/93
- *	$Id: resolv.h,v 1.19.18.3 2005/08/25 04:43:51 marka Exp $
+ *	$Id: resolv.h,v 1.19.18.4 2008/04/03 23:15:15 marka Exp $
  * $FreeBSD$
  */
 
@@ -245,6 +245,7 @@ union res_sockaddr_union {
 #define	RES_NOCHECKNAME	0x00008000	/*%< do not check names for sanity. */
 #define	RES_KEEPTSIG	0x00010000	/*%< do not strip TSIG records */
 #define	RES_BLAST	0x00020000	/*%< blast all recursive servers */
+#define RES_NSID	0x00040000      /*%< request name server ID */
 #define RES_NOTLDQUERY	0x00100000	/*%< don't unqualified name as a tld */
 #define RES_USE_DNSSEC	0x00200000	/*%< use DNSSEC using OK bit in OPT */
 /* #define RES_DEBUG2	0x00400000 */	/* nslookup internal */
@@ -386,6 +387,7 @@ extern const struct res_sym __p_rcode_sy
 #define sym_ntos		__sym_ntos
 #define sym_ston		__sym_ston
 #define res_nopt		__res_nopt
+#define res_nopt_rdata       	__res_nopt_rdata
 #define res_ndestroy		__res_ndestroy
 #define	res_nametoclass		__res_nametoclass
 #define	res_nametotype		__res_nametotype
@@ -474,6 +476,8 @@ int		res_findzonecut2(res_state, const c
 				 union res_sockaddr_union *, int);
 void		res_nclose(res_state);
 int		res_nopt(res_state, int, u_char *, int, int);
+int		res_nopt_rdata(res_state, int, u_char *, int, u_char *,
+			       u_short, u_short, u_char *);
 void		res_send_setqhook(res_send_qhook);
 void		res_send_setrhook(res_send_rhook);
 int		__res_vinit(res_state, int);

Modified: stable/7/lib/libc/include/isc/eventlib.h
==============================================================================
--- stable/7/lib/libc/include/isc/eventlib.h	Wed Dec 17 10:49:03 2008	(r186219)
+++ stable/7/lib/libc/include/isc/eventlib.h	Wed Dec 17 12:31:04 2008	(r186220)
@@ -18,7 +18,7 @@
 /* eventlib.h - exported interfaces for eventlib
  * vix 09sep95 [initial]
  *
- * $Id: eventlib.h,v 1.3.18.2 2005/07/28 07:38:07 marka Exp $
+ * $Id: eventlib.h,v 1.3.18.3 2008/01/23 02:12:01 marka Exp $
  */
 
 #ifndef _EVENTLIB_H
@@ -29,6 +29,8 @@
 #include <sys/time.h>
 #include <stdio.h>
 
+#include <isc/platform.h>
+
 #ifndef __P
 # define __EVENTLIB_P_DEFINED
 # ifdef __STDC__

Copied: stable/7/lib/libc/include/isc/platform.h (from r186090, head/lib/libc/include/isc/platform.h)
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ stable/7/lib/libc/include/isc/platform.h	Wed Dec 17 12:31:04 2008	(r186220, copy of r186090, head/lib/libc/include/isc/platform.h)
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2008  Internet Systems Consortium, Inc. ("ISC")
+ *
+ * Permission to use, copy, modify, and/or distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
+ * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
+ * AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
+ * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
+ * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
+ * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+ * PERFORMANCE OF THIS SOFTWARE.
+ */
+
+/* $Id: platform.h.in,v 1.2.6.2 2008/01/23 02:15:02 tbox Exp $ */
+/* $FreeBSD$ */
+
+/*! \file */
+
+#ifndef ISC_PLATFORM_H
+#define ISC_PLATFORM_H
+
+/*
+ * Define if the OS does not define struct timespec.
+ */
+#undef ISC_PLATFORM_NEEDTIMESPEC
+#ifdef ISC_PLATFORM_NEEDTIMESPEC
+#include <time.h>               /* For time_t */
+struct timespec {
+	time_t  tv_sec;         /* seconds */
+	long    tv_nsec;        /* nanoseconds */
+};
+#endif
+
+#endif

Modified: stable/7/lib/libc/inet/inet_net_pton.c
==============================================================================
--- stable/7/lib/libc/inet/inet_net_pton.c	Wed Dec 17 10:49:03 2008	(r186219)
+++ stable/7/lib/libc/inet/inet_net_pton.c	Wed Dec 17 12:31:04 2008	(r186220)
@@ -16,7 +16,7 @@
  */
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.1 2005/04/27 05:00:53 sra Exp $";
+static const char rcsid[] = "$Id: inet_net_pton.c,v 1.7.18.2 2008/08/26 04:42:43 marka Exp $";
 #endif
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
@@ -135,11 +135,11 @@ inet_net_pton_ipv4(const char *src, u_ch
 			assert(n >= 0 && n <= 9);
 			bits *= 10;
 			bits += n;
+			if (bits > 32)
+				goto enoent;
 		} while ((ch = *src++) != '\0' && isascii(ch) && isdigit(ch));
 		if (ch != '\0')
 			goto enoent;
-		if (bits > 32)
-			goto emsgsize;
 	}
 
 	/* Firey death and destruction unless we prefetched EOS. */

Modified: stable/7/lib/libc/resolv/res_debug.c
==============================================================================
--- stable/7/lib/libc/resolv/res_debug.c	Wed Dec 17 10:49:03 2008	(r186219)
+++ stable/7/lib/libc/resolv/res_debug.c	Wed Dec 17 12:31:04 2008	(r186220)
@@ -91,7 +91,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static const char sccsid[] = "@(#)res_debug.c	8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_debug.c,v 1.10.18.5 2005/07/28 07:38:11 marka Exp $";
+static const char rcsid[] = "$Id: res_debug.c,v 1.10.18.6 2008/04/03 23:15:15 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
@@ -187,10 +187,56 @@ do_section(const res_state statp,
 				p_type(ns_rr_type(rr)),
 				p_class(ns_rr_class(rr)));
 		else if (section == ns_s_ar && ns_rr_type(rr) == ns_t_opt) {
+			u_int16_t optcode, optlen, rdatalen = ns_rr_rdlen(rr);
 			u_int32_t ttl = ns_rr_ttl(rr);
+
 			fprintf(file,
 				"; EDNS: version: %u, udp=%u, flags=%04x\n",
 				(ttl>>16)&0xff, ns_rr_class(rr), ttl&0xffff);
+
+			while (rdatalen >= 4) {
+				const u_char *cp = ns_rr_rdata(rr);
+				int i;
+
+				GETSHORT(optcode, cp);
+				GETSHORT(optlen, cp);
+
+				if (optcode == NS_OPT_NSID) {
+					fputs("; NSID: ", file);
+					if (optlen == 0) {
+						fputs("; NSID\n", file);
+					} else {
+						fputs("; NSID: ", file);
+						for (i = 0; i < optlen; i++)
+							fprintf(file, "%02x ",
+								cp[i]);
+						fputs(" (",file);
+						for (i = 0; i < optlen; i++)
+							fprintf(file, "%c",
+								isprint(cp[i])?
+								cp[i] : '.');
+						fputs(")\n", file);
+					}
+				} else {
+					if (optlen == 0) {
+						fprintf(file, "; OPT=%u\n",
+							optcode);
+					} else {
+						fprintf(file, "; OPT=%u: ",
+							optcode);
+						for (i = 0; i < optlen; i++)
+							fprintf(file, "%02x ",
+								cp[i]);
+						fputs(" (",file);
+						for (i = 0; i < optlen; i++)
+							fprintf(file, "%c",
+								isprint(cp[i]) ?
+									cp[i] : '.');
+						fputs(")\n", file);
+					}
+				}
+				rdatalen -= 4 + optlen;
+			}
 		} else {
 			n = ns_sprintrr(handle, &rr, NULL, NULL,
 					buf, buflen);
@@ -202,7 +248,7 @@ do_section(const res_state statp,
 						buf = malloc(buflen += 1024);
 					if (buf == NULL) {
 						fprintf(file,
-				              ";; memory allocation failure\n");
+					      ";; memory allocation failure\n");
 					      return;
 					}
 					continue;
@@ -379,7 +425,7 @@ static const struct res_sym __p_default_
 	{ns_s_an,	"ANSWER",	(char *)0},
 	{ns_s_ns,	"AUTHORITY",	(char *)0},
 	{ns_s_ar,	"ADDITIONAL",	(char *)0},
-	{0,             (char *)0,	(char *)0}
+	{0,		(char *)0,	(char *)0}
 };
 
 static const struct res_sym __p_update_section_syms[] = {
@@ -387,7 +433,7 @@ static const struct res_sym __p_update_s
 	{S_PREREQ,	"PREREQUISITE",	(char *)0},
 	{S_UPDATE,	"UPDATE",	(char *)0},
 	{S_ADDT,	"ADDITIONAL",	(char *)0},
-	{0,             (char *)0,	(char *)0}
+	{0,		(char *)0,	(char *)0}
 };
 
 const struct res_sym __p_key_syms[] = {
@@ -615,6 +661,7 @@ p_option(u_long option) {
 	case RES_USE_INET6:	return "inet6";
 #ifdef RES_USE_EDNS0	/*%< KAME extension */
 	case RES_USE_EDNS0:	return "edns0";
+	case RES_NSID:		return "nsid";
 #endif
 #ifdef RES_USE_DNAME
 	case RES_USE_DNAME:	return "dname";

Modified: stable/7/lib/libc/resolv/res_mkquery.c
==============================================================================
--- stable/7/lib/libc/resolv/res_mkquery.c	Wed Dec 17 10:49:03 2008	(r186219)
+++ stable/7/lib/libc/resolv/res_mkquery.c	Wed Dec 17 12:31:04 2008	(r186220)
@@ -66,7 +66,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static const char sccsid[] = "@(#)res_mkquery.c	8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_mkquery.c,v 1.5.18.1 2005/04/27 05:01:11 sra Exp $";
+static const char rcsid[] = "$Id: res_mkquery.c,v 1.5.18.2 2008/04/03 23:15:15 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
@@ -201,9 +201,6 @@ res_nmkquery(res_state statp,
 
 #ifdef RES_USE_EDNS0
 /* attach OPT pseudo-RR, as documented in RFC2671 (EDNS0). */
-#ifndef T_OPT
-#define T_OPT	41
-#endif
 
 int
 res_nopt(res_state statp,
@@ -228,15 +225,16 @@ res_nopt(res_state statp,
 	if ((ep - cp) < 1 + RRFIXEDSZ)
 		return (-1);
 
-	*cp++ = 0;	/*%< "." */
-	ns_put16(T_OPT, cp);	/*%< TYPE */
+	*cp++ = 0;				/*%< "." */
+	ns_put16(ns_t_opt, cp);			/*%< TYPE */
 	cp += INT16SZ;
 	if (anslen > 0xffff)
 		anslen = 0xffff;		/* limit to 16bit value */
-	ns_put16(anslen & 0xffff, cp);	/*%< CLASS = UDP payload size */
+	ns_put16(anslen & 0xffff, cp);		/*%< CLASS = UDP payload size */
 	cp += INT16SZ;
-	*cp++ = NOERROR;	/*%< extended RCODE */
-	*cp++ = 0;		/*%< EDNS version */
+	*cp++ = NOERROR;			/*%< extended RCODE */
+	*cp++ = 0;				/*%< EDNS version */
+
 	if (statp->options & RES_USE_DNSSEC) {
 #ifdef DEBUG
 		if (statp->options & RES_DEBUG)
@@ -246,12 +244,60 @@ res_nopt(res_state statp,
 	}
 	ns_put16(flags, cp);
 	cp += INT16SZ;
-	ns_put16(0, cp);	/*%< RDLEN */
+
+	ns_put16(0U, cp);			/*%< RDLEN */
 	cp += INT16SZ;
+
 	hp->arcount = htons(ntohs(hp->arcount) + 1);
 
 	return (cp - buf);
 }
+
+/*
+ * Construct variable data (RDATA) block for OPT psuedo-RR, append it
+ * to the buffer, then update the RDLEN field (previously set to zero by
+ * res_nopt()) with the new RDATA length.
+ */
+int
+res_nopt_rdata(res_state statp,
+	  int n0,	 	/*%< current offset in buffer */
+	  u_char *buf,	 	/*%< buffer to put query */
+	  int buflen,		/*%< size of buffer */
+	  u_char *rdata,	/*%< ptr to start of opt rdata */
+	  u_short code,		/*%< OPTION-CODE */
+	  u_short len,		/*%< OPTION-LENGTH */
+	  u_char *data)		/*%< OPTION_DATA */
+{
+	register u_char *cp, *ep;
+
+#ifdef DEBUG
+	if ((statp->options & RES_DEBUG) != 0U)
+		printf(";; res_nopt_rdata()\n");
+#endif
+
+	cp = buf + n0;
+	ep = buf + buflen;
+
+	if ((ep - cp) < (4 + len))
+		return (-1);
+
+	if (rdata < (buf + 2) || rdata >= ep)
+		return (-1);
+
+	ns_put16(code, cp);
+	cp += INT16SZ;
+
+	ns_put16(len, cp);
+	cp += INT16SZ;
+
+	memcpy(cp, data, len);
+	cp += len;
+
+	len = cp - rdata;
+	ns_put16(len, rdata - 2);	/* Update RDLEN field */
+
+	return (cp - buf);
+}
 #endif
 
 /*! \file */

Modified: stable/7/lib/libc/resolv/res_query.c
==============================================================================
--- stable/7/lib/libc/resolv/res_query.c	Wed Dec 17 10:49:03 2008	(r186219)
+++ stable/7/lib/libc/resolv/res_query.c	Wed Dec 17 12:31:04 2008	(r186220)
@@ -66,7 +66,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static const char sccsid[] = "@(#)res_query.c	8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_query.c,v 1.7.18.1 2005/04/27 05:01:11 sra Exp $";
+static const char rcsid[] = "$Id: res_query.c,v 1.7.18.2 2008/04/03 23:15:15 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
@@ -115,8 +115,9 @@ res_nquery(res_state statp,
 {
 	u_char buf[MAXPACKET];
 	HEADER *hp = (HEADER *) answer;
-	int n;
 	u_int oflags;
+	u_char *rdata;
+	int n;
 
 	oflags = statp->_flags;
 
@@ -131,8 +132,14 @@ again:
 			 buf, sizeof(buf));
 #ifdef RES_USE_EDNS0
 	if (n > 0 && (statp->_flags & RES_F_EDNS0ERR) == 0 &&
-	    (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC)) != 0U)
+	    (statp->options & (RES_USE_EDNS0|RES_USE_DNSSEC|RES_NSID))) {
 		n = res_nopt(statp, n, buf, sizeof(buf), anslen);
+		rdata = &buf[n];
+		if (n > 0 && (statp->options & RES_NSID) != 0U) {
+			n = res_nopt_rdata(statp, n, buf, sizeof(buf), rdata,
+					   NS_OPT_NSID, 0, NULL);
+		}
+	}
 #endif
 	if (n <= 0) {
 #ifdef DEBUG
@@ -142,6 +149,7 @@ again:
 		RES_SET_H_ERRNO(statp, NO_RECOVERY);
 		return (n);
 	}
+
 	n = res_nsend(statp, buf, n, answer, anslen);
 	if (n < 0) {
 #ifdef RES_USE_EDNS0

Modified: stable/7/lib/libc/resolv/res_send.c
==============================================================================
--- stable/7/lib/libc/resolv/res_send.c	Wed Dec 17 10:49:03 2008	(r186219)
+++ stable/7/lib/libc/resolv/res_send.c	Wed Dec 17 12:31:04 2008	(r186220)
@@ -66,7 +66,7 @@
 
 #if defined(LIBC_SCCS) && !defined(lint)
 static const char sccsid[] = "@(#)res_send.c	8.1 (Berkeley) 6/4/93";
-static const char rcsid[] = "$Id: res_send.c,v 1.9.18.8 2006/10/16 23:00:58 marka Exp $";
+static const char rcsid[] = "$Id: res_send.c,v 1.9.18.10 2008/01/27 02:06:26 marka Exp $";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
@@ -302,7 +302,7 @@ int
 res_nsend(res_state statp,
 	  const u_char *buf, int buflen, u_char *ans, int anssiz)
 {
-	int gotsomewhere, terrno, try, v_circuit, resplen, ns, n;
+	int gotsomewhere, terrno, tries, v_circuit, resplen, ns, n;
 #ifdef USE_KQUEUE
 	int kq;
 #endif
@@ -420,7 +420,7 @@ res_nsend(res_state statp,
 	/*
 	 * Send request, RETRY times, or until successful.
 	 */
-	for (try = 0; try < statp->retry; try++) {
+	for (tries = 0; tries < statp->retry; tries++) {
 	    for (ns = 0; ns < statp->nscount; ns++) {
 		struct sockaddr *nsap;
 		int nsaplen;
@@ -471,7 +471,7 @@ res_nsend(res_state statp,
 
 		if (v_circuit) {
 			/* Use VC; at most one attempt per server. */
-			try = statp->retry;
+			tries = statp->retry;
 			n = send_vc(statp, buf, buflen, ans, anssiz, &terrno,
 				    ns);
 			if (n < 0)
@@ -486,7 +486,7 @@ res_nsend(res_state statp,
 				    kq,
 #endif
 				    buf, buflen, ans, anssiz, &terrno,
-				    ns, try, &v_circuit, &gotsomewhere);
+				    ns, tries, &v_circuit, &gotsomewhere);
 			if (n < 0)
 				goto fail;
 			if (n == 0)
@@ -632,6 +632,9 @@ send_vc(res_state statp,
 	u_short len;
 	u_char *cp;
 	void *tmp;
+#ifdef SO_NOSIGPIPE
+	int on = 1;
+#endif
 
 	nsap = get_nsaddr(statp, ns);
 	nsaplen = get_salen(nsap);
@@ -679,6 +682,17 @@ send_vc(res_state statp,
 				return (-1);
 			}
 		}
+#ifdef SO_NOSIGPIPE
+		/*
+		 * Disable generation of SIGPIPE when writing to a closed
+		 * socket.  Write should return -1 and set errno to EPIPE
+		 * instead. 
+		 *
+		 * Push on even if setsockopt(SO_NOSIGPIPE) fails.
+		 */
+		(void)_setsockopt(statp->_vcsock, SOL_SOCKET, SO_NOSIGPIPE, &on,
+			         sizeof(on));
+#endif
 		errno = 0;
 		if (_connect(statp->_vcsock, nsap, nsaplen) < 0) {
 			*terrno = errno;
@@ -811,7 +825,7 @@ send_dg(res_state statp,
 	int kq,
 #endif
 	const u_char *buf, int buflen, u_char *ans,
-	int anssiz, int *terrno, int ns, int try, int *v_circuit,
+	int anssiz, int *terrno, int ns, int tries, int *v_circuit,
 	int *gotsomewhere)
 {
 	const HEADER *hp = (const HEADER *) buf;
@@ -915,7 +929,7 @@ send_dg(res_state statp,
 	/*
 	 * Wait for reply.
 	 */
-	seconds = (statp->retrans << try);
+	seconds = (statp->retrans << tries);
 	if (ns > 0)
 		seconds /= statp->nscount;
 	if (seconds <= 0)

From owner-svn-src-stable-7@FreeBSD.ORG  Wed Dec 17 17:37:54 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id C616E1065673;
	Wed, 17 Dec 2008 17:37:54 +0000 (UTC)
	(envelope-from ambrisko@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B08988FC21;
	Wed, 17 Dec 2008 17:37:54 +0000 (UTC)
	(envelope-from ambrisko@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBHHbsQw010396;
	Wed, 17 Dec 2008 17:37:54 GMT
	(envelope-from ambrisko@svn.freebsd.org)
Received: (from ambrisko@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBHHbsjs010394;
	Wed, 17 Dec 2008 17:37:54 GMT
	(envelope-from ambrisko@svn.freebsd.org)
Message-Id: <200812171737.mBHHbsjs010394@svn.freebsd.org>
From: Doug Ambrisko <ambrisko@FreeBSD.org>
Date: Wed, 17 Dec 2008 17:37:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186238 - in stable/7/sys: . dev/mfi
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Wed, 17 Dec 2008 17:37:54 -0000

Author: ambrisko
Date: Wed Dec 17 17:37:54 2008
New Revision: 186238
URL: http://svn.freebsd.org/changeset/base/186238

Log:
  MFC: r185584,185994,185999,186132 which updates the strings that identifies
       the new supported HW and bump the driver version number.
  
  Submitted by:	LSI
  Approved by:	re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/dev/mfi/mfi.c
  stable/7/sys/dev/mfi/mfi_pci.c

Modified: stable/7/sys/dev/mfi/mfi.c
==============================================================================
--- stable/7/sys/dev/mfi/mfi.c	Wed Dec 17 17:35:14 2008	(r186237)
+++ stable/7/sys/dev/mfi/mfi.c	Wed Dec 17 17:37:54 2008	(r186238)
@@ -296,7 +296,8 @@ mfi_attach(struct mfi_softc *sc)
 	uint32_t status;
 	int error, commsz, framessz, sensesz;
 	int frames, unit, max_fw_sge;
-    device_printf(sc->mfi_dev, "Megaraid SAS driver Ver 2.00 \n");
+
+	device_printf(sc->mfi_dev, "Megaraid SAS driver Ver 3.00 \n");
 
 	mtx_init(&sc->mfi_io_lock, "MFI I/O lock", NULL, MTX_DEF);
 	sx_init(&sc->mfi_config_lock, "MFI config");

Modified: stable/7/sys/dev/mfi/mfi_pci.c
==============================================================================
--- stable/7/sys/dev/mfi/mfi_pci.c	Wed Dec 17 17:35:14 2008	(r186237)
+++ stable/7/sys/dev/mfi/mfi_pci.c	Wed Dec 17 17:37:54 2008	(r186238)
@@ -114,18 +114,21 @@ struct mfi_ident {
 	int		flags;
 	const char	*desc;
 } mfi_identifiers[] = {
-	{0x1000, 0x0411, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Brocton IOP */
-	{0x1000, 0x0413, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Verde ZCR */
-	{0x1028, 0x0015, 0xffff, 0xffff, MFI_FLAGS_1064R, "Dell PERC 5/i"},
 	{0x1000, 0x0060, 0x1028, 0xffff, MFI_FLAGS_1078,  "Dell PERC 6"},
- 	{0x1000, 0x0060, 0xffff, 0xffff, MFI_FLAGS_1078,  "LSI MegaSAS 1078"},
-	{0x1000, 0x0079, 0x1028, 0x1f15, MFI_FLAGS_GEN2,  "Dell PERC 607E Adapter"},
-	{0x1000, 0x0079, 0x1028, 0x1f16, MFI_FLAGS_GEN2,  "Dell PERC 607I Adapter"},
-	{0x1000, 0x0079, 0x1028, 0x1f17, MFI_FLAGS_GEN2,  "Dell PERC 607I Integrated"},
-	{0x1000, 0x0079, 0x1028, 0x1f18, MFI_FLAGS_GEN2,  "Dell PERC 607I Modular"},
+	{0x1000, 0x0060, 0xffff, 0xffff, MFI_FLAGS_1078,  "LSI MegaSAS 1078"},
 	{0x1000, 0x0078, 0xffff, 0xffff, MFI_FLAGS_GEN2,  "LSI MegaSAS Gen2"},
+	{0x1000, 0x0079, 0x1028, 0x1f15, MFI_FLAGS_GEN2,  "Dell PERC H800 Adapter"},
+	{0x1000, 0x0079, 0x1028, 0x1f16, MFI_FLAGS_GEN2,  "Dell PERC H700 Adapter"},
+	{0x1000, 0x0079, 0x1028, 0x1f17, MFI_FLAGS_GEN2,  "Dell PERC H700 Integrated"},
+	{0x1000, 0x0079, 0x1028, 0x1f18, MFI_FLAGS_GEN2,  "Dell PERC H700 Modular"},
+	{0x1000, 0x0079, 0x1028, 0x1f19, MFI_FLAGS_GEN2,  "Dell PERC H700"},
+	{0x1000, 0x0079, 0x1028, 0x1f1b, MFI_FLAGS_GEN2,  "Dell PERC H800"},
+	{0x1000, 0x0079, 0x1028, 0xffff, MFI_FLAGS_GEN2,  "Dell PERC Gen2"},
 	{0x1000, 0x0079, 0xffff, 0xffff, MFI_FLAGS_GEN2,  "LSI MegaSAS Gen2"},
 	{0x1000, 0x007c, 0xffff, 0xffff, MFI_FLAGS_1078,  "LSI MegaSAS 1078"},
+	{0x1000, 0x0411, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Brocton IOP */
+	{0x1000, 0x0413, 0xffff, 0xffff, MFI_FLAGS_1064R, "LSI MegaSAS 1064R"}, /* Verde ZCR */
+	{0x1028, 0x0015, 0xffff, 0xffff, MFI_FLAGS_1064R, "Dell PERC 5/i"},
 	{0, 0, 0, 0, 0, NULL}
 };
 

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Dec 19 00:14:45 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id B8CB61065675;
	Fri, 19 Dec 2008 00:14:45 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AA1C58FC13;
	Fri, 19 Dec 2008 00:14:45 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBJ0EjKd056010;
	Fri, 19 Dec 2008 00:14:45 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBJ0EjGU056009;
	Fri, 19 Dec 2008 00:14:45 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200812190014.mBJ0EjGU056009@svn.freebsd.org>
From: Xin LI <delphij@FreeBSD.org>
Date: Fri, 19 Dec 2008 00:14:45 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186303 - in stable/7/sys: . contrib/pf dev/bce dev/cxgb
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Dec 2008 00:14:45 -0000

Author: delphij
Date: Fri Dec 19 00:14:45 2008
New Revision: 186303
URL: http://svn.freebsd.org/changeset/base/186303

Log:
  MFC r186168:
  
  Test whether sc->tx_mbuf_map[i], not whether sc->tx_mbuf_map is NULL before
  doing bus_dmamap_sync() since it operates on the former, not the latter.
  
  Approved by:	re (kensmith)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/bce/if_bce.c
  stable/7/sys/dev/cxgb/   (props changed)

Modified: stable/7/sys/dev/bce/if_bce.c
==============================================================================
--- stable/7/sys/dev/bce/if_bce.c	Thu Dec 18 23:00:09 2008	(r186302)
+++ stable/7/sys/dev/bce/if_bce.c	Fri Dec 19 00:14:45 2008	(r186303)
@@ -5114,7 +5114,7 @@ bce_free_tx_chain(struct bce_softc *sc)
 	/* Unmap, unload, and free any mbufs still in the TX mbuf chain. */
 	for (i = 0; i < TOTAL_TX_BD; i++) {
 		if (sc->tx_mbuf_ptr[i] != NULL) {
-			if (sc->tx_mbuf_map != NULL)
+			if (sc->tx_mbuf_map[i] != NULL)
 				bus_dmamap_sync(sc->tx_mbuf_tag, sc->tx_mbuf_map[i],
 					BUS_DMASYNC_POSTWRITE);
 			m_freem(sc->tx_mbuf_ptr[i]);

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Dec 19 00:17:09 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9208B106564A;
	Fri, 19 Dec 2008 00:17:09 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 83D718FC0C;
	Fri, 19 Dec 2008 00:17:09 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBJ0H9Mv056111;
	Fri, 19 Dec 2008 00:17:09 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBJ0H9j1056110;
	Fri, 19 Dec 2008 00:17:09 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <200812190017.mBJ0H9j1056110@svn.freebsd.org>
From: Xin LI <delphij@FreeBSD.org>
Date: Fri, 19 Dec 2008 00:17:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186304 - in stable/7/sys: . contrib/pf dev/bce dev/cxgb
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Dec 2008 00:17:09 -0000

Author: delphij
Date: Fri Dec 19 00:17:09 2008
New Revision: 186304
URL: http://svn.freebsd.org/changeset/base/186304

Log:
  MFC r186169:
  
  Don't count InFramesL2FilterDiscards into Ierr.  This value does not represent
  a real packet error but simply indicate that an unexpected unicast or multicast
  error was received by the NIC, which was not counted in the past as well.
  
  Reported by:	many (on -stable@)
  Reviewed by:	davidch
  Approved by:	re (kensmith)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/bce/if_bce.c
  stable/7/sys/dev/cxgb/   (props changed)

Modified: stable/7/sys/dev/bce/if_bce.c
==============================================================================
--- stable/7/sys/dev/bce/if_bce.c	Fri Dec 19 00:14:45 2008	(r186303)
+++ stable/7/sys/dev/bce/if_bce.c	Fri Dec 19 00:17:09 2008	(r186304)
@@ -7408,7 +7408,6 @@ bce_stats_update(struct bce_softc *sc)
 		(u_long) sc->stat_IfInMBUFDiscards +
 		(u_long) sc->stat_Dot3StatsAlignmentErrors +
 		(u_long) sc->stat_Dot3StatsFCSErrors +
-		(u_long) sc->stat_IfInFramesL2FilterDiscards +
 		(u_long) sc->stat_IfInRuleCheckerDiscards +
 		(u_long) sc->stat_IfInFTQDiscards +
 		(u_long) sc->com_no_buffers;

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Dec 19 03:59:22 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 522591065670;
	Fri, 19 Dec 2008 03:59:21 +0000 (UTC)
	(envelope-from kensmith@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 406288FC1C;
	Fri, 19 Dec 2008 03:59:21 +0000 (UTC)
	(envelope-from kensmith@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBJ3xLMj060882;
	Fri, 19 Dec 2008 03:59:21 GMT
	(envelope-from kensmith@svn.freebsd.org)
Received: (from kensmith@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBJ3xLov060881;
	Fri, 19 Dec 2008 03:59:21 GMT
	(envelope-from kensmith@svn.freebsd.org)
Message-Id: <200812190359.mBJ3xLov060881@svn.freebsd.org>
From: Ken Smith <kensmith@FreeBSD.org>
Date: Fri, 19 Dec 2008 03:59:21 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186309 - in stable/7/sys: . contrib/pf dev/cxgb
	nfsserver
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Dec 2008 03:59:22 -0000

Author: kensmith
Date: Fri Dec 19 03:59:20 2008
New Revision: 186309
URL: http://svn.freebsd.org/changeset/base/186309

Log:
  MFC r186165:
  > Handle VFS_VGET() failing with an error other than EOPNOTSUPP in addition
  > to failing with that error.
  >
  > PR:           125149
  > Submitted by: Jaakko Heinonen (jh <at> saunalahti <dot> fi)
  > Reviewed by:  mohans, kan
  
  Approved by:	re (kib)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/nfsserver/nfs_serv.c

Modified: stable/7/sys/nfsserver/nfs_serv.c
==============================================================================
--- stable/7/sys/nfsserver/nfs_serv.c	Fri Dec 19 01:37:20 2008	(r186308)
+++ stable/7/sys/nfsserver/nfs_serv.c	Fri Dec 19 03:59:20 2008	(r186309)
@@ -3600,9 +3600,12 @@ again:
 	 * Probe one of the directory entries to see if the filesystem
 	 * supports VGET.
 	 */
-	if (VFS_VGET(vp->v_mount, dp->d_fileno, LK_EXCLUSIVE, &nvp) ==
-	    EOPNOTSUPP) {
-		error = NFSERR_NOTSUPP;
+	error = VFS_VGET(vp->v_mount, dp->d_fileno, LK_EXCLUSIVE, &nvp);
+	if (error) {
+		if (error == EOPNOTSUPP)
+			error = NFSERR_NOTSUPP;
+		else
+			error = NFSERR_SERVERFAULT;
 		vrele(vp);
 		vp = NULL;
 		free((caddr_t)cookies, M_TEMP);

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Dec 19 06:33:18 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 8293D1065674;
	Fri, 19 Dec 2008 06:33:18 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 70EB08FC19;
	Fri, 19 Dec 2008 06:33:18 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBJ6XICM063915;
	Fri, 19 Dec 2008 06:33:18 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBJ6XIqq063914;
	Fri, 19 Dec 2008 06:33:18 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200812190633.mBJ6XIqq063914@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Fri, 19 Dec 2008 06:33:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186312 - stable/7/share/man/man4
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Dec 2008 06:33:18 -0000

Author: kmacy
Date: Fri Dec 19 06:33:18 2008
New Revision: 186312
URL: http://svn.freebsd.org/changeset/base/186312

Log:
  MFC 185970
   fix support and capabilities
  
  Approved by:	re

Modified:
  stable/7/share/man/man4/cxgb.4

Modified: stable/7/share/man/man4/cxgb.4
==============================================================================
--- stable/7/share/man/man4/cxgb.4	Fri Dec 19 05:05:35 2008	(r186311)
+++ stable/7/share/man/man4/cxgb.4	Fri Dec 19 06:33:18 2008	(r186312)
@@ -1,4 +1,4 @@
-.\" Copyright (c) 2007, Chelsio Inc
+.\" Copyright (c) 2007-2008, Chelsio Inc
 .\" All rights reserved.
 .\"
 .\" Redistribution and use in source and binary forms, with or without
@@ -56,7 +56,8 @@ if_cxgb_load="YES"
 The
 .Nm
 driver supports Transmit/Receive checksum offload,
-Jumbo Frames as well as TCP segmentation offload (TSO).
+Jumbo Frames, TCP segmentation offload (TSO), Large Receive Offload (LRO),
+VLAN hardware insertion / extraction, and VLAN checksum offload.
 For further hardware information, see
 .Pa http://www.chelsio.com/ .
 .Pp
@@ -76,7 +77,7 @@ For more information on configuring this
 .Sh HARDWARE
 The
 .Nm
-driver supports 10 Gigabit Ethernet adapters based on the T3 and T3B chipset:
+driver supports 10 Gigabit and 1 Gigabit Ethernet adapters based on the T3 and T3B chipset:
 .Pp
 .Bl -bullet -compact
 .It
@@ -111,7 +112,7 @@ go to the Chelsio support website at:
 If an issue is identified with the released source code on the supported kernel
 with a supported adapter, email the specific information related to the
 issue to
-.Aq help@chelsio.com .
+.Aq support@chelsio.com .
 .Sh SEE ALSO
 .Xr altq 4 ,
 .Xr arp 4 ,

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Dec 19 14:47:39 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 1B3BD106564A;
	Fri, 19 Dec 2008 14:47:39 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0A2A78FC0C;
	Fri, 19 Dec 2008 14:47:39 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBJElcc9074632;
	Fri, 19 Dec 2008 14:47:38 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBJElcEI074631;
	Fri, 19 Dec 2008 14:47:38 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200812191447.mBJElcEI074631@svn.freebsd.org>
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Fri, 19 Dec 2008 14:47:38 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186321 - in stable/7/sys: . contrib/pf dev/cxgb kern
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Dec 2008 14:47:39 -0000

Author: kib
Date: Fri Dec 19 14:47:38 2008
New Revision: 186321
URL: http://svn.freebsd.org/changeset/base/186321

Log:
  MFC r185764:
  Do drop vm map lock earlier in the sysctl_kern_proc_vmmap(), to avoid
  locking a vnode while having vm map locked.
  
  Approved by:	re (kensmith)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/kern/kern_proc.c

Modified: stable/7/sys/kern/kern_proc.c
==============================================================================
--- stable/7/sys/kern/kern_proc.c	Fri Dec 19 14:33:29 2008	(r186320)
+++ stable/7/sys/kern/kern_proc.c	Fri Dec 19 14:47:38 2008	(r186321)
@@ -1413,13 +1413,32 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A
 			lobj = tobj;
 		}
 
+		kve->kve_start = (void*)entry->start;
+		kve->kve_end = (void*)entry->end;
+		kve->kve_offset = (off_t)entry->offset;
+
+		if (entry->protection & VM_PROT_READ)
+			kve->kve_protection |= KVME_PROT_READ;
+		if (entry->protection & VM_PROT_WRITE)
+			kve->kve_protection |= KVME_PROT_WRITE;
+		if (entry->protection & VM_PROT_EXECUTE)
+			kve->kve_protection |= KVME_PROT_EXEC;
+
+		if (entry->eflags & MAP_ENTRY_COW)
+			kve->kve_flags |= KVME_FLAG_COW;
+		if (entry->eflags & MAP_ENTRY_NEEDS_COPY)
+			kve->kve_flags |= KVME_FLAG_NEEDS_COPY;
+
+		last_timestamp = map->timestamp;
+		vm_map_unlock_read(map);
+
 		kve->kve_fileid = 0;
 		kve->kve_fsid = 0;
 		freepath = NULL;
 		fullpath = "";
 		if (lobj) {
 			vp = NULL;
-			switch(lobj->type) {
+			switch (lobj->type) {
 			case OBJT_DEFAULT:
 				kve->kve_type = KVME_TYPE_DEFAULT;
 				break;
@@ -1470,28 +1489,10 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A
 			kve->kve_shadow_count = 0;
 		}
 
-		kve->kve_start = (void*)entry->start;
-		kve->kve_end = (void*)entry->end;
-		kve->kve_offset = (off_t)entry->offset;
-
-		if (entry->protection & VM_PROT_READ)
-			kve->kve_protection |= KVME_PROT_READ;
-		if (entry->protection & VM_PROT_WRITE)
-			kve->kve_protection |= KVME_PROT_WRITE;
-		if (entry->protection & VM_PROT_EXECUTE)
-			kve->kve_protection |= KVME_PROT_EXEC;
-
-		if (entry->eflags & MAP_ENTRY_COW)
-			kve->kve_flags |= KVME_FLAG_COW;
-		if (entry->eflags & MAP_ENTRY_NEEDS_COPY)
-			kve->kve_flags |= KVME_FLAG_NEEDS_COPY;
-
 		strlcpy(kve->kve_path, fullpath, sizeof(kve->kve_path));
 		if (freepath != NULL)
 			free(freepath, M_TEMP);
 
-		last_timestamp = map->timestamp;
-		vm_map_unlock_read(map);
 		error = SYSCTL_OUT(req, kve, sizeof(*kve));
 		vm_map_lock_read(map);
 		if (error)
@@ -1578,13 +1579,32 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR
 			lobj = tobj;
 		}
 
+		kve->kve_start = entry->start;
+		kve->kve_end = entry->end;
+		kve->kve_offset = entry->offset;
+
+		if (entry->protection & VM_PROT_READ)
+			kve->kve_protection |= KVME_PROT_READ;
+		if (entry->protection & VM_PROT_WRITE)
+			kve->kve_protection |= KVME_PROT_WRITE;
+		if (entry->protection & VM_PROT_EXECUTE)
+			kve->kve_protection |= KVME_PROT_EXEC;
+
+		if (entry->eflags & MAP_ENTRY_COW)
+			kve->kve_flags |= KVME_FLAG_COW;
+		if (entry->eflags & MAP_ENTRY_NEEDS_COPY)
+			kve->kve_flags |= KVME_FLAG_NEEDS_COPY;
+
+		last_timestamp = map->timestamp;
+		vm_map_unlock_read(map);
+
 		kve->kve_fileid = 0;
 		kve->kve_fsid = 0;
 		freepath = NULL;
 		fullpath = "";
 		if (lobj) {
 			vp = NULL;
-			switch(lobj->type) {
+			switch (lobj->type) {
 			case OBJT_DEFAULT:
 				kve->kve_type = KVME_TYPE_DEFAULT;
 				break;
@@ -1635,28 +1655,10 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR
 			kve->kve_shadow_count = 0;
 		}
 
-		kve->kve_start = entry->start;
-		kve->kve_end = entry->end;
-		kve->kve_offset = entry->offset;
-
-		if (entry->protection & VM_PROT_READ)
-			kve->kve_protection |= KVME_PROT_READ;
-		if (entry->protection & VM_PROT_WRITE)
-			kve->kve_protection |= KVME_PROT_WRITE;
-		if (entry->protection & VM_PROT_EXECUTE)
-			kve->kve_protection |= KVME_PROT_EXEC;
-
-		if (entry->eflags & MAP_ENTRY_COW)
-			kve->kve_flags |= KVME_FLAG_COW;
-		if (entry->eflags & MAP_ENTRY_NEEDS_COPY)
-			kve->kve_flags |= KVME_FLAG_NEEDS_COPY;
-
 		strlcpy(kve->kve_path, fullpath, sizeof(kve->kve_path));
 		if (freepath != NULL)
 			free(freepath, M_TEMP);
 
-		last_timestamp = map->timestamp;
-		vm_map_unlock_read(map);
 		/* Pack record size down */
 		kve->kve_structsize = offsetof(struct kinfo_vmentry, kve_path) +
 		    strlen(kve->kve_path) + 1;

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Dec 19 15:04:27 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 6A9C71065679;
	Fri, 19 Dec 2008 15:04:27 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 593F98FC13;
	Fri, 19 Dec 2008 15:04:27 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBJF4R0N075064;
	Fri, 19 Dec 2008 15:04:27 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBJF4Rje075062;
	Fri, 19 Dec 2008 15:04:27 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200812191504.mBJF4Rje075062@svn.freebsd.org>
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Fri, 19 Dec 2008 15:04:27 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186323 - in stable/7/sys: . compat/linprocfs
	contrib/pf dev/cxgb fs/procfs
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Dec 2008 15:04:27 -0000

Author: kib
Date: Fri Dec 19 15:04:26 2008
New Revision: 186323
URL: http://svn.freebsd.org/changeset/base/186323

Log:
  MFC r185765, r185766:
  Make two style changes to create new commit and document proper commit
  message for r185765.
  Commit message for r185765 should be:
  In procfs map handler, and in linprocfs maps handler, do not call
  vn_fullpath() while having vm map locked. This is done in anticipation
  of the vop_vptocnp commit, that would make vn_fullpath sometime
  acquire vnode lock.
  
  Also, in linprocfs, maps handler already acquires vnode lock.
  
  MFC r185864:
  Relock user map earlier, to have the lock held when break leaves the
  loop earlier due to sbuf error.
  
  Approved by:	re (kensmith)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/compat/linprocfs/linprocfs.c
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/fs/procfs/procfs_map.c

Modified: stable/7/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- stable/7/sys/compat/linprocfs/linprocfs.c	Fri Dec 19 14:49:14 2008	(r186322)
+++ stable/7/sys/compat/linprocfs/linprocfs.c	Fri Dec 19 15:04:26 2008	(r186323)
@@ -269,8 +269,7 @@ linprocfs_docpuinfo(PFS_FILL_ARGS)
 		/* XXX per-cpu vendor / class / model / id? */
 	}
 
-	sbuf_cat(sb,
-	    "flags\t\t:");
+	sbuf_cat(sb, "flags\t\t:");
 
 	if (!strcmp(cpu_vendor, "AuthenticAMD") && (class < 6)) {
 		flags[16] = "fcmov";
@@ -870,10 +869,12 @@ static int
 linprocfs_doprocmaps(PFS_FILL_ARGS)
 {
 	vm_map_t map = &p->p_vmspace->vm_map;
-	vm_map_entry_t entry;
+	vm_map_entry_t entry, tmp_entry;
 	vm_object_t obj, tobj, lobj;
-	vm_offset_t saved_end;
+	vm_offset_t e_start, e_end;
 	vm_ooffset_t off = 0;
+	vm_prot_t e_prot;
+	unsigned int last_timestamp;
 	char *name = "", *freename = NULL;
 	ino_t ino;
 	int ref_count, shadow_count, flags;
@@ -899,7 +900,9 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 		freename = NULL;
 		if (entry->eflags & MAP_ENTRY_IS_SUB_MAP)
 			continue;
-		saved_end = entry->end;
+		e_prot = entry->protection;
+		e_start = entry->start;
+		e_end = entry->end;
 		obj = entry->object.vm_object;
 		for (lobj = tobj = obj; tobj; tobj = tobj->backing_object) {
 			VM_OBJECT_LOCK(tobj);
@@ -907,6 +910,8 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 				VM_OBJECT_UNLOCK(lobj);
 			lobj = tobj;
 		}
+		last_timestamp = map->timestamp;
+		vm_map_unlock_read(map);
 		ino = 0;
 		if (lobj) {
 			off = IDX_TO_OFF(lobj->size);
@@ -944,10 +949,10 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 		 */
 		error = sbuf_printf(sb,
 		    "%08lx-%08lx %s%s%s%s %08lx %02x:%02x %lu%s%s\n",
-		    (u_long)entry->start, (u_long)entry->end,
-		    (entry->protection & VM_PROT_READ)?"r":"-",
-		    (entry->protection & VM_PROT_WRITE)?"w":"-",
-		    (entry->protection & VM_PROT_EXECUTE)?"x":"-",
+		    (u_long)e_start, (u_long)e_end,
+		    (e_prot & VM_PROT_READ)?"r":"-",
+		    (e_prot & VM_PROT_WRITE)?"w":"-",
+		    (e_prot & VM_PROT_EXECUTE)?"x":"-",
 		    "p",
 		    (u_long)off,
 		    0,
@@ -958,10 +963,20 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 		    );
 		if (freename)
 			free(freename, M_TEMP);
+		vm_map_lock_read(map);
 		if (error == -1) {
 			error = 0;
 			break;
 		}
+		if (last_timestamp + 1 != map->timestamp) {
+			/*
+			 * Look again for the entry because the map was
+			 * modified while it was unlocked.  Specifically,
+			 * the entry may have been clipped, merged, or deleted.
+			 */
+			vm_map_lookup_entry(map, e_end - 1, &tmp_entry);
+			entry = tmp_entry;
+		}
 	}
 	vm_map_unlock_read(map);
 

Modified: stable/7/sys/fs/procfs/procfs_map.c
==============================================================================
--- stable/7/sys/fs/procfs/procfs_map.c	Fri Dec 19 14:49:14 2008	(r186322)
+++ stable/7/sys/fs/procfs/procfs_map.c	Fri Dec 19 15:04:26 2008	(r186323)
@@ -82,11 +82,12 @@ extern struct sysentvec ia32_freebsd_sys
 int
 procfs_doprocmap(PFS_FILL_ARGS)
 {
-	int error, vfslocked;
 	vm_map_t map = &p->p_vmspace->vm_map;
-	vm_map_entry_t entry;
+	vm_map_entry_t entry, tmp_entry;
 	struct vnode *vp;
 	char *fullpath, *freepath;
+	int error, vfslocked;
+	unsigned int last_timestamp;
 #ifdef COMPAT_IA32
 	int wrap32 = 0;
 #endif
@@ -113,13 +114,19 @@ procfs_doprocmap(PFS_FILL_ARGS)
 	     entry = entry->next) {
 		vm_object_t obj, tobj, lobj;
 		int ref_count, shadow_count, flags;
-		vm_offset_t addr;
+		vm_offset_t e_start, e_end, addr;
 		int resident, privateresident;
 		char *type;
+		vm_eflags_t e_eflags;
+		vm_prot_t e_prot;
 
 		if (entry->eflags & MAP_ENTRY_IS_SUB_MAP)
 			continue;
 
+		e_eflags = entry->eflags;
+		e_prot = entry->protection;
+		e_start = entry->start;
+		e_end = entry->end;
 		privateresident = 0;
 		obj = entry->object.vm_object;
 		if (obj != NULL) {
@@ -143,11 +150,13 @@ procfs_doprocmap(PFS_FILL_ARGS)
 				VM_OBJECT_UNLOCK(lobj);
 			lobj = tobj;
 		}
+		last_timestamp = map->timestamp;
+		vm_map_unlock_read(map);
 
 		freepath = NULL;
 		fullpath = "-";
 		if (lobj) {
-			switch(lobj->type) {
+			switch (lobj->type) {
 			default:
 			case OBJT_DEFAULT:
 				type = "default";
@@ -194,28 +203,37 @@ procfs_doprocmap(PFS_FILL_ARGS)
 		 */
 		error = sbuf_printf(sb,
 		    "0x%lx 0x%lx %d %d %p %s%s%s %d %d 0x%x %s %s %s %s\n",
-			(u_long)entry->start, (u_long)entry->end,
+			(u_long)e_start, (u_long)e_end,
 			resident, privateresident,
 #ifdef COMPAT_IA32
 			wrap32 ? NULL : obj,	/* Hide 64 bit value */
 #else
 			obj,
 #endif
-			(entry->protection & VM_PROT_READ)?"r":"-",
-			(entry->protection & VM_PROT_WRITE)?"w":"-",
-			(entry->protection & VM_PROT_EXECUTE)?"x":"-",
+			(e_prot & VM_PROT_READ)?"r":"-",
+			(e_prot & VM_PROT_WRITE)?"w":"-",
+			(e_prot & VM_PROT_EXECUTE)?"x":"-",
 			ref_count, shadow_count, flags,
-			(entry->eflags & MAP_ENTRY_COW)?"COW":"NCOW",
-			(entry->eflags & MAP_ENTRY_NEEDS_COPY)?"NC":"NNC",
+			(e_eflags & MAP_ENTRY_COW)?"COW":"NCOW",
+			(e_eflags & MAP_ENTRY_NEEDS_COPY)?"NC":"NNC",
 			type, fullpath);
 
 		if (freepath != NULL)
 			free(freepath, M_TEMP);
-
+		vm_map_lock_read(map);
 		if (error == -1) {
 			error = 0;
 			break;
 		}
+		if (last_timestamp + 1 != map->timestamp) {
+			/*
+			 * Look again for the entry because the map was
+			 * modified while it was unlocked.  Specifically,
+			 * the entry may have been clipped, merged, or deleted.
+			 */
+			vm_map_lookup_entry(map, e_end - 1, &tmp_entry);
+			entry = tmp_entry;
+		}
 	}
 	vm_map_unlock_read(map);
 	return (error);

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Dec 19 15:24:18 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id EEC531065677;
	Fri, 19 Dec 2008 15:24:18 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DE0A48FC1E;
	Fri, 19 Dec 2008 15:24:18 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBJFOIxP075548;
	Fri, 19 Dec 2008 15:24:18 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBJFOIMj075547;
	Fri, 19 Dec 2008 15:24:18 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200812191524.mBJFOIMj075547@svn.freebsd.org>
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Fri, 19 Dec 2008 15:24:18 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186324 - in stable/7/sys: . contrib/pf dev/cxgb kern
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Dec 2008 15:24:19 -0000

Author: kib
Date: Fri Dec 19 15:24:18 2008
New Revision: 186324
URL: http://svn.freebsd.org/changeset/base/186324

Log:
  MFC r185983:
  The userland_sysctl() function retries sysctl_root() until returned
  error is not EAGAIN. Several sysctls that inspect another process use
  p_candebug() for checking access right for the curproc. p_candebug()
  returns EAGAIN for some reasons, in particular, for the process doing
  exec() now. If execing process tries to lock Giant, we get a livelock,
  because sysctl handlers are covered by Giant, and often do not sleep.
  
  Break the livelock by dropping Giant and allowing other threads to
  execute in the EAGAIN loop.
  
  This commit does not merge the following change, as was discussed with jhb:
  [Also, do not return EAGAIN from p_candebug() when process is executing,
  use more appropriate EBUSY error.]
  
  MFC r185987:
  Uio_yield() already does DROP_GIANT/PICKUP_GIANT, no need to repeat this
  around the call.
  
  Approved by:	re (kensmith)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/kern/kern_sysctl.c

Modified: stable/7/sys/kern/kern_sysctl.c
==============================================================================
--- stable/7/sys/kern/kern_sysctl.c	Fri Dec 19 15:04:26 2008	(r186323)
+++ stable/7/sys/kern/kern_sysctl.c	Fri Dec 19 15:24:18 2008	(r186324)
@@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/mutex.h>
 #include <sys/sx.h>
 #include <sys/sysproto.h>
+#include <sys/uio.h>
 
 #include <security/mac/mac_framework.h>
 
@@ -1395,11 +1396,14 @@ userland_sysctl(struct thread *td, int *
 
 	SYSCTL_LOCK();
 
-	do {
+	for (;;) {
 		req.oldidx = 0;
 		req.newidx = 0;
 		error = sysctl_root(0, name, namelen, &req);
-	} while (error == EAGAIN);
+		if (error != EAGAIN)
+			break;
+		uio_yield();
+	}
 
 	if (req.lock == REQ_WIRED && req.validlen > 0)
 		vsunlock(req.oldptr, req.validlen);

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Dec 19 15:32:49 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id E82B41065670;
	Fri, 19 Dec 2008 15:32:48 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D73A68FC17;
	Fri, 19 Dec 2008 15:32:48 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBJFWmjT075738;
	Fri, 19 Dec 2008 15:32:48 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBJFWmFr075735;
	Fri, 19 Dec 2008 15:32:48 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <200812191532.mBJFWmFr075735@svn.freebsd.org>
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Fri, 19 Dec 2008 15:32:48 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186325 - in stable/7/sys: . compat/linprocfs
	contrib/pf dev/cxgb fs/procfs kern
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Dec 2008 15:32:49 -0000

Author: kib
Date: Fri Dec 19 15:32:48 2008
New Revision: 186325
URL: http://svn.freebsd.org/changeset/base/186325

Log:
  MFC r185984:
  Reference the vmspace of the process being inspected by procfs, linprocfs
  and sysctl kern_proc_vmmap handlers.
  
  Approved by:	re (kensmith)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/compat/linprocfs/linprocfs.c
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/fs/procfs/procfs_map.c
  stable/7/sys/kern/kern_proc.c

Modified: stable/7/sys/compat/linprocfs/linprocfs.c
==============================================================================
--- stable/7/sys/compat/linprocfs/linprocfs.c	Fri Dec 19 15:24:18 2008	(r186324)
+++ stable/7/sys/compat/linprocfs/linprocfs.c	Fri Dec 19 15:32:48 2008	(r186325)
@@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$");
 #include <net/if.h>
 
 #include <vm/vm.h>
+#include <vm/vm_extern.h>
 #include <vm/pmap.h>
 #include <vm/vm_map.h>
 #include <vm/vm_param.h>
@@ -868,7 +869,8 @@ linprocfs_doprocenviron(PFS_FILL_ARGS)
 static int
 linprocfs_doprocmaps(PFS_FILL_ARGS)
 {
-	vm_map_t map = &p->p_vmspace->vm_map;
+	struct vmspace *vm;
+	vm_map_t map;
 	vm_map_entry_t entry, tmp_entry;
 	vm_object_t obj, tobj, lobj;
 	vm_offset_t e_start, e_end;
@@ -893,6 +895,10 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 		return (EOPNOTSUPP);
 
 	error = 0;
+	vm = vmspace_acquire_ref(p);
+	if (vm == NULL)
+		return (ESRCH);
+	map = &vm->vm_map;
 	vm_map_lock_read(map);
 	for (entry = map->header.next; entry != &map->header;
 	    entry = entry->next) {
@@ -979,6 +985,7 @@ linprocfs_doprocmaps(PFS_FILL_ARGS)
 		}
 	}
 	vm_map_unlock_read(map);
+	vmspace_free(vm);
 
 	return (error);
 }

Modified: stable/7/sys/fs/procfs/procfs_map.c
==============================================================================
--- stable/7/sys/fs/procfs/procfs_map.c	Fri Dec 19 15:24:18 2008	(r186324)
+++ stable/7/sys/fs/procfs/procfs_map.c	Fri Dec 19 15:32:48 2008	(r186325)
@@ -53,6 +53,7 @@
 #include <fs/procfs/procfs.h>
 
 #include <vm/vm.h>
+#include <vm/vm_extern.h>
 #include <vm/pmap.h>
 #include <vm/vm_map.h>
 #include <vm/vm_page.h>
@@ -82,7 +83,8 @@ extern struct sysentvec ia32_freebsd_sys
 int
 procfs_doprocmap(PFS_FILL_ARGS)
 {
-	vm_map_t map = &p->p_vmspace->vm_map;
+	struct vmspace *vm;
+	vm_map_t map;
 	vm_map_entry_t entry, tmp_entry;
 	struct vnode *vp;
 	char *fullpath, *freepath;
@@ -109,6 +111,10 @@ procfs_doprocmap(PFS_FILL_ARGS)
         }
 #endif
 
+	vm = vmspace_acquire_ref(p);
+	if (vm == NULL)
+		return (ESRCH);
+	map = &vm->vm_map;
 	vm_map_lock_read(map);
 	for (entry = map->header.next; entry != &map->header;
 	     entry = entry->next) {
@@ -236,5 +242,6 @@ procfs_doprocmap(PFS_FILL_ARGS)
 		}
 	}
 	vm_map_unlock_read(map);
+	vmspace_free(vm);
 	return (error);
 }

Modified: stable/7/sys/kern/kern_proc.c
==============================================================================
--- stable/7/sys/kern/kern_proc.c	Fri Dec 19 15:24:18 2008	(r186324)
+++ stable/7/sys/kern/kern_proc.c	Fri Dec 19 15:32:48 2008	(r186325)
@@ -1358,6 +1358,7 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A
 	struct vnode *vp;
 	struct proc *p;
 	vm_map_t map;
+	struct vmspace *vm;
 
 	name = (int *)arg1;
 	if ((p = pfind((pid_t)name[0])) == NULL)
@@ -1372,7 +1373,11 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A
 	}
 	_PHOLD(p);
 	PROC_UNLOCK(p);
-
+	vm = vmspace_acquire_ref(p);
+	if (vm == NULL) {
+		PRELE(p);
+		return (ESRCH);
+	}
 	kve = malloc(sizeof(*kve), M_TEMP, M_WAITOK);
 
 	map = &p->p_vmspace->vm_map;	/* XXXRW: More locking required? */
@@ -1503,6 +1508,7 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A
 		}
 	}
 	vm_map_unlock_read(map);
+	vmspace_free(vm);
 	PRELE(p);
 	free(kve, M_TEMP);
 	return (error);
@@ -1524,6 +1530,7 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR
 	int error, *name;
 	struct vnode *vp;
 	struct proc *p;
+	struct vmspace *vm;
 	vm_map_t map;
 
 	name = (int *)arg1;
@@ -1539,10 +1546,14 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR
 	}
 	_PHOLD(p);
 	PROC_UNLOCK(p);
-
+	vm = vmspace_acquire_ref(p);
+	if (vm == NULL) {
+		PRELE(p);
+		return (ESRCH);
+	}
 	kve = malloc(sizeof(*kve), M_TEMP, M_WAITOK);
 
-	map = &p->p_vmspace->vm_map;	/* XXXRW: More locking required? */
+	map = &vm->vm_map;	/* XXXRW: More locking required? */
 	vm_map_lock_read(map);
 	for (entry = map->header.next; entry != &map->header;
 	    entry = entry->next) {
@@ -1674,6 +1685,7 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR
 		}
 	}
 	vm_map_unlock_read(map);
+	vmspace_free(vm);
 	PRELE(p);
 	free(kve, M_TEMP);
 	return (error);

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Dec 19 20:19:59 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 79336106564A;
	Fri, 19 Dec 2008 20:19:59 +0000 (UTC)
	(envelope-from marcus@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 671798FC1D;
	Fri, 19 Dec 2008 20:19:59 +0000 (UTC)
	(envelope-from marcus@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBJKJxe1081744;
	Fri, 19 Dec 2008 20:19:59 GMT (envelope-from marcus@svn.freebsd.org)
Received: (from marcus@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBJKJx5I081742;
	Fri, 19 Dec 2008 20:19:59 GMT (envelope-from marcus@svn.freebsd.org)
Message-Id: <200812192019.mBJKJx5I081742@svn.freebsd.org>
From: Joe Marcus Clarke <marcus@FreeBSD.org>
Date: Fri, 19 Dec 2008 20:19:59 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186336 - stable/7/lib/libutil
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Dec 2008 20:19:59 -0000

Author: marcus (doc,ports committer)
Date: Fri Dec 19 20:19:59 2008
New Revision: 186336
URL: http://svn.freebsd.org/changeset/base/186336

Log:
  MFC r186314:
  
  Initialize the cntp pointer to 0 prior to doing any work so that callers
  don't try to iterate through garbage or NULL memory.  Additionally, return
  NULL instead of 0 on error.
  
  Approved by:	re (kib)

Modified:
  stable/7/lib/libutil/kinfo_getfile.c
  stable/7/lib/libutil/kinfo_getvmmap.c

Modified: stable/7/lib/libutil/kinfo_getfile.c
==============================================================================
--- stable/7/lib/libutil/kinfo_getfile.c	Fri Dec 19 18:47:46 2008	(r186335)
+++ stable/7/lib/libutil/kinfo_getfile.c	Fri Dec 19 20:19:59 2008	(r186336)
@@ -19,6 +19,7 @@ kinfo_getfile(pid_t pid, int *cntp)
 	char *buf, *bp, *eb;
 	struct kinfo_file *kif, *kp, *kf;
 
+	*cntp = 0;
 	len = 0;
 	mib[0] = CTL_KERN;
 	mib[1] = KERN_PROC;
@@ -27,15 +28,15 @@ kinfo_getfile(pid_t pid, int *cntp)
 
 	error = sysctl(mib, 4, NULL, &len, NULL, 0);
 	if (error)
-		return (0);
+		return (NULL);
 	len = len * 4 / 3;
 	buf = malloc(len);
 	if (buf == NULL)
-		return (0);
+		return (NULL);
 	error = sysctl(mib, 4, buf, &len, NULL, 0);
 	if (error) {
 		free(buf);
-		return (0);
+		return (NULL);
 	}
 	/* Pass 1: count items */
 	cnt = 0;
@@ -50,7 +51,7 @@ kinfo_getfile(pid_t pid, int *cntp)
 	kif = calloc(cnt, sizeof(*kif));
 	if (kif == NULL) {
 		free(buf);
-		return (0);
+		return (NULL);
 	}
 	bp = buf;
 	eb = buf + len;

Modified: stable/7/lib/libutil/kinfo_getvmmap.c
==============================================================================
--- stable/7/lib/libutil/kinfo_getvmmap.c	Fri Dec 19 18:47:46 2008	(r186335)
+++ stable/7/lib/libutil/kinfo_getvmmap.c	Fri Dec 19 20:19:59 2008	(r186336)
@@ -19,6 +19,7 @@ kinfo_getvmmap(pid_t pid, int *cntp)
 	char *buf, *bp, *eb;
 	struct kinfo_vmentry *kiv, *kp, *kv;
 
+	*cntp = 0;
 	len = 0;
 	mib[0] = CTL_KERN;
 	mib[1] = KERN_PROC;
@@ -27,15 +28,15 @@ kinfo_getvmmap(pid_t pid, int *cntp)
 
 	error = sysctl(mib, 4, NULL, &len, NULL, 0);
 	if (error)
-		return (0);
+		return (NULL);
 	len = len * 4 / 3;
 	buf = malloc(len);
 	if (buf == NULL)
-		return (0);
+		return (NULL);
 	error = sysctl(mib, 4, buf, &len, NULL, 0);
 	if (error) {
 		free(buf);
-		return (0);
+		return (NULL);
 	}
 	/* Pass 1: count items */
 	cnt = 0;
@@ -50,7 +51,7 @@ kinfo_getvmmap(pid_t pid, int *cntp)
 	kiv = calloc(cnt, sizeof(*kiv));
 	if (kiv == NULL) {
 		free(buf);
-		return (0);
+		return (NULL);
 	}
 	bp = buf;
 	eb = buf + len;

From owner-svn-src-stable-7@FreeBSD.ORG  Fri Dec 19 20:20:50 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 9D5A31065674;
	Fri, 19 Dec 2008 20:20:50 +0000 (UTC)
	(envelope-from marcus@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8BDC68FC20;
	Fri, 19 Dec 2008 20:20:50 +0000 (UTC)
	(envelope-from marcus@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBJKKo0g081839;
	Fri, 19 Dec 2008 20:20:50 GMT (envelope-from marcus@svn.freebsd.org)
Received: (from marcus@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBJKKo6P081837;
	Fri, 19 Dec 2008 20:20:50 GMT (envelope-from marcus@svn.freebsd.org)
Message-Id: <200812192020.mBJKKo6P081837@svn.freebsd.org>
From: Joe Marcus Clarke <marcus@FreeBSD.org>
Date: Fri, 19 Dec 2008 20:20:50 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186338 - stable/7/usr.bin/procstat
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Fri, 19 Dec 2008 20:20:50 -0000

Author: marcus (doc,ports committer)
Date: Fri Dec 19 20:20:50 2008
New Revision: 186338
URL: http://svn.freebsd.org/changeset/base/186338

Log:
  MFC r186315:
  
  Do not segfault when procstat -f or procstat -v is called on a process not
  owned by the current user.  If kinfo_getfile() or kinfo_getvmmap() return
  NULL, simply exit, and do not try and derefernce the memory.
  
  Approved by:	re (kib)

Modified:
  stable/7/usr.bin/procstat/procstat_files.c
  stable/7/usr.bin/procstat/procstat_vm.c

Modified: stable/7/usr.bin/procstat/procstat_files.c
==============================================================================
--- stable/7/usr.bin/procstat/procstat_files.c	Fri Dec 19 20:20:14 2008	(r186337)
+++ stable/7/usr.bin/procstat/procstat_files.c	Fri Dec 19 20:20:50 2008	(r186338)
@@ -144,6 +144,8 @@ procstat_files(pid_t pid, struct kinfo_p
 		    "PRO", "NAME");
 
 	freep = kinfo_getfile(pid, &cnt);
+	if (freep == NULL)
+		return;
 	for (i = 0; i < cnt; i++) {
 		kif = &freep[i];
 		

Modified: stable/7/usr.bin/procstat/procstat_vm.c
==============================================================================
--- stable/7/usr.bin/procstat/procstat_vm.c	Fri Dec 19 20:20:14 2008	(r186337)
+++ stable/7/usr.bin/procstat/procstat_vm.c	Fri Dec 19 20:20:50 2008	(r186338)
@@ -54,6 +54,8 @@ procstat_vm(pid_t pid, struct kinfo_proc
 		    "PRES", "REF", "SHD", "FL", "TP", "PATH");
 
 	freep = kinfo_getvmmap(pid, &cnt);
+	if (freep == NULL)
+		return;
 	for (i = 0; i < cnt; i++) {
 		kve = &freep[i];
 		printf("%5d ", pid);

From owner-svn-src-stable-7@FreeBSD.ORG  Sat Dec 20 19:39:10 2008
Return-Path: <owner-svn-src-stable-7@FreeBSD.ORG>
Delivered-To: svn-src-stable-7@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 3E72E106564A;
	Sat, 20 Dec 2008 19:39:10 +0000 (UTC)
	(envelope-from csjp@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2A9FB8FC08;
	Sat, 20 Dec 2008 19:39:10 +0000 (UTC)
	(envelope-from csjp@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id mBKJdAxp012458;
	Sat, 20 Dec 2008 19:39:10 GMT (envelope-from csjp@svn.freebsd.org)
Received: (from csjp@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id mBKJdA8F012457;
	Sat, 20 Dec 2008 19:39:10 GMT (envelope-from csjp@svn.freebsd.org)
Message-Id: <200812201939.mBKJdA8F012457@svn.freebsd.org>
From: "Christian S.J. Peron" <csjp@FreeBSD.org>
Date: Sat, 20 Dec 2008 19:39:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
	svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org
X-SVN-Group: stable-7
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r186363 - in stable/7/sys: . contrib/pf dev/cxgb netinet
X-BeenThere: svn-src-stable-7@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: SVN commit messages for only the 7-stable src tree
	<svn-src-stable-7.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-stable-7>
List-Post: <mailto:svn-src-stable-7@freebsd.org>
List-Help: <mailto:svn-src-stable-7-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-stable-7>, 
	<mailto:svn-src-stable-7-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 20 Dec 2008 19:39:10 -0000

Author: csjp
Date: Sat Dec 20 19:39:09 2008
New Revision: 186363
URL: http://svn.freebsd.org/changeset/base/186363

Log:
  MFC revision 185713 from head.
  
  Make sure we are maintaining the reference count on the route eliminating
  another:
  
  rtfree: 0xc841ee88 has 1 refs
  
  Reviewed by:	bz
  Approved by:	re@ (gnn)

Modified:
  stable/7/sys/   (props changed)
  stable/7/sys/contrib/pf/   (props changed)
  stable/7/sys/dev/cxgb/   (props changed)
  stable/7/sys/netinet/if_ether.c

Modified: stable/7/sys/netinet/if_ether.c
==============================================================================
--- stable/7/sys/netinet/if_ether.c	Sat Dec 20 17:55:37 2008	(r186362)
+++ stable/7/sys/netinet/if_ether.c	Sat Dec 20 19:39:09 2008	(r186363)
@@ -909,12 +909,12 @@ reply:
 			 * over who claims what Ether address.
 			 */
 			if (rt->rt_ifp == ifp) {
-				rtfree(rt);
+				RTFREE_LOCKED(rt);
 				goto drop;
 			}
 			(void)memcpy(ar_tha(ah), ar_sha(ah), ah->ar_hln);
 			(void)memcpy(ar_sha(ah), enaddr, ah->ar_hln);
-			rtfree(rt);
+			RTFREE_LOCKED(rt);
 
 			/*
 			 * Also check that the node which sent the ARP packet
@@ -933,10 +933,10 @@ reply:
 				    " from %s via %s, expecting %s\n",
 				    inet_ntoa(isaddr), ifp->if_xname,
 				    rt->rt_ifp->if_xname);
-				rtfree(rt);
+				RTFREE_LOCKED(rt);
 				goto drop;
 			}
-			rtfree(rt);
+			RTFREE_LOCKED(rt);
 
 #ifdef DEBUG_PROXY
 			printf("arp: proxying for %s\n",