From owner-svn-src-stable-8@FreeBSD.ORG Sun Mar 18 10:45:37 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 011101065674; Sun, 18 Mar 2012 10:45:37 +0000 (UTC) (envelope-from hrs@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E44EE8FC14; Sun, 18 Mar 2012 10:45:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2IAjaL9015715; Sun, 18 Mar 2012 10:45:36 GMT (envelope-from hrs@svn.freebsd.org) Received: (from hrs@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2IAjapU015713; Sun, 18 Mar 2012 10:45:36 GMT (envelope-from hrs@svn.freebsd.org) Message-Id: <201203181045.q2IAjapU015713@svn.freebsd.org> From: Hiroki Sato Date: Sun, 18 Mar 2012 10:45:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233112 - stable/8/sys/netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 18 Mar 2012 10:45:37 -0000 Author: hrs Date: Sun Mar 18 10:45:36 2012 New Revision: 233112 URL: http://svn.freebsd.org/changeset/base/233112 Log: MFC r216650: Add IFT_L2VLAN to the list that is capable of supplying the ingredients of the EUI64 part of an IPv6 address. Otherwise vlans will all use the MAC address of the first ethernet interface of the system. Modified: stable/8/sys/netinet6/in6_ifattach.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netinet6/in6_ifattach.c ============================================================================== --- stable/8/sys/netinet6/in6_ifattach.c Sun Mar 18 09:52:54 2012 (r233111) +++ stable/8/sys/netinet6/in6_ifattach.c Sun Mar 18 10:45:36 2012 (r233112) @@ -267,6 +267,7 @@ found: /* get EUI64 */ switch (ifp->if_type) { case IFT_ETHER: + case IFT_L2VLAN: case IFT_FDDI: case IFT_ISO88025: case IFT_ATM: From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 01:04:47 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 769321065675; Mon, 19 Mar 2012 01:04:47 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6215C8FC0A; Mon, 19 Mar 2012 01:04:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J14lDJ043611; Mon, 19 Mar 2012 01:04:47 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J14l8h043609; Mon, 19 Mar 2012 01:04:47 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190104.q2J14l8h043609@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:04:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233140 - stable/8/bin/df X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:04:47 -0000 Author: eadler Date: Mon Mar 19 01:04:46 2012 New Revision: 233140 URL: http://svn.freebsd.org/changeset/base/233140 Log: MFC r232466, r232469: Direct users to swapinfo and pstat from df PR: bin/165321 Approved by: cperciva Modified: stable/8/bin/df/df.1 Directory Properties: stable/8/bin/df/ (props changed) Modified: stable/8/bin/df/df.1 ============================================================================== --- stable/8/bin/df/df.1 Mon Mar 19 01:04:26 2012 (r233139) +++ stable/8/bin/df/df.1 Mon Mar 19 01:04:46 2012 (r233140) @@ -29,7 +29,7 @@ .\" @(#)df.1 8.3 (Berkeley) 5/8/95 .\" $FreeBSD$ .\" -.Dd October 18, 2011 +.Dd March 3, 2012 .Dt DF 1 .Os .Sh NAME @@ -158,7 +158,9 @@ is set, the block counts will be display .El .Sh SEE ALSO .Xr lsvfs 1 , +.Xr pstat 1 , .Xr quota 1 , +.Xr swapinfo 1 , .Xr fstatfs 2 , .Xr getfsstat 2 , .Xr statfs 2 , From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 01:16:12 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 5559E106564A; Mon, 19 Mar 2012 01:16:12 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 409098FC0A; Mon, 19 Mar 2012 01:16:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1GCKI044032; Mon, 19 Mar 2012 01:16:12 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1GC2w044030; Mon, 19 Mar 2012 01:16:12 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190116.q2J1GC2w044030@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:16:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233142 - stable/8/share/man/man4 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:16:12 -0000 Author: eadler Date: Mon Mar 19 01:16:11 2012 New Revision: 233142 URL: http://svn.freebsd.org/changeset/base/233142 Log: MFC r232501: ehci tunables are only available when kernel is compiled with USB_DEBUG PR: docs/163646 Approved by: cperciva Modified: stable/8/share/man/man4/ehci.4 Directory Properties: stable/8/share/man/man4/ (props changed) Modified: stable/8/share/man/man4/ehci.4 ============================================================================== --- stable/8/share/man/man4/ehci.4 Mon Mar 19 01:15:36 2012 (r233141) +++ stable/8/share/man/man4/ehci.4 Mon Mar 19 01:16:11 2012 (r233142) @@ -87,7 +87,11 @@ The device driver first appeared in .Fx 5.1 . .Sh LOADER TUNABLES -Tunables can be set at the +When the kernel has been compiled with +.Cd options USB_DEBUG , +some tunables become available that affect the behavior of +.Nm . +These tunables can be set at the .Xr loader 8 prompt before booting the kernel or stored in .Xr loader.conf 5 . From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 01:18:47 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6655C1065670; Mon, 19 Mar 2012 01:18:47 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 513E88FC14; Mon, 19 Mar 2012 01:18:47 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1IlZp044181; Mon, 19 Mar 2012 01:18:47 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1IltA044179; Mon, 19 Mar 2012 01:18:47 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190118.q2J1IltA044179@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:18:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233144 - stable/8/sys/modules/dtrace/dtrace X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:18:47 -0000 Author: eadler Date: Mon Mar 19 01:18:46 2012 New Revision: 233144 URL: http://svn.freebsd.org/changeset/base/233144 Log: MFC r232506: Explicitly list dependency PR: misc/160463 Approved by: cperciva Modified: stable/8/sys/modules/dtrace/dtrace/Makefile Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/modules/dtrace/dtrace/Makefile ============================================================================== --- stable/8/sys/modules/dtrace/dtrace/Makefile Mon Mar 19 01:18:22 2012 (r233143) +++ stable/8/sys/modules/dtrace/dtrace/Makefile Mon Mar 19 01:18:46 2012 (r233144) @@ -42,4 +42,6 @@ EXPORT_SYMS= dtrace_register \ dtrace_unregister \ dtrace_probe_lookup +dtrace_asm.o: assym.s + .include From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 01:27:55 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E3760106564A; Mon, 19 Mar 2012 01:27:55 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9472A8FC08; Mon, 19 Mar 2012 01:27:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1RtwY044561; Mon, 19 Mar 2012 01:27:55 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1RtgB044557; Mon, 19 Mar 2012 01:27:55 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190127.q2J1RtgB044557@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:27:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233147 - stable/8/lib/libc/string X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:27:56 -0000 Author: eadler Date: Mon Mar 19 01:27:55 2012 New Revision: 233147 URL: http://svn.freebsd.org/changeset/base/233147 Log: MFC r232503: POSIX mandates that swab do nothing when len < 0 PR: 140690 Approved by: cperciva Modified: stable/8/lib/libc/string/swab.3 stable/8/lib/libc/string/swab.c Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/string/swab.3 ============================================================================== --- stable/8/lib/libc/string/swab.3 Mon Mar 19 01:27:30 2012 (r233146) +++ stable/8/lib/libc/string/swab.3 Mon Mar 19 01:27:55 2012 (r233147) @@ -28,7 +28,7 @@ .\" @(#)swab.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd December 10, 2004 +.Dd March 4, 2012 .Dt SWAB 3 .Os .Sh NAME @@ -54,6 +54,9 @@ swapping adjacent bytes. The argument .Fa len must be an even number. +If +.Fa len +is less than zero, nothing will be done. .Sh SEE ALSO .Xr bzero 3 , .Xr memset 3 Modified: stable/8/lib/libc/string/swab.c ============================================================================== --- stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:30 2012 (r233146) +++ stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:55 2012 (r233147) @@ -45,6 +45,8 @@ swab(const void * __restrict from, void int n; char *fp, *tp; + if (len <= 0) + return; n = len >> 1; fp = (char *)from; tp = (char *)to; From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 01:32:54 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 01E83106566C; Mon, 19 Mar 2012 01:32:54 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E03FE8FC0C; Mon, 19 Mar 2012 01:32:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1Wr7Q044826; Mon, 19 Mar 2012 01:32:53 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1Wrj0044824; Mon, 19 Mar 2012 01:32:53 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190132.q2J1Wrj0044824@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:32:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233150 - stable/8/lib/libc/stdio X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:32:54 -0000 Author: eadler Date: Mon Mar 19 01:32:53 2012 New Revision: 233150 URL: http://svn.freebsd.org/changeset/base/233150 Log: MFC r232504: Remove reference to gcc's non-standard -fwritable-strings, which doesn't exist in recent releases (and is bad advice anyway) PR: docs/163119 Approved by: cperciva Modified: stable/8/lib/libc/stdio/mktemp.3 Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/stdio/mktemp.3 ============================================================================== --- stable/8/lib/libc/stdio/mktemp.3 Mon Mar 19 01:32:28 2012 (r233149) +++ stable/8/lib/libc/stdio/mktemp.3 Mon Mar 19 01:32:53 2012 (r233150) @@ -28,7 +28,7 @@ .\" @(#)mktemp.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd February 11, 1998 +.Dd March 4, 2012 .Dt MKTEMP 3 .Os .Sh NAME @@ -180,12 +180,6 @@ with an argument of will result in a core dump due to .Fn mkstemp attempting to modify the string constant that was given. -If the program in question makes heavy use of that type -of function call, you do have the option of compiling the program -so that it will store string constants in a writable segment of memory. -See -.Xr gcc 1 -for more information. .Sh SEE ALSO .Xr chmod 2 , .Xr getpid 2 , From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 01:51:53 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9F7FF1065673; Mon, 19 Mar 2012 01:51:53 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8AAAD8FC1B; Mon, 19 Mar 2012 01:51:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1prYh045483; Mon, 19 Mar 2012 01:51:53 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1pr3s045481; Mon, 19 Mar 2012 01:51:53 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190151.q2J1pr3s045481@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:51:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233153 - stable/8/lib/libutil X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:51:53 -0000 Author: eadler Date: Mon Mar 19 01:51:53 2012 New Revision: 233153 URL: http://svn.freebsd.org/changeset/base/233153 Log: MFC r231306: Fix NULL ptr dereference in setusercontext if pwd is null, LOGIN_SETPRIORITY is set, and setting the priority (rtprio or setpriority) fails. PR: kern/164238 Approved by: cperciva Modified: stable/8/lib/libutil/login_class.c Directory Properties: stable/8/lib/libutil/ (props changed) Modified: stable/8/lib/libutil/login_class.c ============================================================================== --- stable/8/lib/libutil/login_class.c Mon Mar 19 01:51:08 2012 (r233152) +++ stable/8/lib/libutil/login_class.c Mon Mar 19 01:51:53 2012 (r233153) @@ -450,18 +450,21 @@ setusercontext(login_cap_t *lc, const st p = (rtp.prio > RTP_PRIO_MAX) ? 31 : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", - pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS); + pwd ? pwd->pw_name : "-", + lc ? lc->lc_class : LOGIN_DEFCLASS); } else if (p < PRIO_MIN) { rtp.type = RTP_PRIO_REALTIME; rtp.prio = abs(p - PRIO_MIN + RTP_PRIO_MAX); p = (rtp.prio > RTP_PRIO_MAX) ? 1 : p; if (rtprio(RTP_SET, 0, &rtp)) syslog(LOG_WARNING, "rtprio '%s' (%s): %m", - pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS); + pwd ? pwd->pw_name : "-", + lc ? lc->lc_class : LOGIN_DEFCLASS); } else { if (setpriority(PRIO_PROCESS, 0, (int)p) != 0) syslog(LOG_WARNING, "setpriority '%s' (%s): %m", - pwd->pw_name, lc ? lc->lc_class : LOGIN_DEFCLASS); + pwd ? pwd->pw_name : "-", + lc ? lc->lc_class : LOGIN_DEFCLASS); } } From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 01:52:08 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 12641106566B for ; Mon, 19 Mar 2012 01:52:08 +0000 (UTC) (envelope-from jhellenthal@dataix.net) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id B6A0E8FC19 for ; Mon, 19 Mar 2012 01:52:07 +0000 (UTC) Received: by iahk25 with SMTP id k25so12189832iah.13 for ; Sun, 18 Mar 2012 18:52:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dataix.net; s=rsa; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to; bh=xG6hlcWyhxQLTPxUfA9nTmQzEO3spsOmgd4YXYWJV7o=; b=JSeJE+P93+DKttHbq+q4opIAFoa1Vc4GZ8ws297hTRC5jE1/uVRTyfCNrGaLb+Nb2w T0z2qv8PrOyB3URyXXCGJ5ocf9nbkDY+s0f4R4+yZvkyd6IHRlSR9/XM8s3i2jJLSSdg IeTU64h7enPNg/Wuwl4GkVYg4yrqXA7Vj1xrE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:x-gm-message-state; bh=xG6hlcWyhxQLTPxUfA9nTmQzEO3spsOmgd4YXYWJV7o=; b=h/2TVhkUUT1hTEswGUtEjbViSkPnjaGJJWqWxM8JC4un/DhEojby8CkyRNTLaoDLpZ V5wYw3poPZngFpwjSV0aJH0/B4qXZYhJhr4mlLj3b+/iT9SkslVjE+6AVfH/afaHYolT SPQD4M0rVRR3qBUPSmFg6UzWjpCThWkDEcD0cxXe7zWesp2wStc7MQrs3YUxSVhhzoL2 mVPO0Q85639qltwhu3ZqiWD6j/CUmH/92PvdZ1tKrO/IKeYU/oN8faTxGon73V0Cs75k F3f3Qm+R+Pf29G5FOaZCV6qGQB+MO2kTrNMOgyh5s/A0Ln//NhcJslJRz6PmCwJZieEb ZxOw== Received: by 10.50.161.232 with SMTP id xv8mr4943476igb.9.1332121927191; Sun, 18 Mar 2012 18:52:07 -0700 (PDT) Received: from DataIX.net (adsl-99-112-214-41.dsl.klmzmi.sbcglobal.net. [99.112.214.41]) by mx.google.com with ESMTPS id i7sm4962031igq.11.2012.03.18.18.52.05 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Mar 2012 18:52:06 -0700 (PDT) Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.5/8.14.5) with ESMTP id q2J1q3eR059729 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 18 Mar 2012 21:52:03 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Received: (from jhellenthal@localhost) by DataIX.net (8.14.5/8.14.5/Submit) id q2J1q3wF059660; Sun, 18 Mar 2012 21:52:03 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Date: Sun, 18 Mar 2012 21:52:03 -0400 From: Jason Hellenthal To: Eitan Adler Message-ID: <20120319015203.GB13456@DataIX.net> References: <201203190127.q2J1RtgB044557@svn.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="uQr8t48UFsdbeI+V" Content-Disposition: inline In-Reply-To: <201203190127.q2J1RtgB044557@svn.freebsd.org> X-Gm-Message-State: ALoCoQlXmAERtc4Ntr0dqaubMQd73knXfrUqPyNVKhHeCai8v3eQrb4gS3UcpARXXYdMWgbOhfRd Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233147 - stable/8/lib/libc/string X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:52:08 -0000 --uQr8t48UFsdbeI+V Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 19, 2012 at 01:27:55AM +0000, Eitan Adler wrote: > Author: eadler > Date: Mon Mar 19 01:27:55 2012 > New Revision: 233147 > URL: http://svn.freebsd.org/changeset/base/233147 >=20 > Log: > MFC r232503: > POSIX mandates that swab do nothing when len < 0 > =20 > PR: 140690 > Approved by: cperciva >=20 > Modified: stable/8/lib/libc/string/swab.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:30 2012 (r233146) > +++ stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:55 2012 (r233147) > @@ -45,6 +45,8 @@ swab(const void * __restrict from, void=20 > int n; > char *fp, *tp; > =20 > + if (len <=3D 0) > + return; Does this not test to see if it is also equal to 0(zero) ? If I understand the above statement "POSIX mandates that swab do nothing when len < 0" then the above code should be exactly that ... and not testing whether it is equal to zero... > n =3D len >> 1; > fp =3D (char *)from; > tp =3D (char *)to; > _______________________________________________ > svn-src-stable-8@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/svn-src-stable-8 > To unsubscribe, send any mail to "svn-src-stable-8-unsubscribe@freebsd.or= g" --=20 ;s =3D; --uQr8t48UFsdbeI+V Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJPZpFCAAoJEJBXh4mJ2FR+yNUH/j7hn/2z1yoIcP0Tbux7lQaT Y/z3W+dXCGGFuDkyIsoAQBF7zDAXqjUxjj0g/qJWakdq+SaRJA65v2AV8d1CYDbf fFlv5JY9UsDpjyHD4Z2r33Xk2hgTB8lDyJLEgFrPhbS3x9AY9euQ6oE1TS0R3J3/ 8I3Zde+MlU0c2g7ST3lZA4cKsKB8asl+fBd9NdpR7T7emryrLx2pjO+9ff9jeqpZ Sol1QnVWzgTbHkJVrM2GM3Y/1mWdpkCLa4yYNAW20u0y7/KX/Z5fNeBUZVHYFoDV wM8oioLDHhVc9d2fuWd6QaEwM5YYyh9BMC3SGALPNAAgIKwd1iOuDixKeufkmDg= =4Hc8 -----END PGP SIGNATURE----- --uQr8t48UFsdbeI+V-- From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 01:56:53 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 593FE106566C; Mon, 19 Mar 2012 01:56:53 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4158E8FC15; Mon, 19 Mar 2012 01:56:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2J1urGn045758; Mon, 19 Mar 2012 01:56:53 GMT (envelope-from eadler@svn.freebsd.org) Received: (from eadler@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2J1ursF045756; Mon, 19 Mar 2012 01:56:53 GMT (envelope-from eadler@svn.freebsd.org) Message-Id: <201203190156.q2J1ursF045756@svn.freebsd.org> From: Eitan Adler Date: Mon, 19 Mar 2012 01:56:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233156 - stable/8/lib/libc/stdio X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:56:53 -0000 Author: eadler Date: Mon Mar 19 01:56:52 2012 New Revision: 233156 URL: http://svn.freebsd.org/changeset/base/233156 Log: MFC r232505: Remove outdated comment of seven years PR: docs/116116 Approved by: cperciva Modified: stable/8/lib/libc/stdio/mktemp.3 Directory Properties: stable/8/lib/libc/ (props changed) Modified: stable/8/lib/libc/stdio/mktemp.3 ============================================================================== --- stable/8/lib/libc/stdio/mktemp.3 Mon Mar 19 01:56:26 2012 (r233155) +++ stable/8/lib/libc/stdio/mktemp.3 Mon Mar 19 01:56:52 2012 (r233156) @@ -236,10 +236,3 @@ and the return status of the call should This will ensure that the program does not continue blindly in the event that an attacker has already created the file with the intention of manipulating or reading its contents. -.Pp -The implementation of these functions calls -.Xr arc4random 3 , -which is not reentrant. -You must provide your own locking around this and other consumers of the -.Xr arc4random 3 -API. From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 01:58:44 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93E9B106564A for ; Mon, 19 Mar 2012 01:58:44 +0000 (UTC) (envelope-from lists@eitanadler.com) Received: from mail-lb0-f182.google.com (mail-lb0-f182.google.com [209.85.217.182]) by mx1.freebsd.org (Postfix) with ESMTP id 062F68FC18 for ; Mon, 19 Mar 2012 01:58:43 +0000 (UTC) Received: by lboi15 with SMTP id i15so4096244lbo.13 for ; Sun, 18 Mar 2012 18:58:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=eitanadler.com; s=0xdeadbeef; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; bh=HHQlaUytgYY1OLpEvtP7+RCBrkZA4UKx9QC5nkvGkb0=; b=gijIJSO+uhvbSE6azwNrYvcyYeKr+co/qL8DRkBmMYwHyK4ulSLidZq8Q9aTD0NrKu dmafGGQG/mtdrsDCDvk5kbSZCmwITE6nC4jayxmLkbecwavLoxHb8tVbHWcWM9aVSaEl MTkzWexQWZkexxEUHwLKsNXO/LldyellIRinc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding:x-gm-message-state; bh=HHQlaUytgYY1OLpEvtP7+RCBrkZA4UKx9QC5nkvGkb0=; b=JzSvDf/WSw7/5tGU8OolrMXaSoKrouKje3aTKFHuUABfQ6WhdoyxZG/J9MscLCq2YX g5sXF4S75/oIqN/YTfKli8jfYKsZqFDXKDRf8eESkwArn/zDi/0NarEWvpt30Zljl5ov 4Sq8iiJP08EsaL6GbY0PQsKlgtpclopMzGBKFQ6PXe5tzN2zPRWZNhwQJPbWFKg4ksDc /s/chc/XSWOgPO6E/q/tUekmNCXVv6ITfnA8mh6EYcPSZT1motAq3zc65PZfMX0atiLg 1ICpcMiRu0BiqikvBuurP8yIi7k0Ied6GnN9RJlizuQ964Jvtyr7mkU34aZFeLAGlr0p e4dg== Received: by 10.112.24.161 with SMTP id v1mr4174285lbf.12.1332122322899; Sun, 18 Mar 2012 18:58:42 -0700 (PDT) MIME-Version: 1.0 Sender: lists@eitanadler.com Received: by 10.112.106.105 with HTTP; Sun, 18 Mar 2012 18:58:12 -0700 (PDT) In-Reply-To: <20120319015203.GB13456@DataIX.net> References: <201203190127.q2J1RtgB044557@svn.freebsd.org> <20120319015203.GB13456@DataIX.net> From: Eitan Adler Date: Sun, 18 Mar 2012 21:58:12 -0400 X-Google-Sender-Auth: cg-UeLuRKxLBoJasBzs0K9hRZEs Message-ID: To: Jason Hellenthal Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Gm-Message-State: ALoCoQnMn+ZxB7pSBpHZDJxMKuIQ4TkDMSWzktz6yp80/Rl5BgJcRBanftXkGXEu/dDSNlKfEPPA Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233147 - stable/8/lib/libc/string X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 01:58:44 -0000 On Sun, Mar 18, 2012 at 9:52 PM, Jason Hellenthal wrote: > > > On Mon, Mar 19, 2012 at 01:27:55AM +0000, Eitan Adler wrote: >> Author: eadler >> Date: Mon Mar 19 01:27:55 2012 >> New Revision: 233147 >> URL: http://svn.freebsd.org/changeset/base/233147 >> >> Log: >> =C2=A0 MFC r232503: >> =C2=A0 =C2=A0 =C2=A0 POSIX mandates that swab do nothing when len < 0 >> >> =C2=A0 PR: =C2=A0 =C2=A0 =C2=A0 =C2=A0 140690 >> =C2=A0 Approved by: =C2=A0 =C2=A0 =C2=A0 =C2=A0cperciva >> >> Modified: stable/8/lib/libc/string/swab.c >> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D >> --- stable/8/lib/libc/string/swab.c =C2=A0 Mon Mar 19 01:27:30 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233146) >> +++ stable/8/lib/libc/string/swab.c =C2=A0 Mon Mar 19 01:27:55 2012 =C2= =A0 =C2=A0 =C2=A0 =C2=A0(r233147) >> @@ -45,6 +45,8 @@ swab(const void * __restrict from, void >> =C2=A0 =C2=A0 =C2=A0 int n; >> =C2=A0 =C2=A0 =C2=A0 char *fp, *tp; >> >> + =C2=A0 =C2=A0 if (len <=3D 0) >> + =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return; > > Does this not test to see if it is also equal to 0(zero) ? > > If I understand the above statement "POSIX mandates that swab do nothing > when len < 0" then the above code should be exactly that ... and not > testing whether it is equal to zero... If the code doesn't check for len <=3D 0 then it will do something. --=20 Eitan Adler Source & Ports committer X11, Bugbusting teams From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 02:17:30 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id B0D231065678 for ; Mon, 19 Mar 2012 02:17:30 +0000 (UTC) (envelope-from jhellenthal@dataix.net) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id 60AC38FC14 for ; Mon, 19 Mar 2012 02:17:29 +0000 (UTC) Received: by iahk25 with SMTP id k25so12226954iah.13 for ; Sun, 18 Mar 2012 19:17:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dataix.net; s=rsa; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to; bh=KDtC/0ktxJp3vDQXpYtToV/w65BZ79QDpxSAqPsGKDo=; b=X0OhXvNoxcbHK//VoSAWFL4w/mQnff4Rkc4fHDHLoaLF1T/GfQNuGnZhaGWDnktxi7 w5Ekwsd1WoKun2oO4ibCTI1ducZDYnRn+uqgU3r3trIfNmp3lb2mUw5RUbHv/4/1LZu3 D/fxU9jlCuC+vzgcCeqhu/c1bSaqFl6w40hQg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:x-gm-message-state; bh=KDtC/0ktxJp3vDQXpYtToV/w65BZ79QDpxSAqPsGKDo=; b=NBycOyPYTwWTMzSqZrRra+UzTvB19QOv3959stOnap06bX/4Cp/XaEAmXmCeCG63e0 YF0f7bhb7eUYGPamu7ZIBmxmfkVaA7gQtn0afeymcHkkM/xogLQ0W5lxTEfs+Frl2QEm sm08U1/72QPEIVamMcQNGkXrotdXyNbEDV9VwFetkYuOjvVs15Oga2MDmZl4yXq322UY 9YlOMKT5HnG9IuvuHWaVGJjiUFjDJvFWNlm2tTYwPnSLxbIGEz03ZiOXTI1Hkw3KVcvJ gS7uU28HordxVU337FiCNYNgU9AnF7/uErjVBMZMYxLxCFK6nDMnHaAzM8pl2xOP3Agj 0upw== Received: by 10.43.52.10 with SMTP id vk10mr5781188icb.25.1332123449452; Sun, 18 Mar 2012 19:17:29 -0700 (PDT) Received: from DataIX.net (adsl-99-112-214-41.dsl.klmzmi.sbcglobal.net. [99.112.214.41]) by mx.google.com with ESMTPS id gh8sm4997814igb.16.2012.03.18.19.17.27 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Mar 2012 19:17:28 -0700 (PDT) Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.5/8.14.5) with ESMTP id q2J2HPJA002608 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 18 Mar 2012 22:17:25 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Received: (from jhellenthal@localhost) by DataIX.net (8.14.5/8.14.5/Submit) id q2J2HOUS002134; Sun, 18 Mar 2012 22:17:24 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Date: Sun, 18 Mar 2012 22:17:24 -0400 From: Jason Hellenthal To: Eitan Adler Message-ID: <20120319021724.GC13456@DataIX.net> References: <201203190127.q2J1RtgB044557@svn.freebsd.org> <20120319015203.GB13456@DataIX.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Gm-Message-State: ALoCoQkIi7Pt0vU9eavHteHYcHlj1bEiawxe7oggnWmOHFK8YU40AkHAOSF4q7txrxNfjt3Z8mBW Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233147 - stable/8/lib/libc/string X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 02:17:30 -0000 On Sun, Mar 18, 2012 at 09:58:12PM -0400, Eitan Adler wrote: > On Sun, Mar 18, 2012 at 9:52 PM, Jason Hellenthal > wrote: > > > > > > On Mon, Mar 19, 2012 at 01:27:55AM +0000, Eitan Adler wrote: > >> Author: eadler > >> Date: Mon Mar 19 01:27:55 2012 > >> New Revision: 233147 > >> URL: http://svn.freebsd.org/changeset/base/233147 > >> > >> Log: > >>   MFC r232503: > >>       POSIX mandates that swab do nothing when len < 0 > >> > >>   PR:         140690 > >>   Approved by:        cperciva > >> > >> Modified: stable/8/lib/libc/string/swab.c > >> ============================================================================== > >> --- stable/8/lib/libc/string/swab.c   Mon Mar 19 01:27:30 2012        (r233146) > >> +++ stable/8/lib/libc/string/swab.c   Mon Mar 19 01:27:55 2012        (r233147) > >> @@ -45,6 +45,8 @@ swab(const void * __restrict from, void > >>       int n; > >>       char *fp, *tp; > >> > >> +     if (len <= 0) > >> +             return; > > > > Does this not test to see if it is also equal to 0(zero) ? > > > > If I understand the above statement "POSIX mandates that swab do nothing > > when len < 0" then the above code should be exactly that ... and not > > testing whether it is equal to zero... > > If the code doesn't check for len <= 0 then it will do something. > To my understanding of the specification it should only return if len is negative... 0 is not a negative number. -- ;s =; From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 02:32:18 2012 Return-Path: Delivered-To: svn-src-stable-8@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6402E106564A; Mon, 19 Mar 2012 02:32:18 +0000 (UTC) (envelope-from tim@kientzle.com) Received: from monday.kientzle.com (99-115-135-74.uvs.sntcca.sbcglobal.net [99.115.135.74]) by mx1.freebsd.org (Postfix) with ESMTP id 19FF48FC14; Mon, 19 Mar 2012 02:32:14 +0000 (UTC) Received: (from root@localhost) by monday.kientzle.com (8.14.4/8.14.4) id q2J2W7XV089805; Mon, 19 Mar 2012 02:32:07 GMT (envelope-from tim@kientzle.com) Received: from [192.168.2.119] (CiscoE3000 [192.168.1.65]) by kientzle.com with SMTP id 74sitbxu8cehhdt79hbbq52guw; Mon, 19 Mar 2012 02:32:06 +0000 (UTC) (envelope-from tim@kientzle.com) Mime-Version: 1.0 (Apple Message framework v1257) Content-Type: text/plain; charset=windows-1252 From: Tim Kientzle In-Reply-To: <20120319021724.GC13456@DataIX.net> Date: Sun, 18 Mar 2012 19:32:04 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: <264991E4-B083-4E61-9337-E5882DED66C3@kientzle.com> References: <201203190127.q2J1RtgB044557@svn.freebsd.org> <20120319015203.GB13456@DataIX.net> <20120319021724.GC13456@DataIX.net> To: Jason Hellenthal X-Mailer: Apple Mail (2.1257) Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Eitan Adler , svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r233147 - stable/8/lib/libc/string X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 02:32:18 -0000 On Mar 18, 2012, at 7:17 PM, Jason Hellenthal wrote: >=20 >=20 > On Sun, Mar 18, 2012 at 09:58:12PM -0400, Eitan Adler wrote: >> On Sun, Mar 18, 2012 at 9:52 PM, Jason Hellenthal >> wrote: >>>=20 >>>=20 >>> On Mon, Mar 19, 2012 at 01:27:55AM +0000, Eitan Adler wrote: >>>> Author: eadler >>>> Date: Mon Mar 19 01:27:55 2012 >>>> New Revision: 233147 >>>> URL: http://svn.freebsd.org/changeset/base/233147 >>>>=20 >>>> Log: >>>> MFC r232503: >>>> POSIX mandates that swab do nothing when len < 0 >>>>=20 >>>> PR: 140690 >>>> Approved by: cperciva >>>>=20 >>>> Modified: stable/8/lib/libc/string/swab.c >>>> = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D >>>> --- stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:30 2012 = (r233146) >>>> +++ stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:55 2012 = (r233147) >>>> @@ -45,6 +45,8 @@ swab(const void * __restrict from, void >>>> int n; >>>> char *fp, *tp; >>>>=20 >>>> + if (len <=3D 0) >>>> + return; >>>=20 >>> Does this not test to see if it is also equal to 0(zero) ? >>>=20 >>> If I understand the above statement "POSIX mandates that swab do = nothing >>> when len < 0" then the above code should be exactly that ... and not >>> testing whether it is equal to zero... >>=20 >> If the code doesn't check for len <=3D 0 then it will do something. >>=20 >=20 > To my understanding of the specification it should only return if len = is > negative... 0 is not a negative number. =46rom POSIX: > The swab() function shall copy nbytes bytes=85 This implies that it does nothing when the argument is zero. The check for <=3D 0 is a performance optimization; otherwise the code will do nothing in a more expensive fashion. > If nbytes is negative, swab() does nothing. This states that it does nothing when the argument is less than zero. So the change is correct; it covers both cases. Tim From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 02:59:18 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 1BA4C1065676 for ; Mon, 19 Mar 2012 02:59:18 +0000 (UTC) (envelope-from jhellenthal@dataix.net) Received: from mail-iy0-f182.google.com (mail-iy0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id B88A88FC18 for ; Mon, 19 Mar 2012 02:59:17 +0000 (UTC) Received: by iahk25 with SMTP id k25so12287721iah.13 for ; Sun, 18 Mar 2012 19:59:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=dataix.net; s=rsa; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to; bh=dfFFFyIlffruE/gLmNJmiSGkmnLlf456JEu319OSom8=; b=eTLdhvQvjY0G6GW/AI0AoLV+H0fKcQmGRkuFGVyGEPvy8OjNyumM1NLxl4x0ZuPpS+ qktXArG/zwdThdmiH+xmqjSx+qJ+zsQ0NHdWGxs09yRU+sRKruaJcSqf8zJulsK6ZRUK U0p1JsE0CLiFxl9Bv6VrJO/+U2UH3qW6j8Edo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:content-transfer-encoding :in-reply-to:x-gm-message-state; bh=dfFFFyIlffruE/gLmNJmiSGkmnLlf456JEu319OSom8=; b=n8vNyN8SnjzE36YzMxGlzXAT5KGTEhidGTSvJmoioC/ECtiY/dlg1D3Bc9MOdRnp50 m6hamALK3K4Xw6cjPSsbSLUP0lAfIXxDQMZMgslmEG9rTyOKo5A78JDmZNSSd8HEq2Z9 6eXWw9YEH3sH8uvGCyIkJUD9EoEEHCRPt2+77jgpsUGOV29CndAacE0jV5vmp8Kb9YO1 2fhUnBzkzHKCKd7UMHtUxotcMRCGazNbE/kgjYz6qXLEwkX/XsWWJ5FpmQYDuX5ZcLKC XIK0LFAmTL7wgGquMZYqkHCvFA01Rewl33VvfT0+SzG3vXJOlRZegJ3CqzLJMAPjlvjY VKag== Received: by 10.50.106.132 with SMTP id gu4mr4904409igb.59.1332125957139; Sun, 18 Mar 2012 19:59:17 -0700 (PDT) Received: from DataIX.net (adsl-99-112-214-41.dsl.klmzmi.sbcglobal.net. [99.112.214.41]) by mx.google.com with ESMTPS id ba4sm7458438igb.14.2012.03.18.19.59.15 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Mar 2012 19:59:16 -0700 (PDT) Received: from DataIX.net (localhost [127.0.0.1]) by DataIX.net (8.14.5/8.14.5) with ESMTP id q2J2xDvV079731 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 18 Mar 2012 22:59:14 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Received: (from jhellenthal@localhost) by DataIX.net (8.14.5/8.14.5/Submit) id q2J2xD13079708; Sun, 18 Mar 2012 22:59:13 -0400 (EDT) (envelope-from jhellenthal@DataIX.net) Date: Sun, 18 Mar 2012 22:59:13 -0400 From: Jason Hellenthal To: Tim Kientzle Message-ID: <20120319025913.GA29610@DataIX.net> References: <201203190127.q2J1RtgB044557@svn.freebsd.org> <20120319015203.GB13456@DataIX.net> <20120319021724.GC13456@DataIX.net> <264991E4-B083-4E61-9337-E5882DED66C3@kientzle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <264991E4-B083-4E61-9337-E5882DED66C3@kientzle.com> X-Gm-Message-State: ALoCoQmRCAT3vKynkH6Hz9RAjbRG18b0z7glLWrRIcvFREKXUMHS/UGqo7beY/q7AustBIm0VWtF Cc: svn-src-stable@FreeBSD.org, svn-src-all@FreeBSD.org, src-committers@FreeBSD.org, Eitan Adler , svn-src-stable-8@FreeBSD.org Subject: Re: svn commit: r233147 - stable/8/lib/libc/string X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 02:59:18 -0000 On Sun, Mar 18, 2012 at 07:32:04PM -0700, Tim Kientzle wrote: > > On Mar 18, 2012, at 7:17 PM, Jason Hellenthal wrote: > > > > > > > On Sun, Mar 18, 2012 at 09:58:12PM -0400, Eitan Adler wrote: > >> On Sun, Mar 18, 2012 at 9:52 PM, Jason Hellenthal > >> wrote: > >>> > >>> > >>> On Mon, Mar 19, 2012 at 01:27:55AM +0000, Eitan Adler wrote: > >>>> Author: eadler > >>>> Date: Mon Mar 19 01:27:55 2012 > >>>> New Revision: 233147 > >>>> URL: http://svn.freebsd.org/changeset/base/233147 > >>>> > >>>> Log: > >>>> MFC r232503: > >>>> POSIX mandates that swab do nothing when len < 0 > >>>> > >>>> PR: 140690 > >>>> Approved by: cperciva > >>>> > >>>> Modified: stable/8/lib/libc/string/swab.c > >>>> ============================================================================== > >>>> --- stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:30 2012 (r233146) > >>>> +++ stable/8/lib/libc/string/swab.c Mon Mar 19 01:27:55 2012 (r233147) > >>>> @@ -45,6 +45,8 @@ swab(const void * __restrict from, void > >>>> int n; > >>>> char *fp, *tp; > >>>> > >>>> + if (len <= 0) > >>>> + return; > >>> > >>> Does this not test to see if it is also equal to 0(zero) ? > >>> > >>> If I understand the above statement "POSIX mandates that swab do nothing > >>> when len < 0" then the above code should be exactly that ... and not > >>> testing whether it is equal to zero... > >> > >> If the code doesn't check for len <= 0 then it will do something. > >> > > > > To my understanding of the specification it should only return if len is > > negative... 0 is not a negative number. > > >From POSIX: > > The swab() function shall copy nbytes bytes… > > This implies that it does nothing when the argument is zero. > The check for <= 0 is a performance optimization; > otherwise the code will do nothing in a more expensive > fashion. > > > If nbytes is negative, swab() does nothing. > > This states that it does nothing when the argument is less than zero. > > So the change is correct; it covers both cases. > Yes. My point being though the description of this change does not adequately describe both cases. It just simply points to POSIX and saying it should return if negative. IMHO calling things what they are and making that very same change causes less grief. Also the man page specifies len "must be an even number" and by the posix spec it can be an odd number and copies and exchanges nbytes-1 and the disposition of the last byte is unspecified. Sorry but irregular documentation is a pet peeve of mine. -- ;s =; From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 11:27:55 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 43304106566C; Mon, 19 Mar 2012 11:27:55 +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 13BBF8FC16; Mon, 19 Mar 2012 11:27:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JBRsOf066349; Mon, 19 Mar 2012 11:27:54 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JBRsDP066347; Mon, 19 Mar 2012 11:27:54 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203191127.q2JBRsDP066347@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 19 Mar 2012 11:27:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233171 - stable/8/sys/fs/pseudofs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 11:27:55 -0000 Author: kib Date: Mon Mar 19 11:27:54 2012 New Revision: 233171 URL: http://svn.freebsd.org/changeset/base/233171 Log: MFC r232541: Apply inlined vn_vget_ino() algorithm for ".." lookup in pseudofs. Modified: stable/8/sys/fs/pseudofs/pseudofs_vnops.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/fs/pseudofs/pseudofs_vnops.c ============================================================================== --- stable/8/sys/fs/pseudofs/pseudofs_vnops.c Mon Mar 19 10:06:22 2012 (r233170) +++ stable/8/sys/fs/pseudofs/pseudofs_vnops.c Mon Mar 19 11:27:54 2012 (r233171) @@ -433,6 +433,7 @@ pfs_lookup(struct vop_cachedlookup_args struct pfs_vdata *pvd = vn->v_data; struct pfs_node *pd = pvd->pvd_pn; struct pfs_node *pn, *pdn = NULL; + struct mount *mp; pid_t pid = pvd->pvd_pid; char *pname; int error, i, namelen, visible; @@ -475,10 +476,26 @@ pfs_lookup(struct vop_cachedlookup_args PFS_RETURN (0); } + mp = vn->v_mount; + /* parent */ if (cnp->cn_flags & ISDOTDOT) { if (pd->pn_type == pfstype_root) PFS_RETURN (EIO); + error = vfs_busy(mp, MBF_NOWAIT); + if (error != 0) { + vfs_ref(mp); + VOP_UNLOCK(vn, 0); + error = vfs_busy(mp, 0); + vn_lock(vn, LK_EXCLUSIVE | LK_RETRY); + vfs_rel(mp); + if (error != 0) + PFS_RETURN(ENOENT); + if (vn->v_iflag & VI_DOOMED) { + vfs_unbusy(mp); + PFS_RETURN(ENOENT); + } + } VOP_UNLOCK(vn, 0); KASSERT(pd->pn_parent != NULL, ("%s(): non-root directory has no parent", __func__)); @@ -536,18 +553,28 @@ pfs_lookup(struct vop_cachedlookup_args goto failed; } - error = pfs_vncache_alloc(vn->v_mount, vpp, pn, pid); + error = pfs_vncache_alloc(mp, vpp, pn, pid); if (error) goto failed; - if (cnp->cn_flags & ISDOTDOT) - vn_lock(vn, LK_EXCLUSIVE|LK_RETRY); + if (cnp->cn_flags & ISDOTDOT) { + vfs_unbusy(mp); + vn_lock(vn, LK_EXCLUSIVE | LK_RETRY); + if (vn->v_iflag & VI_DOOMED) { + vput(*vpp); + *vpp = NULL; + PFS_RETURN(ENOENT); + } + } if (cnp->cn_flags & MAKEENTRY && !(vn->v_iflag & VI_DOOMED)) cache_enter(vn, *vpp, cnp); PFS_RETURN (0); failed: - if (cnp->cn_flags & ISDOTDOT) - vn_lock(vn, LK_EXCLUSIVE|LK_RETRY); + if (cnp->cn_flags & ISDOTDOT) { + vfs_unbusy(mp); + vn_lock(vn, LK_EXCLUSIVE | LK_RETRY); + *vpp = NULL; + } PFS_RETURN(error); } From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 11:32:43 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 06A34106564A; Mon, 19 Mar 2012 11:32:43 +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 E53C38FC18; Mon, 19 Mar 2012 11:32:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JBWg3P066552; Mon, 19 Mar 2012 11:32:42 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JBWgR8066550; Mon, 19 Mar 2012 11:32:42 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203191132.q2JBWgR8066550@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 19 Mar 2012 11:32:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233172 - stable/8/libexec/rtld-elf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 11:32:43 -0000 Author: kib Date: Mon Mar 19 11:32:42 2012 New Revision: 233172 URL: http://svn.freebsd.org/changeset/base/233172 Log: MFC r233041: Remove write-only variable. Modified: stable/8/libexec/rtld-elf/map_object.c Directory Properties: stable/8/libexec/rtld-elf/ (props changed) Modified: stable/8/libexec/rtld-elf/map_object.c ============================================================================== --- stable/8/libexec/rtld-elf/map_object.c Mon Mar 19 11:27:54 2012 (r233171) +++ stable/8/libexec/rtld-elf/map_object.c Mon Mar 19 11:32:42 2012 (r233172) @@ -65,7 +65,6 @@ map_object(int fd, const char *path, con Elf_Phdr *phtls; caddr_t mapbase; size_t mapsize; - Elf_Off base_offset; Elf_Addr base_vaddr; Elf_Addr base_vlimit; caddr_t base_addr; @@ -146,7 +145,6 @@ map_object(int fd, const char *path, con * Map the entire address space of the object, to stake out our * contiguous region, and to establish the base address for relocation. */ - base_offset = trunc_page(segs[0]->p_offset); base_vaddr = trunc_page(segs[0]->p_vaddr); base_vlimit = round_page(segs[nsegs]->p_vaddr + segs[nsegs]->p_memsz); mapsize = base_vlimit - base_vaddr; From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 13:19:02 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F194D1065673; Mon, 19 Mar 2012 13:19:02 +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 DC0958FC1E; Mon, 19 Mar 2012 13:19:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JDJ2av070198; Mon, 19 Mar 2012 13:19:02 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JDJ22p070195; Mon, 19 Mar 2012 13:19:02 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203191319.q2JDJ22p070195@svn.freebsd.org> From: Ken Smith Date: Mon, 19 Mar 2012 13:19:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233180 - stable/8/release X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 13:19:03 -0000 Author: kensmith Date: Mon Mar 19 13:19:02 2012 New Revision: 233180 URL: http://svn.freebsd.org/changeset/base/233180 Log: Bump the version of perl used as part of the release build from 5.10 to 5.12. Modified: stable/8/release/Makefile stable/8/release/Makefile.inc.docports Modified: stable/8/release/Makefile ============================================================================== --- stable/8/release/Makefile Mon Mar 19 13:17:47 2012 (r233179) +++ stable/8/release/Makefile Mon Mar 19 13:19:02 2012 (r233180) @@ -171,7 +171,7 @@ NOPORTSATALL= YES # # Doing 'make index' in /usr/ports requires Perl. -MAKEINDEXPORTS= lang/perl5.10 +MAKEINDEXPORTS= lang/perl5.12 DOCPORTS= textproc/docproj # Set this to wherever the distfiles required by release procedures. .if defined(DOCDISTFILES) Modified: stable/8/release/Makefile.inc.docports ============================================================================== --- stable/8/release/Makefile.inc.docports Mon Mar 19 13:17:47 2012 (r233179) +++ stable/8/release/Makefile.inc.docports Mon Mar 19 13:19:02 2012 (r233180) @@ -81,5 +81,5 @@ MINIMALDOCPORTS+= \ ports/textproc/p5-PodParser .else MINIMALDOCPORTS+= \ - ports/lang/perl5.10 + ports/lang/perl5.12 .endif From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 20:15:19 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1699410656FE; Mon, 19 Mar 2012 20:15:19 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DBDCA8FC0A; Mon, 19 Mar 2012 20:15:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JKFI53084482; Mon, 19 Mar 2012 20:15:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JKFItl084480; Mon, 19 Mar 2012 20:15:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203192015.q2JKFItl084480@svn.freebsd.org> From: John Baldwin Date: Mon, 19 Mar 2012 20:15:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233199 - in stable/8/sys: i386/conf netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 20:15:19 -0000 Author: jhb Date: Mon Mar 19 20:15:18 2012 New Revision: 233199 URL: http://svn.freebsd.org/changeset/base/233199 Log: MFC 225096: Fix if_addr_mtx recursion in mld6. mld_set_version() is called only from mld_v1_input_query() and mld_v2_input_query() both holding the if_addr_mtx lock, and then calling into mld_v2_cancel_link_timers() acquires it the second time, which results in mtx recursion. To avoid that, delay if_addr_mtx acquisition until after mld_set_version() is called; while here, further reduce locking scope to protect only the needed pieces: if_multiaddrs, in6m_lookup_locked(). Modified: stable/8/sys/netinet6/mld6.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/netinet6/mld6.c ============================================================================== --- stable/8/sys/netinet6/mld6.c Mon Mar 19 19:53:53 2012 (r233198) +++ stable/8/sys/netinet6/mld6.c Mon Mar 19 20:15:18 2012 (r233199) @@ -681,7 +681,6 @@ mld_v1_input_query(struct ifnet *ifp, co IN6_MULTI_LOCK(); MLD_LOCK(); - IF_ADDR_LOCK(ifp); /* * Switch to MLDv1 host compatibility mode. @@ -694,6 +693,7 @@ mld_v1_input_query(struct ifnet *ifp, co if (timer == 0) timer = 1; + IF_ADDR_LOCK(ifp); if (is_general_query) { /* * For each reporting group joined on this @@ -889,7 +889,6 @@ mld_v2_input_query(struct ifnet *ifp, co IN6_MULTI_LOCK(); MLD_LOCK(); - IF_ADDR_LOCK(ifp); mli = MLD_IFINFO(ifp); KASSERT(mli != NULL, ("%s: no mld_ifinfo for ifp %p", __func__, ifp)); @@ -937,14 +936,18 @@ mld_v2_input_query(struct ifnet *ifp, co * Queries for groups we are not a member of on this * link are simply ignored. */ + IF_ADDR_LOCK(ifp); inm = in6m_lookup_locked(ifp, &mld->mld_addr); - if (inm == NULL) + if (inm == NULL) { + IF_ADDR_UNLOCK(ifp); goto out_locked; + } if (nsrc > 0) { if (!ratecheck(&inm->in6m_lastgsrtv, &V_mld_gsrdelay)) { CTR1(KTR_MLD, "%s: GS query throttled.", __func__); + IF_ADDR_UNLOCK(ifp); goto out_locked; } } @@ -962,10 +965,10 @@ mld_v2_input_query(struct ifnet *ifp, co /* XXX Clear embedded scope ID as userland won't expect it. */ in6_clearscope(&mld->mld_addr); + IF_ADDR_UNLOCK(ifp); } out_locked: - IF_ADDR_UNLOCK(ifp); MLD_UNLOCK(); IN6_MULTI_UNLOCK(); From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 20:49:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E9719106566B; Mon, 19 Mar 2012 20:49:42 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D198C8FC0C; Mon, 19 Mar 2012 20:49:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JKngKA085668; Mon, 19 Mar 2012 20:49:42 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JKnghc085653; Mon, 19 Mar 2012 20:49:42 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203192049.q2JKnghc085653@svn.freebsd.org> From: John Baldwin Date: Mon, 19 Mar 2012 20:49:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233201 - in stable/8/sys: i386/conf kern net netatalk netinet netinet6 netipx X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 20:49:43 -0000 Author: jhb Date: Mon Mar 19 20:49:42 2012 New Revision: 233201 URL: http://svn.freebsd.org/changeset/base/233201 Log: MFC 229621: Convert all users of IF_ADDR_LOCK to use new locking macros that specify either a read lock or write lock. Modified: stable/8/sys/kern/kern_uuid.c stable/8/sys/net/if.c stable/8/sys/net/rtsock.c stable/8/sys/netatalk/aarp.c stable/8/sys/netatalk/at_control.c stable/8/sys/netinet/if_ether.c stable/8/sys/netinet/igmp.c stable/8/sys/netinet/in.c stable/8/sys/netinet/in_mcast.c stable/8/sys/netinet/in_pcb.c stable/8/sys/netinet/in_var.h stable/8/sys/netinet/ip_carp.c stable/8/sys/netinet/ip_icmp.c stable/8/sys/netinet/ip_input.c stable/8/sys/netinet/sctp_bsd_addr.c stable/8/sys/netinet6/icmp6.c stable/8/sys/netinet6/in6.c stable/8/sys/netinet6/in6_ifattach.c stable/8/sys/netinet6/in6_mcast.c stable/8/sys/netinet6/in6_var.h stable/8/sys/netinet6/ip6_input.c stable/8/sys/netinet6/mld6.c stable/8/sys/netinet6/nd6.c stable/8/sys/netinet6/nd6_rtr.c stable/8/sys/netipx/ipx.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/kern/kern_uuid.c ============================================================================== --- stable/8/sys/kern/kern_uuid.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/kern/kern_uuid.c Mon Mar 19 20:49:42 2012 (r233201) @@ -98,20 +98,20 @@ uuid_node(uint16_t *node) IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { /* Walk the address list */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sdl = (struct sockaddr_dl*)ifa->ifa_addr; if (sdl != NULL && sdl->sdl_family == AF_LINK && sdl->sdl_type == IFT_ETHER) { /* Got a MAC address. */ bcopy(LLADDR(sdl), node, UUID_NODE_LEN); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); IFNET_RUNLOCK_NOSLEEP(); CURVNET_RESTORE(); return; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } IFNET_RUNLOCK_NOSLEEP(); Modified: stable/8/sys/net/if.c ============================================================================== --- stable/8/sys/net/if.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/net/if.c Mon Mar 19 20:49:42 2012 (r233201) @@ -835,10 +835,10 @@ if_purgemaddrs(struct ifnet *ifp) struct ifmultiaddr *ifma; struct ifmultiaddr *next; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) if_delmulti_locked(ifp, ifma, 1); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); } /* @@ -1182,10 +1182,10 @@ if_addgroup(struct ifnet *ifp, const cha ifgl->ifgl_group = ifg; ifgm->ifgm_ifp = ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifg->ifg_members, ifgm, ifgm_next); TAILQ_INSERT_TAIL(&ifp->if_groups, ifgl, ifgl_next); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); IFNET_WUNLOCK(); @@ -1212,9 +1212,9 @@ if_delgroup(struct ifnet *ifp, const cha return (ENOENT); } - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_groups, ifgl, ifgl_next); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); TAILQ_FOREACH(ifgm, &ifgl->ifgl_group->ifg_members, ifgm_next) if (ifgm->ifgm_ifp == ifp) @@ -1255,9 +1255,9 @@ if_delgroups(struct ifnet *ifp) strlcpy(groupname, ifgl->ifgl_group->ifg_group, IFNAMSIZ); - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_groups, ifgl, ifgl_next); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); TAILQ_FOREACH(ifgm, &ifgl->ifgl_group->ifg_members, ifgm_next) if (ifgm->ifgm_ifp == ifp) @@ -1299,33 +1299,33 @@ if_getgroup(struct ifgroupreq *data, str struct ifgroupreq *ifgr = data; if (ifgr->ifgr_len == 0) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next) ifgr->ifgr_len += sizeof(struct ifg_req); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (0); } len = ifgr->ifgr_len; ifgp = ifgr->ifgr_groups; /* XXX: wire */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifgl, &ifp->if_groups, ifgl_next) { if (len < sizeof(ifgrq)) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (EINVAL); } bzero(&ifgrq, sizeof ifgrq); strlcpy(ifgrq.ifgrq_group, ifgl->ifgl_group->ifg_group, sizeof(ifgrq.ifgrq_group)); if ((error = copyout(&ifgrq, ifgp, sizeof(struct ifg_req)))) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (error); } len -= sizeof(ifgrq); ifgp++; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (0); } @@ -1432,28 +1432,28 @@ void if_addr_rlock(struct ifnet *ifp) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); } void if_addr_runlock(struct ifnet *ifp) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } void if_maddr_rlock(struct ifnet *ifp) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); } void if_maddr_runlock(struct ifnet *ifp) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } /* @@ -1565,14 +1565,14 @@ ifa_ifwithaddr_internal(struct sockaddr IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (sa_equal(addr, ifa->ifa_addr)) { if (getref) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } /* IP6 doesn't have broadcast */ @@ -1582,11 +1582,11 @@ ifa_ifwithaddr_internal(struct sockaddr sa_equal(ifa->ifa_broadaddr, addr)) { if (getref) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = NULL; done: @@ -1620,7 +1620,7 @@ ifa_ifwithbroadaddr(struct sockaddr *add IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; @@ -1629,11 +1629,11 @@ ifa_ifwithbroadaddr(struct sockaddr *add ifa->ifa_broadaddr->sa_len != 0 && sa_equal(ifa->ifa_broadaddr, addr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = NULL; done: @@ -1655,18 +1655,18 @@ ifa_ifwithdstaddr(struct sockaddr *addr) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if ((ifp->if_flags & IFF_POINTOPOINT) == 0) continue; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != addr->sa_family) continue; if (ifa->ifa_dstaddr != NULL && sa_equal(addr, ifa->ifa_dstaddr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = NULL; done: @@ -1700,12 +1700,12 @@ ifa_ifwithnet(struct sockaddr *addr, int /* * Scan though each interface, looking for ones that have addresses * in this address family. Maintain a reference on ifa_maybe once - * we find one, as we release the IF_ADDR_LOCK() that kept it stable + * we find one, as we release the IF_ADDR_RLOCK() that kept it stable * when we move onto the next interface. */ IFNET_RLOCK_NOSLEEP(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { char *cp, *cp2, *cp3; @@ -1724,7 +1724,7 @@ next: continue; if (ifa->ifa_dstaddr != NULL && sa_equal(addr, ifa->ifa_dstaddr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } else { @@ -1735,7 +1735,7 @@ next: continue; if (ifa->ifa_claim_addr) { if ((*ifa->ifa_claim_addr)(ifa, addr)) { ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } continue; @@ -1775,7 +1775,7 @@ next: continue; } } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } ifa = ifa_maybe; ifa_maybe = NULL; @@ -1801,7 +1801,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, if (af >= AF_MAX) return (NULL); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != af) continue; @@ -1833,7 +1833,7 @@ ifaof_ifpforaddr(struct sockaddr *addr, done: if (ifa != NULL) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (ifa); } @@ -2410,9 +2410,9 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, * lose a race while we check if the membership * already exists. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); ifma = if_findmulti(ifp, &ifr->ifr_addr); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (ifma != NULL) error = EADDRINUSE; else @@ -2828,7 +2828,7 @@ again: } addrs = 0; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa = ifa->ifa_addr; @@ -2860,7 +2860,7 @@ again: if (!sbuf_overflowed(sb)) valid_len = sbuf_len(sb); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (addrs == 0) { bzero((caddr_t)&ifr.ifr_addr, sizeof(ifr.ifr_addr)); sbuf_bcat(sb, &ifr, sizeof(ifr)); @@ -3018,13 +3018,13 @@ if_addmulti(struct ifnet *ifp, struct so * If the address is already present, return a new reference to it; * otherwise, allocate storage and set up a new address. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); ifma = if_findmulti(ifp, sa); if (ifma != NULL) { ifma->ifma_refcount++; if (retifma != NULL) *retifma = ifma; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (0); } @@ -3090,7 +3090,7 @@ if_addmulti(struct ifnet *ifp, struct so * pointer is still valid. */ rt_newmaddrmsg(RTM_NEWMADDR, ifma); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); /* * We are certain we have added something, so call down to the @@ -3110,7 +3110,7 @@ free_llsa_out: free(llsa, M_IFMADDR); unlock_out: - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (error); } @@ -3144,12 +3144,12 @@ if_delmulti(struct ifnet *ifp, struct so if (ifp == NULL) return (ENOENT); - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); lastref = 0; ifma = if_findmulti(ifp, sa); if (ifma != NULL) lastref = if_delmulti_locked(ifp, ifma, 0); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); if (ifma == NULL) return (ENOENT); @@ -3171,10 +3171,10 @@ if_delallmulti(struct ifnet *ifp) struct ifmultiaddr *ifma; struct ifmultiaddr *next; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_FOREACH_SAFE(ifma, &ifp->if_multiaddrs, ifma_link, next) if_delmulti_locked(ifp, ifma, 0); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); } /* @@ -3211,7 +3211,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm * If and only if the ifnet instance exists: Acquire the address lock. */ if (ifp != NULL) - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); lastref = if_delmulti_locked(ifp, ifma, 0); @@ -3221,7 +3221,7 @@ if_delmulti_ifma(struct ifmultiaddr *ifm * Release the address lock. * If the group was left: update the hardware hash filter. */ - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); if (lastref && ifp->if_ioctl != NULL) { (void)(*ifp->if_ioctl)(ifp, SIOCDELMULTI, 0); } @@ -3243,7 +3243,7 @@ if_delmulti_locked(struct ifnet *ifp, st if (ifp != NULL && ifma->ifma_ifp != NULL) { KASSERT(ifma->ifma_ifp == ifp, ("%s: inconsistent ifp %p", __func__, ifp)); - IF_ADDR_LOCK_ASSERT(ifp); + IF_ADDR_WLOCK_ASSERT(ifp); } ifp = ifma->ifma_ifp; @@ -3316,14 +3316,14 @@ if_setlladdr(struct ifnet *ifp, const u_ struct ifaddr *ifa; struct ifreq ifr; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); ifa = ifp->if_addr; if (ifa == NULL) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (EINVAL); } ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); sdl = (struct sockaddr_dl *)ifa->ifa_addr; if (sdl == NULL) { ifa_free(ifa); Modified: stable/8/sys/net/rtsock.c ============================================================================== --- stable/8/sys/net/rtsock.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/net/rtsock.c Mon Mar 19 20:49:42 2012 (r233201) @@ -479,7 +479,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * Try to find an address on the given outgoing interface * that belongs to the jail. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa; sa = ifa->ifa_addr; @@ -491,7 +491,7 @@ rtm_get_jailed(struct rt_addrinfo *info, break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (!found) { /* * As a last resort return the 'default' jail address. @@ -521,7 +521,7 @@ rtm_get_jailed(struct rt_addrinfo *info, * Try to find an address on the given outgoing interface * that belongs to the jail. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa; sa = ifa->ifa_addr; @@ -534,7 +534,7 @@ rtm_get_jailed(struct rt_addrinfo *info, break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (!found) { /* * As a last resort return the 'default' jail address. @@ -1708,7 +1708,7 @@ sysctl_iflist(int af, struct walkarg *w) TAILQ_FOREACH(ifp, &V_ifnet, if_link) { if (w->w_arg && w->w_arg != ifp->if_index) continue; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa->ifa_addr; len = rt_msg2(RTM_IFINFO, &info, NULL, w); @@ -1742,13 +1742,13 @@ sysctl_iflist(int af, struct walkarg *w) goto done; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); info.rti_info[RTAX_IFA] = info.rti_info[RTAX_NETMASK] = info.rti_info[RTAX_BRD] = NULL; } done: if (ifp != NULL) - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); IFNET_RUNLOCK(); return (error); } @@ -1769,7 +1769,7 @@ sysctl_ifmalist(int af, struct walkarg * continue; ifa = ifp->if_addr; info.rti_info[RTAX_IFP] = ifa ? ifa->ifa_addr : NULL; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (af && af != ifma->ifma_addr->sa_family) continue; @@ -1790,12 +1790,12 @@ sysctl_ifmalist(int af, struct walkarg * ifmam->ifmam_addrs = info.rti_addrs; error = SYSCTL_OUT(w->w_req, w->w_tmem, len); if (error) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } done: IFNET_RUNLOCK(); Modified: stable/8/sys/netatalk/aarp.c ============================================================================== --- stable/8/sys/netatalk/aarp.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netatalk/aarp.c Mon Mar 19 20:49:42 2012 (r233201) @@ -406,7 +406,7 @@ at_aarpinput(struct ifnet *ifp, struct m * Since we don't know the net, we just look for the first * phase 1 address on the interface. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); for (aa = (struct at_ifaddr *)TAILQ_FIRST(&ifp->if_addrhead); aa; aa = (struct at_ifaddr *)aa->aa_ifa.ifa_link.tqe_next) { @@ -416,12 +416,12 @@ at_aarpinput(struct ifnet *ifp, struct m } } if (aa == NULL) { - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); m_freem(m); return; } ifa_ref(&aa->aa_ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); tpa.s_net = spa.s_net = AA_SAT(aa)->sat_addr.s_net; } Modified: stable/8/sys/netatalk/at_control.c ============================================================================== --- stable/8/sys/netatalk/at_control.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netatalk/at_control.c Mon Mar 19 20:49:42 2012 (r233201) @@ -254,9 +254,9 @@ at_control(struct socket *so, u_long cmd */ aa->aa_ifp = ifp; ifa_ref(&aa->aa_ifa); /* if_addrhead */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); } else { /* * If we DID find one then we clobber any routes @@ -357,9 +357,9 @@ at_control(struct socket *so, u_long cmd * remove the ifaddr from the interface */ ifa = (struct ifaddr *)aa; - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_REMOVE(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_free(ifa); /* if_addrhead */ /* Modified: stable/8/sys/netinet/if_ether.c ============================================================================== --- stable/8/sys/netinet/if_ether.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/if_ether.c Mon Mar 19 20:49:42 2012 (r233201) @@ -603,15 +603,15 @@ in_arpinput(struct mbuf *m) * No match, use the first inet address on the receive interface * as a dummy address for the rest of the function. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) if (ifa->ifa_addr->sa_family == AF_INET) { ia = ifatoia(ifa); ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto match; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* * If bridging, fall back to using any inet address. Modified: stable/8/sys/netinet/igmp.c ============================================================================== --- stable/8/sys/netinet/igmp.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/igmp.c Mon Mar 19 20:49:42 2012 (r233201) @@ -617,7 +617,7 @@ igmp_ifdetach(struct ifnet *ifp) igi = ((struct in_ifinfo *)ifp->if_afdata[AF_INET])->ii_igmp; if (igi->igi_version == IGMP_VERSION_3) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -633,7 +633,7 @@ igmp_ifdetach(struct ifnet *ifp) } inm_clear_recorded(inm); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* * Free the in_multi reference(s) for this IGMP lifecycle. */ @@ -750,7 +750,7 @@ igmp_input_v1_query(struct ifnet *ifp, c * for the interface on which the query arrived, * except those which are already running. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -778,7 +778,7 @@ igmp_input_v1_query(struct ifnet *ifp, c break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); out_locked: IGMP_UNLOCK(); @@ -851,7 +851,7 @@ igmp_input_v2_query(struct ifnet *ifp, c */ CTR2(KTR_IGMPV3, "process v2 general query on ifp %p(%s)", ifp, ifp->if_xname); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -859,7 +859,7 @@ igmp_input_v2_query(struct ifnet *ifp, c inm = (struct in_multi *)ifma->ifma_protospec; igmp_v2_update_group(inm, timer); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } else { /* * Group-specific IGMPv2 query, we need only @@ -1707,7 +1707,7 @@ igmp_fasttimo_vnet(void) IFQ_SET_MAXLEN(&scq, IGMP_MAX_STATE_CHANGE_PACKETS); } - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -1725,7 +1725,7 @@ igmp_fasttimo_vnet(void) break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (igi->igi_version == IGMP_VERSION_3) { struct in_multi *tinm; @@ -2022,7 +2022,7 @@ igmp_v3_cancel_link_timers(struct igmp_i * for all memberships scoped to this link. */ ifp = igi->igi_ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -2067,7 +2067,7 @@ igmp_v3_cancel_link_timers(struct igmp_i inm->inm_timer = 0; _IF_DRAIN(&inm->inm_scq); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); SLIST_FOREACH_SAFE(inm, &igi->igi_relinmhead, inm_nrele, tinm) { SLIST_REMOVE_HEAD(&igi->igi_relinmhead, inm_nrele); inm_release_locked(inm); @@ -3330,7 +3330,7 @@ igmp_v3_dispatch_general_query(struct ig ifp = igi->igi_ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -3361,7 +3361,7 @@ igmp_v3_dispatch_general_query(struct ig break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); loop = (igi->igi_flags & IGIF_LOOPBACK) ? 1 : 0; igmp_dispatch_queue(&igi->igi_gq, IGMP_MAX_RESPONSE_BURST, loop); Modified: stable/8/sys/netinet/in.c ============================================================================== --- stable/8/sys/netinet/in.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/in.c Mon Mar 19 20:49:42 2012 (r233201) @@ -342,7 +342,7 @@ in_control(struct socket *so, u_long cmd ifa_ref(&ia->ia_ifa); IN_IFADDR_RUNLOCK(); if (ia == NULL) { - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { iap = ifatoia(ifa); if (iap->ia_addr.sin_family == AF_INET) { @@ -356,7 +356,7 @@ in_control(struct socket *so, u_long cmd } if (ia != NULL) ifa_ref(&ia->ia_ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } if (ia == NULL) iaIsFirst = 1; @@ -420,9 +420,9 @@ in_control(struct socket *so, u_long cmd ia->ia_ifp = ifp; ifa_ref(ifa); /* if_addrhead */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); TAILQ_INSERT_TAIL(&ifp->if_addrhead, ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_ref(ifa); /* in_ifaddrhead */ IN_IFADDR_WLOCK(); TAILQ_INSERT_TAIL(&V_in_ifaddrhead, ia, ia_link); @@ -602,7 +602,7 @@ in_control(struct socket *so, u_long cmd panic("in_control: unsupported ioctl"); } - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); /* Re-check that ia is still part of the list. */ TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa == &ia->ia_ifa) @@ -614,12 +614,12 @@ in_control(struct socket *so, u_long cmd * try it again for the next loop as there is no other exit * path between here and out. */ - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); error = EADDRNOTAVAIL; goto out; } TAILQ_REMOVE(&ifp->if_addrhead, &ia->ia_ifa, ifa_link); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); ifa_free(&ia->ia_ifa); /* if_addrhead */ IN_IFADDR_WLOCK(); @@ -769,7 +769,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo } } - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family != AF_INET) continue; @@ -782,7 +782,7 @@ in_lifaddr_ioctl(struct socket *so, u_lo } if (ifa != NULL) ifa_ref(ifa); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); if (ifa == NULL) return (EADDRNOTAVAIL); ia = (struct in_ifaddr *)ifa; @@ -1310,7 +1310,7 @@ in_purgemaddrs(struct ifnet *ifp) * We need to do this as IF_ADDR_LOCK() may be re-acquired * by code further down. */ - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -1322,7 +1322,7 @@ in_purgemaddrs(struct ifnet *ifp) inm = (struct in_multi *)ifma->ifma_protospec; LIST_INSERT_HEAD(&purgeinms, inm, inm_link); } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); LIST_FOREACH_SAFE(inm, &purgeinms, inm_link, tinm) { LIST_REMOVE(inm, inm_link); Modified: stable/8/sys/netinet/in_mcast.c ============================================================================== --- stable/8/sys/netinet/in_mcast.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/in_mcast.c Mon Mar 19 20:49:42 2012 (r233201) @@ -421,7 +421,7 @@ in_getmulti(struct ifnet *ifp, const str return (error); /* XXX ifma_protospec must be covered by IF_ADDR_LOCK */ - IF_ADDR_LOCK(ifp); + IF_ADDR_WLOCK(ifp); /* * If something other than netinet is occupying the link-layer @@ -445,11 +445,11 @@ in_getmulti(struct ifnet *ifp, const str #endif ++inm->inm_refcount; *pinm = inm; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (0); } - IF_ADDR_LOCK_ASSERT(ifp); + IF_ADDR_WLOCK_ASSERT(ifp); /* * A new in_multi record is needed; allocate and initialize it. @@ -461,7 +461,7 @@ in_getmulti(struct ifnet *ifp, const str inm = malloc(sizeof(*inm), M_IPMADDR, M_NOWAIT | M_ZERO); if (inm == NULL) { if_delmulti_ifma(ifma); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (ENOMEM); } inm->inm_addr = *group; @@ -484,7 +484,7 @@ in_getmulti(struct ifnet *ifp, const str *pinm = inm; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_WUNLOCK(ifp); return (0); } @@ -2775,7 +2775,7 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_A IN_MULTI_LOCK(); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { if (ifma->ifma_addr->sa_family != AF_INET || ifma->ifma_protospec == NULL) @@ -2808,7 +2808,7 @@ sysctl_ip_mcast_filters(SYSCTL_HANDLER_A break; } } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); IN_MULTI_UNLOCK(); Modified: stable/8/sys/netinet/in_pcb.c ============================================================================== --- stable/8/sys/netinet/in_pcb.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/in_pcb.c Mon Mar 19 20:49:42 2012 (r233201) @@ -661,7 +661,7 @@ in_pcbladdr(struct inpcb *inp, struct in ifp = ia->ia_ifp; ifa_free(&ia->ia_ifa); ia = NULL; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; @@ -675,10 +675,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* 3. As a last resort return the 'default' jail address. */ error = prison_get_ip4(cred, laddr); @@ -720,7 +720,7 @@ in_pcbladdr(struct inpcb *inp, struct in */ ia = NULL; ifp = sro.ro_rt->rt_ifp; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; if (sa->sa_family != AF_INET) @@ -733,10 +733,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); /* 3. As a last resort return the 'default' jail address. */ error = prison_get_ip4(cred, laddr); @@ -784,7 +784,7 @@ in_pcbladdr(struct inpcb *inp, struct in ifp = ia->ia_ifp; ifa_free(&ia->ia_ifa); ia = NULL; - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { sa = ifa->ifa_addr; @@ -799,10 +799,10 @@ in_pcbladdr(struct inpcb *inp, struct in } if (ia != NULL) { laddr->s_addr = ia->ia_addr.sin_addr.s_addr; - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); goto done; } - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); } /* 3. As a last resort return the 'default' jail address. */ Modified: stable/8/sys/netinet/in_var.h ============================================================================== --- stable/8/sys/netinet/in_var.h Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/in_var.h Mon Mar 19 20:49:42 2012 (r233201) @@ -396,9 +396,9 @@ inm_lookup(struct ifnet *ifp, const stru struct in_multi *inm; IN_MULTI_LOCK_ASSERT(); - IF_ADDR_LOCK(ifp); + IF_ADDR_RLOCK(ifp); inm = inm_lookup_locked(ifp, ina); - IF_ADDR_UNLOCK(ifp); + IF_ADDR_RUNLOCK(ifp); return (inm); } Modified: stable/8/sys/netinet/ip_carp.c ============================================================================== --- stable/8/sys/netinet/ip_carp.c Mon Mar 19 20:49:16 2012 (r233200) +++ stable/8/sys/netinet/ip_carp.c Mon Mar 19 20:49:42 2012 (r233201) @@ -279,7 +279,7 @@ carp_hmac_prepare(struct carp_softc *sc) found = 0; last = cur; cur.s_addr = 0xffffffff; - IF_ADDR_LOCK(SC2IFP(sc)); + IF_ADDR_RLOCK(SC2IFP(sc)); TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) { in.s_addr = ifatoia(ifa)->ia_addr.sin_addr.s_addr; if (ifa->ifa_addr->sa_family == AF_INET && @@ -289,7 +289,7 @@ carp_hmac_prepare(struct carp_softc *sc) found++; } } - IF_ADDR_UNLOCK(SC2IFP(sc)); + IF_ADDR_RUNLOCK(SC2IFP(sc)); if (found) SHA1Update(&sc->sc_sha1, (void *)&cur, sizeof(cur)); } while (found); @@ -300,7 +300,7 @@ carp_hmac_prepare(struct carp_softc *sc) found = 0; last6 = cur6; memset(&cur6, 0xff, sizeof(cur6)); - IF_ADDR_LOCK(SC2IFP(sc)); + IF_ADDR_RLOCK(SC2IFP(sc)); TAILQ_FOREACH(ifa, &SC2IFP(sc)->if_addrlist, ifa_list) { in6 = ifatoia6(ifa)->ia_addr.sin6_addr; if (IN6_IS_SCOPE_EMBED(&in6)) @@ -312,7 +312,7 @@ carp_hmac_prepare(struct carp_softc *sc) found++; } } - IF_ADDR_UNLOCK(SC2IFP(sc)); + IF_ADDR_RUNLOCK(SC2IFP(sc)); if (found) SHA1Update(&sc->sc_sha1, (void *)&cur6, sizeof(cur6)); } while (found); @@ -1138,7 +1138,7 @@ carp_addrcount(struct carp_if *cif, stru (SC2IFP(vh)->if_flags & IFF_UP) && (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING)) || (type == CARP_COUNT_MASTER && vh->sc_state == MASTER)) { - IF_ADDR_LOCK(SC2IFP(vh)); + IF_ADDR_RLOCK(SC2IFP(vh)); TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family == AF_INET && @@ -1146,7 +1146,7 @@ carp_addrcount(struct carp_if *cif, stru ifatoia(ifa)->ia_addr.sin_addr.s_addr) count++; } - IF_ADDR_UNLOCK(SC2IFP(vh)); + IF_ADDR_RUNLOCK(SC2IFP(vh)); } } return (count); @@ -1186,7 +1186,7 @@ carp_iamatch(struct ifnet *ifp, struct i TAILQ_FOREACH(vh, &cif->vhif_vrs, sc_list) { if ((SC2IFP(vh)->if_flags & IFF_UP) && (SC2IFP(vh)->if_drv_flags & IFF_DRV_RUNNING)) { - IF_ADDR_LOCK(SC2IFP(vh)); + IF_ADDR_RLOCK(SC2IFP(vh)); TAILQ_FOREACH(ifa, &SC2IFP(vh)->if_addrlist, ifa_list) { if (ifa->ifa_addr->sa_family == @@ -1197,11 +1197,11 @@ carp_iamatch(struct ifnet *ifp, struct i if (vh->sc_state == MASTER) { *enaddr = IF_LLADDR(vh->sc_ifp); - IF_ADDR_UNLOCK(SC2IFP(vh)); + IF_ADDR_RUNLOCK(SC2IFP(vh)); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 21:33:36 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 94722106577F; Mon, 19 Mar 2012 21:33:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 65F9B8FC1E; Mon, 19 Mar 2012 21:33:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JLXa2P087268; Mon, 19 Mar 2012 21:33:36 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JLXa1H087264; Mon, 19 Mar 2012 21:33:36 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203192133.q2JLXa1H087264@svn.freebsd.org> From: John Baldwin Date: Mon, 19 Mar 2012 21:33:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233206 - stable/8/usr.bin/kdump X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 21:33:36 -0000 Author: jhb Date: Mon Mar 19 21:33:35 2012 New Revision: 233206 URL: http://svn.freebsd.org/changeset/base/233206 Log: MFC 232072: Pretty-print the advice constants passed to posix_fadvise(2). Modified: stable/8/usr.bin/kdump/kdump.c stable/8/usr.bin/kdump/kdump_subr.h stable/8/usr.bin/kdump/mksubr Directory Properties: stable/8/usr.bin/kdump/ (props changed) Modified: stable/8/usr.bin/kdump/kdump.c ============================================================================== --- stable/8/usr.bin/kdump/kdump.c Mon Mar 19 21:33:23 2012 (r233205) +++ stable/8/usr.bin/kdump/kdump.c Mon Mar 19 21:33:35 2012 (r233206) @@ -939,6 +939,14 @@ ktrsyscall(struct ktr_syscall *ktr, u_in kldunloadfflagsname ((int)*ip); ip++; narg--; + } else if (ktr->ktr_code == SYS_posix_fadvise) { + print_number(ip,narg,c); + print_number(ip,narg,c); + print_number(ip,narg,c); + (void)putchar(','); + fadvisebehavname((int)*ip); + ip++; + narg--; } } while (narg > 0) { Modified: stable/8/usr.bin/kdump/kdump_subr.h ============================================================================== --- stable/8/usr.bin/kdump/kdump_subr.h Mon Mar 19 21:33:23 2012 (r233205) +++ stable/8/usr.bin/kdump/kdump_subr.h Mon Mar 19 21:33:35 2012 (r233206) @@ -32,6 +32,7 @@ void whencename (int); void rlimitname (int); void shutdownhowname (int); void prioname (int); +void fadvisebehavname (int); void madvisebehavname (int); void msyncflagsname (int); void schedpolicyname (int); Modified: stable/8/usr.bin/kdump/mksubr ============================================================================== --- stable/8/usr.bin/kdump/mksubr Mon Mar 19 21:33:23 2012 (r233205) +++ stable/8/usr.bin/kdump/mksubr Mon Mar 19 21:33:35 2012 (r233206) @@ -349,6 +349,7 @@ auto_switch_type "whencename" "SEEK_[A-Z auto_switch_type "rlimitname" "RLIMIT_[A-Z]+[[:space:]]+[0-9]+" "sys/resource.h" auto_switch_type "shutdownhowname" "SHUT_[A-Z]+[[:space:]]+0x[0-9]+" "sys/socket.h" auto_switch_type "prioname" "PRIO_[A-Z]+[[:space:]]+[0-9]" "sys/resource.h" +auto_switch_type "fadvisebehavname" "POSIX_FADV_[A-Z]+[[:space:]]+[0-9]+" "sys/fcntl.h" auto_switch_type "madvisebehavname" "_?MADV_[A-Z]+[[:space:]]+[0-9]+" "sys/mman.h" auto_switch_type "msyncflagsname" "MS_[A-Z]+[[:space:]]+0x[0-9]+" "sys/mman.h" auto_switch_type "schedpolicyname" "SCHED_[A-Z]+[[:space:]]+[0-9]+" "sched.h" From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 22:20:48 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 8FBDE106564A; Mon, 19 Mar 2012 22:20:48 +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 7A3248FC0C; Mon, 19 Mar 2012 22:20:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JMKmFO088965; Mon, 19 Mar 2012 22:20:48 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JMKmuk088963; Mon, 19 Mar 2012 22:20:48 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <201203192220.q2JMKmuk088963@svn.freebsd.org> From: Ken Smith Date: Mon, 19 Mar 2012 22:20:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233211 - stable/8/sys/conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 22:20:48 -0000 Author: kensmith Date: Mon Mar 19 22:20:47 2012 New Revision: 233211 URL: http://svn.freebsd.org/changeset/base/233211 Log: We seem to be having issues with a bug in the loader that causes it to estimate the program header size for the kernel wrong. It can result in the kernel build failing with the message: ld: kernel.debug: Not enough room for program headers (allocated 5, need 6) ld: final link failed: Bad value Tinderbox builds were failing with this message a short time ago, and I encountered it while preparing the i386 build machine for the 8.3-RC2 builds. Konstantin has looked at it and believes the issue was fixed in recent versions of binutils. It is a bit too late in the release process to be messing around with the loader and/or binutils. This workaround seems to take care of the problem for now. Reviewed by: kib Modified: stable/8/sys/conf/ldscript.i386 Modified: stable/8/sys/conf/ldscript.i386 ============================================================================== --- stable/8/sys/conf/ldscript.i386 Mon Mar 19 22:08:13 2012 (r233210) +++ stable/8/sys/conf/ldscript.i386 Mon Mar 19 22:20:47 2012 (r233211) @@ -6,7 +6,7 @@ SEARCH_DIR(/usr/lib); SECTIONS { /* Read-only sections, merged into text segment: */ - . = kernbase + kernload + SIZEOF_HEADERS; + . = kernbase + kernload + 256; .interp : { *(.interp) } .hash : { *(.hash) } .dynsym : { *(.dynsym) } From owner-svn-src-stable-8@FreeBSD.ORG Mon Mar 19 22:26:03 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 527F61065675; Mon, 19 Mar 2012 22:26:03 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 337A28FC18; Mon, 19 Mar 2012 22:26:03 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2JMQ3Zk089273; Mon, 19 Mar 2012 22:26:03 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2JMQ2oi089271; Mon, 19 Mar 2012 22:26:02 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201203192226.q2JMQ2oi089271@svn.freebsd.org> From: Jung-uk Kim Date: Mon, 19 Mar 2012 22:26:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233214 - stable/8/sys/dev/pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 19 Mar 2012 22:26:03 -0000 Author: jkim Date: Mon Mar 19 22:26:02 2012 New Revision: 233214 URL: http://svn.freebsd.org/changeset/base/233214 Log: MFC: r232991 Add a PCI quirk to ignore PCI map registers from configuration space. This works around a resource conflict, e. g., MSI K9AGM2 motherboard. Modified: stable/8/sys/dev/pci/pci.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/pci/pci.c ============================================================================== --- stable/8/sys/dev/pci/pci.c Mon Mar 19 22:23:52 2012 (r233213) +++ stable/8/sys/dev/pci/pci.c Mon Mar 19 22:26:02 2012 (r233214) @@ -188,6 +188,7 @@ struct pci_quirk { #define PCI_QUIRK_MAP_REG 1 /* PCI map register in weird place */ #define PCI_QUIRK_DISABLE_MSI 2 /* MSI/MSI-X doesn't work */ #define PCI_QUIRK_ENABLE_MSI_VM 3 /* Older chipset in VM where MSI works */ +#define PCI_QUIRK_UNMAP_REG 4 /* Ignore PCI map register */ int arg1; int arg2; }; @@ -236,6 +237,16 @@ static const struct pci_quirk const pci_ */ { 0x12378086, PCI_QUIRK_ENABLE_MSI_VM, 0, 0 }, + /* + * HPET MMIO base address may appear in Bar1 for AMD SB600 SMBus + * controller depending on SoftPciRst register (PM_IO 0x55 [7]). + * It prevents us from attaching hpet(4) when the bit is unset. + * Note this quirk only affects SB600 revision A13 and earlier. + * For SB600 A21 and later, firmware must set the bit to hide it. + * For SB700 and later, it is unused and hardcoded to zero. + */ + { 0x43851002, PCI_QUIRK_UNMAP_REG, 0x14, 0 }, + { 0 } }; @@ -2790,12 +2801,18 @@ ehci_early_takeover(device_t self) void pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask) { - struct pci_devinfo *dinfo = device_get_ivars(dev); - pcicfgregs *cfg = &dinfo->cfg; - struct resource_list *rl = &dinfo->resources; + struct pci_devinfo *dinfo; + pcicfgregs *cfg; + struct resource_list *rl; const struct pci_quirk *q; + uint32_t devid; int i; + dinfo = device_get_ivars(dev); + cfg = &dinfo->cfg; + rl = &dinfo->resources; + devid = (cfg->device << 16) | cfg->vendor; + /* ATA devices needs special map treatment */ if ((pci_get_class(dev) == PCIC_STORAGE) && (pci_get_subclass(dev) == PCIS_STORAGE_IDE) && @@ -2804,18 +2821,29 @@ pci_add_resources(device_t bus, device_t !pci_read_config(dev, PCIR_BAR(2), 4))) ) pci_ata_maps(bus, dev, rl, force, prefetchmask); else - for (i = 0; i < cfg->nummaps;) + for (i = 0; i < cfg->nummaps;) { + /* + * Skip quirked resources. + */ + for (q = &pci_quirks[0]; q->devid != 0; q++) + if (q->devid == devid && + q->type == PCI_QUIRK_UNMAP_REG && + q->arg1 == PCIR_BAR(i)) + break; + if (q->devid != 0) { + i++; + continue; + } i += pci_add_map(bus, dev, PCIR_BAR(i), rl, force, prefetchmask & (1 << i)); + } /* * Add additional, quirked resources. */ - for (q = &pci_quirks[0]; q->devid; q++) { - if (q->devid == ((cfg->device << 16) | cfg->vendor) - && q->type == PCI_QUIRK_MAP_REG) + for (q = &pci_quirks[0]; q->devid != 0; q++) + if (q->devid == devid && q->type == PCI_QUIRK_MAP_REG) pci_add_map(bus, dev, q->arg1, rl, force, 0); - } if (cfg->intpin > 0 && PCI_INTERRUPT_VALID(cfg->intline)) { #ifdef __PCI_REROUTE_INTERRUPT From owner-svn-src-stable-8@FreeBSD.ORG Tue Mar 20 09:03:02 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9A14A1065674; Tue, 20 Mar 2012 09:03:02 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-lpp01m010-f54.google.com (mail-lpp01m010-f54.google.com [209.85.215.54]) by mx1.freebsd.org (Postfix) with ESMTP id 43ECC8FC14; Tue, 20 Mar 2012 09:02:55 +0000 (UTC) Received: by lagv3 with SMTP id v3so7414600lag.13 for ; Tue, 20 Mar 2012 02:02:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=6VEmmNeG4h04vcQZMG8P6SPbruUS78Otzq3pPvV6yD4=; b=MPqOmz9pPA3ee4esLPVXWExJcGNfN0k6K4lQeZ/Xd9CEwySaakh35YnGn5pumAOuJX k0vRk/w/XNxe3tR4S8z+EJ+RjvKmkBVV2xA9pasZ2VozhgmrMoAka7qGN8XWqiQPvI/0 cfdGr95gX6m+3qCgPPy9gWsa4tSNqt/Da6ziLFImaAkwjeLS5Y2XdtEUHSIR3m1VkQsI lIGe0Sgp+4cxxCjBbZi1sfYrbjl9EFha4jo+ODe2MbOTeSfaLU1nRkq109oucTc650tg M6owJHa8jRdpXHMSUzEq3b4NVclWDPe5UYgoPJ5eO5CN0dbH1G+a9BsEJl1KsWApjkAY Awbg== MIME-Version: 1.0 Received: by 10.112.100.232 with SMTP id fb8mr5836069lbb.86.1332234168976; Tue, 20 Mar 2012 02:02:48 -0700 (PDT) Sender: pluknet@gmail.com Received: by 10.152.21.73 with HTTP; Tue, 20 Mar 2012 02:02:48 -0700 (PDT) In-Reply-To: <201203192015.q2JKFItl084480@svn.freebsd.org> References: <201203192015.q2JKFItl084480@svn.freebsd.org> Date: Tue, 20 Mar 2012 12:02:48 +0300 X-Google-Sender-Auth: E1rrIRId25OKy2YfqfLteiTCroQ Message-ID: From: Sergey Kandaurov To: John Baldwin Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233199 - in stable/8/sys: i386/conf netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 09:03:02 -0000 On 20 March 2012 00:15, John Baldwin wrote: > Author: jhb > Date: Mon Mar 19 20:15:18 2012 > New Revision: 233199 > URL: http://svn.freebsd.org/changeset/base/233199 > > Log: > =A0MFC 225096: > =A0Fix if_addr_mtx recursion in mld6. Ehh.. Thank you for doing this. As I mentioned earlier I could not reproduce this problem myself in RELENG_8, that's why it was not MFCed so far... > > =A0mld_set_version() is called only from mld_v1_input_query() and > =A0mld_v2_input_query() both holding the if_addr_mtx lock, and then calli= ng > =A0into mld_v2_cancel_link_timers() acquires it the second time, which re= sults > =A0in mtx recursion. To avoid that, delay if_addr_mtx acquisition until a= fter > =A0mld_set_version() is called; while here, further reduce locking scope > =A0to protect only the needed pieces: if_multiaddrs, in6m_lookup_locked()= . [...] --=20 wbr, pluknet From owner-svn-src-stable-8@FreeBSD.ORG Tue Mar 20 09:11:16 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 6A483106564A; Tue, 20 Mar 2012 09:11:16 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id CFDDA8FC0A; Tue, 20 Mar 2012 09:11:15 +0000 (UTC) Received: from skuns.kiev.zoral.com.ua (localhost [127.0.0.1]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id q2K9B8X8065483; Tue, 20 Mar 2012 11:11:08 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5) with ESMTP id q2K9B8WS034137; Tue, 20 Mar 2012 11:11:08 +0200 (EET) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.5/8.14.5/Submit) id q2K9B87r034136; Tue, 20 Mar 2012 11:11:08 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Tue, 20 Mar 2012 11:11:07 +0200 From: Konstantin Belousov To: Ken Smith Message-ID: <20120320091107.GG2358@deviant.kiev.zoral.com.ua> References: <201203192220.q2JMKmuk088963@svn.freebsd.org> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="sLx0z+5FKKtIVDwd" Content-Disposition: inline In-Reply-To: <201203192220.q2JMKmuk088963@svn.freebsd.org> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-4.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 autolearn=ham version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233211 - stable/8/sys/conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 09:11:16 -0000 --sLx0z+5FKKtIVDwd Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Mar 19, 2012 at 10:20:48PM +0000, Ken Smith wrote: > Author: kensmith > Date: Mon Mar 19 22:20:47 2012 > New Revision: 233211 > URL: http://svn.freebsd.org/changeset/base/233211 >=20 > Log: > We seem to be having issues with a bug in the loader that causes it to s/loader/linker/ > estimate the program header size for the kernel wrong. It can result > in the kernel build failing with the message: > =20 > ld: kernel.debug: Not enough room for program headers (allocated 5, nee= d 6) > ld: final link failed: Bad value > =20 > Tinderbox builds were failing with this message a short time ago, and > I encountered it while preparing the i386 build machine for the 8.3-RC2 > builds. > =20 > Konstantin has looked at it and believes the issue was fixed in recent > versions of binutils. It is a bit too late in the release process to > be messing around with the loader and/or binutils. This workaround > seems to take care of the problem for now. > =20 > Reviewed by: kib >=20 > Modified: > stable/8/sys/conf/ldscript.i386 >=20 > Modified: stable/8/sys/conf/ldscript.i386 > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- stable/8/sys/conf/ldscript.i386 Mon Mar 19 22:08:13 2012 (r233210) > +++ stable/8/sys/conf/ldscript.i386 Mon Mar 19 22:20:47 2012 (r233211) > @@ -6,7 +6,7 @@ SEARCH_DIR(/usr/lib); > SECTIONS > { > /* Read-only sections, merged into text segment: */ > - . =3D kernbase + kernload + SIZEOF_HEADERS; > + . =3D kernbase + kernload + 256; > .interp : { *(.interp) } > .hash : { *(.hash) } > .dynsym : { *(.dynsym) } --sLx0z+5FKKtIVDwd Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (FreeBSD) iEUEARECAAYFAk9oSasACgkQC3+MBN1Mb4hFMQCYh0a2QesJJcRbyheL07GIizAs YwCggeGklaNJb6IyI6XCGOLJV61hTgM= =IyqL -----END PGP SIGNATURE----- --sLx0z+5FKKtIVDwd-- From owner-svn-src-stable-8@FreeBSD.ORG Tue Mar 20 19:04:00 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E7B5D1065679; Tue, 20 Mar 2012 19:04:00 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id B89998FC15; Tue, 20 Mar 2012 19:04:00 +0000 (UTC) Received: from bigwig.baldwin.cx (bigwig.baldwin.cx [96.47.65.170]) by cyrus.watson.org (Postfix) with ESMTPSA id 6B1D046B43; Tue, 20 Mar 2012 15:04:00 -0400 (EDT) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id DA4A0B960; Tue, 20 Mar 2012 15:03:59 -0400 (EDT) From: John Baldwin To: Sergey Kandaurov Date: Tue, 20 Mar 2012 14:53:52 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p10; KDE/4.5.5; amd64; ; ) References: <201203192015.q2JKFItl084480@svn.freebsd.org> In-Reply-To: MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201203201453.52982.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Tue, 20 Mar 2012 15:03:59 -0400 (EDT) Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233199 - in stable/8/sys: i386/conf netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:04:01 -0000 On Tuesday, March 20, 2012 5:02:48 am Sergey Kandaurov wrote: > On 20 March 2012 00:15, John Baldwin wrote: > > Author: jhb > > Date: Mon Mar 19 20:15:18 2012 > > New Revision: 233199 > > URL: http://svn.freebsd.org/changeset/base/233199 > > > > Log: > > MFC 225096: > > Fix if_addr_mtx recursion in mld6. > > Ehh.. Thank you for doing this. > As I mentioned earlier I could not reproduce this problem myself > in RELENG_8, that's why it was not MFCed so far... To be honest, my main movitation was to remove a merge conflict in my subsequent MFC of the IF_ADDR locking changes. I could have patched the locking in the old mld6.c, but when I reviewed your diff, I figured it would be better to merge it first instead. > > > > mld_set_version() is called only from mld_v1_input_query() and > > mld_v2_input_query() both holding the if_addr_mtx lock, and then calling > > into mld_v2_cancel_link_timers() acquires it the second time, which results > > in mtx recursion. To avoid that, delay if_addr_mtx acquisition until after > > mld_set_version() is called; while here, further reduce locking scope > > to protect only the needed pieces: if_multiaddrs, in6m_lookup_locked(). > > [...] > > -- > wbr, > pluknet > -- John Baldwin From owner-svn-src-stable-8@FreeBSD.ORG Tue Mar 20 19:37:06 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 3C3DE106566C; Tue, 20 Mar 2012 19:37:06 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 260108FC19; Tue, 20 Mar 2012 19:37:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJb6M1034671; Tue, 20 Mar 2012 19:37:06 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJb594034668; Tue, 20 Mar 2012 19:37:05 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201937.q2KJb594034668@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:37:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233244 - in stable/8/sys: i386/conf netinet netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:37:06 -0000 Author: tuexen Date: Tue Mar 20 19:37:05 2012 New Revision: 233244 URL: http://svn.freebsd.org/changeset/base/233244 Log: MFC r231895: Remove two clang warnings. Modified: stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Tue Mar 20 19:27:27 2012 (r233243) +++ stable/8/sys/netinet/sctp_usrreq.c Tue Mar 20 19:37:05 2012 (r233244) @@ -6325,7 +6325,7 @@ sctp_ingetaddr(struct socket *so, struct int sctp_peeraddr(struct socket *so, struct sockaddr **addr) { - struct sockaddr_in *sin = (struct sockaddr_in *)*addr; + struct sockaddr_in *sin; int fnd; struct sockaddr_in *sin_a; struct sctp_inpcb *inp; Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Tue Mar 20 19:27:27 2012 (r233243) +++ stable/8/sys/netinet6/sctp6_usrreq.c Tue Mar 20 19:37:05 2012 (r233244) @@ -1199,7 +1199,7 @@ sctp6_getaddr(struct socket *so, struct static int sctp6_peeraddr(struct socket *so, struct sockaddr **addr) { - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)*addr; + struct sockaddr_in6 *sin6; int fnd; struct sockaddr_in6 *sin_a6; struct sctp_inpcb *inp; From owner-svn-src-stable-8@FreeBSD.ORG Tue Mar 20 19:39:44 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C2C3D106566B; Tue, 20 Mar 2012 19:39:44 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AC2B18FC14; Tue, 20 Mar 2012 19:39:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJdiaO034797; Tue, 20 Mar 2012 19:39:44 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJdiNH034795; Tue, 20 Mar 2012 19:39:44 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201939.q2KJdiNH034795@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:39:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233245 - in stable/8/sys: i386/conf netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:39:44 -0000 Author: tuexen Date: Tue Mar 20 19:39:44 2012 New Revision: 233245 URL: http://svn.freebsd.org/changeset/base/233245 Log: MFC r232724: Add support for stf interfaces. Modified: stable/8/sys/netinet/sctp_bsd_addr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/8/sys/netinet/sctp_bsd_addr.c Tue Mar 20 19:37:05 2012 (r233244) +++ stable/8/sys/netinet/sctp_bsd_addr.c Tue Mar 20 19:39:44 2012 (r233245) @@ -180,6 +180,7 @@ sctp_is_desired_interface_type(struct if case IFT_SLIP: case IFT_GIF: case IFT_L2VLAN: + case IFT_STF: case IFT_IP: case IFT_IPOVERCDLC: case IFT_IPOVERCLAW: From owner-svn-src-stable-8@FreeBSD.ORG Tue Mar 20 19:42:41 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 25102106566C; Tue, 20 Mar 2012 19:42:41 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0F3B48FC0C; Tue, 20 Mar 2012 19:42:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJgeDe034956; Tue, 20 Mar 2012 19:42:40 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJgefN034954; Tue, 20 Mar 2012 19:42:40 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201942.q2KJgefN034954@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:42:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233246 - in stable/8/sys: i386/conf netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:42:41 -0000 Author: tuexen Date: Tue Mar 20 19:42:40 2012 New Revision: 233246 URL: http://svn.freebsd.org/changeset/base/233246 Log: MFC r232866: This fixes PR 165210. Basically we just add in the netgraph interface to the list of acceptable interfaces. A todo at the next IETF code blitz, though is we need to review why we screen interfaces, there was a reason ;-). From rrs@. Modified: stable/8/sys/netinet/sctp_bsd_addr.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/netinet/sctp_bsd_addr.c ============================================================================== --- stable/8/sys/netinet/sctp_bsd_addr.c Tue Mar 20 19:39:44 2012 (r233245) +++ stable/8/sys/netinet/sctp_bsd_addr.c Tue Mar 20 19:42:40 2012 (r233246) @@ -184,6 +184,7 @@ sctp_is_desired_interface_type(struct if case IFT_IP: case IFT_IPOVERCDLC: case IFT_IPOVERCLAW: + case IFT_PROPVIRTUAL: /* NetGraph Virtual too */ case IFT_VIRTUALIPADDRESS: result = 1; break; From owner-svn-src-stable-8@FreeBSD.ORG Tue Mar 20 19:45:26 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4593F106566C; Tue, 20 Mar 2012 19:45:26 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27A198FC17; Tue, 20 Mar 2012 19:45:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJjQBi035116; Tue, 20 Mar 2012 19:45:26 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJjPi9035113; Tue, 20 Mar 2012 19:45:25 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201945.q2KJjPi9035113@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:45:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233247 - in stable/8/sys: i386/conf kern netinet X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:45:26 -0000 Author: tuexen Date: Tue Mar 20 19:45:25 2012 New Revision: 233247 URL: http://svn.freebsd.org/changeset/base/233247 Log: MFC r233004: Fix bugs which can result in a panic when an non-SCTP socket it used with an sctp_ system-call which expects an SCTP socket. Modified: stable/8/sys/kern/uipc_syscalls.c stable/8/sys/netinet/sctp_peeloff.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/kern/uipc_syscalls.c ============================================================================== --- stable/8/sys/kern/uipc_syscalls.c Tue Mar 20 19:42:40 2012 (r233246) +++ stable/8/sys/kern/uipc_syscalls.c Tue Mar 20 19:45:25 2012 (r233247) @@ -2300,6 +2300,10 @@ sctp_peeloff(td, uap) error = fgetsock(td, uap->sd, &head, &fflag); if (error) goto done2; + if (head->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto done2; + } error = sctp_can_peel_off(head, (sctp_assoc_t)uap->name); if (error) goto done2; @@ -2418,6 +2422,10 @@ sctp_generic_sendmsg (td, uap) iov[0].iov_len = uap->mlen; so = (struct socket *)fp->f_data; + if (so->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto sctp_bad; + } #ifdef MAC error = mac_socket_check_send(td->td_ucred, so); if (error) @@ -2528,6 +2536,10 @@ sctp_generic_sendmsg_iov(td, uap) #endif so = (struct socket *)fp->f_data; + if (so->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto sctp_bad; + } #ifdef MAC error = mac_socket_check_send(td->td_ucred, so); if (error) @@ -2632,6 +2644,10 @@ sctp_generic_recvmsg(td, uap) goto out1; so = fp->f_data; + if (so->so_proto->pr_protocol != IPPROTO_SCTP) { + error = EOPNOTSUPP; + goto out; + } #ifdef MAC error = mac_socket_check_receive(td->td_ucred, so); if (error) { Modified: stable/8/sys/netinet/sctp_peeloff.c ============================================================================== --- stable/8/sys/netinet/sctp_peeloff.c Tue Mar 20 19:42:40 2012 (r233246) +++ stable/8/sys/netinet/sctp_peeloff.c Tue Mar 20 19:45:25 2012 (r233247) @@ -59,16 +59,16 @@ sctp_can_peel_off(struct socket *head, s SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EBADF); return (EBADF); } - if ((head->so_proto->pr_protocol != IPPROTO_SCTP) || - (head->so_type != SOCK_SEQPACKET)) { - SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EOPNOTSUPP); - return (EOPNOTSUPP); - } inp = (struct sctp_inpcb *)head->so_pcb; if (inp == NULL) { SCTP_LTRACE_ERR_RET(NULL, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EFAULT); return (EFAULT); } + if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || + (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { + SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_PEELOFF, EOPNOTSUPP); + return (EOPNOTSUPP); + } stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1); if (stcb == NULL) { SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_PEELOFF, ENOENT); From owner-svn-src-stable-8@FreeBSD.ORG Tue Mar 20 19:48:00 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8F92A106564A; Tue, 20 Mar 2012 19:48:00 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6FFDD8FC0A; Tue, 20 Mar 2012 19:48:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2KJm0KN035240; Tue, 20 Mar 2012 19:48:00 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2KJm0B8035237; Tue, 20 Mar 2012 19:48:00 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <201203201948.q2KJm0B8035237@svn.freebsd.org> From: Michael Tuexen Date: Tue, 20 Mar 2012 19:48:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233248 - in stable/8/sys: i386/conf netinet netinet6 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Mar 2012 19:48:00 -0000 Author: tuexen Date: Tue Mar 20 19:47:59 2012 New Revision: 233248 URL: http://svn.freebsd.org/changeset/base/233248 Log: MFC r233005: Clean up, no functional change. Modified: stable/8/sys/netinet/sctp_usrreq.c stable/8/sys/netinet6/sctp6_usrreq.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Tue Mar 20 19:45:25 2012 (r233247) +++ stable/8/sys/netinet/sctp_usrreq.c Tue Mar 20 19:47:59 2012 (r233248) @@ -451,7 +451,7 @@ sctp_abort(struct socket *so) uint32_t flags; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { return; } sctp_must_try_again: @@ -569,7 +569,7 @@ sctp_bind(struct socket *so, struct sock return (EINVAL); } inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); } @@ -585,7 +585,7 @@ sctp_close(struct socket *so) uint32_t flags; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) + if (inp == NULL) return; /* @@ -650,7 +650,7 @@ sctp_sendm(struct socket *so, int flags, int error; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { if (control) { sctp_m_freem(control); control = NULL; @@ -979,7 +979,7 @@ sctp_shutdown(struct socket *so) struct sctp_inpcb *inp; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); } @@ -1639,7 +1639,7 @@ sctp_getopt(struct socket *so, int optna return (EINVAL); } inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return EINVAL; } @@ -3306,7 +3306,7 @@ sctp_setopt(struct socket *so, int optna return (EINVAL); } inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_PRINTF("inp is NULL?\n"); SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (EINVAL); @@ -5733,12 +5733,6 @@ sctp_ctloutput(struct socket *so, struct void *p; int error = 0; - inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { - /* I made the same as TCP since we are not setup? */ - SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); - return (ECONNRESET); - } if (sopt->sopt_level != IPPROTO_SCTP) { /* wrong proto level... send back up to IP */ #ifdef INET6 @@ -5753,6 +5747,7 @@ sctp_ctloutput(struct socket *so, struct #endif return (error); } + inp = (struct sctp_inpcb *)so->so_pcb; optsize = sopt->sopt_valsize; if (optsize) { SCTP_MALLOC(optval, void *, optsize, SCTP_M_SOCKOPT); @@ -5796,7 +5791,7 @@ sctp_connect(struct socket *so, struct s struct sctp_tcb *stcb = NULL; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { /* I made the same as TCP since we are not setup? */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (ECONNRESET); @@ -5956,7 +5951,7 @@ sctp_listen(struct socket *so, int backl struct sctp_inpcb *inp; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { /* I made the same as TCP since we are not setup? */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (ECONNRESET); @@ -6120,7 +6115,7 @@ sctp_accept(struct socket *so, struct so #endif inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); return (ECONNRESET); } Modified: stable/8/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/8/sys/netinet6/sctp6_usrreq.c Tue Mar 20 19:45:25 2012 (r233247) +++ stable/8/sys/netinet6/sctp6_usrreq.c Tue Mar 20 19:47:59 2012 (r233248) @@ -632,7 +632,7 @@ sctp6_abort(struct socket *so) uint32_t flags; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); return; } @@ -720,7 +720,7 @@ sctp6_bind(struct socket *so, struct soc int error; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); return (EINVAL); } @@ -960,7 +960,7 @@ sctp6_connect(struct socket *so, struct inp6 = (struct in6pcb *)so->so_pcb; inp = (struct sctp_inpcb *)so->so_pcb; - if (inp == 0) { + if (inp == NULL) { SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, ECONNRESET); return (ECONNRESET); /* I made the same as TCP since we are * not setup? */ From owner-svn-src-stable-8@FreeBSD.ORG Wed Mar 21 10:03:53 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 624E11065674; Wed, 21 Mar 2012 10:03:53 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4D1D78FC15; Wed, 21 Mar 2012 10:03:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2LA3rBR065930; Wed, 21 Mar 2012 10:03:53 GMT (envelope-from ae@svn.freebsd.org) Received: (from ae@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2LA3qsQ065928; Wed, 21 Mar 2012 10:03:52 GMT (envelope-from ae@svn.freebsd.org) Message-Id: <201203211003.q2LA3qsQ065928@svn.freebsd.org> From: "Andrey V. Elsukov" Date: Wed, 21 Mar 2012 10:03:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233277 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 10:03:53 -0000 Author: ae Date: Wed Mar 21 10:03:52 2012 New Revision: 233277 URL: http://svn.freebsd.org/changeset/base/233277 Log: MFC r224546 (by glebius): Don't leak kld_sx lock in kldunloadf(). Modified: stable/8/sys/kern/kern_linker.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/kern_linker.c ============================================================================== --- stable/8/sys/kern/kern_linker.c Wed Mar 21 09:48:32 2012 (r233276) +++ stable/8/sys/kern/kern_linker.c Wed Mar 21 10:03:52 2012 (r233277) @@ -1111,8 +1111,9 @@ kern_kldunload(struct thread *td, int fi PMC_CALL_HOOK(td, PMC_FN_KLD_UNLOAD, (void *) &pkm); KLD_UNLOCK_READ(); } else -#else KLD_UNLOCK(); +#else + KLD_UNLOCK(); #endif CURVNET_RESTORE(); return (error); From owner-svn-src-stable-8@FreeBSD.ORG Wed Mar 21 20:50:48 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AD949106568B; Wed, 21 Mar 2012 20:50:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 962E78FC0A; Wed, 21 Mar 2012 20:50:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2LKomaJ092940; Wed, 21 Mar 2012 20:50:48 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2LKomrA092931; Wed, 21 Mar 2012 20:50:48 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203212050.q2LKomrA092931@svn.freebsd.org> From: John Baldwin Date: Wed, 21 Mar 2012 20:50:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233286 - in stable/8/sys: fs/nfsclient i386/conf kern nfsclient sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 21 Mar 2012 20:50:48 -0000 Author: jhb Date: Wed Mar 21 20:50:47 2012 New Revision: 233286 URL: http://svn.freebsd.org/changeset/base/233286 Log: MFC 230394,230441,230489,230552,232420: Close a race in NFS lookup processing that could result in stale name cache entries on one client when a directory was renamed on another client. The root cause for the stale entry being trusted is that each per-vnode nfsnode structure has a single 'n_ctime' timestamp used to validate positive name cache entries. However, if there are multiple entries for a single vnode, they all share a single timestamp. To fix this, extend the name cache to allow filesystems to optionally store a timestamp value in each name cache entry. The NFS clients now fetch the timestamp associated with each name cache entry and use that to validate cache hits instead of the timestamps previously stored in the nfsnode. Another part of the fix is that the NFS clients now use timestamps from the post-op attributes of RPCs when adding name cache entries rather than pulling the timestamps out of the file's attribute cache. The latter is subject to races with other lookups updating the attribute cache concurrently. Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c stable/8/sys/fs/nfsclient/nfs_clvnops.c stable/8/sys/fs/nfsclient/nfsnode.h stable/8/sys/kern/vfs_cache.c stable/8/sys/nfsclient/nfs_subs.c stable/8/sys/nfsclient/nfs_vnops.c stable/8/sys/nfsclient/nfsm_subs.h stable/8/sys/nfsclient/nfsnode.h stable/8/sys/sys/vnode.h Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clrpcops.c Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c Wed Mar 21 20:50:47 2012 (r233286) @@ -2951,10 +2951,12 @@ nfsrpc_readdirplus(vnode_t vp, struct ui nfsattrbit_t attrbits, dattrbits; size_t tresid; u_int32_t *tl2 = NULL, fakefileno = 0xffffffff, rderr; + struct timespec dctime; KASSERT(uiop->uio_iovcnt == 1 && (uio_uio_resid(uiop) & (DIRBLKSIZ - 1)) == 0, ("nfs readdirplusrpc bad uio")); + timespecclear(&dctime); *attrflagp = 0; if (eofp != NULL) *eofp = 0; @@ -2997,6 +2999,7 @@ nfsrpc_readdirplus(vnode_t vp, struct ui #endif if (error) return (error); + dctime = nfsva.na_ctime; dotfileid = nfsva.na_fileid; NFSCL_REQSTART(nd, NFSPROC_LOOKUPP, vp); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); @@ -3134,6 +3137,8 @@ nfsrpc_readdirplus(vnode_t vp, struct ui error = nd->nd_repstat; goto nfsmout; } + if ((nd->nd_flag & ND_NFSV3) != 0 && *attrflagp != 0) + dctime = nap->na_ctime; NFSM_DISSECT(tl, u_int32_t *, 3 * NFSX_UNSIGNED); NFSLOCKNODE(dnp); dnp->n_cookieverf.nfsuquad[0] = *tl++; @@ -3316,9 +3321,14 @@ nfsrpc_readdirplus(vnode_t vp, struct ui vtonfs_dtype(np->n_vattr.na_type); ndp->ni_vp = newvp; NFSCNHASH(cnp, HASHINIT); - if (cnp->cn_namelen <= NCHNAMLEN) { - np->n_ctime = np->n_vattr.na_ctime; - cache_enter(ndp->ni_dvp,ndp->ni_vp,cnp); + if (cnp->cn_namelen <= NCHNAMLEN && + (newvp->v_type != VDIR || + dctime.tv_sec != 0)) { + cache_enter_time(ndp->ni_dvp, + ndp->ni_vp, cnp, + &nfsva.na_ctime, + newvp->v_type != VDIR ? NULL : + &dctime); } if (unlocknewvp) vput(newvp); Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Wed Mar 21 20:50:47 2012 (r233286) @@ -979,12 +979,12 @@ nfs_lookup(struct vop_lookup_args *ap) struct vnode *newvp; struct nfsmount *nmp; struct nfsnode *np, *newnp; - int error = 0, attrflag, dattrflag, ltype; + int error = 0, attrflag, dattrflag, ltype, ncticks; struct thread *td = cnp->cn_thread; struct nfsfh *nfhp; struct nfsvattr dnfsva, nfsva; struct vattr vattr; - struct timespec dmtime; + struct timespec nctime; *vpp = NULLVP; if ((flags & ISLASTCN) && (mp->mnt_flag & MNT_RDONLY) && @@ -1005,11 +1005,24 @@ nfs_lookup(struct vop_lookup_args *ap) if ((error = VOP_ACCESS(dvp, VEXEC, cnp->cn_cred, td)) != 0) return (error); - error = cache_lookup(dvp, vpp, cnp); + error = cache_lookup_times(dvp, vpp, cnp, &nctime, &ncticks); if (error > 0 && error != ENOENT) return (error); if (error == -1) { /* + * Lookups of "." are special and always return the + * current directory. cache_lookup() already handles + * associated locking bookkeeping, etc. + */ + if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') { + /* XXX: Is this really correct? */ + if (cnp->cn_nameiop != LOOKUP && + (flags & ISLASTCN)) + cnp->cn_flags |= SAVENAME; + return (0); + } + + /* * We only accept a positive hit in the cache if the * change time of the file matches our cached copy. * Otherwise, we discard the cache entry and fallback @@ -1035,7 +1048,7 @@ nfs_lookup(struct vop_lookup_args *ap) } if (nfscl_nodeleg(newvp, 0) == 0 || (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && - timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==))) { + timespeccmp(&vattr.va_ctime, &nctime, ==))) { NFSINCRGLOBAL(newnfsstats.lookupcache_hits); if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -1054,36 +1067,21 @@ nfs_lookup(struct vop_lookup_args *ap) /* * We only accept a negative hit in the cache if the * modification time of the parent directory matches - * our cached copy. Otherwise, we discard all of the - * negative cache entries for this directory. We also - * only trust -ve cache entries for less than - * nm_negative_namecache_timeout seconds. + * the cached copy in the name cache entry. + * Otherwise, we discard all of the negative cache + * entries for this directory. We also only trust + * negative cache entries for up to nm_negnametimeo + * seconds. */ - if ((u_int)(ticks - np->n_dmtime_ticks) < - (nmp->nm_negnametimeo * hz) && + if ((u_int)(ticks - ncticks) < (nmp->nm_negnametimeo * hz) && VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && - timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) { + timespeccmp(&vattr.va_mtime, &nctime, ==)) { NFSINCRGLOBAL(newnfsstats.lookupcache_hits); return (ENOENT); } cache_purge_negative(dvp); - mtx_lock(&np->n_mtx); - timespecclear(&np->n_dmtime); - mtx_unlock(&np->n_mtx); } - /* - * Cache the modification time of the parent directory in case - * the lookup fails and results in adding the first negative - * name cache entry for the directory. Since this is reading - * a single time_t, don't bother with locking. The - * modification time may be a bit stale, but it must be read - * before performing the lookup RPC to prevent a race where - * another lookup updates the timestamp on the directory after - * the lookup RPC has been performed on the server but before - * n_dmtime is set at the end of this function. - */ - dmtime = np->n_vattr.na_mtime; error = 0; newvp = NULLVP; NFSINCRGLOBAL(newnfsstats.lookupcache_misses); @@ -1119,30 +1117,22 @@ nfs_lookup(struct vop_lookup_args *ap) return (EJUSTRETURN); } - if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE) { + if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE && + dattrflag) { /* - * Maintain n_dmtime as the modification time - * of the parent directory when the oldest -ve - * name cache entry for this directory was - * added. If a -ve cache entry has already - * been added with a newer modification time - * by a concurrent lookup, then don't bother - * adding a cache entry. The modification - * time of the directory might have changed - * due to the file this lookup failed to find - * being created. In that case a subsequent - * lookup would incorrectly use the entry - * added here instead of doing an extra - * lookup. + * Cache the modification time of the parent + * directory from the post-op attributes in + * the name cache entry. The negative cache + * entry will be ignored once the directory + * has changed. Don't bother adding the entry + * if the directory has already changed. */ mtx_lock(&np->n_mtx); - if (timespeccmp(&np->n_dmtime, &dmtime, <=)) { - if (!timespecisset(&np->n_dmtime)) { - np->n_dmtime = dmtime; - np->n_dmtime_ticks = ticks; - } + if (timespeccmp(&np->n_vattr.na_mtime, + &dnfsva.na_mtime, ==)) { mtx_unlock(&np->n_mtx); - cache_enter(dvp, NULL, cnp); + cache_enter_time(dvp, NULL, cnp, + &dnfsva.na_mtime, NULL); } else mtx_unlock(&np->n_mtx); } @@ -1240,10 +1230,10 @@ nfs_lookup(struct vop_lookup_args *ap) if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && - (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.na_vattr.va_ctime; - cache_enter(dvp, newvp, cnp); - } + (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) && + attrflag != 0 && (newvp->v_type != VDIR || dattrflag != 0)) + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + newvp->v_type != VDIR ? NULL : &dnfsva.na_ctime); *vpp = newvp; return (0); } @@ -1403,8 +1393,6 @@ nfs_mknodrpc(struct vnode *dvp, struct v } } if (!error) { - if ((cnp->cn_flags & MAKEENTRY)) - cache_enter(dvp, newvp, cnp); *vpp = newvp; } else if (NFS_ISV4(dvp)) { error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, @@ -1549,8 +1537,9 @@ again: } } if (!error) { - if (cnp->cn_flags & MAKEENTRY) - cache_enter(dvp, newvp, cnp); + if ((cnp->cn_flags & MAKEENTRY) && attrflag) + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + NULL); *ap->a_vpp = newvp; } else if (NFS_ISV4(dvp)) { error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, @@ -1916,8 +1905,9 @@ nfs_link(struct vop_link_args *ap) * must care about lookup caching hit rate, so... */ if (VFSTONFS(vp->v_mount)->nm_negnametimeo != 0 && - (cnp->cn_flags & MAKEENTRY)) - cache_enter(tdvp, vp, cnp); + (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) { + cache_enter_time(tdvp, vp, cnp, &nfsva.na_ctime, NULL); + } if (error && NFS_ISV4(vp)) error = nfscl_maperr(cnp->cn_thread, error, (uid_t)0, (gid_t)0); @@ -1973,15 +1963,6 @@ nfs_symlink(struct vop_symlink_args *ap) error = nfscl_maperr(cnp->cn_thread, error, vap->va_uid, vap->va_gid); } else { - /* - * If negative lookup caching is enabled, I might as well - * add an entry for this node. Not necessary for correctness, - * but if negative caching is enabled, then the system - * must care about lookup caching hit rate, so... - */ - if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && - (cnp->cn_flags & MAKEENTRY)) - cache_enter(dvp, newvp, cnp); *ap->a_vpp = newvp; } @@ -1995,6 +1976,16 @@ nfs_symlink(struct vop_symlink_args *ap) dnp->n_attrstamp = 0; mtx_unlock(&dnp->n_mtx); } + /* + * If negative lookup caching is enabled, I might as well + * add an entry for this node. Not necessary for correctness, + * but if negative caching is enabled, then the system + * must care about lookup caching hit rate, so... + */ + if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && + (cnp->cn_flags & MAKEENTRY) && attrflag != 0 && error == 0) { + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, NULL); + } return (error); } @@ -2064,8 +2055,10 @@ nfs_mkdir(struct vop_mkdir_args *ap) * must care about lookup caching hit rate, so... */ if (VFSTONFS(dvp->v_mount)->nm_negnametimeo != 0 && - (cnp->cn_flags & MAKEENTRY)) - cache_enter(dvp, newvp, cnp); + (cnp->cn_flags & MAKEENTRY) && + attrflag != 0 && dattrflag != 0) + cache_enter_time(dvp, newvp, cnp, &nfsva.na_ctime, + &dnfsva.na_ctime); *ap->a_vpp = newvp; } return (error); Modified: stable/8/sys/fs/nfsclient/nfsnode.h ============================================================================== --- stable/8/sys/fs/nfsclient/nfsnode.h Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/fs/nfsclient/nfsnode.h Wed Mar 21 20:50:47 2012 (r233286) @@ -107,7 +107,7 @@ struct nfsnode { struct timespec n_mtime; /* Prev modify time. */ time_t n_unused0; time_t n_unused1; - int n_dmtime_ticks; /* Tick of -ve cache entry */ + int n_unused3; time_t n_unused2; struct nfsfh *n_fhp; /* NFS File Handle */ struct vnode *n_vnode; /* associated vnode */ @@ -134,8 +134,8 @@ struct nfsnode { struct nfs_attrcache_timestamp n_unused; u_int64_t n_change; /* old Change attribute */ struct nfsv4node *n_v4; /* extra V4 stuff */ - struct timespec n_ctime; /* Prev create time. */ - struct timespec n_dmtime; /* Prev dir modify time. */ + struct timespec n_unused4; + struct timespec n_unused5; }; #define n_atim n_un1.nf_atim Modified: stable/8/sys/kern/vfs_cache.c ============================================================================== --- stable/8/sys/kern/vfs_cache.c Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/kern/vfs_cache.c Wed Mar 21 20:50:47 2012 (r233286) @@ -102,6 +102,36 @@ struct namecache { }; /* + * struct namecache_ts repeats struct namecache layout up to the + * nc_nlen member. + * struct namecache_ts is used in place of struct namecache when time(s) need + * to be stored. The nc_dotdottime field is used when a cache entry is mapping + * both a non-dotdot directory name plus dotdot for the directory's + * parent. + */ +struct namecache_ts { + LIST_ENTRY(namecache) nc_hash; /* hash chain */ + LIST_ENTRY(namecache) nc_src; /* source vnode list */ + TAILQ_ENTRY(namecache) nc_dst; /* destination vnode list */ + struct vnode *nc_dvp; /* vnode of parent of name */ + struct vnode *nc_vp; /* vnode the name refers to */ + u_char nc_flag; /* flag bits */ + u_char nc_nlen; /* length of name */ + struct timespec nc_time; /* timespec provided by fs */ + struct timespec nc_dotdottime; /* dotdot timespec provided by fs */ + int nc_ticks; /* ticks value when entry was added */ + char nc_name[0]; /* segment name + nul */ +}; + +/* + * Flags in namecache.nc_flag + */ +#define NCF_WHITE 0x01 +#define NCF_ISDOTDOT 0x02 +#define NCF_TS 0x04 +#define NCF_DTS 0x08 + +/* * Name caching works as follows: * * Names found by directory scans are retained in a cache @@ -165,20 +195,71 @@ RW_SYSINIT(vfscache, &cache_lock, "Name * fit in the small cache. */ static uma_zone_t cache_zone_small; +static uma_zone_t cache_zone_small_ts; static uma_zone_t cache_zone_large; +static uma_zone_t cache_zone_large_ts; #define CACHE_PATH_CUTOFF 35 -#define CACHE_ZONE_SMALL (sizeof(struct namecache) + CACHE_PATH_CUTOFF \ - + 1) -#define CACHE_ZONE_LARGE (sizeof(struct namecache) + NAME_MAX + 1) - -#define cache_alloc(len) uma_zalloc(((len) <= CACHE_PATH_CUTOFF) ? \ - cache_zone_small : cache_zone_large, M_WAITOK) -#define cache_free(ncp) do { \ - if (ncp != NULL) \ - uma_zfree(((ncp)->nc_nlen <= CACHE_PATH_CUTOFF) ? \ - cache_zone_small : cache_zone_large, (ncp)); \ -} while (0) + +static struct namecache * +cache_alloc(int len, int ts) +{ + + if (len > CACHE_PATH_CUTOFF) { + if (ts) + return (uma_zalloc(cache_zone_large_ts, M_WAITOK)); + else + return (uma_zalloc(cache_zone_large, M_WAITOK)); + } + if (ts) + return (uma_zalloc(cache_zone_small_ts, M_WAITOK)); + else + return (uma_zalloc(cache_zone_small, M_WAITOK)); +} + +static void +cache_free(struct namecache *ncp) +{ + int ts; + + if (ncp == NULL) + return; + ts = ncp->nc_flag & NCF_TS; + if (ncp->nc_nlen <= CACHE_PATH_CUTOFF) { + if (ts) + uma_zfree(cache_zone_small_ts, ncp); + else + uma_zfree(cache_zone_small, ncp); + } else if (ts) + uma_zfree(cache_zone_large_ts, ncp); + else + uma_zfree(cache_zone_large, ncp); +} + +static char * +nc_get_name(struct namecache *ncp) +{ + struct namecache_ts *ncp_ts; + + if ((ncp->nc_flag & NCF_TS) == 0) + return (ncp->nc_name); + ncp_ts = (struct namecache_ts *)ncp; + return (ncp_ts->nc_name); +} + +static void +cache_out_ts(struct namecache *ncp, struct timespec *tsp, int *ticksp) +{ + + KASSERT((ncp->nc_flag & NCF_TS) != 0 || + (tsp == NULL && ticksp == NULL), + ("No NCF_TS")); + + if (tsp != NULL) + *tsp = ((struct namecache_ts *)ncp)->nc_time; + if (ticksp != NULL) + *ticksp = ((struct namecache_ts *)ncp)->nc_ticks; +} static int doingcache = 1; /* 1 => enable the cache */ SYSCTL_INT(_debug, OID_AUTO, vfscache, CTLFLAG_RW, &doingcache, 0, @@ -234,12 +315,6 @@ static int vn_fullpath1(struct thread *t static MALLOC_DEFINE(M_VFSCACHE, "vfscache", "VFS name cache entries"); -/* - * Flags in namecache.nc_flag - */ -#define NCF_WHITE 0x01 -#define NCF_ISDOTDOT 0x02 - #ifdef DIAGNOSTIC /* * Grab an atomic snapshot of the name cache hash chain lengths @@ -344,10 +419,10 @@ cache_zap(ncp) #ifdef KDTRACE_HOOKS if (ncp->nc_vp != NULL) { SDT_PROBE(vfs, namecache, zap, done, ncp->nc_dvp, - ncp->nc_name, ncp->nc_vp, 0, 0); + nc_get_name(ncp), ncp->nc_vp, 0, 0); } else { SDT_PROBE(vfs, namecache, zap_negative, done, ncp->nc_dvp, - ncp->nc_name, 0, 0, 0); + nc_get_name(ncp), 0, 0, 0); } #endif vp = NULL; @@ -394,10 +469,12 @@ cache_zap(ncp) */ int -cache_lookup(dvp, vpp, cnp) +cache_lookup_times(dvp, vpp, cnp, tsp, ticksp) struct vnode *dvp; struct vnode **vpp; struct componentname *cnp; + struct timespec *tsp; + int *ticksp; { struct namecache *ncp; u_int32_t hash; @@ -422,6 +499,10 @@ retry_wlocked: dothits++; SDT_PROBE(vfs, namecache, lookup, hit, dvp, ".", *vpp, 0, 0); + if (tsp != NULL) + timespecclear(tsp); + if (ticksp != NULL) + *ticksp = ticks; goto success; } if (cnp->cn_namelen == 2 && cnp->cn_nameptr[1] == '.') { @@ -440,19 +521,23 @@ retry_wlocked: CACHE_WUNLOCK(); return (0); } - if (dvp->v_cache_dd->nc_flag & NCF_ISDOTDOT) - *vpp = dvp->v_cache_dd->nc_vp; + ncp = dvp->v_cache_dd; + if (ncp->nc_flag & NCF_ISDOTDOT) + *vpp = ncp->nc_vp; else - *vpp = dvp->v_cache_dd->nc_dvp; + *vpp = ncp->nc_dvp; /* Return failure if negative entry was found. */ - if (*vpp == NULL) { - ncp = dvp->v_cache_dd; + if (*vpp == NULL) goto negative_success; - } CTR3(KTR_VFS, "cache_lookup(%p, %s) found %p via ..", dvp, cnp->cn_nameptr, *vpp); SDT_PROBE(vfs, namecache, lookup, hit, dvp, "..", *vpp, 0, 0); + cache_out_ts(ncp, tsp, ticksp); + if ((ncp->nc_flag & (NCF_ISDOTDOT | NCF_DTS)) == + NCF_DTS && tsp != NULL) + *tsp = ((struct namecache_ts *)ncp)-> + nc_dotdottime; goto success; } } @@ -462,7 +547,7 @@ retry_wlocked: LIST_FOREACH(ncp, (NCHHASH(hash)), nc_hash) { numchecks++; if (ncp->nc_dvp == dvp && ncp->nc_nlen == cnp->cn_namelen && - !bcmp(ncp->nc_name, cnp->cn_nameptr, ncp->nc_nlen)) + !bcmp(nc_get_name(ncp), cnp->cn_nameptr, ncp->nc_nlen)) break; } @@ -497,8 +582,9 @@ retry_wlocked: *vpp = ncp->nc_vp; CTR4(KTR_VFS, "cache_lookup(%p, %s) found %p via ncp %p", dvp, cnp->cn_nameptr, *vpp, ncp); - SDT_PROBE(vfs, namecache, lookup, hit, dvp, ncp->nc_name, + SDT_PROBE(vfs, namecache, lookup, hit, dvp, nc_get_name(ncp), *vpp, 0, 0); + cache_out_ts(ncp, tsp, ticksp); goto success; } @@ -528,8 +614,9 @@ negative_success: nchstats.ncs_neghits++; if (ncp->nc_flag & NCF_WHITE) cnp->cn_flags |= ISWHITEOUT; - SDT_PROBE(vfs, namecache, lookup, hit_negative, dvp, ncp->nc_name, + SDT_PROBE(vfs, namecache, lookup, hit_negative, dvp, nc_get_name(ncp), 0, 0, 0); + cache_out_ts(ncp, tsp, ticksp); CACHE_WUNLOCK(); return (ENOENT); @@ -616,12 +703,15 @@ unlock: * Add an entry to the cache. */ void -cache_enter(dvp, vp, cnp) +cache_enter_time(dvp, vp, cnp, tsp, dtsp) struct vnode *dvp; struct vnode *vp; struct componentname *cnp; + struct timespec *tsp; + struct timespec *dtsp; { struct namecache *ncp, *n2; + struct namecache_ts *n3; struct nchashhead *ncpp; u_int32_t hash; int flag; @@ -688,13 +778,23 @@ cache_enter(dvp, vp, cnp) * Calculate the hash key and setup as much of the new * namecache entry as possible before acquiring the lock. */ - ncp = cache_alloc(cnp->cn_namelen); + ncp = cache_alloc(cnp->cn_namelen, tsp != NULL); ncp->nc_vp = vp; ncp->nc_dvp = dvp; ncp->nc_flag = flag; + if (tsp != NULL) { + n3 = (struct namecache_ts *)ncp; + n3->nc_time = *tsp; + n3->nc_ticks = ticks; + n3->nc_flag |= NCF_TS; + if (dtsp != NULL) { + n3->nc_dotdottime = *dtsp; + n3->nc_flag |= NCF_DTS; + } + } len = ncp->nc_nlen = cnp->cn_namelen; hash = fnv_32_buf(cnp->cn_nameptr, len, FNV1_32_INIT); - strlcpy(ncp->nc_name, cnp->cn_nameptr, len + 1); + strlcpy(nc_get_name(ncp), cnp->cn_nameptr, len + 1); hash = fnv_32_buf(&dvp, sizeof(dvp), hash); CACHE_WLOCK(); @@ -707,7 +807,22 @@ cache_enter(dvp, vp, cnp) LIST_FOREACH(n2, ncpp, nc_hash) { if (n2->nc_dvp == dvp && n2->nc_nlen == cnp->cn_namelen && - !bcmp(n2->nc_name, cnp->cn_nameptr, n2->nc_nlen)) { + !bcmp(nc_get_name(n2), cnp->cn_nameptr, n2->nc_nlen)) { + if (tsp != NULL) { + KASSERT((n2->nc_flag & NCF_TS) != 0, + ("no NCF_TS")); + n3 = (struct namecache_ts *)n2; + n3->nc_time = + ((struct namecache_ts *)ncp)->nc_time; + n3->nc_ticks = + ((struct namecache_ts *)ncp)->nc_ticks; + if (dtsp != NULL) { + n3->nc_dotdottime = + ((struct namecache_ts *)ncp)-> + nc_dotdottime; + n3->nc_flag |= NCF_DTS; + } + } CACHE_WUNLOCK(); cache_free(ncp); return; @@ -736,6 +851,11 @@ cache_enter(dvp, vp, cnp) ncp->nc_flag |= NCF_WHITE; } else if (vp->v_type == VDIR) { if (flag != NCF_ISDOTDOT) { + /* + * For this case, the cache entry maps both the + * directory name in it and the name ".." for the + * directory's parent. + */ if ((n2 = vp->v_cache_dd) != NULL && (n2->nc_flag & NCF_ISDOTDOT) != 0) cache_zap(n2); @@ -765,12 +885,12 @@ cache_enter(dvp, vp, cnp) */ if (vp) { TAILQ_INSERT_HEAD(&vp->v_cache_dst, ncp, nc_dst); - SDT_PROBE(vfs, namecache, enter, done, dvp, ncp->nc_name, vp, - 0, 0); + SDT_PROBE(vfs, namecache, enter, done, dvp, nc_get_name(ncp), + vp, 0, 0); } else { TAILQ_INSERT_TAIL(&ncneg, ncp, nc_dst); SDT_PROBE(vfs, namecache, enter_negative, done, dvp, - ncp->nc_name, 0, 0, 0); + nc_get_name(ncp), 0, 0, 0); } if (numneg * ncnegfactor > numcache) { ncp = TAILQ_FIRST(&ncneg); @@ -792,10 +912,18 @@ nchinit(void *dummy __unused) TAILQ_INIT(&ncneg); - cache_zone_small = uma_zcreate("S VFS Cache", CACHE_ZONE_SMALL, NULL, - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); - cache_zone_large = uma_zcreate("L VFS Cache", CACHE_ZONE_LARGE, NULL, - NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_small = uma_zcreate("S VFS Cache", + sizeof(struct namecache) + CACHE_PATH_CUTOFF + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_small_ts = uma_zcreate("STS VFS Cache", + sizeof(struct namecache_ts) + CACHE_PATH_CUTOFF + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_large = uma_zcreate("L VFS Cache", + sizeof(struct namecache) + NAME_MAX + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); + cache_zone_large_ts = uma_zcreate("LTS VFS Cache", + sizeof(struct namecache_ts) + NAME_MAX + 1, + NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_ZINIT); nchashtbl = hashinit(desiredvnodes * 2, M_VFSCACHE, &nchash); } @@ -1104,9 +1232,9 @@ vn_vptocnp_locked(struct vnode **vp, str return (error); } *buflen -= ncp->nc_nlen; - memcpy(buf + *buflen, ncp->nc_name, ncp->nc_nlen); + memcpy(buf + *buflen, nc_get_name(ncp), ncp->nc_nlen); SDT_PROBE(vfs, namecache, fullpath, hit, ncp->nc_dvp, - ncp->nc_name, vp, 0, 0); + nc_get_name(ncp), vp, 0, 0); *vp = ncp->nc_dvp; return (0); } @@ -1243,8 +1371,31 @@ vn_commname(struct vnode *vp, char *buf, return (ENOENT); } l = min(ncp->nc_nlen, buflen - 1); - memcpy(buf, ncp->nc_name, l); + memcpy(buf, nc_get_name(ncp), l); CACHE_RUNLOCK(); buf[l] = '\0'; return (0); } + +/* ABI compat shims for old kernel modules. */ +#undef cache_enter +#undef cache_lookup + +void cache_enter(struct vnode *dvp, struct vnode *vp, + struct componentname *cnp); +int cache_lookup(struct vnode *dvp, struct vnode **vpp, + struct componentname *cnp); + +void +cache_enter(struct vnode *dvp, struct vnode *vp, struct componentname *cnp) +{ + + cache_enter_time(dvp, vp, cnp, NULL, NULL); +} + +int +cache_lookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) +{ + + return (cache_lookup_times(dvp, vpp, cnp, NULL, NULL)); +} Modified: stable/8/sys/nfsclient/nfs_subs.c ============================================================================== --- stable/8/sys/nfsclient/nfs_subs.c Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/nfsclient/nfs_subs.c Wed Mar 21 20:50:47 2012 (r233286) @@ -978,8 +978,8 @@ nfsm_loadattr_xx(struct vnode **v, struc } int -nfsm_postop_attr_xx(struct vnode **v, int *f, struct mbuf **md, - caddr_t *dpos) +nfsm_postop_attr_xx(struct vnode **v, int *f, struct vattr *va, + struct mbuf **md, caddr_t *dpos) { u_int32_t *tl; int t1; @@ -990,7 +990,7 @@ nfsm_postop_attr_xx(struct vnode **v, in return EBADRPC; *f = fxdr_unsigned(int, *tl); if (*f != 0) { - t1 = nfs_loadattrcache(&ttvp, md, dpos, NULL, 1); + t1 = nfs_loadattrcache(&ttvp, md, dpos, va, 1); if (t1 != 0) { *f = 0; return t1; @@ -1020,7 +1020,7 @@ nfsm_wcc_data_xx(struct vnode **v, int * VTONFS(*v)->n_mtime.tv_nsec == fxdr_unsigned(u_int32_t, *(tl + 3))); mtx_unlock(&(VTONFS(*v))->n_mtx); } - t1 = nfsm_postop_attr_xx(v, &ttattrf, md, dpos); + t1 = nfsm_postop_attr_xx(v, &ttattrf, NULL, md, dpos); if (t1) return t1; if (*f) Modified: stable/8/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vnops.c Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/nfsclient/nfs_vnops.c Wed Mar 21 20:50:47 2012 (r233286) @@ -913,8 +913,8 @@ nfs_lookup(struct vop_lookup_args *ap) struct vnode *dvp = ap->a_dvp; struct vnode **vpp = ap->a_vpp; struct mount *mp = dvp->v_mount; - struct vattr vattr; - struct timespec dmtime; + struct vattr dvattr, vattr; + struct timespec nctime; int flags = cnp->cn_flags; struct vnode *newvp; struct nfsmount *nmp; @@ -923,7 +923,7 @@ nfs_lookup(struct vop_lookup_args *ap) long len; nfsfh_t *fhp; struct nfsnode *np, *newnp; - int error = 0, attrflag, fhsize, ltype; + int error = 0, attrflag, dattrflag, fhsize, ltype, ncticks; int v3 = NFS_ISV3(dvp); struct thread *td = cnp->cn_thread; @@ -939,11 +939,24 @@ nfs_lookup(struct vop_lookup_args *ap) *vpp = NULLVP; return (error); } - error = cache_lookup(dvp, vpp, cnp); + error = cache_lookup_times(dvp, vpp, cnp, &nctime, &ncticks); if (error > 0 && error != ENOENT) return (error); if (error == -1) { /* + * Lookups of "." are special and always return the + * current directory. cache_lookup() already handles + * associated locking bookkeeping, etc. + */ + if (cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.') { + /* XXX: Is this really correct? */ + if (cnp->cn_nameiop != LOOKUP && + (flags & ISLASTCN)) + cnp->cn_flags |= SAVENAME; + return (0); + } + + /* * We only accept a positive hit in the cache if the * change time of the file matches our cached copy. * Otherwise, we discard the cache entry and fallback @@ -969,7 +982,7 @@ nfs_lookup(struct vop_lookup_args *ap) mtx_unlock(&newnp->n_mtx); } if (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && - timespeccmp(&vattr.va_ctime, &newnp->n_ctime, ==)) { + timespeccmp(&vattr.va_ctime, &nctime, ==)) { nfsstats.lookupcache_hits++; if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) @@ -988,36 +1001,22 @@ nfs_lookup(struct vop_lookup_args *ap) /* * We only accept a negative hit in the cache if the * modification time of the parent directory matches - * our cached copy. Otherwise, we discard all of the - * negative cache entries for this directory. We also - * only trust -ve cache entries for less than - * nm_negative_namecache_timeout seconds. + * the cached copy in the name cache entry. + * Otherwise, we discard all of the negative cache + * entries for this directory. We also only trust + * negative cache entries for up to nm_negnametimeo + * seconds. */ - if ((u_int)(ticks - np->n_dmtime_ticks) < - (nmp->nm_negnametimeo * hz) && + if ((u_int)(ticks - ncticks) < (nmp->nm_negnametimeo * hz) && VOP_GETATTR(dvp, &vattr, cnp->cn_cred) == 0 && - timespeccmp(&vattr.va_mtime, &np->n_dmtime, ==)) { + timespeccmp(&vattr.va_mtime, &nctime, ==)) { nfsstats.lookupcache_hits++; return (ENOENT); } cache_purge_negative(dvp); - mtx_lock(&np->n_mtx); - timespecclear(&np->n_dmtime); - mtx_unlock(&np->n_mtx); } - /* - * Cache the modification time of the parent directory in case - * the lookup fails and results in adding the first negative - * name cache entry for the directory. Since this is reading - * a single time_t, don't bother with locking. The - * modification time may be a bit stale, but it must be read - * before performing the lookup RPC to prevent a race where - * another lookup updates the timestamp on the directory after - * the lookup RPC has been performed on the server but before - * n_dmtime is set at the end of this function. - */ - dmtime = np->n_vattr.va_mtime; + attrflag = dattrflag = 0; error = 0; newvp = NULLVP; nfsstats.lookupcache_misses++; @@ -1032,7 +1031,7 @@ nfs_lookup(struct vop_lookup_args *ap) nfsm_request(dvp, NFSPROC_LOOKUP, cnp->cn_thread, cnp->cn_cred); if (error) { if (v3) { - nfsm_postop_attr(dvp, attrflag); + nfsm_postop_attr_va(dvp, dattrflag, &vattr); m_freem(mrep); } goto nfsmout; @@ -1128,17 +1127,19 @@ nfs_lookup(struct vop_lookup_args *ap) } } if (v3) { - nfsm_postop_attr(newvp, attrflag); - nfsm_postop_attr(dvp, attrflag); - } else - nfsm_loadattr(newvp, NULL); + nfsm_postop_attr_va(newvp, attrflag, &vattr); + nfsm_postop_attr_va(dvp, dattrflag, &dvattr); + } else { + nfsm_loadattr(newvp, &vattr); + attrflag = 1; + } if (cnp->cn_nameiop != LOOKUP && (flags & ISLASTCN)) cnp->cn_flags |= SAVENAME; if ((cnp->cn_flags & MAKEENTRY) && - (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN))) { - np->n_ctime = np->n_vattr.va_ctime; - cache_enter(dvp, newvp, cnp); - } + (cnp->cn_nameiop != DELETE || !(flags & ISLASTCN)) && + attrflag != 0 && (newvp->v_type != VDIR || dattrflag != 0)) + cache_enter_time(dvp, newvp, cnp, &vattr.va_ctime, + newvp->v_type != VDIR ? NULL : &dvattr.va_ctime); *vpp = newvp; m_freem(mrep); nfsmout: @@ -1165,30 +1166,22 @@ nfsmout: return (EJUSTRETURN); } - if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE) { + if ((cnp->cn_flags & MAKEENTRY) && cnp->cn_nameiop != CREATE && + dattrflag) { /* - * Maintain n_dmtime as the modification time - * of the parent directory when the oldest -ve - * name cache entry for this directory was - * added. If a -ve cache entry has already - * been added with a newer modification time - * by a concurrent lookup, then don't bother - * adding a cache entry. The modification - * time of the directory might have changed - * due to the file this lookup failed to find - * being created. In that case a subsequent - * lookup would incorrectly use the entry - * added here instead of doing an extra - * lookup. + * Cache the modification time of the parent + * directory from the post-op attributes in + * the name cache entry. The negative cache + * entry will be ignored once the directory + * has changed. Don't bother adding the entry + * if the directory has already changed. */ mtx_lock(&np->n_mtx); - if (timespeccmp(&np->n_dmtime, &dmtime, <=)) { - if (!timespecisset(&np->n_dmtime)) { - np->n_dmtime = dmtime; - np->n_dmtime_ticks = ticks; - } + if (timespeccmp(&np->n_vattr.va_mtime, + &vattr.va_mtime, ==)) { mtx_unlock(&np->n_mtx); - cache_enter(dvp, NULL, cnp); + cache_enter_time(dvp, NULL, cnp, + &vattr.va_mtime, NULL); } else mtx_unlock(&np->n_mtx); } @@ -1539,8 +1532,6 @@ nfsmout: if (newvp) vput(newvp); } else { - if (cnp->cn_flags & MAKEENTRY) - cache_enter(dvp, newvp, cnp); *vpp = newvp; } mtx_lock(&(VTONFS(dvp))->n_mtx); @@ -1679,8 +1670,6 @@ nfsmout: vput(newvp); } if (!error) { - if (cnp->cn_flags & MAKEENTRY) - cache_enter(dvp, newvp, cnp); *ap->a_vpp = newvp; } mtx_lock(&(VTONFS(dvp))->n_mtx); @@ -2474,10 +2463,11 @@ nfs_readdirplusrpc(struct vnode *vp, str nfsuint64 cookie; struct nfsmount *nmp = VFSTONFS(vp->v_mount); struct nfsnode *dnp = VTONFS(vp), *np; + struct vattr vattr, dvattr; nfsfh_t *fhp; u_quad_t fileno; int error = 0, tlen, more_dirs = 1, blksiz = 0, doit, bigenough = 1, i; - int attrflag, fhsize; + int attrflag, dattrflag, fhsize; #ifndef nolint dp = NULL; @@ -2523,7 +2513,7 @@ nfs_readdirplusrpc(struct vnode *vp, str *tl++ = txdr_unsigned(nmp->nm_readdirsize); *tl = txdr_unsigned(nmp->nm_rsize); nfsm_request(vp, NFSPROC_READDIRPLUS, uiop->uio_td, cred); - nfsm_postop_attr(vp, attrflag); + nfsm_postop_attr_va(vp, dattrflag, &dvattr); if (error) { m_freem(mrep); goto nfsmout; @@ -2654,18 +2644,16 @@ nfs_readdirplusrpc(struct vnode *vp, str dpos = dpossav1; mdsav2 = md; md = mdsav1; - nfsm_loadattr(newvp, NULL); + nfsm_loadattr(newvp, &vattr); dpos = dpossav2; md = mdsav2; - dp->d_type = - IFTODT(VTTOIF(np->n_vattr.va_type)); + dp->d_type = IFTODT(VTTOIF(vattr.va_type)); ndp->ni_vp = newvp; - /* - * Update n_ctime so subsequent lookup - * doesn't purge entry. - */ - np->n_ctime = np->n_vattr.va_ctime; - cache_enter(ndp->ni_dvp, ndp->ni_vp, cnp); + if (newvp->v_type != VDIR || dattrflag != 0) + cache_enter_time(ndp->ni_dvp, ndp->ni_vp, + cnp, &vattr.va_ctime, + newvp->v_type != VDIR ? NULL : + &dvattr.va_ctime); } } else { /* Just skip over the file handle */ Modified: stable/8/sys/nfsclient/nfsm_subs.h ============================================================================== --- stable/8/sys/nfsclient/nfsm_subs.h Wed Mar 21 20:50:15 2012 (r233285) +++ stable/8/sys/nfsclient/nfsm_subs.h Wed Mar 21 20:50:47 2012 (r233286) @@ -152,8 +152,8 @@ int nfsm_getfh_xx(nfsfh_t **f, int *s, i caddr_t *dpos); int nfsm_loadattr_xx(struct vnode **v, struct vattr *va, struct mbuf **md, caddr_t *dpos); -int nfsm_postop_attr_xx(struct vnode **v, int *f, struct mbuf **md, - caddr_t *dpos); +int nfsm_postop_attr_xx(struct vnode **v, int *f, struct vattr *va, + struct mbuf **md, caddr_t *dpos); int nfsm_wcc_data_xx(struct vnode **v, int *f, struct mbuf **md, caddr_t *dpos); @@ -181,7 +181,14 @@ do { \ #define nfsm_postop_attr(v, f) \ do { \ int32_t t1; \ - t1 = nfsm_postop_attr_xx(&v, &f, &md, &dpos); \ + t1 = nfsm_postop_attr_xx(&v, &f, NULL, &md, &dpos); \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-8@FreeBSD.ORG Thu Mar 22 11:43:55 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id BCFCC1065673; Thu, 22 Mar 2012 11:43:54 +0000 (UTC) (envelope-from pluknet@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A81138FC08; Thu, 22 Mar 2012 11:43:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2MBhsKn022805; Thu, 22 Mar 2012 11:43:54 GMT (envelope-from pluknet@svn.freebsd.org) Received: (from pluknet@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2MBhswa022803; Thu, 22 Mar 2012 11:43:54 GMT (envelope-from pluknet@svn.freebsd.org) Message-Id: <201203221143.q2MBhswa022803@svn.freebsd.org> From: Sergey Kandaurov Date: Thu, 22 Mar 2012 11:43:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233303 - stable/8/share/man/man9 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 11:43:57 -0000 Author: pluknet Date: Thu Mar 22 11:43:54 2012 New Revision: 233303 URL: http://svn.freebsd.org/changeset/base/233303 Log: MFC r210525: Missing IFCAP_* macro descriptions in ifnet(9). PR: docs/148952 Submitted by: Lars Hartmann Modified: stable/8/share/man/man9/ifnet.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/ifnet.9 ============================================================================== --- stable/8/share/man/man9/ifnet.9 Thu Mar 22 11:18:14 2012 (r233302) +++ stable/8/share/man/man9/ifnet.9 Thu Mar 22 11:43:54 2012 (r233303) @@ -600,6 +600,31 @@ longer than permitted by the Ethernet sp .It Dv IFCAP_JUMBO_MTU This Ethernet interface can transmit and receive frames up to 9000 bytes long. +.It Dv IFCAP_TSO4 +This Ethernet interface supports TCP Segmentation offloading. +.It Dv IFCAP_TSO6 +This Ethernet interface supports TCP6 Segmentation offloading. +.It Dv IFCAP_TSO +A shorthand for +.Pq Dv IFCAP_TSO4 | IFCAP_TSO6 . +.It Dv IFCAP_TOE4 +This Ethernet interface supports TCP offloading. +.It Dv IFCAP_TOE6 +This Ethernet interface supports TCP6 offloading. +.It Dv ICAP_TOE +A Shorthand for +.Pq Dv IFCAP_TOE4 | IFCAP_TOE6 . +.It Dv IFCAP_WOL_UCAST +This Ethernet interface supports waking up on any Unicast packet. +.It Dv IFCAP_WOL_MCAST +This Ethernet interface supports waking up on any Multicast packet. +.It Dv IFCAP_WOL_MAGIC +This Ethernet interface supports waking up on any Magic packet such +as those sent by +.Xr wake 8 . +.It Dv IFCAP_WOL +A shorthand for +.Pq Dv IFCAP_WOL_UCAST | IFCAP_WOL_MCAST | IFCAP_WOL_MAGIC . .El .Pp The ability of advanced network interfaces to offload certain From owner-svn-src-stable-8@FreeBSD.ORG Thu Mar 22 17:02:06 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id A22F11065673; Thu, 22 Mar 2012 17:02:06 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 82FDC8FC18; Thu, 22 Mar 2012 17:02:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2MH26JW033222; Thu, 22 Mar 2012 17:02:06 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2MH260m033220; Thu, 22 Mar 2012 17:02:06 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201203221702.q2MH260m033220@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 22 Mar 2012 17:02:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233314 - stable/8/usr.sbin/usbdump X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 17:02:06 -0000 Author: hselasky Date: Thu Mar 22 17:02:05 2012 New Revision: 233314 URL: http://svn.freebsd.org/changeset/base/233314 Log: MFC r233037 and r233039: Fix cross-platform issue about the file-format in which usbdump stores data. Modified: stable/8/usr.sbin/usbdump/usbdump.c (contents, props changed) Directory Properties: stable/8/usr.sbin/usbdump/ (props changed) Modified: stable/8/usr.sbin/usbdump/usbdump.c ============================================================================== --- stable/8/usr.sbin/usbdump/usbdump.c Thu Mar 22 17:01:25 2012 (r233313) +++ stable/8/usr.sbin/usbdump/usbdump.c Thu Mar 22 17:02:05 2012 (r233314) @@ -70,9 +70,23 @@ struct usbcap_filehdr { uint8_t reserved[26]; } __packed; +#define HEADER_ALIGN(x,a) (((x) + (a) - 1) & ~((a) - 1)) + +struct header_32 { + /* capture timestamp */ + uint32_t ts_sec; + uint32_t ts_usec; + /* data length and alignment information */ + uint32_t caplen; + uint32_t datalen; + uint8_t hdrlen; + uint8_t align; +} __packed; + static int doexit = 0; static int pkt_captured = 0; static int verbose = 0; +static int uf_minor; static const char *i_arg = "usbus0"; static const char *r_arg = NULL; static const char *w_arg = NULL; @@ -283,7 +297,7 @@ hexdump(const uint8_t *region, uint32_t } static void -print_apacket(const struct bpf_hdr *hdr, const uint8_t *ptr, int ptr_len) +print_apacket(const struct header_32 *hdr, const uint8_t *ptr, int ptr_len) { struct tm *tm; struct usbpf_pkthdr up_temp; @@ -318,8 +332,8 @@ print_apacket(const struct bpf_hdr *hdr, up->up_packet_count = le32toh(up->up_packet_count); up->up_endpoint = le32toh(up->up_endpoint); - tv.tv_sec = hdr->bh_tstamp.tv_sec; - tv.tv_usec = hdr->bh_tstamp.tv_usec; + tv.tv_sec = hdr->ts_sec; + tv.tv_usec = hdr->ts_usec; tm = localtime(&tv.tv_sec); len = strftime(buf, sizeof(buf), "%H:%M:%S", tm); @@ -384,19 +398,73 @@ print_apacket(const struct bpf_hdr *hdr, } static void -print_packets(uint8_t *data, const int datalen) +fix_packets(uint8_t *data, const int datalen) { - const struct bpf_hdr *hdr; + struct header_32 temp; uint8_t *ptr; uint8_t *next; + uint32_t hdrlen; + uint32_t caplen; for (ptr = data; ptr < (data + datalen); ptr = next) { + + const struct bpf_hdr *hdr; + hdr = (const struct bpf_hdr *)ptr; - next = ptr + BPF_WORDALIGN(hdr->bh_hdrlen + hdr->bh_caplen); - if (w_arg == NULL) { - print_apacket(hdr, ptr + - hdr->bh_hdrlen, hdr->bh_caplen); + temp.ts_sec = htole32(hdr->bh_tstamp.tv_sec); + temp.ts_usec = htole32(hdr->bh_tstamp.tv_usec); + temp.caplen = htole32(hdr->bh_caplen); + temp.datalen = htole32(hdr->bh_datalen); + temp.hdrlen = hdr->bh_hdrlen; + temp.align = BPF_WORDALIGN(1); + + hdrlen = hdr->bh_hdrlen; + caplen = hdr->bh_caplen; + + if ((hdrlen >= sizeof(temp)) && (hdrlen <= 255) && + ((ptr + hdrlen) <= (data + datalen))) { + memcpy(ptr, &temp, sizeof(temp)); + memset(ptr + sizeof(temp), 0, hdrlen - sizeof(temp)); + } else { + err(EXIT_FAILURE, "Invalid header length %d", hdrlen); + } + + next = ptr + BPF_WORDALIGN(hdrlen + caplen); + + if (next <= ptr) + err(EXIT_FAILURE, "Invalid length"); + } +} + +static void +print_packets(uint8_t *data, const int datalen) +{ + struct header_32 temp; + uint8_t *ptr; + uint8_t *next; + + for (ptr = data; ptr < (data + datalen); ptr = next) { + + const struct header_32 *hdr32; + + hdr32 = (const struct header_32 *)ptr; + + temp.ts_sec = le32toh(hdr32->ts_sec); + temp.ts_usec = le32toh(hdr32->ts_usec); + temp.caplen = le32toh(hdr32->caplen); + temp.datalen = le32toh(hdr32->datalen); + temp.hdrlen = hdr32->hdrlen; + temp.align = hdr32->align; + + next = ptr + HEADER_ALIGN(temp.hdrlen + temp.caplen, temp.align); + + if (next <= ptr) + err(EXIT_FAILURE, "Invalid length"); + + if (w_arg == NULL || r_arg != NULL) { + print_apacket(&temp, ptr + + temp.hdrlen, temp.caplen); } pkt_captured++; } @@ -437,6 +505,9 @@ read_file(struct usbcap *p) err(EXIT_FAILURE, "Could not read complete " "USB data payload"); } + if (uf_minor == 2) + fix_packets(data, datalen); + print_packets(data, datalen); free(data); } @@ -461,6 +532,9 @@ do_loop(struct usbcap *p) } if (cc == 0) continue; + + fix_packets(p->buffer, cc); + if (w_arg != NULL) write_packets(p, p->buffer, cc); print_packets(p->buffer, cc); @@ -492,7 +566,10 @@ init_rfile(struct usbcap *p) errx(EX_SOFTWARE, "Invalid major version(%d) " "field in USB capture file header.", (int)uf.major); } - if (uf.minor != 2) { + + uf_minor = uf.minor; + + if (uf.minor != 3 && uf.minor != 2) { errx(EX_SOFTWARE, "Invalid minor version(%d) " "field in USB capture file header.", (int)uf.minor); } @@ -507,12 +584,12 @@ init_wfile(struct usbcap *p) p->wfd = open(w_arg, O_CREAT | O_TRUNC | O_WRONLY, S_IRUSR | S_IWUSR); if (p->wfd < 0) { err(EXIT_FAILURE, "Could not open " - "'%s' for write", r_arg); + "'%s' for write", w_arg); } memset(&uf, 0, sizeof(uf)); uf.magic = htole32(USBCAP_FILEHDR_MAGIC); uf.major = 0; - uf.minor = 2; + uf.minor = 3; ret = write(p->wfd, (const void *)&uf, sizeof(uf)); if (ret != sizeof(uf)) { err(EXIT_FAILURE, "Could not write " From owner-svn-src-stable-8@FreeBSD.ORG Thu Mar 22 20:52:00 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CFE73106564A; Thu, 22 Mar 2012 20:52:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BA0D58FC08; Thu, 22 Mar 2012 20:52:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2MKq0tE040892; Thu, 22 Mar 2012 20:52:00 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2MKq0iM040889; Thu, 22 Mar 2012 20:52:00 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203222052.q2MKq0iM040889@svn.freebsd.org> From: John Baldwin Date: Thu, 22 Mar 2012 20:52:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233325 - in stable/8/sys: i386/conf nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 20:52:01 -0000 Author: jhb Date: Thu Mar 22 20:52:00 2012 New Revision: 233325 URL: http://svn.freebsd.org/changeset/base/233325 Log: MFC 232116: Adjust the nfs_skip_wcc_data_onerr setting so that it does not block post-op attributes for ENOENT errors now that the name caching logic depends on working post-op attributes. Modified: stable/8/sys/nfsclient/nfs_krpc.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/nfsclient/nfs_krpc.c ============================================================================== --- stable/8/sys/nfsclient/nfs_krpc.c Thu Mar 22 20:51:35 2012 (r233324) +++ stable/8/sys/nfsclient/nfs_krpc.c Thu Mar 22 20:52:00 2012 (r233325) @@ -603,13 +603,15 @@ tryagain: if (error == ESTALE) nfs_purgecache(vp); /* - * Skip wcc data on NFS errors for now. NetApp filers - * return corrupt postop attrs in the wcc data for NFS - * err EROFS. Not sure if they could return corrupt - * postop attrs for others errors. + * Skip wcc data on non-ENOENT NFS errors for now. + * NetApp filers return corrupt postop attrs in the + * wcc data for NFS err EROFS. Not sure if they could + * return corrupt postop attrs for others errors. + * Blocking ENOENT post-op attributes breaks negative + * name caching, so always allow it through. */ if ((nmp->nm_flag & NFSMNT_NFSV3) && - !nfs_skip_wcc_data_onerr) { + (!nfs_skip_wcc_data_onerr || error == ENOENT)) { *mrp = mrep; *mdp = md; *dposp = dpos; From owner-svn-src-stable-8@FreeBSD.ORG Thu Mar 22 21:08:15 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 211BA1065675; Thu, 22 Mar 2012 21:08:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 018E88FC15; Thu, 22 Mar 2012 21:08:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2ML8Ewb041528; Thu, 22 Mar 2012 21:08:14 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2ML8EDG041520; Thu, 22 Mar 2012 21:08:14 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203222108.q2ML8EDG041520@svn.freebsd.org> From: John Baldwin Date: Thu, 22 Mar 2012 21:08:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233327 - in stable/8: sbin/mount_nfs sys/fs/nfsclient sys/i386/conf sys/nfsclient X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 22 Mar 2012 21:08:15 -0000 Author: jhb Date: Thu Mar 22 21:08:14 2012 New Revision: 233327 URL: http://svn.freebsd.org/changeset/base/233327 Log: MFC 230547: Add a timeout on positive name cache entries in the NFS client. That is, we will only trust a positive name cache entry for a specified amount of time before falling back to a LOOKUP RPC, even if the ctime for the file handle matches the cached copy in the name cache entry. The timeout is configured via a new 'nametimeo' mount option and defaults to 60 seconds. It may be set to zero to disable positive name caching entirely. Modified: stable/8/sbin/mount_nfs/mount_nfs.8 stable/8/sys/fs/nfsclient/nfs_clvfsops.c stable/8/sys/fs/nfsclient/nfs_clvnops.c stable/8/sys/fs/nfsclient/nfsmount.h stable/8/sys/nfsclient/nfs_vfsops.c stable/8/sys/nfsclient/nfs_vnops.c stable/8/sys/nfsclient/nfsmount.h Directory Properties: stable/8/sbin/mount_nfs/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- stable/8/sbin/mount_nfs/mount_nfs.8 Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sbin/mount_nfs/mount_nfs.8 Thu Mar 22 21:08:14 2012 (r233327) @@ -151,6 +151,10 @@ Force the mount protocol to use UDP tran (Necessary for some old .Bx servers.) +.It Cm nametimeo Ns = Ns Aq Ar value +Override the default of NFS_DEFAULT_NAMETIMEO for the timeout (in seconds) +for positive name cache entries. +If this is set to 0 it disables positive name caching for the mount point. .It Cm negnametimeo Ns = Ns Aq Ar value Override the default of NFS_DEFAULT_NEGNAMETIMEO for the timeout (in seconds) for negative name cache entries. If this is set to 0 it disables negative Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvfsops.c Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c Thu Mar 22 21:08:14 2012 (r233327) @@ -104,7 +104,7 @@ static void nfs_decode_args(struct mount static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, u_char *, int, u_char *, int, u_char *, int, struct vnode **, struct ucred *, - struct thread *, int); + struct thread *, int, int); static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *, struct timeval *); @@ -516,7 +516,8 @@ nfs_mountdiskless(char *path, dirlen = 0; nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK); if ((error = mountnfs(args, mp, nam, path, NULL, 0, dirpath, dirlen, - NULL, 0, vpp, td->td_ucred, td, NFS_DEFAULT_NEGNAMETIMEO)) != 0) { + NULL, 0, vpp, td->td_ucred, td, NFS_DEFAULT_NAMETIMEO, + NFS_DEFAULT_NEGNAMETIMEO)) != 0) { printf("nfs_mountroot: mount %s on /: %d\n", path, error); return (error); } @@ -711,7 +712,7 @@ static const char *nfs_opts[] = { "from" "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "resvport", "readahead", "hostname", "timeout", "addr", "fh", "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath", - "negnametimeo", "nocto", "wcommitsize", + "nametimeo", "negnametimeo", "nocto", "wcommitsize", NULL }; /* @@ -756,6 +757,7 @@ nfs_mount(struct mount *mp) char hst[MNAMELEN]; u_char nfh[NFSX_FHMAX], krbname[100], dirpath[100], srvkrbname[100]; char *opt, *name, *secname; + int nametimeo = NFS_DEFAULT_NAMETIMEO; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; int dirlen, has_nfs_args_opt, krbnamelen, srvkrbnamelen; size_t hstlen; @@ -964,6 +966,14 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_TIMEO; } + if (vfs_getopt(mp->mnt_optnew, "nametimeo", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &nametimeo); + if (ret != 1 || nametimeo < 0) { + vfs_mount_error(mp, "illegal nametimeo: %s", opt); + error = EINVAL; + goto out; + } + } if (vfs_getopt(mp->mnt_optnew, "negnametimeo", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &negnametimeo); @@ -1118,7 +1128,7 @@ nfs_mount(struct mount *mp) args.fh = nfh; error = mountnfs(&args, mp, nam, hst, krbname, krbnamelen, dirpath, dirlen, srvkrbname, srvkrbnamelen, &vp, td->td_ucred, td, - negnametimeo); + nametimeo, negnametimeo); out: if (!error) { MNT_ILOCK(mp); @@ -1162,7 +1172,7 @@ static int mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, char *hst, u_char *krbname, int krbnamelen, u_char *dirpath, int dirlen, u_char *srvkrbname, int srvkrbnamelen, struct vnode **vpp, - struct ucred *cred, struct thread *td, int negnametimeo) + struct ucred *cred, struct thread *td, int nametimeo, int negnametimeo) { struct nfsmount *nmp; struct nfsnode *np; @@ -1229,13 +1239,14 @@ mountnfs(struct nfs_args *argp, struct m } vfs_getnewfsid(mp); nmp->nm_mountp = mp; - mtx_init(&nmp->nm_mtx, "NFSmount lock", NULL, MTX_DEF | MTX_DUPOK); + mtx_init(&nmp->nm_mtx, "NFSmount lock", NULL, MTX_DEF | MTX_DUPOK); /* - * Since nfs_decode_args() might optionally set them, these need to - * set to defaults before the call, so that the optional settings - * aren't overwritten. + * Since nfs_decode_args() might optionally set them, these + * need to be set to defaults before the call, so that the + * optional settings aren't overwritten. */ + nmp->nm_nametimeo = nametimeo; nmp->nm_negnametimeo = negnametimeo; nmp->nm_timeo = NFS_TIMEO; nmp->nm_retry = NFS_RETRANS; Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Thu Mar 22 21:08:14 2012 (r233327) @@ -1026,7 +1026,8 @@ nfs_lookup(struct vop_lookup_args *ap) * We only accept a positive hit in the cache if the * change time of the file matches our cached copy. * Otherwise, we discard the cache entry and fallback - * to doing a lookup RPC. + * to doing a lookup RPC. We also only trust cache + * entries for less than nm_nametimeo seconds. * * To better handle stale file handles and attributes, * clear the attribute cache of this node if it is a @@ -1047,7 +1048,8 @@ nfs_lookup(struct vop_lookup_args *ap) mtx_unlock(&newnp->n_mtx); } if (nfscl_nodeleg(newvp, 0) == 0 || - (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && + ((u_int)(ticks - ncticks) < (nmp->nm_nametimeo * hz) && + VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && timespeccmp(&vattr.va_ctime, &nctime, ==))) { NFSINCRGLOBAL(newnfsstats.lookupcache_hits); if (cnp->cn_nameiop != LOOKUP && Modified: stable/8/sys/fs/nfsclient/nfsmount.h ============================================================================== --- stable/8/sys/fs/nfsclient/nfsmount.h Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sys/fs/nfsclient/nfsmount.h Thu Mar 22 21:08:14 2012 (r233327) @@ -66,6 +66,7 @@ struct nfsmount { u_int64_t nm_maxfilesize; /* maximum file size */ int nm_tprintf_initial_delay; /* initial delay */ int nm_tprintf_delay; /* interval for messages */ + int nm_nametimeo; /* timeout for +ve entries (sec) */ int nm_negnametimeo; /* timeout for -ve entries (sec) */ /* Newnfs additions */ @@ -106,6 +107,10 @@ struct nfsmount { */ #define VFSTONFS(mp) ((struct nfsmount *)((mp)->mnt_data)) +#ifndef NFS_DEFAULT_NAMETIMEO +#define NFS_DEFAULT_NAMETIMEO 60 +#endif + #ifndef NFS_DEFAULT_NEGNAMETIMEO #define NFS_DEFAULT_NEGNAMETIMEO 60 #endif Modified: stable/8/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vfsops.c Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sys/nfsclient/nfs_vfsops.c Thu Mar 22 21:08:14 2012 (r233327) @@ -116,7 +116,7 @@ static void nfs_decode_args(struct mount struct nfs_args *argp, const char *hostname); static int mountnfs(struct nfs_args *, struct mount *, struct sockaddr *, char *, struct vnode **, - struct ucred *cred, int); + struct ucred *cred, int, int); static void nfs_getnlminfo(struct vnode *, uint8_t *, size_t *, struct sockaddr_storage *, int *, off_t *, struct timeval *); @@ -558,8 +558,8 @@ nfs_mountdiskless(char *path, int error; nam = sodupsockaddr((struct sockaddr *)sin, M_WAITOK); - if ((error = mountnfs(args, mp, nam, path, vpp, - td->td_ucred, NFS_DEFAULT_NEGNAMETIMEO)) != 0) { + if ((error = mountnfs(args, mp, nam, path, vpp, td->td_ucred, + NFS_DEFAULT_NAMETIMEO, NFS_DEFAULT_NEGNAMETIMEO)) != 0) { printf("nfs_mountroot: mount %s on /: %d\n", path, error); return (error); } @@ -787,6 +787,7 @@ static const char *nfs_opts[] = { "from" "wsize", "rsize", "retrans", "acregmin", "acregmax", "acdirmin", "acdirmax", "deadthresh", "hostname", "timeout", "addr", "fh", "nfsv3", "sec", "maxgroups", "principal", "negnametimeo", "nocto", "wcommitsize", + "nametimeo", NULL }; /* @@ -835,6 +836,7 @@ nfs_mount(struct mount *mp) size_t len; u_char nfh[NFSX_V3FHMAX]; char *opt; + int nametimeo = NFS_DEFAULT_NAMETIMEO; int negnametimeo = NFS_DEFAULT_NEGNAMETIMEO; has_nfs_args_opt = 0; @@ -1057,6 +1059,14 @@ nfs_mount(struct mount *mp) } args.flags |= NFSMNT_MAXGRPS; } + if (vfs_getopt(mp->mnt_optnew, "nametimeo", (void **)&opt, NULL) == 0) { + ret = sscanf(opt, "%d", &nametimeo); + if (ret != 1 || nametimeo < 0) { + vfs_mount_error(mp, "illegal nametimeo: %s", opt); + error = EINVAL; + goto out; + } + } if (vfs_getopt(mp->mnt_optnew, "negnametimeo", (void **)&opt, NULL) == 0) { ret = sscanf(opt, "%d", &negnametimeo); @@ -1177,7 +1187,7 @@ nfs_mount(struct mount *mp) goto out; } error = mountnfs(&args, mp, nam, args.hostname, &vp, - curthread->td_ucred, negnametimeo); + curthread->td_ucred, nametimeo, negnametimeo); out: if (!error) { MNT_ILOCK(mp); @@ -1219,7 +1229,8 @@ nfs_cmount(struct mntarg *ma, void *data */ static int mountnfs(struct nfs_args *argp, struct mount *mp, struct sockaddr *nam, - char *hst, struct vnode **vpp, struct ucred *cred, int negnametimeo) + char *hst, struct vnode **vpp, struct ucred *cred, int nametimeo, + int negnametimeo) { struct nfsmount *nmp; struct nfsnode *np; @@ -1269,6 +1280,7 @@ mountnfs(struct nfs_args *argp, struct m nmp->nm_numgrps = NFS_MAXGRPS; nmp->nm_readahead = NFS_DEFRAHEAD; nmp->nm_deadthresh = NFS_MAXDEADTHRESH; + nmp->nm_nametimeo = nametimeo; nmp->nm_negnametimeo = negnametimeo; nmp->nm_tprintf_delay = nfs_tprintf_delay; if (nmp->nm_tprintf_delay < 0) Modified: stable/8/sys/nfsclient/nfs_vnops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vnops.c Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sys/nfsclient/nfs_vnops.c Thu Mar 22 21:08:14 2012 (r233327) @@ -960,7 +960,8 @@ nfs_lookup(struct vop_lookup_args *ap) * We only accept a positive hit in the cache if the * change time of the file matches our cached copy. * Otherwise, we discard the cache entry and fallback - * to doing a lookup RPC. + * to doing a lookup RPC. We also only trust cache + * entries for less than nm_nametimeo seconds. * * To better handle stale file handles and attributes, * clear the attribute cache of this node if it is a @@ -981,7 +982,8 @@ nfs_lookup(struct vop_lookup_args *ap) KDTRACE_NFS_ATTRCACHE_FLUSH_DONE(newvp); mtx_unlock(&newnp->n_mtx); } - if (VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && + if ((u_int)(ticks - ncticks) < (nmp->nm_nametimeo * hz) && + VOP_GETATTR(newvp, &vattr, cnp->cn_cred) == 0 && timespeccmp(&vattr.va_ctime, &nctime, ==)) { nfsstats.lookupcache_hits++; if (cnp->cn_nameiop != LOOKUP && Modified: stable/8/sys/nfsclient/nfsmount.h ============================================================================== --- stable/8/sys/nfsclient/nfsmount.h Thu Mar 22 21:07:54 2012 (r233326) +++ stable/8/sys/nfsclient/nfsmount.h Thu Mar 22 21:08:14 2012 (r233327) @@ -83,6 +83,7 @@ struct nfsmount { struct rpc_timers nm_timers[NFS_MAX_TIMER]; /* RTT Timers for rpcs */ char nm_principal[MNAMELEN]; /* GSS-API principal of server */ gss_OID nm_mech_oid; /* OID of selected GSS-API mechanism */ + int nm_nametimeo; /* timeout for +ve entries (sec) */ int nm_negnametimeo; /* timeout for -ve entries (sec) */ /* NFSv4 */ @@ -116,6 +117,10 @@ struct nfsmount { #define NFS_TPRINTF_DELAY 30 #endif +#ifndef NFS_DEFAULT_NAMETIMEO +#define NFS_DEFAULT_NAMETIMEO 60 +#endif + #ifndef NFS_DEFAULT_NEGNAMETIMEO #define NFS_DEFAULT_NEGNAMETIMEO 60 #endif From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 23 12:02:01 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 284E61065676; Fri, 23 Mar 2012 12:02:01 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C1BD08FC1B; Fri, 23 Mar 2012 12:02:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NC2023075241; Fri, 23 Mar 2012 12:02:00 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NC20SV075239; Fri, 23 Mar 2012 12:02:00 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231202.q2NC20SV075239@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 12:02:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233356 - in stable/8/sys: i386/conf kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 12:02:01 -0000 Author: jhb Date: Fri Mar 23 12:02:00 2012 New Revision: 233356 URL: http://svn.freebsd.org/changeset/base/233356 Log: MFC 232265: Properly clear a device's devclass if DEVICE_ATTACH() fails if the device does not have a fixed devclass. Modified: stable/8/sys/kern/subr_bus.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Fri Mar 23 12:01:33 2012 (r233355) +++ stable/8/sys/kern/subr_bus.c Fri Mar 23 12:02:00 2012 (r233356) @@ -2729,9 +2729,8 @@ device_attach(device_t dev) if ((error = DEVICE_ATTACH(dev)) != 0) { printf("device_attach: %s%d attach returned %d\n", dev->driver->name, dev->unit, error); - /* Unset the class; set in device_probe_child */ - if (dev->devclass == NULL) - (void)device_set_devclass(dev, NULL); + if (!(dev->flags & DF_FIXEDCLASS)) + devclass_delete_device(dev->devclass, dev); (void)device_set_driver(dev, NULL); device_sysctl_fini(dev); dev->state = DS_NOTPRESENT; From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 23 12:06:33 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 552C11065690; Fri, 23 Mar 2012 12:06:33 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 260CB8FC15; Fri, 23 Mar 2012 12:06:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NC6Ww2075513; Fri, 23 Mar 2012 12:06:32 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NC6WRc075511; Fri, 23 Mar 2012 12:06:32 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231206.q2NC6WRc075511@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 12:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233359 - in stable/8/sys: i386/conf kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 12:06:33 -0000 Author: jhb Date: Fri Mar 23 12:06:32 2012 New Revision: 233359 URL: http://svn.freebsd.org/changeset/base/233359 Log: MFC 232218: Clear the a device's description string anytime it's driver changes. Descriptions are specific to drivers and we don't change drivers on attached devices. This fixes a few places where we were not clearing the description when detaching a driver (e.g. if device_attach() failed). While here, fix a few other nits: - Remove spurious call to remove a device's driver from devclass_driver_deleted(). device_detach() removes it already. - Fix a typo. Modified: stable/8/sys/kern/subr_bus.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/kern/subr_bus.c ============================================================================== --- stable/8/sys/kern/subr_bus.c Fri Mar 23 12:05:51 2012 (r233358) +++ stable/8/sys/kern/subr_bus.c Fri Mar 23 12:06:32 2012 (r233359) @@ -1165,7 +1165,6 @@ devclass_driver_deleted(devclass_t buscl dev->parent->devclass == busclass) { if ((error = device_detach(dev)) != 0) return (error); - (void)device_set_driver(dev, NULL); BUS_PROBE_NOMATCH(dev->parent, dev); devnomatch(dev); dev->flags |= DF_DONENOMATCH; @@ -2094,7 +2093,7 @@ device_probe_child(device_t dev, device_ /* XXX What happens if we rebid and got no best? */ if (best) { /* - * If this device was atached, and we were asked to + * If this device was attached, and we were asked to * rescan, and it is a different driver, then we have * to detach the old driver and reattach this new one. * Note, we don't have to check for DF_REBID here @@ -2601,6 +2600,7 @@ device_set_driver(device_t dev, driver_t free(dev->softc, M_BUS_SC); dev->softc = NULL; } + device_set_desc(dev, NULL); kobj_delete((kobj_t) dev, NULL); dev->driver = driver; if (driver) { @@ -2785,7 +2785,6 @@ device_detach(device_t dev) dev->state = DS_NOTPRESENT; (void)device_set_driver(dev, NULL); - device_set_desc(dev, NULL); device_sysctl_fini(dev); return (0); From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 23 15:37:42 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 215D41065678; Fri, 23 Mar 2012 15:37:42 +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 0B4D18FC17; Fri, 23 Mar 2012 15:37:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NFbfoP082290; Fri, 23 Mar 2012 15:37:41 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NFbf9k082283; Fri, 23 Mar 2012 15:37:41 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201203231537.q2NFbf9k082283@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 23 Mar 2012 15:37:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233365 - in stable/8/sys: kern sys vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 15:37:42 -0000 Author: kib Date: Fri Mar 23 15:37:41 2012 New Revision: 233365 URL: http://svn.freebsd.org/changeset/base/233365 Log: MFC r223889: Add a facility to disable processing page faults. When activated, uiomove generates EFAULT if any accessed address is not mapped, as opposed to handling the fault. Modified: stable/8/sys/kern/kern_subr.c stable/8/sys/sys/proc.h stable/8/sys/sys/systm.h stable/8/sys/sys/uio.h stable/8/sys/vm/vm_extern.h stable/8/sys/vm/vm_fault.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/kern_subr.c ============================================================================== --- stable/8/sys/kern/kern_subr.c Fri Mar 23 14:12:51 2012 (r233364) +++ stable/8/sys/kern/kern_subr.c Fri Mar 23 15:37:41 2012 (r233365) @@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$"); SYSCTL_INT(_kern, KERN_IOV_MAX, iov_max, CTLFLAG_RD, NULL, UIO_MAXIOV, "Maximum number of elements in an I/O vector; sysconf(_SC_IOV_MAX)"); +static int uiomove_faultflag(void *cp, int n, struct uio *uio, int nofault); + #ifdef ZERO_COPY_SOCKETS /* Declared in uipc_socket.c */ extern int so_zero_copy_receive; @@ -132,23 +134,65 @@ retry: #endif /* ZERO_COPY_SOCKETS */ int +copyin_nofault(const void *udaddr, void *kaddr, size_t len) +{ + int error, save; + + save = vm_fault_disable_pagefaults(); + error = copyin(udaddr, kaddr, len); + vm_fault_enable_pagefaults(save); + return (error); +} + +int +copyout_nofault(const void *kaddr, void *udaddr, size_t len) +{ + int error, save; + + save = vm_fault_disable_pagefaults(); + error = copyout(kaddr, udaddr, len); + vm_fault_enable_pagefaults(save); + return (error); +} + +int uiomove(void *cp, int n, struct uio *uio) { - struct thread *td = curthread; + + return (uiomove_faultflag(cp, n, uio, 0)); +} + +int +uiomove_nofault(void *cp, int n, struct uio *uio) +{ + + return (uiomove_faultflag(cp, n, uio, 1)); +} + +static int +uiomove_faultflag(void *cp, int n, struct uio *uio, int nofault) +{ + struct thread *td; struct iovec *iov; u_int cnt; - int error = 0; - int save = 0; + int error, newflags, save; + + td = curthread; + error = 0; KASSERT(uio->uio_rw == UIO_READ || uio->uio_rw == UIO_WRITE, ("uiomove: mode")); - KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == curthread, + KASSERT(uio->uio_segflg != UIO_USERSPACE || uio->uio_td == td, ("uiomove proc")); - WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, - "Calling uiomove()"); - - save = td->td_pflags & TDP_DEADLKTREAT; - td->td_pflags |= TDP_DEADLKTREAT; + if (!nofault) + WITNESS_WARN(WARN_GIANTOK | WARN_SLEEPOK, NULL, + "Calling uiomove()"); + + /* XXX does it make a sense to set TDP_DEADLKTREAT for UIO_SYSSPACE ? */ + newflags = TDP_DEADLKTREAT; + if (uio->uio_segflg == UIO_USERSPACE && nofault) + newflags |= TDP_NOFAULTING; + save = curthread_pflags_set(newflags); while (n > 0 && uio->uio_resid) { iov = uio->uio_iov; @@ -191,8 +235,7 @@ uiomove(void *cp, int n, struct uio *uio n -= cnt; } out: - if (save == 0) - td->td_pflags &= ~TDP_DEADLKTREAT; + curthread_pflags_restore(save); return (error); } Modified: stable/8/sys/sys/proc.h ============================================================================== --- stable/8/sys/sys/proc.h Fri Mar 23 14:12:51 2012 (r233364) +++ stable/8/sys/sys/proc.h Fri Mar 23 15:37:41 2012 (r233365) @@ -391,7 +391,7 @@ do { \ #define TDP_COWINPROGRESS 0x00000010 /* Snapshot copy-on-write in progress. */ #define TDP_ALTSTACK 0x00000020 /* Have alternate signal stack. */ #define TDP_DEADLKTREAT 0x00000040 /* Lock aquisition - deadlock treatment. */ -#define TDP_UNUSED80 0x00000080 /* available. */ +#define TDP_NOFAULTING 0x00000080 /* Do not handle page faults. */ #define TDP_NOSLEEPING 0x00000100 /* Thread is not allowed to sleep on a sq. */ #define TDP_OWEUPC 0x00000200 /* Call addupc() at next AST. */ #define TDP_ITHREAD 0x00000400 /* Thread is an interrupt thread. */ Modified: stable/8/sys/sys/systm.h ============================================================================== --- stable/8/sys/sys/systm.h Fri Mar 23 14:12:51 2012 (r233364) +++ stable/8/sys/sys/systm.h Fri Mar 23 15:37:41 2012 (r233365) @@ -216,8 +216,12 @@ int copyinstr(const void * __restrict ud __nonnull(1) __nonnull(2); int copyin(const void * __restrict udaddr, void * __restrict kaddr, size_t len) __nonnull(1) __nonnull(2); +int copyin_nofault(const void * __restrict udaddr, void * __restrict kaddr, + size_t len) __nonnull(1) __nonnull(2); int copyout(const void * __restrict kaddr, void * __restrict udaddr, size_t len) __nonnull(1) __nonnull(2); +int copyout_nofault(const void * __restrict kaddr, void * __restrict udaddr, + size_t len) __nonnull(1) __nonnull(2); int fubyte(const void *base); long fuword(const void *base); Modified: stable/8/sys/sys/uio.h ============================================================================== --- stable/8/sys/sys/uio.h Fri Mar 23 14:12:51 2012 (r233364) +++ stable/8/sys/sys/uio.h Fri Mar 23 15:37:41 2012 (r233365) @@ -101,6 +101,7 @@ int uiomove(void *cp, int n, struct uio int uiomove_frombuf(void *buf, int buflen, struct uio *uio); int uiomove_fromphys(struct vm_page *ma[], vm_offset_t offset, int n, struct uio *uio); +int uiomove_nofault(void *cp, int n, struct uio *uio); int uiomoveco(void *cp, int n, struct uio *uio, int disposable); #else /* !_KERNEL */ Modified: stable/8/sys/vm/vm_extern.h ============================================================================== --- stable/8/sys/vm/vm_extern.h Fri Mar 23 14:12:51 2012 (r233364) +++ stable/8/sys/vm/vm_extern.h Fri Mar 23 15:37:41 2012 (r233365) @@ -61,6 +61,8 @@ int useracc(void *, int, int); int vm_fault(vm_map_t, vm_offset_t, vm_prot_t, int); void vm_fault_copy_entry(vm_map_t, vm_map_t, vm_map_entry_t, vm_map_entry_t, vm_ooffset_t *); +int vm_fault_disable_pagefaults(void); +void vm_fault_enable_pagefaults(int save); void vm_fault_unwire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t); int vm_fault_wire(vm_map_t, vm_offset_t, vm_offset_t, boolean_t, boolean_t); int vm_forkproc(struct thread *, struct proc *, struct thread *, struct vmspace *, int); Modified: stable/8/sys/vm/vm_fault.c ============================================================================== --- stable/8/sys/vm/vm_fault.c Fri Mar 23 14:12:51 2012 (r233364) +++ stable/8/sys/vm/vm_fault.c Fri Mar 23 15:37:41 2012 (r233365) @@ -222,6 +222,9 @@ vm_fault(vm_map_t map, vm_offset_t vaddr struct vnode *vp; int locked, error; + if ((curthread->td_pflags & TDP_NOFAULTING) != 0) + return (KERN_PROTECTION_FAILURE); + hardfault = 0; growstack = TRUE; PCPU_INC(cnt.v_vm_faults); @@ -1405,3 +1408,17 @@ vm_fault_additional_pages(m, rbehind, ra /* return number of pages */ return i; } + +int +vm_fault_disable_pagefaults(void) +{ + + return (curthread_pflags_set(TDP_NOFAULTING)); +} + +void +vm_fault_enable_pagefaults(int save) +{ + + curthread_pflags_restore(save); +} From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 23 16:19:15 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 0DD9B106567F; Fri, 23 Mar 2012 16:19:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E37328FC21; Fri, 23 Mar 2012 16:19:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NGJE8l083849; Fri, 23 Mar 2012 16:19:14 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NGJEkQ083847; Fri, 23 Mar 2012 16:19:14 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201203231619.q2NGJEkQ083847@svn.freebsd.org> From: Alexander Motin Date: Fri, 23 Mar 2012 16:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233369 - stable/8/sys/kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 16:19:15 -0000 Author: mav Date: Fri Mar 23 16:19:14 2012 New Revision: 233369 URL: http://svn.freebsd.org/changeset/base/233369 Log: MFC r232793: Revert r175376 and tune cpufreq(4) frequency comparison logic instead. Instead of using 25MHz equality threshold, look for the nearest value when handling dev.cpu.0.freq sysctl and for exact match when it is expected. ACPI may report extra level with frequency 1MHz above the nominal to control Intel Turbo Boost operation. It is not a bug, but feature: dev.cpu.0.freq_levels: 2934/106000 2933/95000 2800/82000 ... In this case value 2933 means 2.93GHz, but 2934 means 3.2-3.6GHz. I've found that my Core i7 based systems have Intel Turbo Boost not used by default and without this change it was absolutely invisible and hard to control. Modified: stable/8/sys/kern/kern_cpu.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/kern/kern_cpu.c ============================================================================== --- stable/8/sys/kern/kern_cpu.c Fri Mar 23 16:17:46 2012 (r233368) +++ stable/8/sys/kern/kern_cpu.c Fri Mar 23 16:19:14 2012 (r233369) @@ -311,7 +311,7 @@ cf_set_method(device_t dev, const struct } /* If already at this level, just return. */ - if (CPUFREQ_CMP(sc->curr_level.total_set.freq, level->total_set.freq)) { + if (sc->curr_level.total_set.freq == level->total_set.freq) { CF_DEBUG("skipping freq %d, same as current level %d\n", level->total_set.freq, sc->curr_level.total_set.freq); goto skip; @@ -470,7 +470,7 @@ cf_get_method(device_t dev, struct cf_le if (CPUFREQ_DRV_GET(devs[n], &set) != 0) continue; for (i = 0; i < count; i++) { - if (CPUFREQ_CMP(set.freq, levels[i].total_set.freq)) { + if (set.freq == levels[i].total_set.freq) { sc->curr_level = levels[i]; break; } @@ -626,16 +626,6 @@ cf_levels_method(device_t dev, struct cf /* Finally, output the list of levels. */ i = 0; TAILQ_FOREACH(lev, &sc->all_levels, link) { - /* - * Skip levels that are too close in frequency to the - * previous levels. Some systems report bogus duplicate - * settings (i.e., for acpi_perf). - */ - if (i > 0 && CPUFREQ_CMP(lev->total_set.freq, - levels[i - 1].total_set.freq)) { - sc->all_count--; - continue; - } /* Skip levels that have a frequency that is too low. */ if (lev->total_set.freq < cf_lowest_freq) { @@ -869,7 +859,7 @@ cpufreq_curr_sysctl(SYSCTL_HANDLER_ARGS) { struct cpufreq_softc *sc; struct cf_level *levels; - int count, devcount, error, freq, i, n; + int best, count, diff, bdiff, devcount, error, freq, i, n; device_t *devs; devs = NULL; @@ -901,17 +891,16 @@ cpufreq_curr_sysctl(SYSCTL_HANDLER_ARGS) "cpufreq: need to increase CF_MAX_LEVELS\n"); break; } + best = 0; + bdiff = 1 << 30; for (i = 0; i < count; i++) { - if (CPUFREQ_CMP(levels[i].total_set.freq, freq)) { - error = CPUFREQ_SET(devs[n], &levels[i], - CPUFREQ_PRIO_USER); - break; + diff = abs(levels[i].total_set.freq - freq); + if (diff < bdiff) { + bdiff = diff; + best = i; } } - if (i == count) { - error = EINVAL; - break; - } + error = CPUFREQ_SET(devs[n], &levels[best], CPUFREQ_PRIO_USER); } out: From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 23 16:44:12 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 1033) id C26651065670; Fri, 23 Mar 2012 16:44:12 +0000 (UTC) Date: Fri, 23 Mar 2012 16:44:12 +0000 From: Alexey Dokuchaev To: John Baldwin Message-ID: <20120323164412.GB8323@FreeBSD.org> References: <201203231206.q2NC6WRc075511@svn.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=koi8-r Content-Disposition: inline In-Reply-To: <201203231206.q2NC6WRc075511@svn.freebsd.org> User-Agent: Mutt/1.4.2.1i Cc: svn-src-stable@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org, svn-src-stable-8@freebsd.org Subject: Re: svn commit: r233359 - in stable/8/sys: i386/conf kern X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 16:44:12 -0000 On Fri, Mar 23, 2012 at 12:06:32PM +0000, John Baldwin wrote: > Author: jhb > Date: Fri Mar 23 12:06:32 2012 > New Revision: 233359 > URL: http://svn.freebsd.org/changeset/base/233359 > > Log: > MFC 232218: > Clear the a device's description string anytime it's driver changes. > [...] Thanks John! ./danfe From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 23 17:11:36 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E805A1065673; Fri, 23 Mar 2012 17:11:36 +0000 (UTC) (envelope-from jimharris@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C95BB8FC1E; Fri, 23 Mar 2012 17:11:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NHBa52085800; Fri, 23 Mar 2012 17:11:36 GMT (envelope-from jimharris@svn.freebsd.org) Received: (from jimharris@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NHBaAZ085796; Fri, 23 Mar 2012 17:11:36 GMT (envelope-from jimharris@svn.freebsd.org) Message-Id: <201203231711.q2NHBaAZ085796@svn.freebsd.org> From: Jim Harris Date: Fri, 23 Mar 2012 17:11:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233373 - stable/8/sys/dev/isci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 17:11:37 -0000 Author: jimharris Date: Fri Mar 23 17:11:36 2012 New Revision: 233373 URL: http://svn.freebsd.org/changeset/base/233373 Log: MFC r233371: Call xpt_bus_register during attach context, then freeze and do not release until domain discovery is complete. This fixes an isci(4) bug on FreeBSD 7.x where devices weren't always appearing after boot without an explicit rescan. Sponsored by: Intel Reported and tested by: Reviewed by: scottl Approved by: scottl Modified: stable/8/sys/dev/isci/isci.h stable/8/sys/dev/isci/isci_controller.c stable/8/sys/dev/isci/isci_remote_device.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/dev/isci/isci.h ============================================================================== --- stable/8/sys/dev/isci/isci.h Fri Mar 23 16:59:03 2012 (r233372) +++ stable/8/sys/dev/isci/isci.h Fri Mar 23 17:11:36 2012 (r233373) @@ -122,6 +122,7 @@ struct ISCI_CONTROLLER SCI_CONTROLLER_HANDLE_T scif_controller_handle; struct ISCI_DOMAIN domain[SCI_MAX_DOMAINS]; BOOL is_started; + BOOL has_been_scanned; uint32_t initial_discovery_mask; BOOL is_frozen; uint8_t *remote_device_memory; Modified: stable/8/sys/dev/isci/isci_controller.c ============================================================================== --- stable/8/sys/dev/isci/isci_controller.c Fri Mar 23 16:59:03 2012 (r233372) +++ stable/8/sys/dev/isci/isci_controller.c Fri Mar 23 17:11:36 2012 (r233373) @@ -36,6 +36,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #include #include @@ -300,6 +303,16 @@ SCI_STATUS isci_controller_initialize(st TUNABLE_INT_FETCH("hw.isci.io_shortage", &io_shortage); controller->sim_queue_depth += io_shortage; + /* Attach to CAM using xpt_bus_register now, then immediately freeze + * the simq. It will get released later when initial domain discovery + * is complete. + */ + controller->has_been_scanned = FALSE; + mtx_lock(&controller->lock); + isci_controller_attach_to_cam(controller); + xpt_freeze_simq(controller->sim, 1); + mtx_unlock(&controller->lock); + return (scif_controller_initialize(controller->scif_controller_handle)); } @@ -441,13 +454,13 @@ void isci_controller_start(void *control void isci_controller_domain_discovery_complete( struct ISCI_CONTROLLER *isci_controller, struct ISCI_DOMAIN *isci_domain) { - if (isci_controller->sim == NULL) + if (!isci_controller->has_been_scanned) { - /* Controller has not been attached to CAM yet. We'll clear + /* Controller has not been scanned yet. We'll clear * the discovery bit for this domain, then check if all bits * are now clear. That would indicate that all domains are - * done with discovery and we can then attach the controller - * to CAM. + * done with discovery and we can then proceed with initial + * scan. */ isci_controller->initial_discovery_mask &= @@ -457,7 +470,25 @@ void isci_controller_domain_discovery_co struct isci_softc *driver = isci_controller->isci; uint8_t next_index = isci_controller->index + 1; - isci_controller_attach_to_cam(isci_controller); + isci_controller->has_been_scanned = TRUE; + + /* Unfreeze simq to allow initial scan to proceed. */ + xpt_release_simq(isci_controller->sim, TRUE); + +#if __FreeBSD_version < 800000 + /* When driver is loaded after boot, we need to + * explicitly rescan here for versions <8.0, because + * CAM only automatically scans new buses at boot + * time. + */ + union ccb *ccb = xpt_alloc_ccb_nowait(); + + xpt_create_path(&ccb->ccb_h.path, xpt_periph, + cam_sim_path(isci_controller->sim), + CAM_TARGET_WILDCARD, CAM_LUN_WILDCARD); + + xpt_rescan(ccb); +#endif if (next_index < driver->controller_count) { /* There are more controllers that need to Modified: stable/8/sys/dev/isci/isci_remote_device.c ============================================================================== --- stable/8/sys/dev/isci/isci_remote_device.c Fri Mar 23 16:59:03 2012 (r233372) +++ stable/8/sys/dev/isci/isci_remote_device.c Fri Mar 23 17:11:36 2012 (r233373) @@ -74,13 +74,12 @@ scif_cb_remote_device_ready(SCI_CONTROLL isci_controller->remote_device[device_index] = isci_remote_device; - if (isci_controller->sim != NULL) { - /* The sim object is not NULL, meaning we have attached - * the controller to CAM already. In that case, create - * a CCB to instruct CAM to rescan this device. - * If the sim object is NULL, this device will get - * scanned as part of the initial scan when the - * controller is attached to CAM. + if (isci_controller->has_been_scanned) { + /* The sim object has been scanned at least once + * already. In that case, create a CCB to instruct + * CAM to rescan this device. + * If the sim object has not been scanned, this device + * will get scanned as part of the initial scan. */ union ccb *ccb = xpt_alloc_ccb_nowait(); From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 23 17:24:52 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id C39E8106566C; Fri, 23 Mar 2012 17:24:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A54D98FC0C; Fri, 23 Mar 2012 17:24:52 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NHOqki086397; Fri, 23 Mar 2012 17:24:52 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NHOqS9086394; Fri, 23 Mar 2012 17:24:52 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231724.q2NHOqS9086394@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 17:24:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233377 - in stable/8/sys: boot/i386/boot2 i386/conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 17:24:52 -0000 Author: jhb Date: Fri Mar 23 17:24:52 2012 New Revision: 233377 URL: http://svn.freebsd.org/changeset/base/233377 Log: MFC 232570,232754: Fix boot2 to handle boot config files that only contain a custom path to a loader or kernel. Specifically, kname cannot be pointed at cmd[] since it's value is change to be an empty string after the initial call to parse, and cmd[]'s value can be changed (thus losing a prior setting for kname) due to user input at the boot prompt. While here, ensure that that initial boot config file text is nul-terminated, that ops is initialized to zero, and that kname is always initialized to a valid string. In addition, include other changes to ensure boot2 still builds with Clang. Modified: stable/8/sys/boot/i386/boot2/boot2.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/boot/i386/boot2/boot2.c ============================================================================== --- stable/8/sys/boot/i386/boot2/boot2.c Fri Mar 23 17:24:29 2012 (r233376) +++ stable/8/sys/boot/i386/boot2/boot2.c Fri Mar 23 17:24:52 2012 (r233377) @@ -128,9 +128,9 @@ static struct dsk { unsigned start; int init; } dsk; -static char cmd[512], cmddup[512]; -static const char *kname; -static uint32_t opts; +static char cmd[512], cmddup[512], knamebuf[1024]; +static const char *kname = NULL; +static uint32_t opts = 0; static int comspeed = SIOSPD; static struct bootinfo bootinfo; static uint8_t ioctrl = IO_KEYBOARD; @@ -223,8 +223,8 @@ main(void) { uint8_t autoboot; ino_t ino; + size_t nbyte; - kname = NULL; dmadat = (void *)(roundup2(__base + (int32_t)&_end, 0x10000) - __base); v86.ctl = V86_FLAGS; v86.efl = PSL_RESERVED_DEFAULT | PSL_I; @@ -240,8 +240,10 @@ main(void) autoboot = 1; if ((ino = lookup(PATH_CONFIG)) || - (ino = lookup(PATH_DOTCONFIG))) - fsread(ino, cmd, sizeof(cmd)); + (ino = lookup(PATH_DOTCONFIG))) { + nbyte = fsread(ino, cmd, sizeof(cmd) - 1); + cmd[nbyte] = '\0'; + } if (*cmd) { memcpy(cmddup, cmd, sizeof(cmd)); @@ -258,9 +260,9 @@ main(void) * or in case of failure, try to load a kernel directly instead. */ - if (autoboot && !kname) { + if (!kname) { kname = PATH_BOOT3; - if (!keyhit(3*SECOND)) { + if (autoboot && !keyhit(3*SECOND)) { load(); kname = PATH_KERNEL; } @@ -457,7 +459,12 @@ parse() ? DRV_HARD : 0) + drv; dsk_meta = 0; } - kname = arg; + if ((i = ep - arg)) { + if ((size_t)i >= sizeof(knamebuf)) + return -1; + memcpy(knamebuf, arg, i + 1); + kname = knamebuf; + } } arg = p; } From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 23 18:03:39 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 7F0491065680; Fri, 23 Mar 2012 18:03:39 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68A548FC1A; Fri, 23 Mar 2012 18:03:39 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NI3diW087721; Fri, 23 Mar 2012 18:03:39 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NI3dx2087716; Fri, 23 Mar 2012 18:03:39 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231803.q2NI3dx2087716@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 18:03:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233380 - in stable/8: share/man/man9 sys/dev/pci sys/i386/conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 18:03:39 -0000 Author: jhb Date: Fri Mar 23 18:03:38 2012 New Revision: 233380 URL: http://svn.freebsd.org/changeset/base/233380 Log: MFC 232360: Add pci_save_state() and pci_restore_state() wrappers around pci_cfg_save() and pci_cfg_restore() for device drivers to use when saving and restoring state (e.g. to handle device-specific resets). Modified: stable/8/share/man/man9/Makefile stable/8/share/man/man9/pci.9 stable/8/sys/dev/pci/pci.c stable/8/sys/dev/pci/pcivar.h Directory Properties: stable/8/share/man/man9/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Fri Mar 23 18:03:04 2012 (r233379) +++ stable/8/share/man/man9/Makefile Fri Mar 23 18:03:38 2012 (r233380) @@ -944,6 +944,8 @@ MLINKS+=pci.9 pci_disable_busmaster.9 \ pci.9 pci_find_device.9 \ pci.9 pci_get_powerstate.9 \ pci.9 pci_read_config.9 \ + pci.9 pci_restore_state.9 \ + pci.9 pci_save_state.9 \ pci.9 pci_set_powerstate.9 \ pci.9 pci_write_config.9 MLINKS+=pfil.9 pfil_add_hook.9 \ Modified: stable/8/share/man/man9/pci.9 ============================================================================== --- stable/8/share/man/man9/pci.9 Fri Mar 23 18:03:04 2012 (r233379) +++ stable/8/share/man/man9/pci.9 Fri Mar 23 18:03:38 2012 (r233380) @@ -38,6 +38,8 @@ .Nm pci_disable_io , .Nm pci_set_powerstate , .Nm pci_get_powerstate , +.Nm pci_save_state , +.Nm pci_restore_state , .Nm pci_find_bsf , .Nm pci_find_dbsf , .Nm pci_find_device @@ -63,6 +65,10 @@ .Fn pci_get_powerstate "device_t dev" .Ft uint32_t .Fn pci_read_config "device_t dev" "int reg" "int width" +.Ft void +.Fn pci_save_state "device_t dev" +.Ft void +.Fn pci_restore_state "device_t dev" .Ft device_t .Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func" .Ft device_t @@ -188,6 +194,26 @@ of is set. .Pp The +.Fn pci_save_state +and +.Fn pci_restore_state +functions can be used by a device driver to save and restore standard PCI +config registers. +The +.Fn pci_save_state +function must be invoked while the device has valid state before +.Fn pci_restore_state +can be used. +If the device is not in the fully-powered state +.Pq Dv PCI_POWERSTATE_D0 +when +.Fn pci_restore_state +is invoked, +then the device will be transitioned to +.Dv PCI_POWERSTATE_D0 +before any config registers are restored. +.Pp +The .Fn pci_find_bsf function looks up the .Vt device_t Modified: stable/8/sys/dev/pci/pci.c ============================================================================== --- stable/8/sys/dev/pci/pci.c Fri Mar 23 18:03:04 2012 (r233379) +++ stable/8/sys/dev/pci/pci.c Fri Mar 23 18:03:38 2012 (r233380) @@ -4171,3 +4171,22 @@ pci_cfg_save(device_t dev, struct pci_de if (pci_get_powerstate(dev) != PCI_POWERSTATE_D3) pci_set_powerstate(dev, PCI_POWERSTATE_D3); } + +/* Wrapper APIs suitable for device driver use. */ +void +pci_save_state(device_t dev) +{ + struct pci_devinfo *dinfo; + + dinfo = device_get_ivars(dev); + pci_cfg_save(dev, dinfo, 0); +} + +void +pci_restore_state(device_t dev) +{ + struct pci_devinfo *dinfo; + + dinfo = device_get_ivars(dev); + pci_cfg_restore(dev, dinfo); +} Modified: stable/8/sys/dev/pci/pcivar.h ============================================================================== --- stable/8/sys/dev/pci/pcivar.h Fri Mar 23 18:03:04 2012 (r233379) +++ stable/8/sys/dev/pci/pcivar.h Fri Mar 23 18:03:38 2012 (r233380) @@ -460,6 +460,8 @@ int pci_msi_device_blacklisted(device_t void pci_ht_map_msi(device_t dev, uint64_t addr); int pci_get_max_read_req(device_t dev); +void pci_restore_state(device_t dev); +void pci_save_state(device_t dev); int pci_set_max_read_req(device_t dev, int size); #endif /* _SYS_BUS_H_ */ From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 23 18:22:38 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA3701065678; Fri, 23 Mar 2012 18:22:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A421A8FC0C; Fri, 23 Mar 2012 18:22:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NIMcXN088508; Fri, 23 Mar 2012 18:22:38 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NIMc1M088506; Fri, 23 Mar 2012 18:22:38 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231822.q2NIMc1M088506@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 18:22:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233384 - in stable/8/sys: dev/e1000 i386/conf X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 18:22:38 -0000 Author: jhb Date: Fri Mar 23 18:22:38 2012 New Revision: 233384 URL: http://svn.freebsd.org/changeset/base/233384 Log: MFC 232367: Properly handle failures in igb_setup_msix() by returning 0 if MSI or MSI-X allocation fails. Modified: stable/8/sys/dev/e1000/if_igb.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/dev/e1000/if_igb.c ============================================================================== --- stable/8/sys/dev/e1000/if_igb.c Fri Mar 23 18:22:20 2012 (r233383) +++ stable/8/sys/dev/e1000/if_igb.c Fri Mar 23 18:22:38 2012 (r233384) @@ -2702,7 +2702,7 @@ igb_setup_msix(struct adapter *adapter) "MSIX Configuration Problem, " "%d vectors configured, but %d queues wanted!\n", msgs, want); - return (ENXIO); + return (0); } if ((msgs) && pci_alloc_msix(dev, &msgs) == 0) { device_printf(adapter->dev, @@ -2712,9 +2712,11 @@ igb_setup_msix(struct adapter *adapter) } msi: msgs = pci_msi_count(dev); - if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) - device_printf(adapter->dev,"Using MSI interrupt\n"); - return (msgs); + if (msgs == 1 && pci_alloc_msi(dev, &msgs) == 0) { + device_printf(adapter->dev," Using MSI interrupt\n"); + return (msgs); + } + return (0); } /********************************************************************* From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 23 18:29:29 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F419C106566B; Fri, 23 Mar 2012 18:29:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C50598FC12; Fri, 23 Mar 2012 18:29:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NITSai088800; Fri, 23 Mar 2012 18:29:28 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NITSti088797; Fri, 23 Mar 2012 18:29:28 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203231829.q2NITSti088797@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 18:29:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233386 - in stable/8/sys: fs/tmpfs i386/conf ufs/ufs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 18:29:29 -0000 Author: jhb Date: Fri Mar 23 18:29:28 2012 New Revision: 233386 URL: http://svn.freebsd.org/changeset/base/233386 Log: MFC 232401: Similar to the fixes in 226967 and 226987, purge any name cache entries associated with the previous vnode (if any) associated with the target of a rename(). Otherwise, a lookup of the target pathname concurrent with a rename() could re-add a name cache entry after the namei(RENAME) lookup in kern_renameat() had purged the target pathname. Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c stable/8/sys/ufs/ufs/ufs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/fs/tmpfs/tmpfs_vnops.c ============================================================================== --- stable/8/sys/fs/tmpfs/tmpfs_vnops.c Fri Mar 23 18:29:09 2012 (r233385) +++ stable/8/sys/fs/tmpfs/tmpfs_vnops.c Fri Mar 23 18:29:28 2012 (r233386) @@ -1072,6 +1072,8 @@ tmpfs_rename(struct vop_rename_args *v) tmpfs_free_dirent(VFS_TO_TMPFS(tvp->v_mount), de, TRUE); } cache_purge(fvp); + if (tvp != NULL) + cache_purge(tvp); error = 0; Modified: stable/8/sys/ufs/ufs/ufs_vnops.c ============================================================================== --- stable/8/sys/ufs/ufs/ufs_vnops.c Fri Mar 23 18:29:09 2012 (r233385) +++ stable/8/sys/ufs/ufs/ufs_vnops.c Fri Mar 23 18:29:28 2012 (r233386) @@ -1527,8 +1527,15 @@ relock: * ufs_lookup_ino() and then VFS_VGET(), another thread might do a * normal lookup of the from name just before the VFS_VGET() call, * causing the cache entry to be re-instantiated. + * + * The same issue also applies to tvp if it exists as + * otherwise we may have a stale name cache entry for the new + * name that references the old i-node if it has other links + * or open file descriptors. */ cache_purge(fvp); + if (tvp) + cache_purge(tvp); unlockout: vput(fdvp); From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 23 20:47:50 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AC9701065674; Fri, 23 Mar 2012 20:47:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 95B838FC18; Fri, 23 Mar 2012 20:47:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NKloJQ093507; Fri, 23 Mar 2012 20:47:50 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NKloX5093500; Fri, 23 Mar 2012 20:47:50 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203232047.q2NKloX5093500@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 20:47:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233394 - in stable/8/sys: dev/acpica dev/cardbus dev/pci i386/conf powerpc/ofw sparc64/pci X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 20:47:50 -0000 Author: jhb Date: Fri Mar 23 20:47:49 2012 New Revision: 233394 URL: http://svn.freebsd.org/changeset/base/233394 Log: MFC 232403,232667: - Add a bus_dma tag to each PCI bus that is a child of a Host-PCI bridge. The tag enforces a single restriction that all DMA transactions must not cross a 4GB boundary. Note that while this restriction technically only applies to PCI-express, this change applies it to all PCI devices as it is simpler to implement that way and errs on the side of caution. - Add a softc structure for PCI bus devices to hold the bus_dma tag and a new pci_attach_common() routine that performs actions common to the attach phase of all PCI bus drivers. Right now this only consists of a bootverbose printf and the allocate of a bus_dma tag if necessary. - Adjust all PCI bus drivers to allocate a PCI bus softc and to call pci_attach_common() from their attach routines. Modified: stable/8/sys/dev/acpica/acpi_pci.c stable/8/sys/dev/cardbus/cardbus.c stable/8/sys/dev/pci/pci.c stable/8/sys/dev/pci/pci_private.h stable/8/sys/powerpc/ofw/ofw_pcibus.c stable/8/sys/sparc64/pci/ofw_pcibus.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/e1000/ (props changed) stable/8/sys/i386/conf/XENHVM (props changed) Modified: stable/8/sys/dev/acpica/acpi_pci.c ============================================================================== --- stable/8/sys/dev/acpica/acpi_pci.c Fri Mar 23 20:47:25 2012 (r233393) +++ stable/8/sys/dev/acpica/acpi_pci.c Fri Mar 23 20:47:49 2012 (r233394) @@ -99,7 +99,8 @@ static device_method_t acpi_pci_methods[ static devclass_t pci_devclass; -DEFINE_CLASS_1(pci, acpi_pci_driver, acpi_pci_methods, 0, pci_driver); +DEFINE_CLASS_1(pci, acpi_pci_driver, acpi_pci_methods, sizeof(struct pci_softc), + pci_driver); DRIVER_MODULE(acpi_pci, pcib, acpi_pci_driver, pci_devclass, 0, 0); MODULE_DEPEND(acpi_pci, acpi, 1, 1, 1); MODULE_DEPEND(acpi_pci, pci, 1, 1, 1); @@ -288,7 +289,11 @@ acpi_pci_probe(device_t dev) static int acpi_pci_attach(device_t dev) { - int busno, domain; + int busno, domain, error; + + error = pci_attach_common(dev); + if (error) + return (error); /* * Since there can be multiple independantly numbered PCI @@ -298,9 +303,6 @@ acpi_pci_attach(device_t dev) */ domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); /* * First, PCI devices are added as in the normal PCI bus driver. Modified: stable/8/sys/dev/cardbus/cardbus.c ============================================================================== --- stable/8/sys/dev/cardbus/cardbus.c Fri Mar 23 20:47:25 2012 (r233393) +++ stable/8/sys/dev/cardbus/cardbus.c Fri Mar 23 20:47:49 2012 (r233394) @@ -345,6 +345,7 @@ static device_method_t cardbus_methods[] DEVMETHOD(device_resume, cardbus_resume), /* Bus interface */ + DEVMETHOD(bus_get_dma_tag, bus_generic_get_dma_tag), DEVMETHOD(bus_read_ivar, cardbus_read_ivar), DEVMETHOD(bus_write_ivar, pci_write_ivar), DEVMETHOD(bus_driver_added, cardbus_driver_added), Modified: stable/8/sys/dev/pci/pci.c ============================================================================== --- stable/8/sys/dev/pci/pci.c Fri Mar 23 20:47:25 2012 (r233393) +++ stable/8/sys/dev/pci/pci.c Fri Mar 23 20:47:49 2012 (r233394) @@ -76,6 +76,21 @@ __FBSDID("$FreeBSD$"); #define ACPI_PWR_FOR_SLEEP(x, y, z) #endif +/* + * XXX: Due to a limitation of the bus_dma_tag_create() API, we cannot + * specify a 4GB boundary on 32-bit targets. Usually this does not + * matter as it is ok to use a boundary of 0 on these systems. + * However, in the case of PAE, DMA addresses can cross a 4GB + * boundary, so as a workaround use a 2GB boundary. + */ +#if (BUS_SPACE_MAXADDR > 0xFFFFFFFF) +#ifdef PAE +#define PCI_DMA_BOUNDARY 0x80000000 +#else +#define PCI_DMA_BOUNDARY 0x100000000 +#endif +#endif + static pci_addr_t pci_mapbase(uint64_t mapreg); static const char *pci_maptype(uint64_t mapreg); static int pci_mapsize(uint64_t testval); @@ -95,6 +110,7 @@ static void pci_load_vendor_data(void); static int pci_describe_parse_line(char **ptr, int *vendor, int *device, char **desc); static char *pci_describe_device(device_t dev); +static bus_dma_tag_t pci_get_dma_tag(device_t bus, device_t dev); static int pci_modevent(module_t mod, int what, void *arg); static void pci_hdrtypedata(device_t pcib, int b, int s, int f, pcicfgregs *cfg); @@ -137,6 +153,7 @@ static device_method_t pci_methods[] = { DEVMETHOD(bus_setup_intr, pci_setup_intr), DEVMETHOD(bus_teardown_intr, pci_teardown_intr), + DEVMETHOD(bus_get_dma_tag, pci_get_dma_tag), DEVMETHOD(bus_get_resource_list,pci_get_resource_list), DEVMETHOD(bus_set_resource, bus_generic_rl_set_resource), DEVMETHOD(bus_get_resource, bus_generic_rl_get_resource), @@ -173,7 +190,7 @@ static device_method_t pci_methods[] = { DEVMETHOD_END }; -DEFINE_CLASS_0(pci, pci_driver, pci_methods, 0); +DEFINE_CLASS_0(pci, pci_driver, pci_methods, sizeof(struct pci_softc)); static devclass_t pci_devclass; DRIVER_MODULE(pci, pcib, pci_driver, pci_devclass, pci_modevent, 0); @@ -2925,10 +2942,49 @@ pci_probe(device_t dev) return (BUS_PROBE_GENERIC); } +int +pci_attach_common(device_t dev) +{ + struct pci_softc *sc; + int busno, domain; +#ifdef PCI_DMA_BOUNDARY + int error, tag_valid; +#endif + + sc = device_get_softc(dev); + domain = pcib_get_domain(dev); + busno = pcib_get_bus(dev); + if (bootverbose) + device_printf(dev, "domain=%d, physical bus=%d\n", + domain, busno); +#ifdef PCI_DMA_BOUNDARY + tag_valid = 0; + if (device_get_devclass(device_get_parent(device_get_parent(dev))) != + devclass_find("pci")) { + error = bus_dma_tag_create(bus_get_dma_tag(dev), 1, + PCI_DMA_BOUNDARY, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, + NULL, NULL, BUS_SPACE_MAXSIZE, BUS_SPACE_UNRESTRICTED, + BUS_SPACE_MAXSIZE, 0, NULL, NULL, &sc->sc_dma_tag); + if (error) + device_printf(dev, "Failed to create DMA tag: %d\n", + error); + else + tag_valid = 1; + } + if (!tag_valid) +#endif + sc->sc_dma_tag = bus_get_dma_tag(dev); + return (0); +} + static int pci_attach(device_t dev) { - int busno, domain; + int busno, domain, error; + + error = pci_attach_common(dev); + if (error) + return (error); /* * Since there can be multiple independantly numbered PCI @@ -2938,9 +2994,6 @@ pci_attach(device_t dev) */ domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); pci_add_children(dev, domain, busno, sizeof(struct pci_devinfo)); return (bus_generic_attach(dev)); } @@ -3963,6 +4016,14 @@ pci_get_resource_list (device_t dev, dev return (&dinfo->resources); } +bus_dma_tag_t +pci_get_dma_tag(device_t bus, device_t dev) +{ + struct pci_softc *sc = device_get_softc(bus); + + return (sc->sc_dma_tag); +} + uint32_t pci_read_config_method(device_t dev, device_t child, int reg, int width) { Modified: stable/8/sys/dev/pci/pci_private.h ============================================================================== --- stable/8/sys/dev/pci/pci_private.h Fri Mar 23 20:47:25 2012 (r233393) +++ stable/8/sys/dev/pci/pci_private.h Fri Mar 23 20:47:49 2012 (r233394) @@ -38,11 +38,16 @@ */ DECLARE_CLASS(pci_driver); +struct pci_softc { + bus_dma_tag_t sc_dma_tag; +}; + void pci_add_children(device_t dev, int domain, int busno, size_t dinfo_size); void pci_add_child(device_t bus, struct pci_devinfo *dinfo); void pci_add_resources(device_t bus, device_t dev, int force, uint32_t prefetchmask); +int pci_attach_common(device_t dev); void pci_driver_added(device_t dev, driver_t *driver); int pci_print_child(device_t dev, device_t child); void pci_probe_nomatch(device_t dev, device_t child); Modified: stable/8/sys/powerpc/ofw/ofw_pcibus.c ============================================================================== --- stable/8/sys/powerpc/ofw/ofw_pcibus.c Fri Mar 23 20:47:25 2012 (r233393) +++ stable/8/sys/powerpc/ofw/ofw_pcibus.c Fri Mar 23 20:47:49 2012 (r233394) @@ -95,8 +95,8 @@ struct ofw_pcibus_devinfo { static devclass_t pci_devclass; -DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, 1 /* no softc */, - pci_driver); +DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, + sizeof(struct pci_softc), pci_driver); DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0); MODULE_VERSION(ofw_pcibus, 1); MODULE_DEPEND(ofw_pcibus, pci, 1, 1, 1); @@ -116,12 +116,13 @@ static int ofw_pcibus_attach(device_t dev) { u_int busno, domain; + int error; + error = pci_attach_common(dev); + if (error) + return (error); domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); /* * Attach those children represented in the device tree. Modified: stable/8/sys/sparc64/pci/ofw_pcibus.c ============================================================================== --- stable/8/sys/sparc64/pci/ofw_pcibus.c Fri Mar 23 20:47:25 2012 (r233393) +++ stable/8/sys/sparc64/pci/ofw_pcibus.c Fri Mar 23 20:47:49 2012 (r233394) @@ -100,8 +100,8 @@ struct ofw_pcibus_devinfo { static devclass_t pci_devclass; -DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, 1 /* no softc */, - pci_driver); +DEFINE_CLASS_1(pci, ofw_pcibus_driver, ofw_pcibus_methods, + sizeof(struct pci_softc), pci_driver); EARLY_DRIVER_MODULE(ofw_pcibus, pcib, ofw_pcibus_driver, pci_devclass, 0, 0, BUS_PASS_BUS); MODULE_VERSION(ofw_pcibus, 1); @@ -230,13 +230,14 @@ ofw_pcibus_attach(device_t dev) phandle_t node, child; uint32_t clock; u_int busno, domain, func, slot; + int error; + error = pci_attach_common(dev); + if (error) + return (error); pcib = device_get_parent(dev); domain = pcib_get_domain(dev); busno = pcib_get_bus(dev); - if (bootverbose) - device_printf(dev, "domain=%d, physical bus=%d\n", - domain, busno); node = ofw_bus_get_node(dev); /* From owner-svn-src-stable-8@FreeBSD.ORG Fri Mar 23 20:58:28 2012 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D78C106570E; Fri, 23 Mar 2012 20:58:28 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6700F8FC12; Fri, 23 Mar 2012 20:58:28 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q2NKwSOb094033; Fri, 23 Mar 2012 20:58:28 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q2NKwSpl094030; Fri, 23 Mar 2012 20:58:28 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201203232058.q2NKwSpl094030@svn.freebsd.org> From: John Baldwin Date: Fri, 23 Mar 2012 20:58:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r233396 - stable/8/share/man/man9 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Mar 2012 20:58:28 -0000 Author: jhb Date: Fri Mar 23 20:58:27 2012 New Revision: 233396 URL: http://svn.freebsd.org/changeset/base/233396 Log: MFC 232362,232363,232463,232553,232569,232571: - Sort function prototypes. - Update the documentation on pci_get/set_powerstate(). These methods are not ACPI-specific at all, but deal with PCI power states. Also, pci_set_powerstate() fails with EOPNOTSUPP if a request is made that the underlying device does not support rather than falling back to somehow setting D0. - Document the following routines: pci_alloc_msi(), pci_alloc_msix(), pci_find_cap(), pci_get_max_read_req(), pci_get_vpd_ident(), pci_get_vpd_readonly(), pci_msi_count(), pci_msix_count(), pci_pending_msix(), pci_release_msi(), pci_remap_msix(), and pci_set_max_read_req(). - Group the functions into five sub-sections: raw configuration access, locating devices, device information, device configuration, and message signaled interrupts. - Discourage use of pci_disable_io() and pci_enable_io() in device drivers. The PCI bus driver handles this automatically as resources are activated. Modified: stable/8/share/man/man9/Makefile stable/8/share/man/man9/pci.9 Directory Properties: stable/8/share/man/man9/ (props changed) Modified: stable/8/share/man/man9/Makefile ============================================================================== --- stable/8/share/man/man9/Makefile Fri Mar 23 20:58:18 2012 (r233395) +++ stable/8/share/man/man9/Makefile Fri Mar 23 20:58:27 2012 (r233396) @@ -935,18 +935,30 @@ MLINKS+=namei.9 NDFREE.9 \ MLINKS+=pbuf.9 getpbuf.9 \ pbuf.9 relpbuf.9 \ pbuf.9 trypbuf.9 -MLINKS+=pci.9 pci_disable_busmaster.9 \ +MLINKS+=pci.9 pci_alloc_msi.9 \ + pci.9 pci_alloc_msix.9 \ + pci.9 pci_disable_busmaster.9 \ pci.9 pci_disable_io.9 \ pci.9 pci_enable_busmaster.9 \ pci.9 pci_enable_io.9 \ pci.9 pci_find_bsf.9 \ + pci.9 pci_find_cap.9 \ pci.9 pci_find_dbsf.9 \ pci.9 pci_find_device.9 \ + pci.9 pci_get_max_read_req.9 \ pci.9 pci_get_powerstate.9 \ + pci.9 pci_get_vpd_ident.9 \ + pci.9 pci_get_vpd_readonly.9 \ + pci.9 pci_msi_count.9 \ + pci.9 pci_msix_count.9 \ + pci.9 pci_pending_msix.9 \ pci.9 pci_read_config.9 \ + pci.9 pci_release_msi.9 \ + pci.9 pci_remap_msix.9 \ pci.9 pci_restore_state.9 \ pci.9 pci_save_state.9 \ pci.9 pci_set_powerstate.9 \ + pci.9 pci_set_max_read_req.9 \ pci.9 pci_write_config.9 MLINKS+=pfil.9 pfil_add_hook.9 \ pfil.9 pfil_hook_get.9 \ Modified: stable/8/share/man/man9/pci.9 ============================================================================== --- stable/8/share/man/man9/pci.9 Fri Mar 23 20:58:18 2012 (r233395) +++ stable/8/share/man/man9/pci.9 Fri Mar 23 20:58:27 2012 (r233396) @@ -25,61 +25,103 @@ .\" .\" $FreeBSD$ .\" -.Dd September 30, 2007 +.Dd March 5, 2012 .Dt PCI 9 .Os .Sh NAME .Nm pci , -.Nm pci_read_config , -.Nm pci_write_config , -.Nm pci_enable_busmaster , +.Nm pci_alloc_msi , +.Nm pci_alloc_msix , .Nm pci_disable_busmaster , -.Nm pci_enable_io , .Nm pci_disable_io , -.Nm pci_set_powerstate , -.Nm pci_get_powerstate , -.Nm pci_save_state , -.Nm pci_restore_state , +.Nm pci_enable_busmaster , +.Nm pci_enable_io , .Nm pci_find_bsf , +.Nm pci_find_cap , .Nm pci_find_dbsf , -.Nm pci_find_device +.Nm pci_find_device , +.Nm pci_get_max_read_req , +.Nm pci_get_powerstate , +.Nm pci_get_vpd_ident , +.Nm pci_get_vpd_readonly , +.Nm pci_msi_count , +.Nm pci_msix_count , +.Nm pci_pending_msix , +.Nm pci_read_config , +.Nm pci_release_msi , +.Nm pci_remap_msix , +.Nm pci_restore_state , +.Nm pci_save_state , +.Nm pci_set_max_read_req , +.Nm pci_set_powerstate , +.Nm pci_write_config .Nd PCI bus interface .Sh SYNOPSIS .In sys/bus.h -.In dev/pci/pcivar.h .In dev/pci/pcireg.h -.In machine/pci_cfgreg.h -.Ft void -.Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width" +.In dev/pci/pcivar.h .Ft int -.Fn pci_enable_busmaster "device_t dev" +.Fn pci_alloc_msi "device_t dev" "int *count" +.Ft int +.Fn pci_alloc_msix "device_t dev" "int *count" .Ft int .Fn pci_disable_busmaster "device_t dev" .Ft int +.Fn pci_disable_io "device_t dev" "int space" +.Ft int +.Fn pci_enable_busmaster "device_t dev" +.Ft int .Fn pci_enable_io "device_t dev" "int space" +.Ft device_t +.Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func" .Ft int -.Fn pci_disable_io "device_t dev" "int space" +.Fn pci_find_cap "device_t dev" "int capability" "int *capreg" +.Ft device_t +.Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func" +.Ft device_t +.Fn pci_find_device "uint16_t vendor" "uint16_t device" .Ft int -.Fn pci_set_powerstate "device_t dev" "int state" +.Fn pci_get_max_read_req "device_t dev" .Ft int .Fn pci_get_powerstate "device_t dev" +.Ft int +.Fn pci_get_vpd_ident "device_t dev" "const char **identptr" +.Ft int +.Fn pci_get_vpd_readonly "device_t dev" "const char *kw" "const char **vptr" +.Ft int +.Fn pci_msi_count "device_t dev" +.Ft int +.Fn pci_msix_count "device_t dev" +.Ft int +.Fn pci_pending_msix "device_t dev" "u_int index" .Ft uint32_t .Fn pci_read_config "device_t dev" "int reg" "int width" +.Ft int +.Fn pci_release_msi "device_t dev" +.Ft int +.Fn pci_remap_msix "device_t dev" "int count" "const u_int *vectors" +.Ft void +.Fn pci_restore_state "device_t dev" .Ft void .Fn pci_save_state "device_t dev" +.Ft int +.Fn pci_set_max_read_req "device_t dev" "int size" +.Ft int +.Fn pci_set_powerstate "device_t dev" "int state" .Ft void -.Fn pci_restore_state "device_t dev" -.Ft device_t -.Fn pci_find_bsf "uint8_t bus" "uint8_t slot" "uint8_t func" -.Ft device_t -.Fn pci_find_dbsf "uint32_t domain" "uint8_t bus" "uint8_t slot" "uint8_t func" -.Ft device_t -.Fn pci_find_device "uint16_t vendor" "uint16_t device" +.Fn pci_write_config "device_t dev" "int reg" "uint32_t val" "int width" .Sh DESCRIPTION The .Nm set of functions are used for managing PCI devices. -.Pp +The functions are split into several groups: +raw configuration access, +locating devices, +device information, +device configuration, +and +message signaled interrupts. +.Ss Raw Configuration Access The .Fn pci_read_config function is used to read data from the PCI configuration @@ -104,6 +146,126 @@ with .Fa width specifying the size of the access. .Pp +.Em NOTE : +Device drivers should only use these functions for functionality that +is not available via another +.Fn pci +function. +.Ss Locating Devices +The +.Fn pci_find_bsf +function looks up the +.Vt device_t +of a PCI device, given its +.Fa bus , +.Fa slot , +and +.Fa func . +The +.Fa slot +number actually refers to the number of the device on the bus, +which does not necessarily indicate its geographic location +in terms of a physical slot. +Note that in case the system has multiple PCI domains, +the +.Fn pci_find_bsf +function only searches the first one. +Actually, it is equivalent to: +.Bd -literal -offset indent +pci_find_dbsf(0, bus, slot, func); +.Ed +.Pp +The +.Fn pci_find_dbsf +function looks up the +.Vt device_t +of a PCI device, given its +.Fa domain , +.Fa bus , +.Fa slot , +and +.Fa func . +The +.Fa slot +number actually refers to the number of the device on the bus, +which does not necessarily indicate its geographic location +in terms of a physical slot. +.Pp +The +.Fn pci_find_device +function looks up the +.Vt device_t +of a PCI device, given its +.Fa vendor +and +.Fa device +IDs. +Note that there can be multiple matches for this search; this function +only returns the first matching device. +.Ss Device Information +The +.Fn pci_find_cap +function is used to locate the first instance of a PCI capability +register set for the device +.Fa dev . +The capability to locate is specified by ID via +.Fa capability . +Constant macros of the form +.Dv PCIY_xxx +for standard capability IDs are defined in +.In dev/pci/pcireg.h . +If the capability is found, then +.Fa *capreg +is set to the offset in configuration space of the capability register set, +and +.Fn pci_find_cap +returns zero. +If the capability is not found or the device does not support capabilities, +.Fn pci_find_cap +returns an error. +.Pp +The +.Fn pci_get_vpd_ident +function is used to fetch a device's Vital Product Data +.Pq VPD +identifier string. +If the device +.Fa dev +supports VPD and provides an identifier string, +then +.Fa *identptr +is set to point at a read-only, null-terminated copy of the identifier +string, +and +.Fn pci_get_vpd_ident +returns zero. +If the device does not support VPD or does not provide an identifier +string, +then +.Fn pci_get_vpd_ident +returns an error. +.Pp +The +.Fn pci_get_vpd_readonly +function is used to fetch the value of a single VPD read-only keyword +for the device +.Fa dev . +The keyword to fetch is identified by the two character string +.Fa kw . +If the device supports VPD and provides a read-only value for the +requested keyword, +then +.Fa *vptr +is set to point at a read-only, null-terminated copy of the value, +and +.Fn pci_get_vpd_readonly +returns zero. +If the device does not support VPD or does not provide the requested +keyword, +then +.Fn pci_get_vpd_readonly +returns an error. +.Ss Device Configuration The .Fn pci_enable_busmaster function enables PCI bus mastering for the device @@ -138,20 +300,51 @@ argument specifies which resource is aff or .Dv SYS_RES_IOPORT as appropriate. +Device drivers should generally not use these routines directly. +The PCI bus will enable decoding automatically when a +.Dv SYS_RES_MEMORY +or +.Dv SYS_RES_IOPORT +resource is activated via +.Xr bus_alloc_resource 9 +or +.Xr bus_activate_resource 9 . .Pp -.Em NOTE : -These functions should be used in preference to manually manipulating -the configuration space. +The +.Fn pci_get_max_read_req +function returns the current maximum read request size in bytes for a +PCI-express device. +If the +.Fa dev +device is not a PCI-express device, +.Fn pci_get_max_read_req +returns zero. +.Pp +The +.Fn pci_set_max_read_req +sets the PCI-express maximum read request size for +.Fa dev . +The requested +.Fa size +may be adjusted, +and +.Fn pci_set_max_read_req +returns the actual size set in bytes. +If the +.Fa dev +device is not a PCI-express device, +.Fn pci_set_max_read_req +returns zero. .Pp The .Fn pci_get_powerstate -function returns the current ACPI power state of the device +function returns the current power state of the device .Fa dev . If the device does not support power management capabilities, then the default state of .Dv PCI_POWERSTATE_D0 is returned. -The following power states are defined by ACPI: +The following power states are defined by PCI: .Bl -hang -width ".Dv PCI_POWERSTATE_UNKNOWN" .It Dv PCI_POWERSTATE_D0 State in which device is on and running. @@ -183,15 +376,13 @@ The .Fn pci_set_powerstate function is used to transition the device .Fa dev -to the ACPI power state +to the PCI power state .Fa state . -It checks to see if the device is PCI 2.2 compliant. -If so, it checks the -capabilities pointer to determine which power states the device supports. -If the device does not have power management capabilities, the default state -of -.Dv PCI_POWERSTATE_D0 -is set. +If the device does not support power management capabilities or +it does not support the specific power state +.Fa state , +then the function will fail with +.Er EOPNOTSUPP . .Pp The .Fn pci_save_state @@ -212,57 +403,216 @@ is invoked, then the device will be transitioned to .Dv PCI_POWERSTATE_D0 before any config registers are restored. -.Pp -The -.Fn pci_find_bsf -function looks up the -.Vt device_t -of a PCI device, given its -.Fa bus , -.Fa slot , +.Ss Message Signaled Interrupts +Message Signaled Interrupts +.Pq MSI and -.Fa func . +Enhanced Message Signaled Interrupts +.Pq MSI-X +are PCI capabilities that provide an alternate method for PCI +devices to signal interrupts. +The legacy INTx interrupt is available to PCI devices as a +.Dv SYS_RES_IRQ +resource with a resource ID of zero. +MSI and MSI-X interrupts are available to PCI devices as one or more +.Dv SYS_RES_IRQ +resources with resource IDs greater than zero. +A driver must ask the PCI bus to allocate MSI or MSI-X interrupts +using +.Fn pci_alloc_msi +or +.Fn pci_alloc_msix +before it can use MSI or MSI-X +.Dv SYS_RES_IRQ +resources. +A driver is not allowed to use the legacy INTx +.Dv SYS_RES_IRQ +resource if MSI or MSI-X interrupts have been allocated, +and attempts to allocate MSI or MSI-X interrupts will fail if the +driver is currently using the legacy INTx +.Dv SYS_RES_IRQ +resource. +A driver is only allowed to use either MSI or MSI-X, +but not both. +.Pp +The +.Fn pci_count_msi +function returns the maximum number of MSI messages supported by the +device +.Fa dev. +If the device does not support MSI, +then +.Fn pci_count_msi +returns zero. +.Pp +The +.Fn pci_alloc_msi +function attempts to allocate +.Fa *count +MSI messages for the device +.Fa dev . The -.Fa slot -number actually refers to the number of the device on the bus, -which does not necessarily indicate its geographic location -in terms of a physical slot. -Note that in case the system has multiple PCI domains, -the -.Fn pci_find_bsf -function only searches the first one. -Actually, it is equivalent to: -.Bd -literal -offset indent -pci_find_dbsf(0, bus, slot, func); -.Ed +.Fn pci_alloc_msi +function may allocate fewer messages than requested for various +reasons including requests for more messages than the device +.Fa dev +supports, +or if the system has a shortage of available MSI messages. +On success, +.Fa *count +is set to the number of messages allocated and +.Fn pci_alloc_msi +returns zero. +The +.Dv SYS_RES_IRQ +resources for the allocated messages will be available at consecutive +resource IDs beginning with one. +If +.Fn pci_alloc_msi +is not able to allocate any messages, +it returns an error. +Note that MSI only supports message counts that are powers of two; +requests to allocate a non-power of two count of messages will fail. +.Pp +The +.Fn pci_release_msi +function is used to release any allocated MSI or MSI-X messages back +to the system. +If any MSI or MSI-X +.Dv SYS_RES_IRQ +resources are allocated by the driver or have a configured interrupt +handler, +this function will fail with +.Er EBUSY . +The +.Fn pci_release_msi +function returns zero on success and an error on failure. +.Pp +The +.Fn pci_count_msix +function returns the maximum number of MSI-X messages supported by the +device +.Fa dev . +If the device does not support MSI-X, +then +.Fn pci_count_msix +returns zero. .Pp The -.Fn pci_find_dbsf -function looks up the -.Vt device_t -of a PCI device, given its -.Fa domain , -.Fa bus , -.Fa slot , -and -.Fa func . +.Fn pci_alloc_msix +function attempts to allocate +.Fa *count +MSI-X messages for the device +.Fa dev . The -.Fa slot -number actually refers to the number of the device on the bus, -which does not necessarily indicate its geographic location -in terms of a physical slot. +.Fn pci_alloc_msix +function may allocate fewer messages than requested for various +reasons including requests for more messages than the device +.Fa dev +supports, +or if the system has a shortage of available MSI-X messages. +On success, +.Fa *count +is set to the number of messages allocated and +.Fn pci_alloc_msix +returns zero. +For MSI-X messages, +the resource ID for each +.Dv SYS_RES_IRQ resource identifies the index in the MSI-X table of the +corresponding message. +A resource ID of one maps to the first index of the MSI-X table; +a resource ID two identifies the second index in the table, etc. +The +.Fn pci_alloc_msix +function assigns the +.Fa *count +messages allocated to the first +.Fa *count +table indicies. +If +.Fn pci_alloc_msix +is not able to allocate any messages, +it returns an error. +Unlike MSI, +MSI-X does not require message counts that are powers of two. .Pp The -.Fn pci_find_device -function looks up the -.Vt device_t -of a PCI device, given its -.Fa vendor -and -.Fa device -IDs. -Note that there can be multiple matches for this search; this function -only returns the first matching device. +.Fn pci_pending_msix +function examines the +.Fa dev +device's Pending Bit Array +.Pq PBA +to determine the pending status of the MSI-X message at table index +.Fa index . +If the indicated message is pending, +this function returns a non-zero value; +otherwise, +it returns zero. +Passing an invalid +.Fa index +to this function will result in undefined behavior. +.Pp +As mentioned in the description of +.Fn pci_alloc_msix , +MSI-X messages are initially assigned to the first N table entries. +A driver may use a different distribution of available messages to +table entries via the +.Fn pci_remap_msix +function. +Note that this function must be called after a succesful call to +.Fn pci_alloc_msix +but before any of the +.Dv SYS_RES_IRQ +resources are allocated. +The +.Fn pci_remap_msix +function returns zero on success, +or an error on failure. +.Pp +The +.Fa vectors +array should contain +.Fa count +message vectors. +The array maps directly to the MSI-X table in that the first entry in +the array specifies the message used for the first entry in the MSI-X +table, +the second entry in the array corresponds to the second entry in the +MSI-X table, +etc. +The vector value in each array index can either be zero to indicate +that no message should be assigned to the corresponding MSI-X table entry, +or it can be a number from one to N +.Po +where N is the count returned from the previous call to +.Fn pci_alloc_msix +.Pc +to indicate which of the allocated messages should be assigned to the +corresponding MSI-X table entry. +.Pp +If +.Fn pci_remap_msix +succeeds, +each MSI-X table entry with a non-zero vector will have an associated +.Dv SYS_RES_IRQ +resource whose resource ID corresponds to the table index as described +above for +.Fn pci_alloc_msix . +MSI-X table entries that with a vector of zero will not have an +associated +.Dv SYS_RES_IRQ resource. +Additionally, +if any of the original messages allocated by +.Fn pci_alloc_msix +are not used in the new distribution of messages in the MSI-X table, +they will be released automatically. +Note that if a driver wishes to use fewer messages than were allocated by +.Fn pci_alloc_msix , +the driver must use a single, contiguous range of messages beginning +with one in the new distribution. +The +.Fn pci_remap_msix +function will fail if this condition is not met. .Sh IMPLEMENTATION NOTES The .Vt pci_addr_t @@ -295,7 +645,9 @@ space on the target architecture. .Re .Sh AUTHORS This manual page was written by -.An Bruce M Simpson Aq bms@FreeBSD.org . +.An Bruce M Simpson Aq bms@FreeBSD.org +and +.An John Baldwin Aq jhb@FreeBSD.org . .Sh BUGS The kernel PCI code has a number of references to .Dq "slot numbers" .