From owner-svn-src-stable@FreeBSD.ORG Sun Sep 13 10:04:08 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D8A7F1065695; Sun, 13 Sep 2009 10:04:08 +0000 (UTC) (envelope-from nork@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6EB48FC13; Sun, 13 Sep 2009 10:04:08 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8DA48pO013162; Sun, 13 Sep 2009 10:04:08 GMT (envelope-from nork@svn.freebsd.org) Received: (from nork@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8DA48wf013160; Sun, 13 Sep 2009 10:04:08 GMT (envelope-from nork@svn.freebsd.org) Message-Id: <200909131004.n8DA48wf013160@svn.freebsd.org> From: Norikatsu Shigemura Date: Sun, 13 Sep 2009 10:04:08 +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: r197149 - stable/8/sys/dev/coretemp X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2009 10:04:09 -0000 Author: nork Date: Sun Sep 13 10:04:08 2009 New Revision: 197149 URL: http://svn.freebsd.org/changeset/base/197149 Log: MFC r196889: Change 'dev.cpu.N.temperature', sysctl I (degC) to IK (Kelvin), to match acpi_thermal(4) and amdtemp(4). Approved by: re (rwatson) Reviewed by: rpaulo Suggested by: ume Modified: stable/8/sys/dev/coretemp/coretemp.c (contents, props changed) Modified: stable/8/sys/dev/coretemp/coretemp.c ============================================================================== --- stable/8/sys/dev/coretemp/coretemp.c Sun Sep 13 01:00:24 2009 (r197148) +++ stable/8/sys/dev/coretemp/coretemp.c Sun Sep 13 10:04:08 2009 (r197149) @@ -48,6 +48,8 @@ __FBSDID("$FreeBSD$"); #include #include +#define TZ_ZEROC 2732 + struct coretemp_softc { device_t sc_dev; int sc_tjmax; @@ -193,8 +195,8 @@ coretemp_attach(device_t dev) SYSCTL_CHILDREN(device_get_sysctl_tree(pdev)), OID_AUTO, "temperature", CTLTYPE_INT | CTLFLAG_RD, - dev, 0, coretemp_get_temp_sysctl, "I", - "Current temperature in degC"); + dev, 0, coretemp_get_temp_sysctl, "IK", + "Current temperature"); return (0); } @@ -283,7 +285,7 @@ coretemp_get_temp_sysctl(SYSCTL_HANDLER_ device_t dev = (device_t) arg1; int temp; - temp = coretemp_get_temp(dev); + temp = coretemp_get_temp(dev) * 10 + TZ_ZEROC; return (sysctl_handle_int(oidp, &temp, 0, req)); } From owner-svn-src-stable@FreeBSD.ORG Sun Sep 13 11:31:26 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0D41C106566C; Sun, 13 Sep 2009 11:31:26 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EFDE28FC17; Sun, 13 Sep 2009 11:31:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8DBVPY0019742; Sun, 13 Sep 2009 11:31:25 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8DBVPuh019740; Sun, 13 Sep 2009 11:31:25 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200909131131.n8DBVPuh019740@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sun, 13 Sep 2009 11:31: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: r197157 - stable/8/sbin/ifconfig X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2009 11:31:26 -0000 Author: ume Date: Sun Sep 13 11:31:25 2009 New Revision: 197157 URL: http://svn.freebsd.org/changeset/base/197157 Log: MFC r196929: Suppress an options line when no bit is on. Approved by: re (kib) Modified: stable/8/sbin/ifconfig/ (props changed) stable/8/sbin/ifconfig/ifgif.c Modified: stable/8/sbin/ifconfig/ifgif.c ============================================================================== --- stable/8/sbin/ifconfig/ifgif.c Sun Sep 13 11:20:17 2009 (r197156) +++ stable/8/sbin/ifconfig/ifgif.c Sun Sep 13 11:31:25 2009 (r197157) @@ -71,6 +71,8 @@ gif_status(int s) ifr.ifr_data = (caddr_t)&opts; if (ioctl(s, GIFGOPTS, &ifr) == -1) return; + if (opts == 0) + return; printf("\toptions=%d<", opts); for (i=0; i < sizeof(gif_opts)/sizeof(gif_opts[0]); i++) { From owner-svn-src-stable@FreeBSD.ORG Sun Sep 13 11:34:33 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3064106578A; Sun, 13 Sep 2009 11:34:33 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8FCBC8FC14; Sun, 13 Sep 2009 11:34:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8DBYXlV019845; Sun, 13 Sep 2009 11:34:33 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8DBYX92019838; Sun, 13 Sep 2009 11:34:33 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200909131134.n8DBYX92019838@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sun, 13 Sep 2009 11:34:33 +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: r197158 - in stable/8: contrib/traceroute usr.sbin/traceroute6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2009 11:34:33 -0000 Author: ume Date: Sun Sep 13 11:34:33 2009 New Revision: 197158 URL: http://svn.freebsd.org/changeset/base/197158 Log: MFC r196475: - Add AS lookup functionality to traceroute6(8) as well. - Support for IPv6 transport for AS lookup. - Introduce $RA_SERVER to set whois server. - Support for 4 byte ASN. - ANSIfy function declaration in as.c. Approved by: re (kib) Modified: stable/8/contrib/traceroute/ (props changed) stable/8/contrib/traceroute/as.c stable/8/contrib/traceroute/as.h stable/8/contrib/traceroute/traceroute.c stable/8/usr.sbin/traceroute6/ (props changed) stable/8/usr.sbin/traceroute6/Makefile stable/8/usr.sbin/traceroute6/traceroute6.8 stable/8/usr.sbin/traceroute6/traceroute6.c Modified: stable/8/contrib/traceroute/as.c ============================================================================== --- stable/8/contrib/traceroute/as.c Sun Sep 13 11:31:25 2009 (r197157) +++ stable/8/contrib/traceroute/as.c Sun Sep 13 11:34:33 2009 (r197158) @@ -63,55 +63,42 @@ struct aslookup { }; void * -as_setup(server) - char *server; +as_setup(char *server) { struct aslookup *asn; - struct hostent *he = NULL; - struct servent *se; - struct sockaddr_in in; + struct addrinfo hints, *res0, *res; FILE *f; - int s; + int s, error; if (server == NULL) + server = getenv("RA_SERVER"); + if (server == NULL) server = DEFAULT_AS_SERVER; - (void)memset(&in, 0, sizeof(in)); - in.sin_family = AF_INET; - in.sin_len = sizeof(in); - if ((se = getservbyname("whois", "tcp")) == NULL) { + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo(server, "whois", &hints, &res0); + if (error == EAI_SERVICE) { warnx("warning: whois/tcp service not found"); - in.sin_port = ntohs(43); - } else - in.sin_port = se->s_port; - - if (inet_aton(server, &in.sin_addr) == 0 && - ((he = gethostbyname(server)) == NULL || - he->h_addr == NULL)) { - warnx("%s: %s", server, hstrerror(h_errno)); - return (NULL); + error = getaddrinfo(server, "43", &hints, &res0); } - - if ((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) { - warn("socket"); + if (error != 0) { + warnx("%s: %s", server, gai_strerror(error)); return (NULL); } - do { - if (he != NULL) { - memcpy(&in.sin_addr, he->h_addr, he->h_length); - he->h_addr_list++; - } - if (connect(s, (struct sockaddr *)&in, sizeof(in)) == 0) + for (res = res0; res; res = res->ai_next) { + s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (s < 0) + continue; + if (connect(s, res->ai_addr, res->ai_addrlen) >= 0) break; - if (he == NULL || he->h_addr == NULL) { - close(s); - s = -1; - break; - } - } while (1); - - if (s == -1) { + close(s); + s = -1; + } + freeaddrinfo(res0); + if (s < 0) { warn("connect"); return (NULL); } @@ -137,23 +124,23 @@ as_setup(server) return (asn); } -int -as_lookup(_asn, addr) - void *_asn; - struct in_addr *addr; +unsigned int +as_lookup(void *_asn, char *addr, sa_family_t family) { struct aslookup *asn = _asn; char buf[1024]; - int as, rc, dlen; + unsigned int as; + int rc, dlen, plen; - as = rc = dlen = 0; - (void)fprintf(asn->as_f, "!r%s/32,l\n", inet_ntoa(*addr)); + as = 0; + rc = dlen = 0; + plen = (family == AF_INET6) ? 128 : 32; + (void)fprintf(asn->as_f, "!r%s/%d,l\n", addr, plen); (void)fflush(asn->as_f); #ifdef AS_DEBUG_FILE if (asn->as_debug) { - (void)fprintf(asn->as_debug, ">> !r%s/32,l\n", - inet_ntoa(*addr)); + (void)fprintf(asn->as_debug, ">> !r%s/%d,l\n", addr, plen); (void)fflush(asn->as_debug); } #endif /* AS_DEBUG_FILE */ @@ -182,7 +169,7 @@ as_lookup(_asn, addr) } #endif /* AS_DEBUG_FILE */ break; - case 'C': + case 'C': case 'D': case 'E': case 'F': @@ -209,7 +196,7 @@ as_lookup(_asn, addr) /* origin line is the interesting bit */ if (as == 0 && strncasecmp(buf, "origin:", 7) == 0) { - sscanf(buf + 7, " AS%d", &as); + sscanf(buf + 7, " AS%u", &as); #ifdef AS_DEBUG_FILE if (asn->as_debug) { (void)fprintf(asn->as_debug, "as: %d\n", as); @@ -223,8 +210,7 @@ as_lookup(_asn, addr) } void -as_shutdown(_asn) - void *_asn; +as_shutdown(void *_asn) { struct aslookup *asn = _asn; Modified: stable/8/contrib/traceroute/as.h ============================================================================== --- stable/8/contrib/traceroute/as.h Sun Sep 13 11:31:25 2009 (r197157) +++ stable/8/contrib/traceroute/as.h Sun Sep 13 11:34:33 2009 (r197158) @@ -37,6 +37,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -void *as_setup __P((char *)); -int as_lookup __P((void *, struct in_addr *)); -void as_shutdown __P((void *)); +void *as_setup(char *); +unsigned int as_lookup(void *, char *, sa_family_t); +void as_shutdown(void *); Modified: stable/8/contrib/traceroute/traceroute.c ============================================================================== --- stable/8/contrib/traceroute/traceroute.c Sun Sep 13 11:31:25 2009 (r197157) +++ stable/8/contrib/traceroute/traceroute.c Sun Sep 13 11:34:33 2009 (r197158) @@ -1477,19 +1477,21 @@ print(register u_char *buf, register int { register struct ip *ip; register int hlen; + char addr[INET_ADDRSTRLEN]; ip = (struct ip *) buf; hlen = ip->ip_hl << 2; cc -= hlen; + strlcpy(addr, inet_ntoa(from->sin_addr), sizeof(addr)); + if (as_path) - Printf(" [AS%d]", as_lookup(asn, &from->sin_addr)); + Printf(" [AS%u]", as_lookup(asn, addr, AF_INET)); if (nflag) - Printf(" %s", inet_ntoa(from->sin_addr)); + Printf(" %s", addr); else - Printf(" %s (%s)", inetname(from->sin_addr), - inet_ntoa(from->sin_addr)); + Printf(" %s (%s)", inetname(from->sin_addr), addr); if (verbose) Printf(" %d bytes to %s", cc, inet_ntoa (ip->ip_dst)); Modified: stable/8/usr.sbin/traceroute6/Makefile ============================================================================== --- stable/8/usr.sbin/traceroute6/Makefile Sun Sep 13 11:31:25 2009 (r197157) +++ stable/8/usr.sbin/traceroute6/Makefile Sun Sep 13 11:34:33 2009 (r197158) @@ -13,12 +13,17 @@ # A PARTICULAR PURPOSE. # $FreeBSD$ +TRACEROUTE_DISTDIR?= ${.CURDIR}/../../contrib/traceroute +.PATH: ${TRACEROUTE_DISTDIR} + PROG= traceroute6 MAN= traceroute6.8 +SRCS= as.c traceroute6.c BINOWN= root BINMODE= 4555 CFLAGS+= -DIPSEC -DUSE_RFC2292BIS -DHAVE_POLL +CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I. DPADD= ${LIBIPSEC} LDADD= -lipsec Modified: stable/8/usr.sbin/traceroute6/traceroute6.8 ============================================================================== --- stable/8/usr.sbin/traceroute6/traceroute6.8 Sun Sep 13 11:31:25 2009 (r197157) +++ stable/8/usr.sbin/traceroute6/traceroute6.8 Sun Sep 13 11:34:33 2009 (r197158) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 1998 +.Dd August 24, 2009 .Dt TRACEROUTE6 8 .Os .\" @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm .Bk -words -.Op Fl dIlnNrvU +.Op Fl adIlnNrvU .Ek .Bk -words .Op Fl f Ar firsthop @@ -64,6 +64,9 @@ .Op Fl w Ar waittime .Ek .Bk -words +.Op Fl A Ar as_server +.Ek +.Bk -words .Ar target .Op Ar datalen .Ek @@ -84,6 +87,10 @@ after the destination host name. .Pp Other options are: .Bl -tag -width Ds +.It Fl a +Turn on AS# lookups for each hop encountered. +.It Fl A Ar as_server +Turn on AS# lookups and use the given server instead of the default. .It Fl d Debug mode. .It Fl f Ar firsthop Modified: stable/8/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- stable/8/usr.sbin/traceroute6/traceroute6.c Sun Sep 13 11:31:25 2009 (r197157) +++ stable/8/usr.sbin/traceroute6/traceroute6.c Sun Sep 13 11:34:33 2009 (r197158) @@ -282,6 +282,8 @@ static const char rcsid[] = #include #endif +#include "as.h" + #define DUMMY_PORT 10010 #define MAXPACKET 65535 /* max ip packet size */ @@ -359,6 +361,9 @@ int waittime = 5; /* time to wait for r int nflag; /* print addresses numerically */ int useproto = IPPROTO_UDP; /* protocol to use to send packet */ int lflag; /* print both numerical address & hostname */ +int as_path; /* print as numbers for each hop */ +char *as_server = NULL; +void *asn; int main(argc, argv) @@ -411,8 +416,15 @@ main(argc, argv) seq = 0; - while ((ch = getopt(argc, argv, "df:g:Ilm:nNp:q:rs:Uvw:")) != -1) + while ((ch = getopt(argc, argv, "aA:df:g:Ilm:nNp:q:rs:Uvw:")) != -1) switch (ch) { + case 'a': + as_path = 1; + break; + case 'A': + as_path = 1; + as_server = optarg; + break; case 'd': options |= SO_DEBUG; break; @@ -867,6 +879,17 @@ main(argc, argv) srcport = ntohs(Src.sin6_port); } + if (as_path) { + asn = as_setup(as_server); + if (asn == NULL) { + fprintf(stderr, + "traceroute6: as_setup failed, AS# lookups" + " disabled\n"); + (void)fflush(stderr); + as_path = 0; + } + } + /* * Message to users */ @@ -948,6 +971,8 @@ main(argc, argv) exit(0); } } + if (as_path) + as_shutdown(asn); exit(0); } @@ -1361,6 +1386,8 @@ print(mhdr, cc) if (getnameinfo((struct sockaddr *)from, from->sin6_len, hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0) strlcpy(hbuf, "invalid", sizeof(hbuf)); + if (as_path) + printf(" [AS%u]", as_lookup(asn, hbuf, AF_INET6)); if (nflag) printf(" %s", hbuf); else if (lflag) From owner-svn-src-stable@FreeBSD.ORG Sun Sep 13 11:45:32 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AFFD7106566C; Sun, 13 Sep 2009 11:45:31 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9EC8A8FC14; Sun, 13 Sep 2009 11:45:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8DBjVXC020150; Sun, 13 Sep 2009 11:45:31 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8DBjVkw020148; Sun, 13 Sep 2009 11:45:31 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200909131145.n8DBjVkw020148@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sun, 13 Sep 2009 11:45:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197159 - stable/7/sbin/ifconfig X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2009 11:45:32 -0000 Author: ume Date: Sun Sep 13 11:45:31 2009 New Revision: 197159 URL: http://svn.freebsd.org/changeset/base/197159 Log: MFC r196929: Suppress an options line when no bit is on. Modified: stable/7/sbin/ifconfig/ (props changed) stable/7/sbin/ifconfig/ifgif.c Modified: stable/7/sbin/ifconfig/ifgif.c ============================================================================== --- stable/7/sbin/ifconfig/ifgif.c Sun Sep 13 11:34:33 2009 (r197158) +++ stable/7/sbin/ifconfig/ifgif.c Sun Sep 13 11:45:31 2009 (r197159) @@ -71,6 +71,8 @@ gif_status(int s) ifr.ifr_data = (caddr_t)&opts; if (ioctl(s, GIFGOPTS, &ifr) == -1) return; + if (opts == 0) + return; printf("\toptions=%d<", opts); for (i=0; i < sizeof(gif_opts)/sizeof(gif_opts[0]); i++) { From owner-svn-src-stable@FreeBSD.ORG Sun Sep 13 11:52:18 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A22A106566B; Sun, 13 Sep 2009 11:52:18 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 172588FC19; Sun, 13 Sep 2009 11:52:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8DBqHoo020428; Sun, 13 Sep 2009 11:52:17 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8DBqHAk020421; Sun, 13 Sep 2009 11:52:17 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200909131152.n8DBqHAk020421@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sun, 13 Sep 2009 11:52:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197162 - in stable/7: contrib/traceroute usr.sbin/traceroute6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2009 11:52:18 -0000 Author: ume Date: Sun Sep 13 11:52:17 2009 New Revision: 197162 URL: http://svn.freebsd.org/changeset/base/197162 Log: MFC r196475: - Add AS lookup functionality to traceroute6(8) as well. - Support for IPv6 transport for AS lookup. - Introduce $RA_SERVER to set whois server. - Support for 4 byte ASN. - ANSIfy function declaration in as.c. Modified: stable/7/contrib/traceroute/ (props changed) stable/7/contrib/traceroute/as.c stable/7/contrib/traceroute/as.h stable/7/contrib/traceroute/traceroute.c stable/7/usr.sbin/traceroute6/ (props changed) stable/7/usr.sbin/traceroute6/Makefile stable/7/usr.sbin/traceroute6/traceroute6.8 stable/7/usr.sbin/traceroute6/traceroute6.c Modified: stable/7/contrib/traceroute/as.c ============================================================================== --- stable/7/contrib/traceroute/as.c Sun Sep 13 11:52:15 2009 (r197161) +++ stable/7/contrib/traceroute/as.c Sun Sep 13 11:52:17 2009 (r197162) @@ -63,55 +63,42 @@ struct aslookup { }; void * -as_setup(server) - char *server; +as_setup(char *server) { struct aslookup *asn; - struct hostent *he = NULL; - struct servent *se; - struct sockaddr_in in; + struct addrinfo hints, *res0, *res; FILE *f; - int s; + int s, error; if (server == NULL) + server = getenv("RA_SERVER"); + if (server == NULL) server = DEFAULT_AS_SERVER; - (void)memset(&in, 0, sizeof(in)); - in.sin_family = AF_INET; - in.sin_len = sizeof(in); - if ((se = getservbyname("whois", "tcp")) == NULL) { + memset(&hints, 0, sizeof(hints)); + hints.ai_family = PF_UNSPEC; + hints.ai_socktype = SOCK_STREAM; + error = getaddrinfo(server, "whois", &hints, &res0); + if (error == EAI_SERVICE) { warnx("warning: whois/tcp service not found"); - in.sin_port = ntohs(43); - } else - in.sin_port = se->s_port; - - if (inet_aton(server, &in.sin_addr) == 0 && - ((he = gethostbyname(server)) == NULL || - he->h_addr == NULL)) { - warnx("%s: %s", server, hstrerror(h_errno)); - return (NULL); + error = getaddrinfo(server, "43", &hints, &res0); } - - if ((s = socket(PF_INET, SOCK_STREAM, 0)) == -1) { - warn("socket"); + if (error != 0) { + warnx("%s: %s", server, gai_strerror(error)); return (NULL); } - do { - if (he != NULL) { - memcpy(&in.sin_addr, he->h_addr, he->h_length); - he->h_addr_list++; - } - if (connect(s, (struct sockaddr *)&in, sizeof(in)) == 0) + for (res = res0; res; res = res->ai_next) { + s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); + if (s < 0) + continue; + if (connect(s, res->ai_addr, res->ai_addrlen) >= 0) break; - if (he == NULL || he->h_addr == NULL) { - close(s); - s = -1; - break; - } - } while (1); - - if (s == -1) { + close(s); + s = -1; + } + freeaddrinfo(res0); + if (s < 0) { warn("connect"); return (NULL); } @@ -137,23 +124,23 @@ as_setup(server) return (asn); } -int -as_lookup(_asn, addr) - void *_asn; - struct in_addr *addr; +unsigned int +as_lookup(void *_asn, char *addr, sa_family_t family) { struct aslookup *asn = _asn; char buf[1024]; - int as, rc, dlen; + unsigned int as; + int rc, dlen, plen; - as = rc = dlen = 0; - (void)fprintf(asn->as_f, "!r%s/32,l\n", inet_ntoa(*addr)); + as = 0; + rc = dlen = 0; + plen = (family == AF_INET6) ? 128 : 32; + (void)fprintf(asn->as_f, "!r%s/%d,l\n", addr, plen); (void)fflush(asn->as_f); #ifdef AS_DEBUG_FILE if (asn->as_debug) { - (void)fprintf(asn->as_debug, ">> !r%s/32,l\n", - inet_ntoa(*addr)); + (void)fprintf(asn->as_debug, ">> !r%s/%d,l\n", addr, plen); (void)fflush(asn->as_debug); } #endif /* AS_DEBUG_FILE */ @@ -182,7 +169,7 @@ as_lookup(_asn, addr) } #endif /* AS_DEBUG_FILE */ break; - case 'C': + case 'C': case 'D': case 'E': case 'F': @@ -209,7 +196,7 @@ as_lookup(_asn, addr) /* origin line is the interesting bit */ if (as == 0 && strncasecmp(buf, "origin:", 7) == 0) { - sscanf(buf + 7, " AS%d", &as); + sscanf(buf + 7, " AS%u", &as); #ifdef AS_DEBUG_FILE if (asn->as_debug) { (void)fprintf(asn->as_debug, "as: %d\n", as); @@ -223,8 +210,7 @@ as_lookup(_asn, addr) } void -as_shutdown(_asn) - void *_asn; +as_shutdown(void *_asn) { struct aslookup *asn = _asn; Modified: stable/7/contrib/traceroute/as.h ============================================================================== --- stable/7/contrib/traceroute/as.h Sun Sep 13 11:52:15 2009 (r197161) +++ stable/7/contrib/traceroute/as.h Sun Sep 13 11:52:17 2009 (r197162) @@ -37,6 +37,6 @@ * POSSIBILITY OF SUCH DAMAGE. */ -void *as_setup __P((char *)); -int as_lookup __P((void *, struct in_addr *)); -void as_shutdown __P((void *)); +void *as_setup(char *); +unsigned int as_lookup(void *, char *, sa_family_t); +void as_shutdown(void *); Modified: stable/7/contrib/traceroute/traceroute.c ============================================================================== --- stable/7/contrib/traceroute/traceroute.c Sun Sep 13 11:52:15 2009 (r197161) +++ stable/7/contrib/traceroute/traceroute.c Sun Sep 13 11:52:17 2009 (r197162) @@ -1477,19 +1477,21 @@ print(register u_char *buf, register int { register struct ip *ip; register int hlen; + char addr[INET_ADDRSTRLEN]; ip = (struct ip *) buf; hlen = ip->ip_hl << 2; cc -= hlen; + strlcpy(addr, inet_ntoa(from->sin_addr), sizeof(addr)); + if (as_path) - Printf(" [AS%d]", as_lookup(asn, &from->sin_addr)); + Printf(" [AS%u]", as_lookup(asn, addr, AF_INET)); if (nflag) - Printf(" %s", inet_ntoa(from->sin_addr)); + Printf(" %s", addr); else - Printf(" %s (%s)", inetname(from->sin_addr), - inet_ntoa(from->sin_addr)); + Printf(" %s (%s)", inetname(from->sin_addr), addr); if (verbose) Printf(" %d bytes to %s", cc, inet_ntoa (ip->ip_dst)); Modified: stable/7/usr.sbin/traceroute6/Makefile ============================================================================== --- stable/7/usr.sbin/traceroute6/Makefile Sun Sep 13 11:52:15 2009 (r197161) +++ stable/7/usr.sbin/traceroute6/Makefile Sun Sep 13 11:52:17 2009 (r197162) @@ -13,12 +13,17 @@ # A PARTICULAR PURPOSE. # $FreeBSD$ +TRACEROUTE_DISTDIR?= ${.CURDIR}/../../contrib/traceroute +.PATH: ${TRACEROUTE_DISTDIR} + PROG= traceroute6 MAN= traceroute6.8 +SRCS= as.c traceroute6.c BINOWN= root BINMODE= 4555 CFLAGS+= -DIPSEC -DUSE_RFC2292BIS -DHAVE_POLL +CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I. DPADD= ${LIBIPSEC} LDADD= -lipsec Modified: stable/7/usr.sbin/traceroute6/traceroute6.8 ============================================================================== --- stable/7/usr.sbin/traceroute6/traceroute6.8 Sun Sep 13 11:52:15 2009 (r197161) +++ stable/7/usr.sbin/traceroute6/traceroute6.8 Sun Sep 13 11:52:17 2009 (r197162) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 17, 1998 +.Dd August 24, 2009 .Dt TRACEROUTE6 8 .Os .\" @@ -40,7 +40,7 @@ .Sh SYNOPSIS .Nm .Bk -words -.Op Fl dIlnNrvU +.Op Fl adIlnNrvU .Ek .Bk -words .Op Fl f Ar firsthop @@ -64,6 +64,9 @@ .Op Fl w Ar waittime .Ek .Bk -words +.Op Fl A Ar as_server +.Ek +.Bk -words .Ar target .Op Ar datalen .Ek @@ -84,6 +87,10 @@ after the destination host name. .Pp Other options are: .Bl -tag -width Ds +.It Fl a +Turn on AS# lookups for each hop encountered. +.It Fl A Ar as_server +Turn on AS# lookups and use the given server instead of the default. .It Fl d Debug mode. .It Fl f Ar firsthop Modified: stable/7/usr.sbin/traceroute6/traceroute6.c ============================================================================== --- stable/7/usr.sbin/traceroute6/traceroute6.c Sun Sep 13 11:52:15 2009 (r197161) +++ stable/7/usr.sbin/traceroute6/traceroute6.c Sun Sep 13 11:52:17 2009 (r197162) @@ -282,6 +282,8 @@ static const char rcsid[] = #include #endif +#include "as.h" + #define DUMMY_PORT 10010 #define MAXPACKET 65535 /* max ip packet size */ @@ -359,6 +361,9 @@ int waittime = 5; /* time to wait for r int nflag; /* print addresses numerically */ int useproto = IPPROTO_UDP; /* protocol to use to send packet */ int lflag; /* print both numerical address & hostname */ +int as_path; /* print as numbers for each hop */ +char *as_server = NULL; +void *asn; int main(argc, argv) @@ -411,8 +416,15 @@ main(argc, argv) seq = 0; - while ((ch = getopt(argc, argv, "df:g:Ilm:nNp:q:rs:Uvw:")) != -1) + while ((ch = getopt(argc, argv, "aA:df:g:Ilm:nNp:q:rs:Uvw:")) != -1) switch (ch) { + case 'a': + as_path = 1; + break; + case 'A': + as_path = 1; + as_server = optarg; + break; case 'd': options |= SO_DEBUG; break; @@ -867,6 +879,17 @@ main(argc, argv) srcport = ntohs(Src.sin6_port); } + if (as_path) { + asn = as_setup(as_server); + if (asn == NULL) { + fprintf(stderr, + "traceroute6: as_setup failed, AS# lookups" + " disabled\n"); + (void)fflush(stderr); + as_path = 0; + } + } + /* * Message to users */ @@ -948,6 +971,8 @@ main(argc, argv) exit(0); } } + if (as_path) + as_shutdown(asn); exit(0); } @@ -1361,6 +1386,8 @@ print(mhdr, cc) if (getnameinfo((struct sockaddr *)from, from->sin6_len, hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0) strlcpy(hbuf, "invalid", sizeof(hbuf)); + if (as_path) + printf(" [AS%u]", as_lookup(asn, hbuf, AF_INET6)); if (nflag) printf(" %s", hbuf); else if (lflag) From owner-svn-src-stable@FreeBSD.ORG Sun Sep 13 17:00:21 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A581B106566B; Sun, 13 Sep 2009 17:00:21 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 93FEA8FC1C; Sun, 13 Sep 2009 17:00:21 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8DH0L5X026536; Sun, 13 Sep 2009 17:00:21 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8DH0L2m026535; Sun, 13 Sep 2009 17:00:21 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200909131700.n8DH0L2m026535@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sun, 13 Sep 2009 17:00:21 +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: r197168 - stable/8/share/timedef X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2009 17:00:21 -0000 Author: ume Date: Sun Sep 13 17:00:21 2009 New Revision: 197168 URL: http://svn.freebsd.org/changeset/base/197168 Log: MFC r196651: AM/PM date format for ja_JP.eucJP and ja_JP.SJIS were localized by r193869. However, ja_JP.UTF-8 wasn't. So, reflect it to ja_JP.UTF-8 as well. Approved by: re (kib) Modified: stable/8/share/timedef/ (props changed) stable/8/share/timedef/ja_JP.UTF-8.src Modified: stable/8/share/timedef/ja_JP.UTF-8.src ============================================================================== --- stable/8/share/timedef/ja_JP.UTF-8.src Sun Sep 13 16:05:20 2009 (r197167) +++ stable/8/share/timedef/ja_JP.UTF-8.src Sun Sep 13 17:00:21 2009 (r197168) @@ -68,13 +68,11 @@ # # am # -#午前 -AM +午前 # # pm # -#午後 -PM +午後 # # date_fmt # From owner-svn-src-stable@FreeBSD.ORG Sun Sep 13 17:01:35 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4A05E106566C; Sun, 13 Sep 2009 17:01:35 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 385948FC0A; Sun, 13 Sep 2009 17:01:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8DH1ZPE026599; Sun, 13 Sep 2009 17:01:35 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8DH1ZSR026595; Sun, 13 Sep 2009 17:01:35 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200909131701.n8DH1ZSR026595@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sun, 13 Sep 2009 17:01:35 +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: r197169 - stable/8/usr.bin/w X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2009 17:01:35 -0000 Author: ume Date: Sun Sep 13 17:01:34 2009 New Revision: 197169 URL: http://svn.freebsd.org/changeset/base/197169 Log: MFC r196652: Fix the problem that the entry broke into two lines with multi-byte AM/PM date format. Approved by: re (kib) Modified: stable/8/usr.bin/w/ (props changed) stable/8/usr.bin/w/extern.h stable/8/usr.bin/w/pr_time.c stable/8/usr.bin/w/w.c Modified: stable/8/usr.bin/w/extern.h ============================================================================== --- stable/8/usr.bin/w/extern.h Sun Sep 13 17:00:21 2009 (r197168) +++ stable/8/usr.bin/w/extern.h Sun Sep 13 17:01:34 2009 (r197169) @@ -38,6 +38,6 @@ extern int use_ampm; struct kinfo_proc; -void pr_attime(time_t *, time_t *); +int pr_attime(time_t *, time_t *); int pr_idle(time_t); int proc_compare(struct kinfo_proc *, struct kinfo_proc *); Modified: stable/8/usr.bin/w/pr_time.c ============================================================================== --- stable/8/usr.bin/w/pr_time.c Sun Sep 13 17:00:21 2009 (r197168) +++ stable/8/usr.bin/w/pr_time.c Sun Sep 13 17:01:34 2009 (r197169) @@ -52,13 +52,14 @@ static const char sccsid[] = "@(#)pr_tim * pr_attime -- * Print the time since the user logged in. */ -void +int pr_attime(time_t *started, time_t *now) { - static char buf[256]; + static wchar_t buf[256]; struct tm tp, tm; time_t diff; - char fmt[20]; + wchar_t *fmt; + int len, width, offset = 0; tp = *localtime(started); tm = *localtime(now); @@ -66,7 +67,7 @@ pr_attime(time_t *started, time_t *now) /* If more than a week, use day-month-year. */ if (diff > 86400 * 7) - (void)strcpy(fmt, "%d%b%y"); + fmt = L"%d%b%y"; /* If not today, use day-hour-am/pm. */ else if (tm.tm_mday != tp.tm_mday || @@ -74,16 +75,26 @@ pr_attime(time_t *started, time_t *now) tm.tm_year != tp.tm_year) { /* The line below does not take DST into consideration */ /* else if (*now / 86400 != *started / 86400) { */ - (void)strcpy(fmt, use_ampm ? "%a%I%p" : "%a%H"); + fmt = use_ampm ? L"%a%I%p" : L"%a%H"; } /* Default is hh:mm{am,pm}. */ else { - (void)strcpy(fmt, use_ampm ? "%l:%M%p" : "%k:%M"); + fmt = use_ampm ? L"%l:%M%p" : L"%k:%M"; } - (void)strftime(buf, sizeof(buf), fmt, &tp); - (void)wprintf(L"%-7.7s", buf); + (void)wcsftime(buf, sizeof(buf), fmt, &tp); + len = wcslen(buf); + width = wcswidth(buf, len); + if (len == width) + (void)wprintf(L"%-7.7ls", buf); + else if (width < 7) + (void)wprintf(L"%ls%.*s", buf, 7 - width, " "); + else { + (void)wprintf(L"%ls", buf); + offset = width - 7; + } + return (offset); } /* Modified: stable/8/usr.bin/w/w.c ============================================================================== --- stable/8/usr.bin/w/w.c Sun Sep 13 17:00:21 2009 (r197168) +++ stable/8/usr.bin/w/w.c Sun Sep 13 17:01:34 2009 (r197169) @@ -137,7 +137,7 @@ main(int argc, char *argv[]) struct stat *stp; FILE *ut; time_t touched; - int ch, i, nentries, nusers, wcmd, longidle, dropgid; + int ch, i, nentries, nusers, wcmd, longidle, longattime, dropgid; const char *memf, *nlistf, *p; char *x_suffix; char buf[MAXHOSTNAMELEN], errbuf[_POSIX2_LINE_MAX]; @@ -406,9 +406,10 @@ main(int argc, char *argv[]) ep->utmp.ut_line : ep->utmp.ut_line + 3, W_DISPHOSTSIZE, W_DISPHOSTSIZE, *p ? p : "-"); t = _time_to_time32(ep->utmp.ut_time); - pr_attime(&t, &now); + longattime = pr_attime(&t, &now); longidle = pr_idle(ep->idle); - (void)printf("%.*s\n", argwidth - longidle, ep->args); + (void)printf("%.*s\n", argwidth - longidle - longattime, + ep->args); } (void)kvm_close(kd); exit(0); From owner-svn-src-stable@FreeBSD.ORG Sun Sep 13 17:05:56 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CDDAF1065672; Sun, 13 Sep 2009 17:05:56 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BC7358FC08; Sun, 13 Sep 2009 17:05:56 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8DH5uUp026724; Sun, 13 Sep 2009 17:05:56 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8DH5uLn026723; Sun, 13 Sep 2009 17:05:56 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200909131705.n8DH5uLn026723@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sun, 13 Sep 2009 17:05:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197170 - stable/7/share/timedef X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2009 17:05:56 -0000 Author: ume Date: Sun Sep 13 17:05:56 2009 New Revision: 197170 URL: http://svn.freebsd.org/changeset/base/197170 Log: MFC r196651: AM/PM date format for ja_JP.eucJP and ja_JP.SJIS were localized by r193869. However, ja_JP.UTF-8 wasn't. So, reflect it to ja_JP.UTF-8 as well. Modified: stable/7/share/timedef/ (props changed) stable/7/share/timedef/ja_JP.UTF-8.src Modified: stable/7/share/timedef/ja_JP.UTF-8.src ============================================================================== --- stable/7/share/timedef/ja_JP.UTF-8.src Sun Sep 13 17:01:34 2009 (r197169) +++ stable/7/share/timedef/ja_JP.UTF-8.src Sun Sep 13 17:05:56 2009 (r197170) @@ -68,13 +68,11 @@ # # am # -#午前 -AM +午前 # # pm # -#午後 -PM +午後 # # date_fmt # From owner-svn-src-stable@FreeBSD.ORG Sun Sep 13 17:08:58 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BF59D106566C; Sun, 13 Sep 2009 17:08:58 +0000 (UTC) (envelope-from ume@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 755608FC0C; Sun, 13 Sep 2009 17:08:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8DH8w5Z026822; Sun, 13 Sep 2009 17:08:58 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8DH8wlY026818; Sun, 13 Sep 2009 17:08:58 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <200909131708.n8DH8wlY026818@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sun, 13 Sep 2009 17:08:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197171 - stable/7/usr.bin/w X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 13 Sep 2009 17:08:59 -0000 Author: ume Date: Sun Sep 13 17:08:58 2009 New Revision: 197171 URL: http://svn.freebsd.org/changeset/base/197171 Log: MFC r196652: Fix the problem that the entry broke into two lines with multi-byte AM/PM date format. Modified: stable/7/usr.bin/w/ (props changed) stable/7/usr.bin/w/extern.h stable/7/usr.bin/w/pr_time.c stable/7/usr.bin/w/w.c Modified: stable/7/usr.bin/w/extern.h ============================================================================== --- stable/7/usr.bin/w/extern.h Sun Sep 13 17:05:56 2009 (r197170) +++ stable/7/usr.bin/w/extern.h Sun Sep 13 17:08:58 2009 (r197171) @@ -38,6 +38,6 @@ extern int use_ampm; struct kinfo_proc; -void pr_attime(time_t *, time_t *); +int pr_attime(time_t *, time_t *); int pr_idle(time_t); int proc_compare(struct kinfo_proc *, struct kinfo_proc *); Modified: stable/7/usr.bin/w/pr_time.c ============================================================================== --- stable/7/usr.bin/w/pr_time.c Sun Sep 13 17:05:56 2009 (r197170) +++ stable/7/usr.bin/w/pr_time.c Sun Sep 13 17:08:58 2009 (r197171) @@ -52,13 +52,14 @@ static const char sccsid[] = "@(#)pr_tim * pr_attime -- * Print the time since the user logged in. */ -void +int pr_attime(time_t *started, time_t *now) { - static char buf[256]; + static wchar_t buf[256]; struct tm tp, tm; time_t diff; - char fmt[20]; + wchar_t *fmt; + int len, width, offset = 0; tp = *localtime(started); tm = *localtime(now); @@ -66,7 +67,7 @@ pr_attime(time_t *started, time_t *now) /* If more than a week, use day-month-year. */ if (diff > 86400 * 7) - (void)strcpy(fmt, "%d%b%y"); + fmt = L"%d%b%y"; /* If not today, use day-hour-am/pm. */ else if (tm.tm_mday != tp.tm_mday || @@ -74,16 +75,26 @@ pr_attime(time_t *started, time_t *now) tm.tm_year != tp.tm_year) { /* The line below does not take DST into consideration */ /* else if (*now / 86400 != *started / 86400) { */ - (void)strcpy(fmt, use_ampm ? "%a%I%p" : "%a%H"); + fmt = use_ampm ? L"%a%I%p" : L"%a%H"; } /* Default is hh:mm{am,pm}. */ else { - (void)strcpy(fmt, use_ampm ? "%l:%M%p" : "%k:%M"); + fmt = use_ampm ? L"%l:%M%p" : L"%k:%M"; } - (void)strftime(buf, sizeof(buf), fmt, &tp); - (void)wprintf(L"%-7.7s", buf); + (void)wcsftime(buf, sizeof(buf), fmt, &tp); + len = wcslen(buf); + width = wcswidth(buf, len); + if (len == width) + (void)wprintf(L"%-7.7ls", buf); + else if (width < 7) + (void)wprintf(L"%ls%.*s", buf, 7 - width, " "); + else { + (void)wprintf(L"%ls", buf); + offset = width - 7; + } + return (offset); } /* Modified: stable/7/usr.bin/w/w.c ============================================================================== --- stable/7/usr.bin/w/w.c Sun Sep 13 17:05:56 2009 (r197170) +++ stable/7/usr.bin/w/w.c Sun Sep 13 17:08:58 2009 (r197171) @@ -137,7 +137,7 @@ main(int argc, char *argv[]) struct stat *stp; FILE *ut; time_t touched; - int ch, i, nentries, nusers, wcmd, longidle, dropgid; + int ch, i, nentries, nusers, wcmd, longidle, longattime, dropgid; const char *memf, *nlistf, *p; char *x_suffix; char buf[MAXHOSTNAMELEN], errbuf[_POSIX2_LINE_MAX]; @@ -406,9 +406,10 @@ main(int argc, char *argv[]) ep->utmp.ut_line : ep->utmp.ut_line + 3, W_DISPHOSTSIZE, W_DISPHOSTSIZE, *p ? p : "-"); t = _time_to_time32(ep->utmp.ut_time); - pr_attime(&t, &now); + longattime = pr_attime(&t, &now); longidle = pr_idle(ep->idle); - (void)printf("%.*s\n", argwidth - longidle, ep->args); + (void)printf("%.*s\n", argwidth - longidle - longattime, + ep->args); } (void)kvm_close(kd); exit(0); From owner-svn-src-stable@FreeBSD.ORG Mon Sep 14 11:01:15 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DE56106566B; Mon, 14 Sep 2009 11:01:15 +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 8B0E68FC16; Mon, 14 Sep 2009 11:01:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8EB1FJv049957; Mon, 14 Sep 2009 11:01:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8EB1F4K049955; Mon, 14 Sep 2009 11:01:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909141101.n8EB1F4K049955@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 14 Sep 2009 11:01:15 +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: r197188 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/coretemp dev/xen/xenpci fs/pseudofs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2009 11:01:15 -0000 Author: kib Date: Mon Sep 14 11:01:15 2009 New Revision: 197188 URL: http://svn.freebsd.org/changeset/base/197188 Log: MFC r196921: Do not decrement pfs_vncache_entries for the vnode that was not in the pfs_vncache list. Approved by: re (bz) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/coretemp/coretemp.c (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/fs/pseudofs/pseudofs_vncache.c Modified: stable/8/sys/fs/pseudofs/pseudofs_vncache.c ============================================================================== --- stable/8/sys/fs/pseudofs/pseudofs_vncache.c Mon Sep 14 08:04:48 2009 (r197187) +++ stable/8/sys/fs/pseudofs/pseudofs_vncache.c Mon Sep 14 11:01:15 2009 (r197188) @@ -246,11 +246,13 @@ pfs_vncache_free(struct vnode *vp) KASSERT(pvd != NULL, ("pfs_vncache_free(): no vnode data\n")); if (pvd->pvd_next) pvd->pvd_next->pvd_prev = pvd->pvd_prev; - if (pvd->pvd_prev) + if (pvd->pvd_prev) { pvd->pvd_prev->pvd_next = pvd->pvd_next; - else if (pfs_vncache == pvd) + --pfs_vncache_entries; + } else if (pfs_vncache == pvd) { pfs_vncache = pvd->pvd_next; - --pfs_vncache_entries; + --pfs_vncache_entries; + } mtx_unlock(&pfs_vncache_mutex); free(pvd, M_PFSVNCACHE); From owner-svn-src-stable@FreeBSD.ORG Mon Sep 14 15:16:17 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B4BF7106566C; Mon, 14 Sep 2009 15:16:17 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 854B68FC13; Mon, 14 Sep 2009 15:16:17 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8EFGHdR058412; Mon, 14 Sep 2009 15:16:17 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8EFGHRO058408; Mon, 14 Sep 2009 15:16:17 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200909141516.n8EFGHRO058408@svn.freebsd.org> From: Rick Macklem Date: Mon, 14 Sep 2009 15:16:17 +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: r197192 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/coretemp dev/xen/xenpci fs/nfsclient nfsclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2009 15:16:17 -0000 Author: rmacklem Date: Mon Sep 14 15:16:17 2009 New Revision: 197192 URL: http://svn.freebsd.org/changeset/base/197192 Log: MFC r197048: Add LK_NOWITNESS to the vn_lock() calls done on newly created nfs vnodes, since these nodes are not linked into the mount queue and, as such, the vn_lock() cannot cause a deadlock so LORs are harmless. Suggested by: kib Approved by: re (kensmith), kib (mentor) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/coretemp/coretemp.c (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/fs/nfsclient/nfs_clnode.c stable/8/sys/fs/nfsclient/nfs_clport.c stable/8/sys/nfsclient/nfs_node.c Modified: stable/8/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clnode.c Mon Sep 14 13:16:16 2009 (r197191) +++ stable/8/sys/fs/nfsclient/nfs_clnode.c Mon Sep 14 15:16:17 2009 (r197192) @@ -157,7 +157,7 @@ ncl_nget(struct mount *mntp, u_int8_t *f M_NFSFH, M_WAITOK); bcopy(fhp, np->n_fhp->nfh_fh, fhsize); np->n_fhp->nfh_len = fhsize; - lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL); + lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_NOWITNESS, NULL); error = insmntque(vp, mntp); if (error != 0) { *npp = NULL; Modified: stable/8/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clport.c Mon Sep 14 13:16:16 2009 (r197191) +++ stable/8/sys/fs/nfsclient/nfs_clport.c Mon Sep 14 15:16:17 2009 (r197192) @@ -232,7 +232,7 @@ nfscl_nget(struct mount *mntp, struct vn */ VN_LOCK_AREC(vp); VN_LOCK_ASHARE(vp); - lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL); + lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_NOWITNESS, NULL); error = insmntque(vp, mntp); if (error != 0) { *npp = NULL; Modified: stable/8/sys/nfsclient/nfs_node.c ============================================================================== --- stable/8/sys/nfsclient/nfs_node.c Mon Sep 14 13:16:16 2009 (r197191) +++ stable/8/sys/nfsclient/nfs_node.c Mon Sep 14 15:16:17 2009 (r197192) @@ -158,7 +158,7 @@ nfs_nget(struct mount *mntp, nfsfh_t *fh np->n_fhp = &np->n_fh; bcopy((caddr_t)fhp, (caddr_t)np->n_fhp, fhsize); np->n_fhsize = fhsize; - lockmgr(vp->v_vnlock, LK_EXCLUSIVE, NULL); + lockmgr(vp->v_vnlock, LK_EXCLUSIVE | LK_NOWITNESS, NULL); error = insmntque(vp, mntp); if (error != 0) { *npp = NULL; From owner-svn-src-stable@FreeBSD.ORG Mon Sep 14 16:13:13 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2AC6F1065672; Mon, 14 Sep 2009 16:13:13 +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 F10308FC17; Mon, 14 Sep 2009 16:13:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8EGDCQD059585; Mon, 14 Sep 2009 16:13:12 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8EGDCEs059584; Mon, 14 Sep 2009 16:13:12 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200909141613.n8EGDCEs059584@svn.freebsd.org> From: John Baldwin Date: Mon, 14 Sep 2009 16:13: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: r197194 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/coretemp dev/syscons/daemon dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2009 16:13:13 -0000 Author: jhb Date: Mon Sep 14 16:13:12 2009 New Revision: 197194 URL: http://svn.freebsd.org/changeset/base/197194 Log: MFC 197062: Don't malloc a buffer while holding the prison0 mutex. Instead, use a loop where we figure out the hostname length under the lock, malloc the buffer with the lock dropped, then recheck the length under the lock and loop again if the buffer is now too small. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/coretemp/coretemp.c (props changed) stable/8/sys/dev/syscons/daemon/daemon_saver.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/syscons/daemon/daemon_saver.c ============================================================================== --- stable/8/sys/dev/syscons/daemon/daemon_saver.c Mon Sep 14 15:53:30 2009 (r197193) +++ stable/8/sys/dev/syscons/daemon/daemon_saver.c Mon Sep 14 16:13:12 2009 (r197194) @@ -351,11 +351,23 @@ daemon_saver(video_adapter_t *adp, int b static int daemon_init(video_adapter_t *adp) { + size_t hostlen; mtx_lock(&prison0.pr_mtx); - messagelen = strlen(prison0.pr_hostname) + 3 + strlen(ostype) + 1 + - strlen(osrelease); - message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK); + for (;;) { + hostlen = strlen(prison0.pr_hostname); + mtx_unlock(&prison0.pr_mtx); + + messagelen = hostlen + 3 + strlen(ostype) + 1 + + strlen(osrelease); + message = malloc(messagelen + 1, M_DEVBUF, M_WAITOK); + mtx_lock(&prison0.pr_mtx); + if (hostlen < strlen(prison0.pr_hostname)) { + free(message, M_DEVBUF); + continue; + } + break; + } sprintf(message, "%s - %s %s", prison0.pr_hostname, ostype, osrelease); mtx_unlock(&prison0.pr_mtx); blanked = 0; From owner-svn-src-stable@FreeBSD.ORG Mon Sep 14 17:34:50 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6480E106566B; Mon, 14 Sep 2009 17:34: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 50AA58FC25; Mon, 14 Sep 2009 17:34:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8EHYobK061414; Mon, 14 Sep 2009 17:34:50 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8EHYng3061392; Mon, 14 Sep 2009 17:34:49 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200909141734.n8EHYng3061392@svn.freebsd.org> From: John Baldwin Date: Mon, 14 Sep 2009 17:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197197 - in stable/7: sys sys/amd64/amd64 sys/arm/arm sys/conf sys/contrib/pf sys/fs/procfs sys/i386/i386 sys/ia64/ia64 sys/kern sys/sparc64/sparc64 sys/sys sys/vm usr.bin/procstat X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2009 17:34:50 -0000 Author: jhb Date: Mon Sep 14 17:34:49 2009 New Revision: 197197 URL: http://svn.freebsd.org/changeset/base/197197 Log: MFC 195840, 195844, and 196637: Add a new type of VM object: OBJT_SG. An OBJT_SG object is very similar to a device pager (OBJT_DEVICE) object in that it uses fictitious pages to provide aliases to other memory addresses. The primary difference is that it uses an sglist(9) to determine the physical addresses for a given offset into the object instead of invoking the d_mmap() method in a device driver. Added: stable/7/sys/vm/sg_pager.c - copied, changed from r195840, head/sys/vm/sg_pager.c Modified: stable/7/sys/ (props changed) stable/7/sys/amd64/amd64/pmap.c stable/7/sys/arm/arm/pmap.c stable/7/sys/conf/files stable/7/sys/contrib/pf/ (props changed) stable/7/sys/fs/procfs/procfs_map.c stable/7/sys/i386/i386/pmap.c stable/7/sys/ia64/ia64/pmap.c stable/7/sys/kern/kern_proc.c stable/7/sys/sparc64/sparc64/pmap.c stable/7/sys/sys/user.h stable/7/sys/vm/vm.h stable/7/sys/vm/vm_fault.c stable/7/sys/vm/vm_map.c stable/7/sys/vm/vm_meter.c stable/7/sys/vm/vm_object.c stable/7/sys/vm/vm_object.h stable/7/sys/vm/vm_page.c stable/7/sys/vm/vm_pageout.c stable/7/sys/vm/vm_pager.c stable/7/sys/vm/vm_pager.h stable/7/usr.bin/procstat/ (props changed) stable/7/usr.bin/procstat/procstat_vm.c Modified: stable/7/sys/amd64/amd64/pmap.c ============================================================================== --- stable/7/sys/amd64/amd64/pmap.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/amd64/amd64/pmap.c Mon Sep 14 17:34:49 2009 (r197197) @@ -3350,7 +3350,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs int pat_mode; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - KASSERT(object->type == OBJT_DEVICE, + KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG, ("pmap_object_init_pt: non-device object")); if ((addr & (NBPDR - 1)) == 0 && (size & (NBPDR - 1)) == 0) { if (!vm_object_populate(object, pindex, pindex + atop(size))) @@ -4592,7 +4592,8 @@ vm_offset_t pmap_addr_hint(vm_object_t obj, vm_offset_t addr, vm_size_t size) { - if ((obj == NULL) || (size < NBPDR) || (obj->type != OBJT_DEVICE)) { + if ((obj == NULL) || (size < NBPDR) || + (obj->type != OBJT_DEVICE && obj->type != OBJT_SG)) { return addr; } Modified: stable/7/sys/arm/arm/pmap.c ============================================================================== --- stable/7/sys/arm/arm/pmap.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/arm/arm/pmap.c Mon Sep 14 17:34:49 2009 (r197197) @@ -3071,7 +3071,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs { VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - KASSERT(object->type == OBJT_DEVICE, + KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG, ("pmap_object_init_pt: non-device object")); } Modified: stable/7/sys/conf/files ============================================================================== --- stable/7/sys/conf/files Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/conf/files Mon Sep 14 17:34:49 2009 (r197197) @@ -2210,6 +2210,7 @@ vm/default_pager.c standard vm/device_pager.c standard vm/phys_pager.c standard vm/redzone.c optional DEBUG_REDZONE +vm/sg_pager.c standard vm/swap_pager.c standard vm/uma_core.c standard vm/uma_dbg.c standard Modified: stable/7/sys/fs/procfs/procfs_map.c ============================================================================== --- stable/7/sys/fs/procfs/procfs_map.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/fs/procfs/procfs_map.c Mon Sep 14 17:34:49 2009 (r197197) @@ -177,6 +177,7 @@ procfs_doprocmap(PFS_FILL_ARGS) type = "swap"; vp = NULL; break; + case OBJT_SG: case OBJT_DEVICE: type = "device"; vp = NULL; Modified: stable/7/sys/i386/i386/pmap.c ============================================================================== --- stable/7/sys/i386/i386/pmap.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/i386/i386/pmap.c Mon Sep 14 17:34:49 2009 (r197197) @@ -3474,7 +3474,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs int pat_mode; VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - KASSERT(object->type == OBJT_DEVICE, + KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG, ("pmap_object_init_pt: non-device object")); if (pseflag && (addr & (NBPDR - 1)) == 0 && (size & (NBPDR - 1)) == 0) { @@ -4712,7 +4712,8 @@ vm_offset_t pmap_addr_hint(vm_object_t obj, vm_offset_t addr, vm_size_t size) { - if ((obj == NULL) || (size < NBPDR) || (obj->type != OBJT_DEVICE)) { + if ((obj == NULL) || (size < NBPDR) || + (obj->type != OBJT_DEVICE && obj->type != OBJT_SG)) { return addr; } Modified: stable/7/sys/ia64/ia64/pmap.c ============================================================================== --- stable/7/sys/ia64/ia64/pmap.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/ia64/ia64/pmap.c Mon Sep 14 17:34:49 2009 (r197197) @@ -1737,7 +1737,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs { VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - KASSERT(object->type == OBJT_DEVICE, + KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG, ("pmap_object_init_pt: non-device object")); } Modified: stable/7/sys/kern/kern_proc.c ============================================================================== --- stable/7/sys/kern/kern_proc.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/kern/kern_proc.c Mon Sep 14 17:34:49 2009 (r197197) @@ -1488,6 +1488,9 @@ sysctl_kern_proc_ovmmap(SYSCTL_HANDLER_A case OBJT_DEAD: kve->kve_type = KVME_TYPE_DEAD; break; + case OBJT_SG: + kve->kve_type = KVME_TYPE_SG; + break; default: kve->kve_type = KVME_TYPE_UNKNOWN; break; @@ -1659,6 +1662,9 @@ sysctl_kern_proc_vmmap(SYSCTL_HANDLER_AR case OBJT_DEAD: kve->kve_type = KVME_TYPE_DEAD; break; + case OBJT_SG: + kve->kve_type = KVME_TYPE_SG; + break; default: kve->kve_type = KVME_TYPE_UNKNOWN; break; Modified: stable/7/sys/sparc64/sparc64/pmap.c ============================================================================== --- stable/7/sys/sparc64/sparc64/pmap.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/sparc64/sparc64/pmap.c Mon Sep 14 17:34:49 2009 (r197197) @@ -1495,7 +1495,7 @@ pmap_object_init_pt(pmap_t pm, vm_offset { VM_OBJECT_LOCK_ASSERT(object, MA_OWNED); - KASSERT(object->type == OBJT_DEVICE, + KASSERT(object->type == OBJT_DEVICE || object->type == OBJT_SG, ("pmap_object_init_pt: non-device object")); } Modified: stable/7/sys/sys/user.h ============================================================================== --- stable/7/sys/sys/user.h Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/sys/user.h Mon Sep 14 17:34:49 2009 (r197197) @@ -334,6 +334,7 @@ struct kinfo_file { #define KVME_TYPE_DEVICE 4 #define KVME_TYPE_PHYS 5 #define KVME_TYPE_DEAD 6 +#define KVME_TYPE_SG 7 #define KVME_TYPE_UNKNOWN 255 #define KVME_PROT_READ 0x00000001 Copied and modified: stable/7/sys/vm/sg_pager.c (from r195840, head/sys/vm/sg_pager.c) ============================================================================== --- head/sys/vm/sg_pager.c Fri Jul 24 13:50:29 2009 (r195840, copy source) +++ stable/7/sys/vm/sg_pager.c Mon Sep 14 17:34:49 2009 (r197197) @@ -37,6 +37,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -45,7 +46,7 @@ __FBSDID("$FreeBSD$"); static void sg_pager_init(void); static vm_object_t sg_pager_alloc(void *, vm_ooffset_t, vm_prot_t, - vm_ooffset_t, struct ucred *); + vm_ooffset_t); static void sg_pager_dealloc(vm_object_t); static int sg_pager_getpages(vm_object_t, vm_page_t *, int, int); static void sg_pager_putpages(vm_object_t, vm_page_t *, int, @@ -78,7 +79,7 @@ sg_pager_init(void) static vm_object_t sg_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, - vm_ooffset_t foff, struct ucred *cred) + vm_ooffset_t foff) { struct sglist *sg; vm_object_t object; @@ -193,21 +194,18 @@ sg_pager_getpages(vm_object_t object, vm ("backing page for SG is fake")); /* Construct a new fake page. */ - printf("SG: getting fake page for paddr %lx\n", paddr); page = sg_pager_getfake(paddr, memattr); VM_OBJECT_LOCK(object); TAILQ_INSERT_TAIL(&object->un_pager.sgp.sgp_pglist, page, pageq); /* Free the original pages and insert this fake page into the object. */ vm_page_lock_queues(); - for (i = 0; i < count; i++) { - printf("SG: freeing VM page %p\n", m[i]); + for (i = 0; i < count; i++) vm_page_free(m[i]); - } vm_page_unlock_queues(); - printf("SG: Inserting new fake page\n"); vm_page_insert(page, object, offset); m[reqpage] = page; + page->valid = VM_PAGE_BITS_ALL; return (VM_PAGER_OK); } Modified: stable/7/sys/vm/vm.h ============================================================================== --- stable/7/sys/vm/vm.h Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/vm/vm.h Mon Sep 14 17:34:49 2009 (r197197) @@ -89,7 +89,7 @@ typedef u_char vm_prot_t; /* protection #define VM_PROT_DEFAULT VM_PROT_ALL enum obj_type { OBJT_DEFAULT, OBJT_SWAP, OBJT_VNODE, OBJT_DEVICE, OBJT_PHYS, - OBJT_DEAD }; + OBJT_DEAD, OBJT_SG }; typedef u_char objtype_t; union vm_map_object; Modified: stable/7/sys/vm/vm_fault.c ============================================================================== --- stable/7/sys/vm/vm_fault.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/vm/vm_fault.c Mon Sep 14 17:34:49 2009 (r197197) @@ -485,7 +485,8 @@ readrest: (fs.first_object == fs.object || (is_first_object_locked = VM_OBJECT_TRYLOCK(fs.first_object))) && fs.first_object->type != OBJT_DEVICE && - fs.first_object->type != OBJT_PHYS) { + fs.first_object->type != OBJT_PHYS && + fs.first_object->type != OBJT_SG) { vm_pindex_t firstpindex, tmppindex; if (fs.first_pindex < 2 * VM_FAULT_READ) Modified: stable/7/sys/vm/vm_map.c ============================================================================== --- stable/7/sys/vm/vm_map.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/vm/vm_map.c Mon Sep 14 17:34:49 2009 (r197197) @@ -1478,7 +1478,7 @@ vm_map_pmap_enter(vm_map_t map, vm_offse if ((prot & (VM_PROT_READ | VM_PROT_EXECUTE)) == 0 || object == NULL) return; VM_OBJECT_LOCK(object); - if (object->type == OBJT_DEVICE) { + if (object->type == OBJT_DEVICE || object->type == OBJT_SG) { pmap_object_init_pt(map->pmap, addr, object, pindex, size); goto unlock_return; } @@ -1954,7 +1954,8 @@ done: */ vm_fault_unwire(map, entry->start, entry->end, entry->object.vm_object != NULL && - entry->object.vm_object->type == OBJT_DEVICE); + (entry->object.vm_object->type == OBJT_DEVICE || + entry->object.vm_object->type == OBJT_SG)); } } KASSERT(entry->eflags & MAP_ENTRY_IN_TRANSITION, @@ -2073,7 +2074,8 @@ vm_map_wire(vm_map_t map, vm_offset_t st saved_start = entry->start; saved_end = entry->end; fictitious = entry->object.vm_object != NULL && - entry->object.vm_object->type == OBJT_DEVICE; + (entry->object.vm_object->type == OBJT_DEVICE || + entry->object.vm_object->type == OBJT_SG); /* * Release the map lock, relying on the in-transition * mark. @@ -2169,7 +2171,8 @@ done: */ vm_fault_unwire(map, entry->start, entry->end, entry->object.vm_object != NULL && - entry->object.vm_object->type == OBJT_DEVICE); + (entry->object.vm_object->type == OBJT_DEVICE || + entry->object.vm_object->type == OBJT_SG)); } } next_entry_done: @@ -2294,7 +2297,8 @@ vm_map_entry_unwire(vm_map_t map, vm_map { vm_fault_unwire(map, entry->start, entry->end, entry->object.vm_object != NULL && - entry->object.vm_object->type == OBJT_DEVICE); + (entry->object.vm_object->type == OBJT_DEVICE || + entry->object.vm_object->type == OBJT_SG)); entry->wired_count = 0; } Modified: stable/7/sys/vm/vm_meter.c ============================================================================== --- stable/7/sys/vm/vm_meter.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/vm/vm_meter.c Mon Sep 14 17:34:49 2009 (r197197) @@ -211,7 +211,7 @@ vmtotal(SYSCTL_HANDLER_ARGS) * synchronization should not impair the accuracy of * the reported statistics. */ - if (object->type == OBJT_DEVICE) { + if (object->type == OBJT_DEVICE || object->type == OBJT_SG) { /* * Devices, like /dev/mem, will badly skew our totals. */ Modified: stable/7/sys/vm/vm_object.c ============================================================================== --- stable/7/sys/vm/vm_object.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/vm/vm_object.c Mon Sep 14 17:34:49 2009 (r197197) @@ -306,6 +306,7 @@ vm_object_set_memattr(vm_object_t object case OBJT_DEFAULT: case OBJT_DEVICE: case OBJT_PHYS: + case OBJT_SG: case OBJT_SWAP: case OBJT_VNODE: if (!TAILQ_EMPTY(&object->memq)) Modified: stable/7/sys/vm/vm_object.h ============================================================================== --- stable/7/sys/vm/vm_object.h Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/vm/vm_object.h Mon Sep 14 17:34:49 2009 (r197197) @@ -124,6 +124,15 @@ struct vm_object { } devp; /* + * SG pager + * + * sgp_pglist - list of allocated pages + */ + struct { + TAILQ_HEAD(, vm_page) sgp_pglist; + } sgp; + + /* * Swap pager * * swp_bcount - number of swap 'swblock' metablocks, each Modified: stable/7/sys/vm/vm_page.c ============================================================================== --- stable/7/sys/vm/vm_page.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/vm/vm_page.c Mon Sep 14 17:34:49 2009 (r197197) @@ -1149,7 +1149,7 @@ vm_page_alloc(vm_object_t object, vm_pin if (object != NULL) { /* Ignore device objects; the pager sets "memattr" for them. */ if (object->memattr != VM_MEMATTR_DEFAULT && - object->type != OBJT_DEVICE) + object->type != OBJT_DEVICE && object->type != OBJT_SG) pmap_page_set_memattr(m, object->memattr); vm_page_insert(m, object, pindex); } else Modified: stable/7/sys/vm/vm_pageout.c ============================================================================== --- stable/7/sys/vm/vm_pageout.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/vm/vm_pageout.c Mon Sep 14 17:34:49 2009 (r197197) @@ -516,7 +516,9 @@ vm_pageout_object_deactivate_pages(pmap, int actcount, rcount, remove_mode; VM_OBJECT_LOCK_ASSERT(first_object, MA_OWNED); - if (first_object->type == OBJT_DEVICE || first_object->type == OBJT_PHYS) + if (first_object->type == OBJT_DEVICE || + first_object->type == OBJT_SG || + first_object->type == OBJT_PHYS) return; for (object = first_object;; object = backing_object) { if (pmap_resident_count(pmap) <= desired) Modified: stable/7/sys/vm/vm_pager.c ============================================================================== --- stable/7/sys/vm/vm_pager.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/vm/vm_pager.c Mon Sep 14 17:34:49 2009 (r197197) @@ -160,7 +160,8 @@ struct pagerops *pagertab[] = { &vnodepagerops, /* OBJT_VNODE */ &devicepagerops, /* OBJT_DEVICE */ &physpagerops, /* OBJT_PHYS */ - &deadpagerops /* OBJT_DEAD */ + &deadpagerops, /* OBJT_DEAD */ + &sgpagerops /* OBJT_SG */ }; static const int npagers = sizeof(pagertab) / sizeof(pagertab[0]); Modified: stable/7/sys/vm/vm_pager.h ============================================================================== --- stable/7/sys/vm/vm_pager.h Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/sys/vm/vm_pager.h Mon Sep 14 17:34:49 2009 (r197197) @@ -71,6 +71,7 @@ extern struct pagerops swappagerops; extern struct pagerops vnodepagerops; extern struct pagerops devicepagerops; extern struct pagerops physpagerops; +extern struct pagerops sgpagerops; /* * get/put return values Modified: stable/7/usr.bin/procstat/procstat_vm.c ============================================================================== --- stable/7/usr.bin/procstat/procstat_vm.c Mon Sep 14 16:52:38 2009 (r197196) +++ stable/7/usr.bin/procstat/procstat_vm.c Mon Sep 14 17:34:49 2009 (r197197) @@ -93,6 +93,9 @@ procstat_vm(pid_t pid, struct kinfo_proc case KVME_TYPE_DEAD: str = "dd"; break; + case KVME_TYPE_SG: + str = "sg"; + break; case KVME_TYPE_UNKNOWN: default: str = "??"; From owner-svn-src-stable@FreeBSD.ORG Mon Sep 14 17:45:59 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A0871065693; Mon, 14 Sep 2009 17:45:59 +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 EE0548FC0C; Mon, 14 Sep 2009 17:45:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8EHjwYB061686; Mon, 14 Sep 2009 17:45:58 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8EHjwOT061684; Mon, 14 Sep 2009 17:45:58 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200909141745.n8EHjwOT061684@svn.freebsd.org> From: John Baldwin Date: Mon, 14 Sep 2009 17:45:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197198 - stable/7/sys/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2009 17:45:59 -0000 Author: jhb Date: Mon Sep 14 17:45:58 2009 New Revision: 197198 URL: http://svn.freebsd.org/changeset/base/197198 Log: Bump __FreeBSD_version to 702106 for the recent PAT, d_mmap_single(), and OBJT_SG changes. Modified: stable/7/sys/sys/param.h Modified: stable/7/sys/sys/param.h ============================================================================== --- stable/7/sys/sys/param.h Mon Sep 14 17:34:49 2009 (r197197) +++ stable/7/sys/sys/param.h Mon Sep 14 17:45:58 2009 (r197198) @@ -57,7 +57,7 @@ * is created, otherwise 1. */ #undef __FreeBSD_version -#define __FreeBSD_version 702105 /* Master, propagated to newvers */ +#define __FreeBSD_version 702106 /* Master, propagated to newvers */ #ifndef LOCORE #include From owner-svn-src-stable@FreeBSD.ORG Mon Sep 14 17:49:59 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D064B1065672; Mon, 14 Sep 2009 17:49:59 +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 BEB158FC1F; Mon, 14 Sep 2009 17:49:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8EHnxTE061800; Mon, 14 Sep 2009 17:49:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8EHnxCG061799; Mon, 14 Sep 2009 17:49:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200909141749.n8EHnxCG061799@svn.freebsd.org> From: John Baldwin Date: Mon, 14 Sep 2009 17:49:59 +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: r197199 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/coretemp dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 14 Sep 2009 17:49:59 -0000 Author: jhb Date: Mon Sep 14 17:49:59 2009 New Revision: 197199 URL: http://svn.freebsd.org/changeset/base/197199 Log: Fix botched mergeinfo. Approved by: re (kib, bz) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/coretemp/coretemp.c (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 02:23:17 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0ADB6106566C; Tue, 15 Sep 2009 02:23:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id EC97A8FC12; Tue, 15 Sep 2009 02:23:16 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8F2NGBi073049; Tue, 15 Sep 2009 02:23:16 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8F2NGeu073047; Tue, 15 Sep 2009 02:23:16 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <200909150223.n8F2NGeu073047@svn.freebsd.org> From: Ed Maste Date: Tue, 15 Sep 2009 02:23:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197213 - stable/7/sys/cam X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 02:23:17 -0000 Author: emaste Date: Tue Sep 15 02:23:16 2009 New Revision: 197213 URL: http://svn.freebsd.org/changeset/base/197213 Log: MFC r195685: Fix leaks in probestart, probedone, and scsi_scan_bus. Also free page_list using the matching malloc type for the allocation. (In HEAD these functions have moved to scsi_xpt.c) Reviewed by: scottl Modified: stable/7/sys/cam/cam_xpt.c Modified: stable/7/sys/cam/cam_xpt.c ============================================================================== --- stable/7/sys/cam/cam_xpt.c Tue Sep 15 02:22:57 2009 (r197212) +++ stable/7/sys/cam/cam_xpt.c Tue Sep 15 02:23:16 2009 (r197213) @@ -5240,6 +5240,7 @@ xpt_scan_bus(struct cam_periph *periph, } work_ccb = xpt_alloc_ccb_nowait(); if (work_ccb == NULL) { + xpt_free_ccb((union ccb *)scan_info->cpi); free(scan_info, M_CAMXPT); xpt_free_path(path); request_ccb->ccb_h.status = CAM_RESRC_UNAVAIL; @@ -5360,6 +5361,7 @@ xpt_scan_bus(struct cam_periph *periph, } if ((scan_info->cpi->hba_misc & PIM_SEQSCAN) == 0) { + xpt_free_ccb(request_ccb); break; } status = xpt_create_path(&path, xpt_periph, @@ -5828,8 +5830,11 @@ probestart(struct cam_periph *periph, un serial_buf = NULL; device = periph->path->device; - device->serial_num = NULL; - device->serial_num_len = 0; + if (device->serial_num != NULL) { + free(device->serial_num, M_CAMXPT); + device->serial_num = NULL; + device->serial_num_len = 0; + } serial_buf = (struct scsi_vpd_unit_serial_number *) malloc(sizeof(*serial_buf), M_CAMXPT, M_NOWAIT|M_ZERO); @@ -6168,7 +6173,7 @@ probedone(struct cam_periph *periph, uni } if (page_list != NULL) - free(page_list, M_DEVBUF); + free(page_list, M_CAMXPT); if (serialnum_supported) { xpt_release_ccb(done_ccb); From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 11:13:41 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4DC461065694; Tue, 15 Sep 2009 11:13:41 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 379058FC17; Tue, 15 Sep 2009 11:13:41 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FBDf3u086196; Tue, 15 Sep 2009 11:13:41 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FBDeZ1086175; Tue, 15 Sep 2009 11:13:40 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909151113.n8FBDeZ1086175@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 15 Sep 2009 11:13: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: r197215 - in stable/8: . cddl/compat/opensolaris cddl/compat/opensolaris/include cddl/contrib/opensolaris cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/head cddl/contrib/ope... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 11:13:41 -0000 Author: pjd Date: Tue Sep 15 11:13:40 2009 New Revision: 197215 URL: http://svn.freebsd.org/changeset/base/197215 Log: MFC r196456,r196457,r196458,r196662,r196702,r196703,r196919,r196927,r196928, r196943,r196944,r196947,r196950,r196953,r196954,r196965,r196978,r196979, r196980,r196982,r196985,r196992,r197131,r197133,r197150,r197151,r197152, r197153,r197167,r197172,r197177,r197200,r197201: r196456: - Give minclsyspri and maxclsyspri real values (consulted with kmacy). - Honour 'pri' argument for thread_create(). r196457: Set priority of vdev_geom threads and zvol threads to PRIBIO. r196458: - Hide ZFS kernel threads under zfskern process. - Use better (shorter) threads names: 'zvol:worker zvol/tank/vol00' -> 'zvol tank/vol00' 'vdev:worker da0' -> 'vdev da0' r196662: Add missing mountpoint vnode locking. This fixes panic on assertion with DEBUG_VFS_LOCKS and vfs.usermount=1 when regular user tries to mount dataset owned by him. r196702: Remove empty directory. r196703: Backport the 'dirtying dbuf' panic fix from newer ZFS version. Reported by: Thomas Backman r196919: bzero() on-stack argument, so mutex_init() won't misinterpret that the lock is already initialized if we have some garbage on the stack. PR: kern/135480 Reported by: Emil Mikulic r196927: Changing provider size is not really supported by GEOM, but doing so when provider is closed should be ok. When administrator requests to change ZVOL size do it immediately if ZVOL is closed or do it on last ZVOL close. PR: kern/136942 Requested by: Bernard Buri r196928: Teach zdb(8) how to obtain GEOM provider size. PR: kern/133134 Reported by: Philipp Wuensche r196943: - Avoid holding mutex around M_WAITOK allocations. - Add locking for mnt_opt field. r196944: Don't recheck ownership on update mount. This will eliminate LOR between vfs_busy() and mount mutex. We check ownership in vfs_domount() anyway. Noticed by: kib Reviewed by: kib r196947: Defer thread start until we set priority. Reviewed by: kib r196950: Fix detection of file system being shared. Now zfs unshare/destroy/rename command will properly remove exported file systems. r196953: When snapshot mount point is busy (for example we are still in it) we will fail to unmount it, but it won't be removed from the tree, so in that case there is no need to reinsert it. Reported by: trasz r196954: If we have to use avl_find(), optimize a bit and use avl_insert() instead of avl_add() (the latter is actually a wrapper around avl_find() + avl_insert()). Fix similar case in the code that is currently commented out. r196965: Fix reference count leak for a case where snapshot's mount point is updated. r196978: Call ZFS_EXIT() after locking the vnode. r196979: On FreeBSD we don't have to look for snapshot's mount point, because fhtovp method is already called with proper mount point. r196980: When we automatically mount snapshot we want to return vnode of the mount point from the lookup and not covered vnode. This is one of the fixes for using .zfs/ over NFS. r196982: We don't export individual snapshots, so mnt_export field in snapshot's mount point is NULL. That's why when we try to access snapshots over NFS use mnt_export field from the parent file system. r196985: Only log successful commands! Without this fix we log even unsuccessful commands executed by unprivileged users. Action is not really taken, but it is logged to pool history, which might be confusing. Reported by: Denis Ahrens r196992: Implement __assert() for Solaris-specific code. Until now Solaris code was using Solaris prototype for __assert(), but FreeBSD's implementation. Both take different arguments, so we were either core-dumping in assert() or printing garbage. Reported by: avg r197131: Tighten up the check for race in zfs_zget() - ZTOV(zp) can not only contain NULL, but also can point to dead vnode, take that into account. PR: kern/132068 Reported by: Edward Fisk <7ogcg7g02@sneakemail.com>, kris Fix based on patch from: Jaakko Heinonen r197133: - Protect reclaim with z_teardown_inactive_lock. - Be prepared for dbuf to disappear in zfs_reclaim_complete() and check if z_dbuf field is NULL - this might happen in case of rollback or forced unmount between zfs_freebsd_reclaim() and zfs_reclaim_complete(). - On forced unmount wait for all znodes to be destroyed - destruction can be done asynchronously via zfs_reclaim_complete(). r197150: There is a bug where mze_insert() can trigger an assert() of inserting the same entry twice. This bug is not fixed yet, but leads to situation where when try to access corrupted directory the kernel will panic. Until the bug is properly fixed, try to recover from it and log that it happened. Reported by: marck OpenSolaris bug: 6709336 r197151: Be sure not to overflow struct fid. r197152: Extend scope of the z_teardown_lock lock for consistency and "just in case". r197153: When zfs.ko is compiled with debug, make sure that znode and vnode point at each other. r197167: Work-around READDIRPLUS problem with .zfs/ and .zfs/snapshot/ directories by just returning EOPNOTSUPP. This will allow NFS server to fall back to regular READDIR. Note that converting inode number to snapshot's vnode is expensive operation. Snapshots are stored in AVL tree, but based on their names, not inode numbers, so to convert inode to snapshot vnode we have to interate over all snalshots. This is not a problem in OpenSolaris, because in their READDIRPLUS implementation they use VOP_LOOKUP() on d_name, instead of VFS_VGET() on d_fileno as we do. PR: kern/125149 Reported by: Weldon Godfrey Analysis by: Jaakko Heinonen r197172: Add missing \n. Reported by: marck r197177: Support both case: when snapshot is already mounted and when it is not yet mounted. r197200: Modify mount(8) to skip MNT_IGNORE file systems by default, just like df(1) does. This is not POLA violation, because there is no single file system in the base that use MNT_IGNORE currently, although ZFS snapshots will be mounted with MNT_IGNORE after next commit. Reviewed by: kib r197201: - Mount ZFS snapshots with MNT_IGNORE flag, so they are not visible in regular df(1) and mount(8) output. This is a bit smilar to OpenSolaris and follows ZFS route of not listing snapshots by default with 'zfs list' command. - Add UPDATING entry to note that ZFS snapshots are no longer visible in mount(8) and df(1) output by default. Reviewed by: kib Approved by: re (bz) Added: stable/8/cddl/compat/opensolaris/include/assert.h - copied unchanged from r196992, head/cddl/compat/opensolaris/include/assert.h Deleted: stable/8/cddl/contrib/opensolaris/head/assert.h stable/8/sys/cddl/contrib/opensolaris/uts/common/rpc/ Modified: stable/8/UPDATING stable/8/cddl/compat/opensolaris/ (props changed) stable/8/cddl/contrib/opensolaris/ (props changed) stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c stable/8/sbin/mount/ (props changed) stable/8/sbin/mount/mount.8 stable/8/sbin/mount/mount.c stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c stable/8/sys/cddl/compat/opensolaris/sys/mutex.h stable/8/sys/cddl/compat/opensolaris/sys/proc.h stable/8/sys/cddl/compat/opensolaris/sys/vfs.h stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/UPDATING ============================================================================== --- stable/8/UPDATING Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/UPDATING Tue Sep 15 11:13:40 2009 (r197215) @@ -22,6 +22,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 8. to maximize performance. (To disable malloc debugging, run ln -s aj /etc/malloc.conf.) +20090915: + ZFS snapshots are now mounted with MNT_IGNORE flag. Use -v option for + mount(8) and -a option for df(1) to see them. + 20090813: Remove the option STOP_NMI. The default action is now to use NMI only for KDB via the newly introduced function stop_cpus_hard() Copied: stable/8/cddl/compat/opensolaris/include/assert.h (from r196992, head/cddl/compat/opensolaris/include/assert.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/cddl/compat/opensolaris/include/assert.h Tue Sep 15 11:13:40 2009 (r197215, copy of r196992, head/cddl/compat/opensolaris/include/assert.h) @@ -0,0 +1,55 @@ +/*- + * Copyright (c) 2009 Pawel Jakub Dawidek + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#undef assert +#undef _assert + +#ifdef NDEBUG +#define assert(e) ((void)0) +#define _assert(e) ((void)0) +#else +#define _assert(e) assert(e) + +#define assert(e) ((e) ? (void)0 : __assert(#e, __FILE__, __LINE__)) +#endif /* NDEBUG */ + +#ifndef _ASSERT_H_ +#define _ASSERT_H_ +#include +#include + +static __inline void +__assert(const char *expr, const char *file, int line) +{ + + (void)fprintf(stderr, "Assertion failed: (%s), file %s, line %d.\n", + expr, file, line); + abort(); + /* NOTREACHED */ +} +#endif /* !_ASSERT_H_ */ Modified: stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/cddl/contrib/opensolaris/cmd/zdb/zdb.c Tue Sep 15 11:13:40 2009 (r197215) @@ -1322,6 +1322,14 @@ dump_label(const char *dev) exit(1); } + if (S_ISCHR(statbuf.st_mode)) { + if (ioctl(fd, DIOCGMEDIASIZE, &statbuf.st_size) == -1) { + (void) printf("failed to get size of '%s': %s\n", dev, + strerror(errno)); + exit(1); + } + } + psize = statbuf.st_size; psize = P2ALIGN(psize, (uint64_t)sizeof (vdev_label_t)); Modified: stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c ============================================================================== --- stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c Tue Sep 15 11:13:40 2009 (r197215) @@ -172,6 +172,7 @@ is_shared(libzfs_handle_t *hdl, const ch *tab = '\0'; if (strcmp(buf, mountpoint) == 0) { +#if defined(sun) /* * the protocol field is the third field * skip over second field @@ -194,6 +195,10 @@ is_shared(libzfs_handle_t *hdl, const ch return (0); } } +#else + if (proto == PROTO_NFS) + return (SHARED_NFS); +#endif } } Modified: stable/8/sbin/mount/mount.8 ============================================================================== --- stable/8/sbin/mount/mount.8 Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sbin/mount/mount.8 Tue Sep 15 11:13:40 2009 (r197215) @@ -469,6 +469,12 @@ or option. .It Fl v Verbose mode. +If the +.Fl v +is used alone, show all file systems, including those that were mounted with the +.Dv MNT_IGNORE +flag and show additional information about each file system (including fsid +when run by root). .It Fl w The file system object is to be read and write. .El Modified: stable/8/sbin/mount/mount.c ============================================================================== --- stable/8/sbin/mount/mount.c Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sbin/mount/mount.c Tue Sep 15 11:13:40 2009 (r197215) @@ -348,6 +348,9 @@ main(int argc, char *argv[]) if (checkvfsname(mntbuf[i].f_fstypename, vfslist)) continue; + if (!verbose && + (mntbuf[i].f_flags & MNT_IGNORE) != 0) + continue; prmount(&mntbuf[i]); } } Modified: stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c Tue Sep 15 11:13:40 2009 (r197215) @@ -45,20 +45,33 @@ vfs_setmntopt(vfs_t *vfsp, const char *n { struct vfsopt *opt; size_t namesize; + int locked; + + if (!(locked = mtx_owned(MNT_MTX(vfsp)))) + MNT_ILOCK(vfsp); if (vfsp->mnt_opt == NULL) { - vfsp->mnt_opt = malloc(sizeof(*vfsp->mnt_opt), M_MOUNT, M_WAITOK); - TAILQ_INIT(vfsp->mnt_opt); + void *opts; + + MNT_IUNLOCK(vfsp); + opts = malloc(sizeof(*vfsp->mnt_opt), M_MOUNT, M_WAITOK); + MNT_ILOCK(vfsp); + if (vfsp->mnt_opt == NULL) { + vfsp->mnt_opt = opts; + TAILQ_INIT(vfsp->mnt_opt); + } else { + free(opts, M_MOUNT); + } } - opt = malloc(sizeof(*opt), M_MOUNT, M_WAITOK); + MNT_IUNLOCK(vfsp); + opt = malloc(sizeof(*opt), M_MOUNT, M_WAITOK); namesize = strlen(name) + 1; opt->name = malloc(namesize, M_MOUNT, M_WAITOK); strlcpy(opt->name, name, namesize); opt->pos = -1; opt->seen = 1; - if (arg == NULL) { opt->value = NULL; opt->len = 0; @@ -67,16 +80,23 @@ vfs_setmntopt(vfs_t *vfsp, const char *n opt->value = malloc(opt->len, M_MOUNT, M_WAITOK); bcopy(arg, opt->value, opt->len); } - /* TODO: Locking. */ + + MNT_ILOCK(vfsp); TAILQ_INSERT_TAIL(vfsp->mnt_opt, opt, link); + if (!locked) + MNT_IUNLOCK(vfsp); } void vfs_clearmntopt(vfs_t *vfsp, const char *name) { + int locked; - /* TODO: Locking. */ + if (!(locked = mtx_owned(MNT_MTX(vfsp)))) + MNT_ILOCK(vfsp); vfs_deleteopt(vfsp->mnt_opt, name); + if (!locked) + MNT_IUNLOCK(vfsp); } int @@ -92,12 +112,13 @@ vfs_optionisset(const vfs_t *vfsp, const } int -domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath, +mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, char *fspath, char *fspec, int fsflags) { struct mount *mp; struct vfsconf *vfsp; struct ucred *cr; + vnode_t *vp; int error; /* @@ -112,23 +133,28 @@ domount(kthread_t *td, vnode_t *vp, cons if (vfsp == NULL) return (ENODEV); + vp = *vpp; if (vp->v_type != VDIR) return (ENOTDIR); + /* + * We need vnode lock to protect v_mountedhere and vnode interlock + * to protect v_iflag. + */ + vn_lock(vp, LK_SHARED | LK_RETRY); VI_LOCK(vp); - if ((vp->v_iflag & VI_MOUNT) != 0 || - vp->v_mountedhere != NULL) { + if ((vp->v_iflag & VI_MOUNT) != 0 || vp->v_mountedhere != NULL) { VI_UNLOCK(vp); + VOP_UNLOCK(vp, 0); return (EBUSY); } vp->v_iflag |= VI_MOUNT; VI_UNLOCK(vp); + VOP_UNLOCK(vp, 0); /* * Allocate and initialize the filesystem. */ - vn_lock(vp, LK_SHARED | LK_RETRY); mp = vfs_mount_alloc(vp, vfsp, fspath, td->td_ucred); - VOP_UNLOCK(vp, 0); mp->mnt_optnew = NULL; vfs_setmntopt(mp, "from", fspec, 0); @@ -138,11 +164,18 @@ domount(kthread_t *td, vnode_t *vp, cons /* * Set the mount level flags. */ - if (fsflags & MNT_RDONLY) - mp->mnt_flag |= MNT_RDONLY; - mp->mnt_flag &=~ MNT_UPDATEMASK; + mp->mnt_flag &= ~MNT_UPDATEMASK; mp->mnt_flag |= fsflags & (MNT_UPDATEMASK | MNT_FORCE | MNT_ROOTFS); /* + * Snapshots are always read-only. + */ + mp->mnt_flag |= MNT_RDONLY; + /* + * We don't want snapshots to be visible in regular + * mount(8) and df(1) output. + */ + mp->mnt_flag |= MNT_IGNORE; + /* * Unprivileged user can trigger mounting a snapshot, but we don't want * him to unmount it, so we switch to privileged of original mount. */ @@ -150,11 +183,6 @@ domount(kthread_t *td, vnode_t *vp, cons mp->mnt_cred = crdup(vp->v_mount->mnt_cred); mp->mnt_stat.f_owner = mp->mnt_cred->cr_uid; /* - * Mount the filesystem. - * XXX The final recipients of VFS_MOUNT just overwrite the ndp they - * get. No freeing of cn_pnbuf. - */ - /* * XXX: This is evil, but we can't mount a snapshot as a regular user. * XXX: Is is safe when snapshot is mounted from within a jail? */ @@ -163,7 +191,7 @@ domount(kthread_t *td, vnode_t *vp, cons error = VFS_MOUNT(mp); td->td_ucred = cr; - if (!error) { + if (error == 0) { if (mp->mnt_opt != NULL) vfs_freeopts(mp->mnt_opt); mp->mnt_opt = mp->mnt_optnew; @@ -175,42 +203,33 @@ domount(kthread_t *td, vnode_t *vp, cons */ mp->mnt_optnew = NULL; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); - /* - * Put the new filesystem on the mount list after root. - */ #ifdef FREEBSD_NAMECACHE cache_purge(vp); #endif - if (!error) { + VI_LOCK(vp); + vp->v_iflag &= ~VI_MOUNT; + VI_UNLOCK(vp); + if (error == 0) { vnode_t *mvp; - VI_LOCK(vp); - vp->v_iflag &= ~VI_MOUNT; - VI_UNLOCK(vp); vp->v_mountedhere = mp; + /* + * Put the new filesystem on the mount list. + */ mtx_lock(&mountlist_mtx); TAILQ_INSERT_TAIL(&mountlist, mp, mnt_list); mtx_unlock(&mountlist_mtx); vfs_event_signal(NULL, VQ_MOUNT, 0); if (VFS_ROOT(mp, LK_EXCLUSIVE, &mvp)) panic("mount: lost mount"); - mountcheckdirs(vp, mvp); - vput(mvp); - VOP_UNLOCK(vp, 0); - if ((mp->mnt_flag & MNT_RDONLY) == 0) - error = vfs_allocate_syncvnode(mp); + vput(vp); vfs_unbusy(mp); - if (error) - vrele(vp); - else - vfs_mountedfrom(mp, fspec); + *vpp = mvp; } else { - VI_LOCK(vp); - vp->v_iflag &= ~VI_MOUNT; - VI_UNLOCK(vp); - VOP_UNLOCK(vp, 0); + vput(vp); vfs_unbusy(mp); vfs_mount_destroy(mp); + *vpp = NULL; } return (error); } Modified: stable/8/sys/cddl/compat/opensolaris/sys/mutex.h ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/sys/mutex.h Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/compat/opensolaris/sys/mutex.h Tue Sep 15 11:13:40 2009 (r197215) @@ -32,9 +32,9 @@ #ifdef _KERNEL #include -#include #include #include_next +#include #include typedef enum { Modified: stable/8/sys/cddl/compat/opensolaris/sys/proc.h ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/sys/proc.h Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/compat/opensolaris/sys/proc.h Tue Sep 15 11:13:40 2009 (r197215) @@ -34,13 +34,17 @@ #include_next #include #include +#include +#include +#include +#include #include #ifdef _KERNEL #define CPU curcpu -#define minclsyspri 0 -#define maxclsyspri 0 +#define minclsyspri PRIBIO +#define maxclsyspri PVM #define max_ncpus mp_ncpus #define boot_max_ncpus mp_ncpus @@ -54,11 +58,13 @@ typedef struct thread kthread_t; typedef struct thread *kthread_id_t; typedef struct proc proc_t; +extern struct proc *zfsproc; + static __inline kthread_t * thread_create(caddr_t stk, size_t stksize, void (*proc)(void *), void *arg, size_t len, proc_t *pp, int state, pri_t pri) { - proc_t *p; + kthread_t *td = NULL; int error; /* @@ -67,13 +73,20 @@ thread_create(caddr_t stk, size_t stksiz ASSERT(stk == NULL); ASSERT(len == 0); ASSERT(state == TS_RUN); + ASSERT(pp == &p0); - error = kproc_create(proc, arg, &p, 0, stksize / PAGE_SIZE, - "solthread %p", proc); - return (error == 0 ? FIRST_THREAD_IN_PROC(p) : NULL); + error = kproc_kthread_add(proc, arg, &zfsproc, &td, RFSTOPPED, + stksize / PAGE_SIZE, "zfskern", "solthread %p", proc); + if (error == 0) { + thread_lock(td); + sched_prio(td, pri); + sched_add(td, SRQ_BORING); + thread_unlock(td); + } + return (td); } -#define thread_exit() kproc_exit(0) +#define thread_exit() kthread_exit() #endif /* _KERNEL */ Modified: stable/8/sys/cddl/compat/opensolaris/sys/vfs.h ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/sys/vfs.h Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/compat/opensolaris/sys/vfs.h Tue Sep 15 11:13:40 2009 (r197215) @@ -110,8 +110,8 @@ void vfs_setmntopt(vfs_t *vfsp, const ch int flags __unused); void vfs_clearmntopt(vfs_t *vfsp, const char *name); int vfs_optionisset(const vfs_t *vfsp, const char *opt, char **argp); -int domount(kthread_t *td, vnode_t *vp, const char *fstype, char *fspath, - char *fspec, int fsflags); +int mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, + char *fspath, char *fspec, int fsflags); typedef uint64_t vfs_feature_t; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c Tue Sep 15 11:13:40 2009 (r197215) @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -864,10 +864,11 @@ restore_object(struct restorearg *ra, ob /* currently allocated, want to be allocated */ dmu_tx_hold_bonus(tx, drro->drr_object); /* - * We may change blocksize, so need to - * hold_write + * We may change blocksize and delete old content, + * so need to hold_write and hold_free. */ dmu_tx_hold_write(tx, drro->drr_object, 0, 1); + dmu_tx_hold_free(tx, drro->drr_object, 0, DMU_OBJECT_END); err = dmu_tx_assign(tx, TXG_WAIT); if (err) { dmu_tx_abort(tx); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c Tue Sep 15 11:13:40 2009 (r197215) @@ -415,7 +415,7 @@ void dnode_reallocate(dnode_t *dn, dmu_object_type_t ot, int blocksize, dmu_object_type_t bonustype, int bonuslen, dmu_tx_t *tx) { - int i, old_nblkptr; + int i, nblkptr; dmu_buf_impl_t *db = NULL; ASSERT3U(blocksize, >=, SPA_MINBLOCKSIZE); @@ -445,6 +445,8 @@ dnode_reallocate(dnode_t *dn, dmu_object dnode_free_range(dn, 0, -1ULL, tx); } + nblkptr = 1 + ((DN_MAX_BONUSLEN - bonuslen) >> SPA_BLKPTRSHIFT); + /* change blocksize */ rw_enter(&dn->dn_struct_rwlock, RW_WRITER); if (blocksize != dn->dn_datablksz && @@ -457,6 +459,8 @@ dnode_reallocate(dnode_t *dn, dmu_object dnode_setdirty(dn, tx); dn->dn_next_bonuslen[tx->tx_txg&TXG_MASK] = bonuslen; dn->dn_next_blksz[tx->tx_txg&TXG_MASK] = blocksize; + if (dn->dn_nblkptr != nblkptr) + dn->dn_next_nblkptr[tx->tx_txg&TXG_MASK] = nblkptr; rw_exit(&dn->dn_struct_rwlock); if (db) dbuf_rele(db, FTAG); @@ -466,19 +470,15 @@ dnode_reallocate(dnode_t *dn, dmu_object /* change bonus size and type */ mutex_enter(&dn->dn_mtx); - old_nblkptr = dn->dn_nblkptr; dn->dn_bonustype = bonustype; dn->dn_bonuslen = bonuslen; - dn->dn_nblkptr = 1 + ((DN_MAX_BONUSLEN - bonuslen) >> SPA_BLKPTRSHIFT); + dn->dn_nblkptr = nblkptr; dn->dn_checksum = ZIO_CHECKSUM_INHERIT; dn->dn_compress = ZIO_COMPRESS_INHERIT; ASSERT3U(dn->dn_nblkptr, <=, DN_MAX_NBLKPTR); - /* XXX - for now, we can't make nblkptr smaller */ - ASSERT3U(dn->dn_nblkptr, >=, old_nblkptr); - - /* fix up the bonus db_size if dn_nblkptr has changed */ - if (dn->dn_bonus && dn->dn_bonuslen != old_nblkptr) { + /* fix up the bonus db_size */ + if (dn->dn_bonus) { dn->dn_bonus->db.db_size = DN_MAX_BONUSLEN - (dn->dn_nblkptr-1) * sizeof (blkptr_t); ASSERT(dn->dn_bonuslen <= dn->dn_bonus->db.db_size); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c Tue Sep 15 11:13:40 2009 (r197215) @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include #include #include @@ -534,18 +532,12 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx) /* XXX shouldn't the phys already be zeroed? */ bzero(dnp, DNODE_CORE_SIZE); dnp->dn_nlevels = 1; + dnp->dn_nblkptr = dn->dn_nblkptr; } - if (dn->dn_nblkptr > dnp->dn_nblkptr) { - /* zero the new blkptrs we are gaining */ - bzero(dnp->dn_blkptr + dnp->dn_nblkptr, - sizeof (blkptr_t) * - (dn->dn_nblkptr - dnp->dn_nblkptr)); - } dnp->dn_type = dn->dn_type; dnp->dn_bonustype = dn->dn_bonustype; dnp->dn_bonuslen = dn->dn_bonuslen; - dnp->dn_nblkptr = dn->dn_nblkptr; } ASSERT(dnp->dn_nlevels > 1 || @@ -605,6 +597,30 @@ dnode_sync(dnode_t *dn, dmu_tx_t *tx) return; } + if (dn->dn_next_nblkptr[txgoff]) { + /* this should only happen on a realloc */ + ASSERT(dn->dn_allocated_txg == tx->tx_txg); + if (dn->dn_next_nblkptr[txgoff] > dnp->dn_nblkptr) { + /* zero the new blkptrs we are gaining */ + bzero(dnp->dn_blkptr + dnp->dn_nblkptr, + sizeof (blkptr_t) * + (dn->dn_next_nblkptr[txgoff] - dnp->dn_nblkptr)); +#ifdef ZFS_DEBUG + } else { + int i; + ASSERT(dn->dn_next_nblkptr[txgoff] < dnp->dn_nblkptr); + /* the blkptrs we are losing better be unallocated */ + for (i = dn->dn_next_nblkptr[txgoff]; + i < dnp->dn_nblkptr; i++) + ASSERT(BP_IS_HOLE(&dnp->dn_blkptr[i])); +#endif + } + mutex_enter(&dn->dn_mtx); + dnp->dn_nblkptr = dn->dn_next_nblkptr[txgoff]; + dn->dn_next_nblkptr[txgoff] = 0; + mutex_exit(&dn->dn_mtx); + } + if (dn->dn_next_nlevels[txgoff]) { dnode_increase_indirection(dn, tx); dn->dn_next_nlevels[txgoff] = 0; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c Tue Sep 15 11:13:40 2009 (r197215) @@ -1419,6 +1419,7 @@ dsl_dataset_drain_refs(dsl_dataset_t *ds { struct refsarg arg; + bzero(&arg, sizeof(arg)); mutex_init(&arg.lock, NULL, MUTEX_DEFAULT, NULL); cv_init(&arg.cv, NULL, CV_DEFAULT, NULL); arg.gone = FALSE; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h Tue Sep 15 11:13:40 2009 (r197215) @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -160,6 +160,7 @@ typedef struct dnode { uint16_t dn_datablkszsec; /* in 512b sectors */ uint32_t dn_datablksz; /* in bytes */ uint64_t dn_maxblkid; + uint8_t dn_next_nblkptr[TXG_SIZE]; uint8_t dn_next_nlevels[TXG_SIZE]; uint8_t dn_next_indblkshift[TXG_SIZE]; uint16_t dn_next_bonuslen[TXG_SIZE]; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h Tue Sep 15 11:13:40 2009 (r197215) @@ -231,8 +231,27 @@ typedef struct znode { /* * Convert between znode pointers and vnode pointers */ +#ifdef DEBUG +static __inline vnode_t * +ZTOV(znode_t *zp) +{ + vnode_t *vp = zp->z_vnode; + + ASSERT(vp == NULL || vp->v_data == NULL || vp->v_data == zp); + return (vp); +} +static __inline znode_t * +VTOZ(vnode_t *vp) +{ + znode_t *zp = (znode_t *)vp->v_data; + + ASSERT(zp == NULL || zp->z_vnode == NULL || zp->z_vnode == vp); + return (zp); +} +#else #define ZTOV(ZP) ((ZP)->z_vnode) #define VTOZ(VP) ((znode_t *)(VP)->v_data) +#endif /* * ZFS_ENTER() is called on entry to each ZFS vnode and vfs operation. Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c Tue Sep 15 11:13:40 2009 (r197215) @@ -194,6 +194,10 @@ vdev_geom_worker(void *arg) zio_t *zio; struct bio *bp; + thread_lock(curthread); + sched_prio(curthread, PRIBIO); + thread_unlock(curthread); + ctx = arg; for (;;) { mtx_lock(&ctx->gc_queue_mtx); @@ -203,7 +207,7 @@ vdev_geom_worker(void *arg) ctx->gc_state = 2; wakeup_one(&ctx->gc_state); mtx_unlock(&ctx->gc_queue_mtx); - kproc_exit(0); + kthread_exit(); } msleep(&ctx->gc_queue, &ctx->gc_queue_mtx, PRIBIO | PDROP, "vgeom:io", 0); @@ -530,8 +534,8 @@ vdev_geom_open(vdev_t *vd, uint64_t *psi vd->vdev_tsd = ctx; pp = cp->provider; - kproc_create(vdev_geom_worker, ctx, NULL, 0, 0, "vdev:worker %s", - pp->name); + kproc_kthread_add(vdev_geom_worker, ctx, &zfsproc, NULL, 0, 0, + "zfskern", "vdev %s", pp->name); /* * Determine the actual size of the device. Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c Tue Sep 15 11:13:40 2009 (r197215) @@ -181,10 +181,11 @@ mze_compare(const void *arg1, const void return (0); } -static void +static int mze_insert(zap_t *zap, int chunkid, uint64_t hash, mzap_ent_phys_t *mzep) { mzap_ent_t *mze; + avl_index_t idx; ASSERT(zap->zap_ismicro); ASSERT(RW_WRITE_HELD(&zap->zap_rwlock)); @@ -194,7 +195,12 @@ mze_insert(zap_t *zap, int chunkid, uint mze->mze_chunkid = chunkid; mze->mze_hash = hash; mze->mze_phys = *mzep; - avl_add(&zap->zap_m.zap_avl, mze); + if (avl_find(&zap->zap_m.zap_avl, mze, &idx) != NULL) { + kmem_free(mze, sizeof (mzap_ent_t)); + return (EEXIST); + } + avl_insert(&zap->zap_m.zap_avl, mze, idx); + return (0); } static mzap_ent_t * @@ -329,10 +335,15 @@ mzap_open(objset_t *os, uint64_t obj, dm if (mze->mze_name[0]) { zap_name_t *zn; - zap->zap_m.zap_num_entries++; zn = zap_name_alloc(zap, mze->mze_name, MT_EXACT); - mze_insert(zap, i, zn->zn_hash, mze); + if (mze_insert(zap, i, zn->zn_hash, mze) == 0) + zap->zap_m.zap_num_entries++; + else { + printf("ZFS WARNING: Duplicated ZAP " + "entry detected (%s).\n", + mze->mze_name); + } zap_name_free(zn); } } @@ -771,7 +782,7 @@ again: if (zap->zap_m.zap_alloc_next == zap->zap_m.zap_num_chunks) zap->zap_m.zap_alloc_next = 0; - mze_insert(zap, i, zn->zn_hash, mze); + VERIFY(0 == mze_insert(zap, i, zn->zn_hash, mze)); return; } } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c Tue Sep 15 11:13:40 2009 (r197215) @@ -669,9 +669,12 @@ zfsctl_snapdir_remove(vnode_t *dvp, char if (sep) { avl_remove(&sdp->sd_snaps, sep); err = zfsctl_unmount_snap(sep, MS_FORCE, cr); - if (err) - avl_add(&sdp->sd_snaps, sep); - else + if (err) { + avl_index_t where; + + if (avl_find(&sdp->sd_snaps, sep, &where) == NULL) + avl_insert(&sdp->sd_snaps, sep, where); + } else err = dmu_objset_destroy(snapname); } else { err = ENOENT; @@ -877,20 +880,20 @@ domount: mountpoint = kmem_alloc(mountpoint_len, KM_SLEEP); (void) snprintf(mountpoint, mountpoint_len, "%s/.zfs/snapshot/%s", dvp->v_vfsp->mnt_stat.f_mntonname, nm); - err = domount(curthread, *vpp, "zfs", mountpoint, snapname, 0); + err = mount_snapshot(curthread, vpp, "zfs", mountpoint, snapname, 0); kmem_free(mountpoint, mountpoint_len); - /* FreeBSD: This line was moved from below to avoid a lock recursion. */ - if (err == 0) - vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); - mutex_exit(&sdp->sd_lock); - /* - * If we had an error, drop our hold on the vnode and - * zfsctl_snapshot_inactive() will clean up. - */ - if (err) { - VN_RELE(*vpp); - *vpp = NULL; + if (err == 0) { + /* + * Fix up the root vnode mounted on .zfs/snapshot/. + * + * This is where we lie about our v_vfsp in order to + * make .zfs/snapshot/ accessible over NFS + * without requiring manual mounts of . + */ + ASSERT(VTOZ(*vpp)->z_zfsvfs != zfsvfs); + VTOZ(*vpp)->z_zfsvfs->z_parent = zfsvfs; } + mutex_exit(&sdp->sd_lock); ZFS_EXIT(zfsvfs); return (err); } @@ -1344,7 +1347,17 @@ zfsctl_umount_snapshots(vfs_t *vfsp, int if (vn_ismntpt(sep->se_root)) { error = zfsctl_unmount_snap(sep, fflags, cr); if (error) { - avl_add(&sdp->sd_snaps, sep); + avl_index_t where; + + /* + * Before reinserting snapshot to the tree, + * check if it was actually removed. For example + * when snapshot mount point is busy, we will + * have an error here, but there will be no need + * to reinsert snapshot. + */ + if (avl_find(&sdp->sd_snaps, sep, &where) == NULL) + avl_insert(&sdp->sd_snaps, sep, where); break; } } Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Sep 15 11:13:40 2009 (r197215) @@ -3021,8 +3021,10 @@ zfsdev_ioctl(struct cdev *dev, u_long cm if (error == 0) error = zfs_ioc_vec[vec].zvec_func(zc); - if (zfs_ioc_vec[vec].zvec_his_log == B_TRUE) - zfs_log_history(zc); + if (error == 0) { + if (zfs_ioc_vec[vec].zvec_his_log == B_TRUE) + zfs_log_history(zc); + } return (error); } @@ -3057,6 +3059,7 @@ zfsdev_fini(void) } static struct root_hold_token *zfs_root_token; +struct proc *zfsproc; uint_t zfs_fsyncer_key; extern uint_t rrw_tsd_key; Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 15 02:25:03 2009 (r197214) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 15 11:13:40 2009 (r197215) @@ -97,6 +97,8 @@ static int zfs_root(vfs_t *vfsp, int fla static int zfs_statfs(vfs_t *vfsp, struct statfs *statp); static int zfs_vget(vfs_t *vfsp, ino_t ino, int flags, vnode_t **vpp); static int zfs_sync(vfs_t *vfsp, int waitfor); +static int zfs_checkexp(vfs_t *vfsp, struct sockaddr *nam, int *extflagsp, + struct ucred **credanonp, int *numsecflavors, int **secflavors); static int zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp); static void zfs_objset_close(zfsvfs_t *zfsvfs); static void zfs_freevfs(vfs_t *vfsp); @@ -108,6 +110,7 @@ static struct vfsops zfs_vfsops = { .vfs_statfs = zfs_statfs, .vfs_vget = zfs_vget, .vfs_sync = zfs_sync, + .vfs_checkexp = zfs_checkexp, .vfs_fhtovp = zfs_fhtovp, }; @@ -337,6 +340,13 @@ zfs_register_callbacks(vfs_t *vfsp) os = zfsvfs->z_os; /* + * This function can be called for a snapshot when we update snapshot's + * mount point, which isn't really supported. + */ + if (dmu_objset_is_snapshot(os)) + return (EOPNOTSUPP); + + /* * The act of registering our callbacks will destroy any mount * options we may have. In order to enable temporary overrides * of mount options, we stash away the current values and @@ -719,7 +729,10 @@ zfs_mount(vfs_t *vfsp) error = secpolicy_fs_mount(cr, mvp, vfsp); if (error) { error = dsl_deleg_access(osname, ZFS_DELEG_PERM_MOUNT, cr); - if (error == 0) { + if (error != 0) + goto out; + + if (!(vfsp->vfs_flag & MS_REMOUNT)) { vattr_t vattr; /* @@ -729,7 +742,9 @@ zfs_mount(vfs_t *vfsp) vattr.va_mask = AT_UID; + vn_lock(mvp, LK_SHARED | LK_RETRY); if (error = VOP_GETATTR(mvp, &vattr, cr)) { + VOP_UNLOCK(mvp, 0); goto out; } @@ -741,18 +756,19 @@ zfs_mount(vfs_t *vfsp) } #else if (error = secpolicy_vnode_owner(mvp, cr, vattr.va_uid)) { + VOP_UNLOCK(mvp, 0); goto out; } if (error = VOP_ACCESS(mvp, VWRITE, cr, td)) { + VOP_UNLOCK(mvp, 0); goto out; } + VOP_UNLOCK(mvp, 0); #endif - - secpolicy_fs_mount_clearopts(cr, vfsp); - } else { - goto out; } + + secpolicy_fs_mount_clearopts(cr, vfsp); } /* @@ -931,6 +947,18 @@ zfsvfs_teardown(zfsvfs_t *zfsvfs, boolea zfsvfs->z_unmounted = B_TRUE; rrw_exit(&zfsvfs->z_teardown_lock, FTAG); rw_exit(&zfsvfs->z_teardown_inactive_lock); + +#ifdef __FreeBSD__ + /* + * Some znodes might not be fully reclaimed, wait for them. + */ + mutex_enter(&zfsvfs->z_znodes_lock); + while (list_head(&zfsvfs->z_all_znodes) != NULL) { + msleep(zfsvfs, &zfsvfs->z_znodes_lock, 0, + "zteardown", 0); + } + mutex_exit(&zfsvfs->z_znodes_lock); +#endif } /* @@ -1086,6 +1114,20 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla znode_t *zp; int err; + /* + * XXXPJD: zfs_zget() can't operate on virtual entires like .zfs/ or + * .zfs/snapshot/ directories, so for now just return EOPNOTSUPP. + * This will make NFS to fall back to using READDIR instead of + * READDIRPLUS. + * Also snapshots are stored in AVL tree, but based on their names, + * not inode numbers, so it will be very inefficient to iterate + * over all snapshots to find the right one. + * Note that OpenSolaris READDIRPLUS implementation does LOOKUP on + * d_name, and not VGET on d_fileno as we do. + */ + if (ino == ZFSCTL_INO_ROOT || ino == ZFSCTL_INO_SNAPDIR) + return (EOPNOTSUPP); + ZFS_ENTER(zfsvfs); err = zfs_zget(zfsvfs, ino, &zp); if (err == 0 && zp->z_unlinked) { @@ -1103,6 +1145,28 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla } static int +zfs_checkexp(vfs_t *vfsp, struct sockaddr *nam, int *extflagsp, + struct ucred **credanonp, int *numsecflavors, int **secflavors) +{ + zfsvfs_t *zfsvfs = vfsp->vfs_data; + + /* + * If this is regular file system vfsp is the same as + * zfsvfs->z_parent->z_vfs, but if it is snapshot, + * zfsvfs->z_parent->z_vfs represents parent file system + * which we have to use here, because only this file system + * has mnt_export configured. + */ + vfsp = zfsvfs->z_parent->z_vfs; + + return (vfs_stdcheckexp(zfsvfs->z_parent->z_vfs, nam, extflagsp, + credanonp, numsecflavors, secflavors)); +} + +CTASSERT(SHORT_FID_LEN <= sizeof(struct fid)); +CTASSERT(LONG_FID_LEN <= sizeof(struct fid)); + +static int zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vnode_t **vpp) { zfsvfs_t *zfsvfs = vfsp->vfs_data; @@ -1117,7 +1181,11 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vno ZFS_ENTER(zfsvfs); - if (fidp->fid_len == LONG_FID_LEN) { + /* + * On FreeBSD we can get snapshot's mount point or its parent file + * system mount point depending if snapshot is already mounted or not. + */ + if (zfsvfs->z_parent == zfsvfs && fidp->fid_len == LONG_FID_LEN) { zfid_long_t *zlfid = (zfid_long_t *)fidp; uint64_t objsetid = 0; uint64_t setgen = 0; @@ -1160,9 +1228,8 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vno } else { VN_HOLD(*vpp); } - ZFS_EXIT(zfsvfs); - /* XXX: LK_RETRY? */ vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); + ZFS_EXIT(zfsvfs); return (0); } @@ -1184,7 +1251,6 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vno } *vpp = ZTOV(zp); - /* XXX: LK_RETRY? */ vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); vnode_create_vobject(*vpp, zp->z_phys->zp_size, curthread); ZFS_EXIT(zfsvfs); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 11:20:23 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0EE71065672; Tue, 15 Sep 2009 11:20:23 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DDA428FC16; Tue, 15 Sep 2009 11:20:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FBKNxB086423; Tue, 15 Sep 2009 11:20:23 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FBKNhD086421; Tue, 15 Sep 2009 11:20:23 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909151120.n8FBKNhD086421@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 15 Sep 2009 11:20:23 +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: r197216 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci nfsserver X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 11:20:24 -0000 Author: pjd Date: Tue Sep 15 11:20:23 2009 New Revision: 197216 URL: http://svn.freebsd.org/changeset/base/197216 Log: MFC r197039, r197040: Fix usecount leak in mknod(2) on file system exported over NFS. While I'm here, correct typo in comment. Reviewed by: kan, kib Approved by: re (bz) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) stable/8/sys/nfsserver/nfs_serv.c Modified: stable/8/sys/nfsserver/nfs_serv.c ============================================================================== --- stable/8/sys/nfsserver/nfs_serv.c Tue Sep 15 11:13:40 2009 (r197215) +++ stable/8/sys/nfsserver/nfs_serv.c Tue Sep 15 11:20:23 2009 (r197216) @@ -1686,7 +1686,7 @@ out: if (dirp) { vn_lock(dirp, LK_EXCLUSIVE | LK_RETRY); diraft_ret = VOP_GETATTR(dirp, &diraft, cred); - VOP_UNLOCK(dirp, 0); + vput(dirp); } ereply: nfsm_reply(NFSX_SRVFH(1) + NFSX_POSTOPATTR(1) + NFSX_WCCDATA(1)); @@ -3825,7 +3825,7 @@ nfsmout: * what the heck. * * The exception to rule 2 is EPERM. If a file is IMMUTABLE, VOP_ACCESS() - * will return EPERM instead of EACCESS. EPERM is always an error. + * will return EPERM instead of EACCES. EPERM is always an error. */ static int nfsrv_access(struct vnode *vp, accmode_t accmode, struct ucred *cred, From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 11:24:00 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3BF17106566C; Tue, 15 Sep 2009 11:24:00 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 27D6E8FC15; Tue, 15 Sep 2009 11:24:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FBO0V4086641; Tue, 15 Sep 2009 11:24:00 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FBO0MM086637; Tue, 15 Sep 2009 11:24:00 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909151124.n8FBO0MM086637@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 15 Sep 2009 11:23:59 +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: r197217 - in stable/8/sys: . amd64/include/xen cam/scsi cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ata dev/xen/xenpci geom X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 11:24:00 -0000 Author: pjd Date: Tue Sep 15 11:23:59 2009 New Revision: 197217 URL: http://svn.freebsd.org/changeset/base/197217 Log: MFC r196822, r196823, r196824: Remove 'ad:' prefix from disk serial number. We don't want serial number to change when we reconnect the disk in a way that it is accessible through CAM for example. Discussed with: trasz Simplify g_disk_ident_adjust() function and allow any printable character in serial number. Discussed with: trasz Obtained from: Wheel Sp. z o.o. (http://www.wheel.pl) Make serial numbers of daX disks visible by GEOM. No objections from: scottl Obtained from: Wheel Sp. z o.o. (http://www.wheel.pl) Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/scsi/scsi_da.c 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/ata/ata-disk.c stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/geom/geom_disk.c Modified: stable/8/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/8/sys/cam/scsi/scsi_da.c Tue Sep 15 11:20:23 2009 (r197216) +++ stable/8/sys/cam/scsi/scsi_da.c Tue Sep 15 11:23:59 2009 (r197217) @@ -1266,6 +1266,8 @@ daregister(struct cam_periph *periph, vo softc->disk->d_flags = 0; if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0) softc->disk->d_flags |= DISKFLAG_CANFLUSHCACHE; + strlcpy(softc->disk->d_ident, cgd->serial_num, + MIN(sizeof(softc->disk->d_ident), cgd->serial_num_len + 1)); disk_create(softc->disk, DISK_VERSION); mtx_lock(periph->sim->mtx); Modified: stable/8/sys/dev/ata/ata-disk.c ============================================================================== --- stable/8/sys/dev/ata/ata-disk.c Tue Sep 15 11:20:23 2009 (r197216) +++ stable/8/sys/dev/ata/ata-disk.c Tue Sep 15 11:23:59 2009 (r197217) @@ -136,8 +136,8 @@ ad_attach(device_t dev) if ((atadev->param.support.command2 & ATA_SUPPORT_CFA) || atadev->param.config == ATA_PROTO_CFA) adp->disk->d_flags = DISKFLAG_CANDELETE; - snprintf(adp->disk->d_ident, sizeof(adp->disk->d_ident), "ad:%s", - atadev->param.serial); + strlcpy(adp->disk->d_ident, atadev->param.serial, + sizeof(adp->disk->d_ident)); disk_create(adp->disk, DISK_VERSION); device_add_child(dev, "subdisk", device_get_unit(dev)); ad_firmware_geom_adjust(dev, adp->disk); Modified: stable/8/sys/geom/geom_disk.c ============================================================================== --- stable/8/sys/geom/geom_disk.c Tue Sep 15 11:20:23 2009 (r197216) +++ stable/8/sys/geom/geom_disk.c Tue Sep 15 11:23:59 2009 (r197217) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -400,39 +401,25 @@ g_disk_destroy(void *ptr, int flag) } /* - * We only allow [a-zA-Z0-9-_@#%.:] characters, the rest is converted to 'x'. + * We only allow printable characters in disk ident, + * the rest is converted to 'x'. */ static void g_disk_ident_adjust(char *ident, size_t size) { - char newid[DISK_IDENT_SIZE], tmp[4]; - size_t len; - char *p; - - bzero(newid, sizeof(newid)); - len = 0; - for (p = ident; *p != '\0' && len < sizeof(newid) - 1; p++) { - switch (*p) { - default: - if ((*p < 'a' || *p > 'z') && - (*p < 'A' || *p > 'Z') && - (*p < '0' || *p > '9')) { - snprintf(tmp, sizeof(tmp), "x%02hhx", *p); - strlcat(newid, tmp, sizeof(newid)); - len += 3; - break; - } - /* FALLTHROUGH */ - case '-': - case '_': - case '@': - case '#': - case '%': - case '.': - case ':': - newid[len++] = *p; - break; + char *p, tmp[4], newid[DISK_IDENT_SIZE]; + + newid[0] = '\0'; + for (p = ident; *p != '\0'; p++) { + if (isprint(*p)) { + tmp[0] = *p; + tmp[1] = '\0'; + } else { + snprintf(tmp, sizeof(tmp), "x%02hhx", + *(unsigned char *)p); } + if (strlcat(newid, tmp, sizeof(newid)) >= sizeof(newid)) + break; } bzero(ident, size); strlcpy(ident, newid, size); From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 12:19:35 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 28E151065670; Tue, 15 Sep 2009 12:19:35 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 153B68FC1C; Tue, 15 Sep 2009 12:19:35 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FCJYAV088039; Tue, 15 Sep 2009 12:19:34 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FCJYMr088037; Tue, 15 Sep 2009 12:19:34 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909151219.n8FCJYMr088037@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 15 Sep 2009 12:19:34 +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: r197220 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/uts/common/fs/zfs contrib/dev/acpica contrib/pf dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 12:19:35 -0000 Author: pjd Date: Tue Sep 15 12:19:34 2009 New Revision: 197220 URL: http://svn.freebsd.org/changeset/base/197220 Log: MFC r197219: Forced unmounts work just fine in my tests under heavy load. There might still be a problem, but it isn't worth a warning. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 15 11:42:08 2009 (r197219) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Sep 15 12:19:34 2009 (r197220) @@ -994,11 +994,6 @@ zfs_umount(vfs_t *vfsp, int fflag) cred_t *cr = curthread->td_ucred; int ret; - if (fflag & MS_FORCE) { - /* TODO: Force unmount is not well implemented yet, so deny it. */ - ZFS_LOG(0, "Force unmount is experimental - report any problems."); - } - ret = secpolicy_fs_unmount(cr, vfsp); if (ret) { ret = dsl_deleg_access((char *)refstr_value(vfsp->vfs_resource), From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 12:21:07 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1DAF21065676; Tue, 15 Sep 2009 12:21:07 +0000 (UTC) (envelope-from pjd@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0A48A8FC2A; Tue, 15 Sep 2009 12:21:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FCL60h088144; Tue, 15 Sep 2009 12:21:06 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FCL6TU088142; Tue, 15 Sep 2009 12:21:06 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <200909151221.n8FCL6TU088142@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 15 Sep 2009 12:21: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: r197221 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/uts/common/fs/zfs contrib/dev/acpica contrib/pf dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 12:21:07 -0000 Author: pjd Date: Tue Sep 15 12:21:06 2009 New Revision: 197221 URL: http://svn.freebsd.org/changeset/base/197221 Log: MFC r197218: We believe ZFS is ready for production use. Remove a warning about it being experimental. :) Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Sep 15 12:19:34 2009 (r197220) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Tue Sep 15 12:21:06 2009 (r197221) @@ -3072,8 +3072,6 @@ zfs_modevent(module_t mod, int type, voi switch (type) { case MOD_LOAD: zfs_root_token = root_mount_hold("ZFS"); - printf("WARNING: ZFS is considered to be an experimental " - "feature in FreeBSD.\n"); mutex_init(&zfs_share_lock, NULL, MUTEX_DEFAULT, NULL); From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 12:51:22 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7C51410656B4; Tue, 15 Sep 2009 12:51:22 +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 4F4108FC1D; Tue, 15 Sep 2009 12:51:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FCpMDP089000; Tue, 15 Sep 2009 12:51:22 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FCpM6P088998; Tue, 15 Sep 2009 12:51:22 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909151251.n8FCpM6P088998@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 15 Sep 2009 12:51:22 +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: r197222 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci ufs/ffs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 12:51:22 -0000 Author: kib Date: Tue Sep 15 12:51:22 2009 New Revision: 197222 URL: http://svn.freebsd.org/changeset/base/197222 Log: MFC r196888: The clear_remove() and clear_inodedeps() call vn_start_write(NULL, &mp, V_NOWAIT) on the non-busied mount point. Unmount might free ufs-specific mp data, causing ffs_vgetf() to access freed memory. Busy mountpoint before dropping softdep lk. Approved by: re (kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) stable/8/sys/ufs/ffs/ffs_softdep.c Modified: stable/8/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/8/sys/ufs/ffs/ffs_softdep.c Tue Sep 15 12:21:06 2009 (r197221) +++ stable/8/sys/ufs/ffs/ffs_softdep.c Tue Sep 15 12:51:22 2009 (r197222) @@ -5977,12 +5977,19 @@ clear_remove(td) if (vn_start_write(NULL, &mp, V_NOWAIT) != 0) continue; FREE_LOCK(&lk); - if ((error = ffs_vgetf(mp, ino, LK_EXCLUSIVE, &vp, - FFSV_FORCEINSMQ))) { + + /* + * Let unmount clear deps + */ + error = vfs_busy(mp, MBF_NOWAIT); + if (error != 0) + goto finish_write; + error = ffs_vgetf(mp, ino, LK_EXCLUSIVE, &vp, + FFSV_FORCEINSMQ); + vfs_unbusy(mp); + if (error != 0) { softdep_error("clear_remove: vget", error); - vn_finished_write(mp); - ACQUIRE_LOCK(&lk); - return; + goto finish_write; } if ((error = ffs_syncvnode(vp, MNT_NOWAIT))) softdep_error("clear_remove: fsync", error); @@ -5991,6 +5998,7 @@ clear_remove(td) drain_output(vp); BO_UNLOCK(bo); vput(vp); + finish_write: vn_finished_write(mp); ACQUIRE_LOCK(&lk); return; @@ -6050,13 +6058,21 @@ clear_inodedeps(td) if (vn_start_write(NULL, &mp, V_NOWAIT) != 0) continue; FREE_LOCK(&lk); + error = vfs_busy(mp, MBF_NOWAIT); /* Let unmount clear deps */ + if (error != 0) { + vn_finished_write(mp); + ACQUIRE_LOCK(&lk); + return; + } if ((error = ffs_vgetf(mp, ino, LK_EXCLUSIVE, &vp, FFSV_FORCEINSMQ)) != 0) { softdep_error("clear_inodedeps: vget", error); + vfs_unbusy(mp); vn_finished_write(mp); ACQUIRE_LOCK(&lk); return; } + vfs_unbusy(mp); if (ino == lastino) { if ((error = ffs_syncvnode(vp, MNT_WAIT))) softdep_error("clear_inodedeps: fsync1", error); From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 13:01:45 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1D5B41065676; Tue, 15 Sep 2009 13:01:45 +0000 (UTC) (envelope-from artis.caune@gmail.com) Received: from mail-bw0-f206.google.com (mail-bw0-f206.google.com [209.85.218.206]) by mx1.freebsd.org (Postfix) with ESMTP id 72C7B8FC17; Tue, 15 Sep 2009 13:01:44 +0000 (UTC) Received: by bwz2 with SMTP id 2so2608180bwz.43 for ; Tue, 15 Sep 2009 06:01:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=yf4Uiq7f7LHpxTulLWGxjGBx66es2Uu9ciDNo64ZK98=; b=VNceVzL1H5qTagTfgLPC3yUnCOnxvNnJ6pbaziAHY9UmCFAXMakMOG38utV2BjJ9qw AaWcIGIpHgtI/JJ/h/6NgJtNbIhSGkrEUTKvyyida+LLDKzVGWs7gXLCJ8xVQZL++6t5 GPvPMw2WdhSXrufqr+b0NYFSlhBsr8xzLV5vs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=gmQVMZN3uFW8Ct3VqI4jtGgnyuzrV55XF3TkID+IcdzRfsfgYfT8ZUHjI9ydH1L3Ho iXe/NGhWPpqfHnHFE90sT0s+n35GvpztB8D7WJEYnjTvSvy5gPKqfPKrtCtv+VqsVdVn ExCYWCjH0+45UbnAHuYH+MnpjBk8JeO2Nw+9A= MIME-Version: 1.0 Received: by 10.204.162.210 with SMTP id w18mr6237525bkx.174.1253018349579; Tue, 15 Sep 2009 05:39:09 -0700 (PDT) In-Reply-To: <200909151221.n8FCL6TU088142@svn.freebsd.org> References: <200909151221.n8FCL6TU088142@svn.freebsd.org> Date: Tue, 15 Sep 2009 15:39:09 +0300 Message-ID: <9e20d71e0909150539k44ac0b59v93a2d25dbf288e48@mail.gmail.com> From: Artis Caune To: Pawel Jakub Dawidek Content-Type: text/plain; charset=UTF-8 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: r197221 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/uts/common/fs/zfs contrib/dev/acpica contrib/pf dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 13:01:45 -0000 2009/9/15 Pawel Jakub Dawidek : > Author: pjd > Date: Tue Sep 15 12:21:06 2009 > New Revision: 197221 > URL: http://svn.freebsd.org/changeset/base/197221 > > Log: > =C2=A0MFC r197218: > > =C2=A0We believe ZFS is ready for production use. Remove a warning about = it being > =C2=A0experimental. :) > Some time ago, someone told that "FreeBSD 7 will be the best FreeBSD ever", but I think It's not true anymore. :) Thank you Pawel and all other! --=20 Artis Caune Everything should be made as simple as possible, but not simpler. From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 13:04:06 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8C04C106566C; Tue, 15 Sep 2009 13:04:06 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-ew0-f208.google.com (mail-ew0-f208.google.com [209.85.219.208]) by mx1.freebsd.org (Postfix) with ESMTP id 690378FC22; Tue, 15 Sep 2009 13:04:05 +0000 (UTC) Received: by ewy4 with SMTP id 4so4040581ewy.36 for ; Tue, 15 Sep 2009 06:04:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:from:date:x-google-sender-auth:message-id:subject:to:cc :content-type:content-transfer-encoding; bh=Zb72vo3br2WTfbZFGsny2/3bokYYHqdDV/ai1irY4w0=; b=QxrVWsthP8RZwVohpxcuigqqBgjpoI6Cz7h+zYfLlEoi2d71PO47uPlciYKHK9+quQ S6zprPyu8uNX8Z/ssN9GYkOcMPhqzjYTgG/HJnmhLHBtigNVwz4Ay+W1xD2neEyjyL+S LA0sDU85p5xQkDUVGC2R6BrgQNaDFG2XS8x+k= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=hRR1dE4rpMLZzwHK9tvQTH9zzerZcAx/EHX9yZo+JoNISQ3hH1CStpnXGc85c29kMA Ht0X2WxFYkphLAKwP9rGxLHP4+vonJVYK6ncMg4U7O6ZsiH/W40hzuqNLAbGBq5aiJR8 daDXWxq2I4aJyr+Xg+HapKiJTmd74wE/S5RiM= MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.216.87.140 with SMTP id y12mr1914567wee.4.1253019843121; Tue, 15 Sep 2009 06:04:03 -0700 (PDT) In-Reply-To: <200909151221.n8FCL6TU088142@svn.freebsd.org> References: <200909151221.n8FCL6TU088142@svn.freebsd.org> From: Ivan Voras Date: Tue, 15 Sep 2009 15:03:43 +0200 X-Google-Sender-Auth: c3a6916be372a5cc Message-ID: <9bbcef730909150603m5d20ca92p20daec1701dab634@mail.gmail.com> To: Pawel Jakub Dawidek Content-Type: text/plain; charset=UTF-8 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: r197221 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris cddl/contrib/opensolaris/uts/common/fs/zfs contrib/dev/acpica contrib/pf dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 13:04:06 -0000 2009/9/15 Pawel Jakub Dawidek : > Author: pjd > Date: Tue Sep 15 12:21:06 2009 > New Revision: 197221 > URL: http://svn.freebsd.org/changeset/base/197221 > > Log: > =C2=A0MFC r197218: > > =C2=A0We believe ZFS is ready for production use. Remove a warning about = it being > =C2=A0experimental. :) Wheeee :) From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 19:14:25 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A9FCB106566C; Tue, 15 Sep 2009 19:14:25 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 7F24D8FC1D; Tue, 15 Sep 2009 19:14:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FJEPXs000118; Tue, 15 Sep 2009 19:14:25 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FJEPGw000116; Tue, 15 Sep 2009 19:14:25 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200909151914.n8FJEPGw000116@svn.freebsd.org> From: Attilio Rao Date: Tue, 15 Sep 2009 19:14: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: r197226 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 19:14:25 -0000 Author: attilio Date: Tue Sep 15 19:14:25 2009 New Revision: 197226 URL: http://svn.freebsd.org/changeset/base/197226 Log: MFC r197223: Fix sched_switch_migrate() by assuming locks cannot be shared and a deadlock between 3 different threads by acquiring both runqueue locks when doing the migration. Please note that this is a special condition as we want this fix in before RC1 as we assume it is critical and so it has been handled as an instant-merge. For the STABLE_7 branch, 1 week before the MFC is assumed. Approved by: re (kib) Modified: stable/8/sys/kern/sched_ule.c Modified: stable/8/sys/kern/sched_ule.c ============================================================================== --- stable/8/sys/kern/sched_ule.c Tue Sep 15 18:39:27 2009 (r197225) +++ stable/8/sys/kern/sched_ule.c Tue Sep 15 19:14:25 2009 (r197226) @@ -1749,19 +1749,19 @@ sched_switch_migrate(struct tdq *tdq, st */ spinlock_enter(); thread_block_switch(td); /* This releases the lock on tdq. */ - TDQ_LOCK(tdn); - tdq_add(tdn, td, flags); - tdq_notify(tdn, td); + /* - * After we unlock tdn the new cpu still can't switch into this - * thread until we've unblocked it in cpu_switch(). The lock - * pointers may match in the case of HTT cores. Don't unlock here - * or we can deadlock when the other CPU runs the IPI handler. + * Acquire both run-queue locks before placing the thread on the new + * run-queue to avoid deadlocks created by placing a thread with a + * blocked lock on the run-queue of a remote processor. The deadlock + * occurs when a third processor attempts to lock the two queues in + * question while the target processor is spinning with its own + * run-queue lock held while waiting for the blocked lock to clear. */ - if (TDQ_LOCKPTR(tdn) != TDQ_LOCKPTR(tdq)) { - TDQ_UNLOCK(tdn); - TDQ_LOCK(tdq); - } + tdq_lock_pair(tdn, tdq); + tdq_add(tdn, td, flags); + tdq_notify(tdn, td); + TDQ_UNLOCK(tdn); spinlock_exit(); #endif return (TDQ_LOCKPTR(tdn)); From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 19:24:19 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6F36D10656AE; Tue, 15 Sep 2009 19:24:19 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 442468FC0A; Tue, 15 Sep 2009 19:24:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FJOJtF000483; Tue, 15 Sep 2009 19:24:19 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FJOJfL000480; Tue, 15 Sep 2009 19:24:19 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200909151924.n8FJOJfL000480@svn.freebsd.org> From: Attilio Rao Date: Tue, 15 Sep 2009 19:24:19 +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: r197228 - in stable/8: lib/libdevinfo sys/sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 19:24:19 -0000 Author: attilio Date: Tue Sep 15 19:24:18 2009 New Revision: 197228 URL: http://svn.freebsd.org/changeset/base/197228 Log: MFC r197224: Use explicit int values for the device states in order to allow, if necessary, in the future, adds of new states without breaking ABI between revisions. Please note that this is a special condition as we want this fix in before RC1 as we assume it is critical and so it has been handled as an instant-merge. Approved by: re (kib) Modified: stable/8/lib/libdevinfo/devinfo.h stable/8/sys/sys/bus.h Modified: stable/8/lib/libdevinfo/devinfo.h ============================================================================== --- stable/8/lib/libdevinfo/devinfo.h Tue Sep 15 19:18:34 2009 (r197227) +++ stable/8/lib/libdevinfo/devinfo.h Tue Sep 15 19:24:18 2009 (r197228) @@ -41,10 +41,10 @@ typedef __uintptr_t devinfo_handle_t; */ /* XXX not sure if I want a copy here, or expose sys/bus.h */ typedef enum devinfo_state { - DIS_NOTPRESENT, /* not probed or probe failed */ - DIS_ALIVE, /* probe succeeded */ - DIS_ATTACHED, /* attach method called */ - DIS_BUSY /* device is open */ + DIS_NOTPRESENT = 10, /* not probed or probe failed */ + DIS_ALIVE = 20, /* probe succeeded */ + DIS_ATTACHED = 30, /* attach method called */ + DIS_BUSY = 40 /* device is open */ } devinfo_state_t; struct devinfo_dev { Modified: stable/8/sys/sys/bus.h ============================================================================== --- stable/8/sys/sys/bus.h Tue Sep 15 19:18:34 2009 (r197227) +++ stable/8/sys/sys/bus.h Tue Sep 15 19:24:18 2009 (r197228) @@ -50,10 +50,10 @@ struct u_businfo { * @brief State of the device. */ typedef enum device_state { - DS_NOTPRESENT, /**< @brief not probed or probe failed */ - DS_ALIVE, /**< @brief probe succeeded */ - DS_ATTACHED, /**< @brief attach method called */ - DS_BUSY /**< @brief device is open */ + DS_NOTPRESENT = 10, /**< @brief not probed or probe failed */ + DS_ALIVE = 20, /**< @brief probe succeeded */ + DS_ATTACHED = 30, /**< @brief attach method called */ + DS_BUSY = 40 /**< @brief device is open */ } device_state_t; /** From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 19:38:29 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9711106568B; Tue, 15 Sep 2009 19:38:29 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C6C248FC22; Tue, 15 Sep 2009 19:38:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FJcTU8000833; Tue, 15 Sep 2009 19:38:29 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FJcT93000831; Tue, 15 Sep 2009 19:38:29 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200909151938.n8FJcT93000831@svn.freebsd.org> From: Qing Li Date: Tue, 15 Sep 2009 19:38:29 +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: r197229 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 19:38:30 -0000 Author: qingli Date: Tue Sep 15 19:38:29 2009 New Revision: 197229 URL: http://svn.freebsd.org/changeset/base/197229 Log: MFC r197203 Previously local end of point-to-point interface is not reachable within the system that owns the interface. Packets destined to the local end point leak to the wire towards the default gateway if one exists. This behavior is changed as part of the L2/L3 rewrite efforts. The local end point is now reachable within the system. The inpcb code needs to consider this fact during the address selection process. Reviewed by: bz Approved by: re Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) stable/8/sys/netinet/in_pcb.c Modified: stable/8/sys/netinet/in_pcb.c ============================================================================== --- stable/8/sys/netinet/in_pcb.c Tue Sep 15 19:24:18 2009 (r197228) +++ stable/8/sys/netinet/in_pcb.c Tue Sep 15 19:38:29 2009 (r197229) @@ -701,6 +701,8 @@ in_pcbladdr(struct inpcb *inp, struct in ia = ifatoia(ifa_ifwithdstaddr(sintosa(&sain))); if (ia == NULL) ia = ifatoia(ifa_ifwithnet(sintosa(&sain))); + if (ia == NULL) + ia = ifatoia(ifa_ifwithaddr(sintosa(&sain))); if (cred == NULL || !prison_flag(cred, PR_IP4)) { if (ia == NULL) { From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 19:56:36 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 13072106566B; Tue, 15 Sep 2009 19:56:36 +0000 (UTC) (envelope-from blackend@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 01B0C8FC08; Tue, 15 Sep 2009 19:56:36 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FJuZsu001336; Tue, 15 Sep 2009 19:56:35 GMT (envelope-from blackend@svn.freebsd.org) Received: (from blackend@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FJuZBZ001334; Tue, 15 Sep 2009 19:56:35 GMT (envelope-from blackend@svn.freebsd.org) Message-Id: <200909151956.n8FJuZBZ001334@svn.freebsd.org> From: Marc Fonvieille Date: Tue, 15 Sep 2009 19:56:35 +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: r197230 - stable/8/release X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 19:56:36 -0000 Author: blackend (doc committer) Date: Tue Sep 15 19:56:35 2009 New Revision: 197230 URL: http://svn.freebsd.org/changeset/base/197230 Log: MFC: r196588 Log: Update some comments to match the removal of the docset compilation during the release build. Approved by: re (kib) Modified: stable/8/release/Makefile Modified: stable/8/release/Makefile ============================================================================== --- stable/8/release/Makefile Tue Sep 15 19:38:29 2009 (r197229) +++ stable/8/release/Makefile Tue Sep 15 19:56:35 2009 (r197230) @@ -1163,10 +1163,10 @@ iso.1: .endif # -# --==## Documentation Project files such as the Handbook and FAQ ##==-- +# --==## Documentation Project tools required to build the release notes ##==-- # doc.1: - @echo "Making docs..." + @echo "Making docproj tools..." @for i in ${DOCPORTS}; do \ cd /usr/ports/$$i && \ env -i FTP_PASSIVE_MODE=$${FTP_PASSIVE_MODE:-no} PATH=$${PATH} \ From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 19:58:34 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 50075106566C; Tue, 15 Sep 2009 19:58:34 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3D5A08FC0C; Tue, 15 Sep 2009 19:58:34 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FJwYgM001416; Tue, 15 Sep 2009 19:58:34 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FJwYH3001414; Tue, 15 Sep 2009 19:58:34 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200909151958.n8FJwYH3001414@svn.freebsd.org> From: Qing Li Date: Tue, 15 Sep 2009 19:58:34 +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: r197231 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 19:58:34 -0000 Author: qingli Date: Tue Sep 15 19:58:33 2009 New Revision: 197231 URL: http://svn.freebsd.org/changeset/base/197231 Log: MFC r196714 This patch fixes the following issues: - Routing messages are not generated when adding and removing interface address aliases. - Loopback route installed for an interface address alias is not deleted from the routing table when that address alias is removed from the associated interface. - Function in_ifscrub() is called extraneously. Reviewed by: gnn, kmacy, sam Approved by: re Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) stable/8/sys/netinet/in.c Modified: stable/8/sys/netinet/in.c ============================================================================== --- stable/8/sys/netinet/in.c Tue Sep 15 19:56:35 2009 (r197230) +++ stable/8/sys/netinet/in.c Tue Sep 15 19:58:33 2009 (r197231) @@ -536,7 +536,6 @@ in_control(struct socket *so, u_long cmd hostIsNew = 0; } if (ifra->ifra_mask.sin_len) { - in_ifscrub(ifp, ia); ia->ia_sockmask = ifra->ifra_mask; ia->ia_sockmask.sin_family = AF_INET; ia->ia_subnetmask = @@ -545,7 +544,6 @@ in_control(struct socket *so, u_long cmd } if ((ifp->if_flags & IFF_POINTOPOINT) && (ifra->ifra_dstaddr.sin_family == AF_INET)) { - in_ifscrub(ifp, ia); ia->ia_dstaddr = ifra->ifra_dstaddr; maskIsNew = 1; /* We lie; but the effect's the same */ } @@ -991,6 +989,40 @@ in_addprefix(struct in_ifaddr *target, i IN_IFADDR_RUNLOCK(); return (EEXIST); } else { + struct route pfx_ro; + struct sockaddr_in *pfx_addr; + struct rtentry msg_rt; + + /* QL: XXX + * This is a bit questionable because there is no + * additional route entry added for an address alias. + * Therefore this route report is inaccurate. Perhaps + * it's better to supply a empty rtentry as how it + * is done in in_scrubprefix(). + */ + bzero(&pfx_ro, sizeof(pfx_ro)); + pfx_addr = (struct sockaddr_in *)(&pfx_ro.ro_dst); + pfx_addr->sin_len = sizeof(*pfx_addr); + pfx_addr->sin_family = AF_INET; + pfx_addr->sin_addr = prefix; + rtalloc_ign_fib(&pfx_ro, 0, 0); + if (pfx_ro.ro_rt != NULL) { + msg_rt = *pfx_ro.ro_rt; + /* QL: XXX + * Point the gateway to the given interface + * address as if a new prefix route entry has + * been added through the new address alias. + * All other parts of the rtentry is accurate, + * e.g., rt_key, rt_mask, rt_ifp etc. + */ + msg_rt.rt_gateway = + (struct sockaddr *)&ia->ia_addr; + rt_newaddrmsg(RTM_ADD, + (struct ifaddr *)target, + 0, &msg_rt); + RTFREE(pfx_ro.ro_rt); + } + IN_IFADDR_RUNLOCK(); return (0); } @@ -1024,9 +1056,6 @@ in_scrubprefix(struct in_ifaddr *target) struct rt_addrinfo info; struct sockaddr_dl null_sdl; - if ((target->ia_flags & IFA_ROUTE) == 0) - return (0); - /* * Remove the loopback route to the interface address. * The "useloopback" setting is not consulted because if the @@ -1054,6 +1083,20 @@ in_scrubprefix(struct in_ifaddr *target) log(LOG_INFO, "in_scrubprefix: deletion failed\n"); } + if ((target->ia_flags & IFA_ROUTE) == 0) { + struct rtentry rt; + + /* QL: XXX + * Report a blank rtentry when a route has not been + * installed for the given interface address. + */ + bzero(&rt, sizeof(rt)); + rt_newaddrmsg(RTM_DELETE, + (struct ifaddr *)target, + 0, &rt); + return (0); + } + if (rtinitflags(target)) prefix = target->ia_dstaddr.sin_addr; else { From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 20:21:10 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D2A211065676; Tue, 15 Sep 2009 20:21:10 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFF398FC08; Tue, 15 Sep 2009 20:21:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FKLAFB002071; Tue, 15 Sep 2009 20:21:10 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FKLA2A002070; Tue, 15 Sep 2009 20:21:10 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200909152021.n8FKLA2A002070@svn.freebsd.org> From: Attilio Rao Date: Tue, 15 Sep 2009 20:21:10 +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: r197232 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 20:21:10 -0000 Author: attilio Date: Tue Sep 15 20:21:10 2009 New Revision: 197232 URL: http://svn.freebsd.org/changeset/base/197232 Log: Record merge for MFC of r197223, done in r197226. Requested by: kib Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 20:28:30 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 17D711065676; Tue, 15 Sep 2009 20:28:30 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0508D8FC19; Tue, 15 Sep 2009 20:28:30 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FKSTdA002259; Tue, 15 Sep 2009 20:28:29 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FKSTZm002258; Tue, 15 Sep 2009 20:28:29 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <200909152028.n8FKSTZm002258@svn.freebsd.org> From: Attilio Rao Date: Tue, 15 Sep 2009 20:28:29 +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: r197233 - in stable/8: lib/libdevinfo sys sys/amd64/include/xen sys/cddl/contrib/opensolaris sys/contrib/dev/acpica sys/contrib/pf sys/dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 20:28:30 -0000 Author: attilio Date: Tue Sep 15 20:28:29 2009 New Revision: 197233 URL: http://svn.freebsd.org/changeset/base/197233 Log: ecorde merge for MFC of r197224, done in r197228. Requested by: kib Approved by: re (kib) Modified: stable/8/lib/libdevinfo/ (props changed) stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 22:25:19 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F1A99106566B; Tue, 15 Sep 2009 22:25:19 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C49BC8FC1E; Tue, 15 Sep 2009 22:25:19 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FMPJfH004898; Tue, 15 Sep 2009 22:25:19 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FMPJKL004895; Tue, 15 Sep 2009 22:25:19 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200909152225.n8FMPJKL004895@svn.freebsd.org> From: Qing Li Date: Tue, 15 Sep 2009 22:25:19 +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: r197237 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci netinet nfsclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 22:25:20 -0000 Author: qingli Date: Tue Sep 15 22:25:19 2009 New Revision: 197237 URL: http://svn.freebsd.org/changeset/base/197237 Log: MFC r197210, 197212, 197235 The bootp code installs an interface address and the nfs client module tries to install the same address again. This extra code is removed, which was discovered by the removal of a call to in_ifscrub() in r196714. This call to in_ifscrub is put back here because the SIOCAIFADDR command can be used to change the prefix length of an existing alias. r197235 reverts file nfs_vfsops.c Reviewed by: kmacy Approved by: re Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) stable/8/sys/netinet/in.c stable/8/sys/nfsclient/nfs_vfsops.c Modified: stable/8/sys/netinet/in.c ============================================================================== --- stable/8/sys/netinet/in.c Tue Sep 15 22:23:45 2009 (r197236) +++ stable/8/sys/netinet/in.c Tue Sep 15 22:25:19 2009 (r197237) @@ -536,6 +536,16 @@ in_control(struct socket *so, u_long cmd hostIsNew = 0; } if (ifra->ifra_mask.sin_len) { + /* + * QL: XXX + * Need to scrub the prefix here in case + * the issued command is SIOCAIFADDR with + * the same address, but with a different + * prefix length. And if the prefix length + * is the same as before, then the call is + * un-necessarily executed here. + */ + in_ifscrub(ifp, ia); ia->ia_sockmask = ifra->ifra_mask; ia->ia_sockmask.sin_family = AF_INET; ia->ia_subnetmask = @@ -544,6 +554,7 @@ in_control(struct socket *so, u_long cmd } if ((ifp->if_flags & IFF_POINTOPOINT) && (ifra->ifra_dstaddr.sin_family == AF_INET)) { + in_ifscrub(ifp, ia); ia->ia_dstaddr = ifra->ifra_dstaddr; maskIsNew = 1; /* We lie; but the effect's the same */ } Modified: stable/8/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vfsops.c Tue Sep 15 22:23:45 2009 (r197236) +++ stable/8/sys/nfsclient/nfs_vfsops.c Tue Sep 15 22:25:19 2009 (r197237) @@ -463,9 +463,11 @@ nfs_mountroot(struct mount *mp) break; } #endif + error = ifioctl(so, SIOCAIFADDR, (caddr_t)&nd->myif, td); if (error) panic("nfs_mountroot: SIOCAIFADDR: %d", error); + if ((cp = getenv("boot.netif.mtu")) != NULL) { ir.ifr_mtu = strtol(cp, NULL, 10); bcopy(nd->myif.ifra_name, ir.ifr_name, IFNAMSIZ); From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 22:37:18 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C240106568D; Tue, 15 Sep 2009 22:37:18 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 48EA28FC1A; Tue, 15 Sep 2009 22:37:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FMbIiZ005213; Tue, 15 Sep 2009 22:37:18 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FMbISa005212; Tue, 15 Sep 2009 22:37:18 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200909152237.n8FMbISa005212@svn.freebsd.org> From: Qing Li Date: Tue, 15 Sep 2009 22:37: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: r197238 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 22:37:18 -0000 Author: qingli Date: Tue Sep 15 22:37:17 2009 New Revision: 197238 URL: http://svn.freebsd.org/changeset/base/197238 Log: MFC r197225 This patch enables the node to respond to ARP requests for configured proxy ARP entries. Reviewed by: bz Approved by: re Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) stable/8/sys/netinet/if_ether.c Modified: stable/8/sys/netinet/if_ether.c ============================================================================== --- stable/8/sys/netinet/if_ether.c Tue Sep 15 22:25:19 2009 (r197237) +++ stable/8/sys/netinet/if_ether.c Tue Sep 15 22:37:17 2009 (r197238) @@ -694,62 +694,70 @@ reply: } else { struct llentry *lle = NULL; - if (!V_arp_proxyall) - goto drop; - sin.sin_addr = itaddr; - /* XXX MRT use table 0 for arp reply */ - rt = in_rtalloc1((struct sockaddr *)&sin, 0, 0UL, 0); - if (!rt) - goto drop; - - /* - * Don't send proxies for nodes on the same interface - * as this one came out of, or we'll get into a fight - * over who claims what Ether address. - */ - if (!rt->rt_ifp || rt->rt_ifp == ifp) { - RTFREE_LOCKED(rt); - goto drop; - } - IF_AFDATA_LOCK(rt->rt_ifp); - lle = lla_lookup(LLTABLE(rt->rt_ifp), 0, (struct sockaddr *)&sin); - IF_AFDATA_UNLOCK(rt->rt_ifp); - RTFREE_LOCKED(rt); + IF_AFDATA_LOCK(ifp); + lle = lla_lookup(LLTABLE(ifp), 0, (struct sockaddr *)&sin); + IF_AFDATA_UNLOCK(ifp); - if (lle != NULL) { + if ((lle != NULL) && (lle->la_flags & LLE_PUB)) { (void)memcpy(ar_tha(ah), ar_sha(ah), ah->ar_hln); (void)memcpy(ar_sha(ah), &lle->ll_addr, ah->ar_hln); LLE_RUNLOCK(lle); - } else - goto drop; + } else { - /* - * Also check that the node which sent the ARP packet - * is on the the interface we expect it to be on. This - * avoids ARP chaos if an interface is connected to the - * wrong network. - */ - sin.sin_addr = isaddr; + if (lle != NULL) + LLE_RUNLOCK(lle); - /* XXX MRT use table 0 for arp checks */ - rt = in_rtalloc1((struct sockaddr *)&sin, 0, 0UL, 0); - if (!rt) - goto drop; - if (rt->rt_ifp != ifp) { - log(LOG_INFO, "arp_proxy: ignoring request" - " from %s via %s, expecting %s\n", - inet_ntoa(isaddr), ifp->if_xname, - rt->rt_ifp->if_xname); + if (!V_arp_proxyall) + goto drop; + + sin.sin_addr = itaddr; + /* XXX MRT use table 0 for arp reply */ + rt = in_rtalloc1((struct sockaddr *)&sin, 0, 0UL, 0); + if (!rt) + goto drop; + + /* + * Don't send proxies for nodes on the same interface + * as this one came out of, or we'll get into a fight + * over who claims what Ether address. + */ + if (!rt->rt_ifp || rt->rt_ifp == ifp) { + RTFREE_LOCKED(rt); + goto drop; + } + RTFREE_LOCKED(rt); + + (void)memcpy(ar_tha(ah), ar_sha(ah), ah->ar_hln); + (void)memcpy(ar_sha(ah), enaddr, ah->ar_hln); + + /* + * Also check that the node which sent the ARP packet + * is on the the interface we expect it to be on. This + * avoids ARP chaos if an interface is connected to the + * wrong network. + */ + sin.sin_addr = isaddr; + + /* XXX MRT use table 0 for arp checks */ + rt = in_rtalloc1((struct sockaddr *)&sin, 0, 0UL, 0); + if (!rt) + goto drop; + if (rt->rt_ifp != ifp) { + log(LOG_INFO, "arp_proxy: ignoring request" + " from %s via %s, expecting %s\n", + inet_ntoa(isaddr), ifp->if_xname, + rt->rt_ifp->if_xname); + RTFREE_LOCKED(rt); + goto drop; + } RTFREE_LOCKED(rt); - goto drop; - } - RTFREE_LOCKED(rt); #ifdef DEBUG_PROXY - printf("arp: proxying for %s\n", - inet_ntoa(itaddr)); + printf("arp: proxying for %s\n", + inet_ntoa(itaddr)); #endif + } } if (itaddr.s_addr == myaddr.s_addr && From owner-svn-src-stable@FreeBSD.ORG Tue Sep 15 22:46:07 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F20D6106566C; Tue, 15 Sep 2009 22:46:07 +0000 (UTC) (envelope-from qingli@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DDB0B8FC12; Tue, 15 Sep 2009 22:46:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8FMk6LH005420; Tue, 15 Sep 2009 22:46:06 GMT (envelope-from qingli@svn.freebsd.org) Received: (from qingli@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8FMk6Qm005414; Tue, 15 Sep 2009 22:46:06 GMT (envelope-from qingli@svn.freebsd.org) Message-Id: <200909152246.n8FMk6Qm005414@svn.freebsd.org> From: Qing Li Date: Tue, 15 Sep 2009 22:46: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: r197239 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci net netinet netinet6 X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 15 Sep 2009 22:46:08 -0000 Author: qingli Date: Tue Sep 15 22:46:06 2009 New Revision: 197239 URL: http://svn.freebsd.org/changeset/base/197239 Log: MFC r197227 Self pointing routes are installed for configured interface addresses and address aliases. After an interface is brought down and brought back up again, those self pointing routes disappeared. This patch ensures after an interface is brought back up, the loopback routes are reinstalled properly. Reviewed by: bz Approved by: re Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) stable/8/sys/net/if.c stable/8/sys/net/if_var.h stable/8/sys/netinet/in.c stable/8/sys/netinet/raw_ip.c stable/8/sys/netinet6/in6.c Modified: stable/8/sys/net/if.c ============================================================================== --- stable/8/sys/net/if.c Tue Sep 15 22:37:17 2009 (r197238) +++ stable/8/sys/net/if.c Tue Sep 15 22:46:06 2009 (r197239) @@ -1414,6 +1414,59 @@ ifa_free(struct ifaddr *ifa) } } +int +ifa_add_loopback_route(struct ifaddr *ifa, struct sockaddr *ia) +{ + int error = 0; + struct rtentry *rt = NULL; + struct rt_addrinfo info; + static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; + + bzero(&info, sizeof(info)); + info.rti_ifp = V_loif; + info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC; + info.rti_info[RTAX_DST] = ia; + info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; + error = rtrequest1_fib(RTM_ADD, &info, &rt, 0); + + if (error == 0 && rt != NULL) { + RT_LOCK(rt); + ((struct sockaddr_dl *)rt->rt_gateway)->sdl_type = + rt->rt_ifp->if_type; + ((struct sockaddr_dl *)rt->rt_gateway)->sdl_index = + rt->rt_ifp->if_index; + RT_REMREF(rt); + RT_UNLOCK(rt); + } else if (error != 0) + log(LOG_INFO, "ifa_add_loopback_route: insertion failed\n"); + + return (error); +} + +int +ifa_del_loopback_route(struct ifaddr *ifa, struct sockaddr *ia) +{ + int error = 0; + struct rt_addrinfo info; + struct sockaddr_dl null_sdl; + + bzero(&null_sdl, sizeof(null_sdl)); + null_sdl.sdl_len = sizeof(null_sdl); + null_sdl.sdl_family = AF_LINK; + null_sdl.sdl_type = ifa->ifa_ifp->if_type; + null_sdl.sdl_index = ifa->ifa_ifp->if_index; + bzero(&info, sizeof(info)); + info.rti_flags = ifa->ifa_flags | RTF_HOST | RTF_STATIC; + info.rti_info[RTAX_DST] = ia; + info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; + error = rtrequest1_fib(RTM_DELETE, &info, NULL, 0); + + if (error != 0) + log(LOG_INFO, "ifa_del_loopback_route: deletion failed\n"); + + return (error); +} + /* * XXX: Because sockaddr_dl has deeper structure than the sockaddr * structs used to represent other address families, it is necessary Modified: stable/8/sys/net/if_var.h ============================================================================== --- stable/8/sys/net/if_var.h Tue Sep 15 22:37:17 2009 (r197238) +++ stable/8/sys/net/if_var.h Tue Sep 15 22:46:06 2009 (r197239) @@ -854,6 +854,9 @@ struct ifnet *ifunit_ref(const char *); void ifq_init(struct ifaltq *, struct ifnet *ifp); void ifq_delete(struct ifaltq *); +int ifa_add_loopback_route(struct ifaddr *, struct sockaddr *); +int ifa_del_loopback_route(struct ifaddr *, struct sockaddr *); + struct ifaddr *ifa_ifwithaddr(struct sockaddr *); int ifa_ifwithaddr_check(struct sockaddr *); struct ifaddr *ifa_ifwithbroadaddr(struct sockaddr *); Modified: stable/8/sys/netinet/in.c ============================================================================== --- stable/8/sys/netinet/in.c Tue Sep 15 22:37:17 2009 (r197238) +++ stable/8/sys/netinet/in.c Tue Sep 15 22:46:06 2009 (r197239) @@ -827,9 +827,6 @@ in_ifinit(struct ifnet *ifp, struct in_i { register u_long i = ntohl(sin->sin_addr.s_addr); struct sockaddr_in oldaddr; - struct rtentry *rt = NULL; - struct rt_addrinfo info; - static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; int s = splimp(), flags = RTF_UP, error = 0; oldaddr = ia->ia_addr; @@ -927,25 +924,9 @@ in_ifinit(struct ifnet *ifp, struct in_i /* * add a loopback route to self */ - if (V_useloopback && !(ifp->if_flags & IFF_LOOPBACK)) { - bzero(&info, sizeof(info)); - info.rti_ifp = V_loif; - info.rti_flags = ia->ia_flags | RTF_HOST | RTF_STATIC; - info.rti_info[RTAX_DST] = (struct sockaddr *)&ia->ia_addr; - info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; - error = rtrequest1_fib(RTM_ADD, &info, &rt, 0); - - if (error == 0 && rt != NULL) { - RT_LOCK(rt); - ((struct sockaddr_dl *)rt->rt_gateway)->sdl_type = - rt->rt_ifp->if_type; - ((struct sockaddr_dl *)rt->rt_gateway)->sdl_index = - rt->rt_ifp->if_index; - RT_REMREF(rt); - RT_UNLOCK(rt); - } else if (error != 0) - log(LOG_INFO, "in_ifinit: insertion failed\n"); - } + if (V_useloopback && !(ifp->if_flags & IFF_LOOPBACK)) + error = ifa_add_loopback_route((struct ifaddr *)ia, + (struct sockaddr *)&ia->ia_addr); return (error); } @@ -1064,8 +1045,6 @@ in_scrubprefix(struct in_ifaddr *target) struct in_addr prefix, mask, p; int error; struct sockaddr_in prefix0, mask0; - struct rt_addrinfo info; - struct sockaddr_dl null_sdl; /* * Remove the loopback route to the interface address. @@ -1079,19 +1058,8 @@ in_scrubprefix(struct in_ifaddr *target) */ if ((target->ia_addr.sin_addr.s_addr != INADDR_ANY) && !(target->ia_ifp->if_flags & IFF_LOOPBACK)) { - bzero(&null_sdl, sizeof(null_sdl)); - null_sdl.sdl_len = sizeof(null_sdl); - null_sdl.sdl_family = AF_LINK; - null_sdl.sdl_type = V_loif->if_type; - null_sdl.sdl_index = V_loif->if_index; - bzero(&info, sizeof(info)); - info.rti_flags = target->ia_flags | RTF_HOST | RTF_STATIC; - info.rti_info[RTAX_DST] = (struct sockaddr *)&target->ia_addr; - info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; - error = rtrequest1_fib(RTM_DELETE, &info, NULL, 0); - - if (error != 0) - log(LOG_INFO, "in_scrubprefix: deletion failed\n"); + error = ifa_del_loopback_route((struct ifaddr *)target, + (struct sockaddr *)&target->ia_addr); } if ((target->ia_flags & IFA_ROUTE) == 0) { Modified: stable/8/sys/netinet/raw_ip.c ============================================================================== --- stable/8/sys/netinet/raw_ip.c Tue Sep 15 22:37:17 2009 (r197238) +++ stable/8/sys/netinet/raw_ip.c Tue Sep 15 22:46:06 2009 (r197239) @@ -715,6 +715,7 @@ rip_ctlinput(int cmd, struct sockaddr *s err = rtinit(&ia->ia_ifa, RTM_ADD, flags); if (err == 0) ia->ia_flags |= IFA_ROUTE; + err = ifa_add_loopback_route((struct ifaddr *)ia, sa); ifa_free(&ia->ia_ifa); break; } Modified: stable/8/sys/netinet6/in6.c ============================================================================== --- stable/8/sys/netinet6/in6.c Tue Sep 15 22:37:17 2009 (r197238) +++ stable/8/sys/netinet6/in6.c Tue Sep 15 22:46:06 2009 (r197239) @@ -81,6 +81,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1195,24 +1196,8 @@ in6_purgeaddr(struct ifaddr *ifa) * The check for the current setting of "nd6_useloopback" * is not needed. */ - { - struct rt_addrinfo info; - struct sockaddr_dl null_sdl; - - bzero(&null_sdl, sizeof(null_sdl)); - null_sdl.sdl_len = sizeof(null_sdl); - null_sdl.sdl_family = AF_LINK; - null_sdl.sdl_type = ia->ia_ifp->if_type; - null_sdl.sdl_index = ia->ia_ifp->if_index; - bzero(&info, sizeof(info)); - info.rti_flags = ia->ia_flags | RTF_HOST | RTF_STATIC; - info.rti_info[RTAX_DST] = (struct sockaddr *)&ia->ia_addr; - info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; - error = rtrequest1_fib(RTM_DELETE, &info, NULL, 0); - - if (error != 0) - log(LOG_INFO, "in6_purgeaddr: deletion failed\n"); - } + error = ifa_del_loopback_route((struct ifaddr *)ia, + (struct sockaddr *)&ia->ia_addr); /* stop DAD processing */ nd6_dad_stop(ifa); @@ -1771,27 +1756,8 @@ in6_ifinit(struct ifnet *ifp, struct in6 if (!(ia->ia_flags & IFA_ROUTE) && (V_nd6_useloopback || (ifp->if_flags & IFF_LOOPBACK))) { - struct rt_addrinfo info; - struct rtentry *rt = NULL; - static struct sockaddr_dl null_sdl = {sizeof(null_sdl), AF_LINK}; - - bzero(&info, sizeof(info)); - info.rti_ifp = V_loif; - info.rti_flags = ia->ia_flags | RTF_HOST | RTF_STATIC; - info.rti_info[RTAX_DST] = (struct sockaddr *)&ia->ia_addr; - info.rti_info[RTAX_GATEWAY] = (struct sockaddr *)&null_sdl; - error = rtrequest1_fib(RTM_ADD, &info, &rt, 0); - - if (error == 0 && rt != NULL) { - RT_LOCK(rt); - ((struct sockaddr_dl *)rt->rt_gateway)->sdl_type = - ifp->if_type; - ((struct sockaddr_dl *)rt->rt_gateway)->sdl_index = - ifp->if_index; - RT_REMREF(rt); - RT_UNLOCK(rt); - } else if (error != 0) - log(LOG_INFO, "in6_ifinit: error = %d, insertion failed\n", error); + error = ifa_add_loopback_route((struct ifaddr *)ia, + (struct sockaddr *)&ia->ia_addr); } /* Add ownaddr as loopback rtentry, if necessary (ex. on p2p link). */ From owner-svn-src-stable@FreeBSD.ORG Wed Sep 16 12:07:58 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7E4F31065694; Wed, 16 Sep 2009 12:07:58 +0000 (UTC) (envelope-from raj@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 68D208FC16; Wed, 16 Sep 2009 12:07:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8GC7wIi023640; Wed, 16 Sep 2009 12:07:58 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8GC7wpR023623; Wed, 16 Sep 2009 12:07:58 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <200909161207.n8GC7wpR023623@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 16 Sep 2009 12:07:58 +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: r197251 - in stable/8/sys: . amd64/include/xen arm/conf arm/mv arm/mv/discovery arm/mv/kirkwood arm/mv/orion cddl/contrib/opensolaris conf contrib/dev/acpica contrib/pf dev/mge dev/xen/... X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2009 12:07:58 -0000 Author: raj Date: Wed Sep 16 12:07:58 2009 New Revision: 197251 URL: http://svn.freebsd.org/changeset/base/197251 Log: MFC r196531-196534,196536 Clean up Marvell platform code. Introduce SheevaPlug support. - The device is based on Marvell 88F6281 system on chip. - More info about the platform at http://www.plugcomputer.org - To build the FreeBSD kernel: make buildkernel TARGET_ARCH=arm KERNCONF=SHEEVAPLUG - Installation notes at: http://wiki.freebsd.org/FreeBSDMarvell Submitted by: Michal Hajduk Approved by: re (kib) Obtained from: Semihalf Added: stable/8/sys/arm/conf/SHEEVAPLUG - copied unchanged from r196536, head/sys/arm/conf/SHEEVAPLUG stable/8/sys/arm/mv/kirkwood/files.kirkwood - copied unchanged from r196533, head/sys/arm/mv/kirkwood/files.kirkwood stable/8/sys/arm/mv/kirkwood/files.sheevaplug - copied unchanged from r196536, head/sys/arm/mv/kirkwood/files.sheevaplug stable/8/sys/arm/mv/kirkwood/sheevaplug.c - copied unchanged from r196536, head/sys/arm/mv/kirkwood/sheevaplug.c stable/8/sys/arm/mv/kirkwood/std.kirkwood - copied unchanged from r196533, head/sys/arm/mv/kirkwood/std.kirkwood stable/8/sys/arm/mv/kirkwood/std.sheevaplug - copied unchanged from r196536, head/sys/arm/mv/kirkwood/std.sheevaplug Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/arm/mv/common.c stable/8/sys/arm/mv/discovery/db78xxx.c stable/8/sys/arm/mv/kirkwood/db88f6xxx.c stable/8/sys/arm/mv/kirkwood/files.db88f6xxx stable/8/sys/arm/mv/kirkwood/std.db88f6xxx stable/8/sys/arm/mv/mv_machdep.c stable/8/sys/arm/mv/mvreg.h stable/8/sys/arm/mv/mvvar.h stable/8/sys/arm/mv/orion/db88f5xxx.c stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/conf/options.arm stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/mge/if_mge.c stable/8/sys/dev/xen/xenpci/ (props changed) Copied: stable/8/sys/arm/conf/SHEEVAPLUG (from r196536, head/sys/arm/conf/SHEEVAPLUG) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/arm/conf/SHEEVAPLUG Wed Sep 16 12:07:58 2009 (r197251, copy of r196536, head/sys/arm/conf/SHEEVAPLUG) @@ -0,0 +1,70 @@ +# +# Custom kernel for Marvell SheevaPlug devices. +# +# $FreeBSD$ +# + +ident SHEEVAPLUG +include "../mv/kirkwood/std.sheevaplug" + +options SOC_MV_KIRKWOOD +makeoptions MODULES_OVERRIDE="" + +#makeoptions DEBUG=-g #Build kernel with gdb(1) debug symbols +makeoptions WERROR="-Werror" + +options SCHED_4BSD #4BSD scheduler +options INET #InterNETworking +options INET6 #IPv6 communications protocols +options FFS #Berkeley Fast Filesystem +options NFSCLIENT #Network Filesystem Client +options NFSLOCKD #Network Lock Manager +options NFS_ROOT #NFS usable as /, requires NFSCLIENT +options BOOTP +options BOOTP_NFSROOT +options BOOTP_NFSV3 +options BOOTP_WIRED_TO=mge0 + +# Root fs on USB device +#options ROOTDEVNAME=\"ufs:/dev/da0a\" + +options SYSVSHM #SYSV-style shared memory +options SYSVMSG #SYSV-style message queues +options SYSVSEM #SYSV-style semaphores +options _KPOSIX_PRIORITY_SCHEDULING #Posix P1003_1B real-time extensions +options MUTEX_NOINLINE +options RWLOCK_NOINLINE +options NO_FFS_SNAPSHOT +options NO_SWAPPING + +# Debugging +options ALT_BREAK_TO_DEBUGGER +options DDB +options KDB + +# Pseudo devices +device random +device pty +device loop + +# Serial ports +device uart + +# Networking +device ether +device mge # Marvell Gigabit Ethernet controller +device mii +device e1000phy +device bpf +options HZ=1000 +options DEVICE_POLLING +device vlan + +# USB +device usb +device ehci +device umass +device scbus +device pass +device da + Modified: stable/8/sys/arm/mv/common.c ============================================================================== --- stable/8/sys/arm/mv/common.c Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/common.c Wed Sep 16 12:07:58 2009 (r197251) @@ -32,8 +32,10 @@ #include __FBSDID("$FreeBSD$"); +#include #include #include +#include #include @@ -62,6 +64,76 @@ static void decode_win_usb_dump(void); static uint32_t used_cpu_wins; +static __inline int +pm_is_disabled(uint32_t mask) +{ + + return (soc_power_ctrl_get(mask) == mask ? 0 : 1); +} + +static __inline uint32_t +obio_get_pm_mask(uint32_t base) +{ + struct obio_device *od; + + for (od = obio_devices; od->od_name != NULL; od++) + if (od->od_base == base) + return (od->od_pwr_mask); + + return (CPU_PM_CTRL_NONE); +} + +/* + * Disable device using power management register. + * 1 - Device Power On + * 0 - Device Power Off + * Mask can be set in loader. + * EXAMPLE: + * loader> set hw.pm-disable-mask=0x2 + * + * Common mask: + * |-------------------------------| + * | Device | Kirkwood | Discovery | + * |-------------------------------| + * | USB0 | 0x00008 | 0x020000 | + * |-------------------------------| + * | USB1 | - | 0x040000 | + * |-------------------------------| + * | USB2 | - | 0x080000 | + * |-------------------------------| + * | GE0 | 0x00001 | 0x000002 | + * |-------------------------------| + * | GE1 | - | 0x000004 | + * |-------------------------------| + * | IDMA | - | 0x100000 | + * |-------------------------------| + * | XOR | 0x10000 | 0x200000 | + * |-------------------------------| + * | CESA | 0x20000 | 0x400000 | + * |-------------------------------| + * | SATA | 0x04000 | 0x004000 | + * --------------------------------| + * This feature can be used only on Kirkwood and Discovery + * machines. + */ +static __inline void +pm_disable_device(int mask) +{ +#ifdef DIAGNOSTIC + uint32_t reg; + + reg = soc_power_ctrl_get(CPU_PM_CTRL_ALL); + printf("Power Management Register: 0%x\n", reg); + + reg &= ~mask; + soc_power_ctrl_set(reg); + printf("Device %x is disabled\n", mask); + + reg = soc_power_ctrl_get(CPU_PM_CTRL_ALL); + printf("Power Management Register: 0%x\n", reg); +#endif +} + uint32_t read_cpu_ctrl(uint32_t reg) { @@ -103,14 +175,36 @@ cpu_extra_feat(void) return (ef); } +/* + * Get the power status of device. This feature is only supported on + * Kirkwood and Discovery SoCs. + */ uint32_t soc_power_ctrl_get(uint32_t mask) { +#ifndef SOC_MV_ORION if (mask != CPU_PM_CTRL_NONE) mask &= read_cpu_ctrl(CPU_PM_CTRL); return (mask); +#else + return (mask); +#endif +} + +/* + * Set the power status of device. This feature is only supported on + * Kirkwood and Discovery SoCs. + */ +void +soc_power_ctrl_set(uint32_t mask) +{ + +#ifndef SOC_MV_ORION + if (mask != CPU_PM_CTRL_NONE) + write_cpu_ctrl(CPU_PM_CTRL, mask); +#endif } void @@ -191,6 +285,13 @@ int soc_decode_win(void) { uint32_t dev, rev; + int mask; + + mask = 0; + TUNABLE_INT_FETCH("hw.pm-disable-mask", &mask); + + if (mask != 0) + pm_disable_device(mask); /* Retrieve our ID: some windows facilities vary between SoC models */ soc_id(&dev, &rev); @@ -623,8 +724,12 @@ decode_win_usb_setup(void) /* Disable and clear all USB windows for all ports */ m = usb_max_ports(); + for (p = 0; p < m; p++) { + if (pm_is_disabled(CPU_PM_CTRL_USB(p))) + continue; + for (i = 0; i < MV_WIN_USB_MAX; i++) { win_usb_cr_write(i, p, 0); win_usb_br_write(i, p, 0); @@ -710,6 +815,9 @@ decode_win_eth_setup(uint32_t base) uint32_t br, sz; int i, j; + if (pm_is_disabled(obio_get_pm_mask(base))) + return; + /* Disable, clear and revoke protection for all ETH windows */ for (i = 0; i < MV_WIN_ETH_MAX; i++) { @@ -880,6 +988,8 @@ decode_win_idma_setup(void) uint32_t br, sz; int i, j; + if (pm_is_disabled(CPU_PM_CTRL_IDMA)) + return; /* * Disable and clear all IDMA windows, revoke protection for all channels */ @@ -1172,6 +1282,9 @@ decode_win_xor_setup(void) uint32_t br, sz; int i, j, z, e = 1, m, window; + if (pm_is_disabled(CPU_PM_CTRL_XOR)) + return; + /* * Disable and clear all XOR windows, revoke protection for all * channels @@ -1364,6 +1477,9 @@ decode_win_cesa_setup(void) uint32_t br, cr; int i, j; + if (pm_is_disabled(CPU_PM_CTRL_CRYPTO)) + return; + /* Disable and clear all CESA windows */ for (i = 0; i < MV_WIN_CESA_MAX; i++) { win_cesa_cr_write(i, 0); @@ -1432,6 +1548,9 @@ decode_win_sata_setup(void) uint32_t cr, br; int i, j; + if (pm_is_disabled(CPU_PM_CTRL_SATA)) + return; + for (i = 0; i < MV_WIN_SATA_MAX; i++) { win_sata_cr_write(i, 0); win_sata_br_write(i, 0); Modified: stable/8/sys/arm/mv/discovery/db78xxx.c ============================================================================== --- stable/8/sys/arm/mv/discovery/db78xxx.c Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/discovery/db78xxx.c Wed Sep 16 12:07:58 2009 (r197251) @@ -68,11 +68,8 @@ __FBSDID("$FreeBSD$"); * 0xffff_2000 - 0xffff_ffff : unused (~55KB) */ -const struct pmap_devmap *pmap_devmap_bootstrap_table; -vm_offset_t pmap_bootstrap_lastaddr; - /* Static device mappings. */ -static const struct pmap_devmap pmap_devmap[] = { +const struct pmap_devmap pmap_devmap[] = { /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. @@ -105,16 +102,6 @@ const struct gpio_config mv_gpio_config[ { -1, -1, -1 } }; -int -platform_pmap_init(void) -{ - - pmap_bootstrap_lastaddr = MV_BASE - ARM_NOCACHE_KVA_SIZE; - pmap_devmap_bootstrap_table = &pmap_devmap[0]; - - return (0); -} - void platform_mpp_init(void) { Modified: stable/8/sys/arm/mv/kirkwood/db88f6xxx.c ============================================================================== --- stable/8/sys/arm/mv/kirkwood/db88f6xxx.c Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/kirkwood/db88f6xxx.c Wed Sep 16 12:07:58 2009 (r197251) @@ -68,11 +68,8 @@ __FBSDID("$FreeBSD$"); * 0xffff_2000 - 0xffff_ffff : unused (~55KB) */ -const struct pmap_devmap *pmap_devmap_bootstrap_table; -vm_offset_t pmap_bootstrap_lastaddr; - /* Static device mappings. */ -static const struct pmap_devmap pmap_devmap[] = { +const struct pmap_devmap pmap_devmap[] = { /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. @@ -105,16 +102,6 @@ const struct gpio_config mv_gpio_config[ { -1, -1, -1 } }; -int -platform_pmap_init(void) -{ - - pmap_bootstrap_lastaddr = MV_BASE - ARM_NOCACHE_KVA_SIZE; - pmap_devmap_bootstrap_table = &pmap_devmap[0]; - - return (0); -} - void platform_mpp_init(void) { Modified: stable/8/sys/arm/mv/kirkwood/files.db88f6xxx ============================================================================== --- stable/8/sys/arm/mv/kirkwood/files.db88f6xxx Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/kirkwood/files.db88f6xxx Wed Sep 16 12:07:58 2009 (r197251) @@ -1,5 +1,4 @@ # $FreeBSD$ -arm/mv/rtc.c standard -arm/mv/kirkwood/kirkwood.c standard +include "arm/mv/kirkwood/files.kirkwood" arm/mv/kirkwood/db88f6xxx.c standard Copied: stable/8/sys/arm/mv/kirkwood/files.kirkwood (from r196533, head/sys/arm/mv/kirkwood/files.kirkwood) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/arm/mv/kirkwood/files.kirkwood Wed Sep 16 12:07:58 2009 (r197251, copy of r196533, head/sys/arm/mv/kirkwood/files.kirkwood) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +arm/mv/rtc.c standard +arm/mv/kirkwood/kirkwood.c standard Copied: stable/8/sys/arm/mv/kirkwood/files.sheevaplug (from r196536, head/sys/arm/mv/kirkwood/files.sheevaplug) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/arm/mv/kirkwood/files.sheevaplug Wed Sep 16 12:07:58 2009 (r197251, copy of r196536, head/sys/arm/mv/kirkwood/files.sheevaplug) @@ -0,0 +1,4 @@ +# $FreeBSD$ + +include "arm/mv/kirkwood/files.kirkwood" +arm/mv/kirkwood/sheevaplug.c standard Copied: stable/8/sys/arm/mv/kirkwood/sheevaplug.c (from r196536, head/sys/arm/mv/kirkwood/sheevaplug.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/arm/mv/kirkwood/sheevaplug.c Wed Sep 16 12:07:58 2009 (r197251, copy of r196536, head/sys/arm/mv/kirkwood/sheevaplug.c) @@ -0,0 +1,152 @@ +/*- + * Copyright (C) 2008 MARVELL INTERNATIONAL LTD. + * Copyright (C) 2009 Semihalf + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of MARVELL nor the names of contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include + +/* + * Virtual address space layout: + * ----------------------------- + * 0x0000_0000 - 0x7FFF_FFFF : User Process (2 GB) + * 0x8000_0000 - 0xBBFF_FFFF : Unused (960 MB) + * 0xBC00_0000 - 0xBDFF_FFFF : Device Bus: CS1 (32 MB) + * 0xBE00_0000 - 0xBECF_FFFF : Unused (13 MB) + * 0xBED0_0000 - 0xBEDF_FFFF : Device Bus: CS2 (1 MB) + * 0xBEE0_0000 - 0xBEEF_FFFF : Device Bus: CS0 (1 MB) + * 0xBEF0_0000 - 0xBEFF_FFFF : Device Bus: BOOT (1 MB) + * 0xBF00_0000 - 0xBFFF_FFFF : Unused (16 MB) + * 0xC000_0000 - virtual_avail : Kernel Reserved (text, data, page tables, + * : stack etc.) + * virtual-avail - 0xEFFF_FFFF : KVA (virtual_avail is typically < 0xc0a0_0000) + * 0xF000_0000 - 0xF0FF_FFFF : No-Cache allocation area (16 MB) + * 0xF100_0000 - 0xF10F_FFFF : SoC Integrated devices registers range (1 MB) + * 0xF110_0000 - 0xF11F_FFFF : CESA SRAM (1 MB) + * 0xF120_0000 - 0xFFFE_FFFF : Unused (237 MB + 960 kB) + * 0xFFFF_0000 - 0xFFFF_0FFF : 'High' vectors page (4 kB) + * 0xFFFF_1000 - 0xFFFF_1FFF : ARM_TP_ADDRESS/RAS page (4 kB) + * 0xFFFF_2000 - 0xFFFF_FFFF : Unused (56 kB) + */ + +/* Static device mappings. */ +const struct pmap_devmap pmap_devmap[] = { + /* + * Map the on-board devices VA == PA so that we can access them + * with the MMU on or off. + */ + { /* SoC integrated peripherals registers range */ + MV_BASE, + MV_PHYS_BASE, + MV_SIZE, + VM_PROT_READ | VM_PROT_WRITE, + PTE_NOCACHE, + }, + { /* CESA SRAM */ + MV_CESA_SRAM_BASE, + MV_CESA_SRAM_PHYS_BASE, + MV_CESA_SRAM_SIZE, + VM_PROT_READ | VM_PROT_WRITE, + PTE_NOCACHE, + }, + { 0, 0, 0, 0, 0, } +}; + +const struct gpio_config mv_gpio_config[] = { + { -1, -1, -1 } +}; + +void +platform_mpp_init(void) +{ + + /* + * MPP configuration for Sheeva Plug + * + * MPP[0]: NF_IO[2] + * MPP[1]: NF_IO[3] + * MPP[2]: NF_IO[4] + * MPP[3]: NF_IO[5] + * MPP[4]: NF_IO[6] + * MPP[5]: NF_IO[7] + * MPP[6]: SYSRST_OUTn + * MPP[8]: UA0_RTS + * MPP[9]: UA0_CTS + * MPP[10]: UA0_TXD + * MPP[11]: UA0_RXD + * MPP[12]: SD_CLK + * MPP[13]: SD_CMD + * MPP[14]: SD_D[0] + * MPP[15]: SD_D[1] + * MPP[16]: SD_D[2] + * MPP[17]: SD_D[3] + * MPP[18]: NF_IO[0] + * MPP[19]: NF_IO[1] + * MPP[29]: TSMP[9] + * + * Others: GPIO + */ + + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL0, 0x01111111); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL1, 0x11113322); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL2, 0x00001111); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL3, 0x00100000); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL4, 0x00000000); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL5, 0x00000000); + bus_space_write_4(obio_tag, MV_MPP_BASE, MPP_CONTROL6, 0x00000000); +} + +static void +platform_identify(void *dummy) +{ + + soc_identify(); + + /* + * XXX Board identification e.g. read out from FPGA or similar should + * go here + */ +} +SYSINIT(platform_identify, SI_SUB_CPU, SI_ORDER_SECOND, platform_identify, NULL); Modified: stable/8/sys/arm/mv/kirkwood/std.db88f6xxx ============================================================================== --- stable/8/sys/arm/mv/kirkwood/std.db88f6xxx Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/kirkwood/std.db88f6xxx Wed Sep 16 12:07:58 2009 (r197251) @@ -1,13 +1,8 @@ # $FreeBSD$ include "../mv/std.mv" +include "../mv/kirkwood/std.kirkwood" files "../mv/kirkwood/files.db88f6xxx" -makeoptions KERNPHYSADDR=0x00900000 -makeoptions KERNVIRTADDR=0xc0900000 -options KERNPHYSADDR=0x00900000 -options KERNVIRTADDR=0xc0900000 -options PHYSADDR=0x00000000 options PHYSMEM_SIZE=0x20000000 -options STARTUP_PAGETABLE_ADDR=0x00100000 Copied: stable/8/sys/arm/mv/kirkwood/std.kirkwood (from r196533, head/sys/arm/mv/kirkwood/std.kirkwood) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/arm/mv/kirkwood/std.kirkwood Wed Sep 16 12:07:58 2009 (r197251, copy of r196533, head/sys/arm/mv/kirkwood/std.kirkwood) @@ -0,0 +1,15 @@ +# $FreeBSD$ + +# kernel gets loaded at 0x00900000 by the loader, but runs at virtual address +# 0xc0900000. RAM starts at 0. We put the pagetable at a reasonable place +# in memory, but may need to bounce it higher if there's a problem with this. +# We could paper over this by loading the kernel at 0xc0000000 virtual, but +# that leads to other complications, so we'll just reclaim the lower region of +# ram after we're loaded. Put the page tables for startup at 1MB. +makeoptions KERNPHYSADDR=0x00900000 +makeoptions KERNVIRTADDR=0xc0900000 + +options KERNPHYSADDR=0x00900000 +options KERNVIRTADDR=0xc0900000 +options PHYSADDR=0x00000000 +options STARTUP_PAGETABLE_ADDR=0x00100000 Copied: stable/8/sys/arm/mv/kirkwood/std.sheevaplug (from r196536, head/sys/arm/mv/kirkwood/std.sheevaplug) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/sys/arm/mv/kirkwood/std.sheevaplug Wed Sep 16 12:07:58 2009 (r197251, copy of r196536, head/sys/arm/mv/kirkwood/std.sheevaplug) @@ -0,0 +1,8 @@ +# $FreeBSD$ + +include "../mv/std.mv" +include "../mv/kirkwood/std.kirkwood" +files "../mv/kirkwood/files.sheevaplug" + +options PHYSMEM_SIZE=0x20000000 +options MII_ADDR_BASE=0 Modified: stable/8/sys/arm/mv/mv_machdep.c ============================================================================== --- stable/8/sys/arm/mv/mv_machdep.c Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/mv_machdep.c Wed Sep 16 12:07:58 2009 (r197251) @@ -86,6 +86,7 @@ __FBSDID("$FreeBSD$"); #include #include /* XXX eventually this should be eliminated */ +#include #ifdef DEBUG #define debugf(fmt, args...) printf(fmt, ##args) @@ -133,7 +134,9 @@ struct pcpu *pcpup = &__pcpu; vm_paddr_t phys_avail[10]; vm_paddr_t dump_avail[4]; vm_offset_t physical_pages; +vm_offset_t pmap_bootstrap_lastaddr; +const struct pmap_devmap *pmap_devmap_bootstrap_table; struct pv_addr systempage; struct pv_addr msgbufpv; struct pv_addr irqstack; @@ -423,8 +426,8 @@ initarm(void *mdp, void *unused __unused while (1); /* Platform-specific initialisation */ - if (platform_pmap_init() != 0) - return (NULL); + pmap_bootstrap_lastaddr = MV_BASE - ARM_NOCACHE_KVA_SIZE; + pmap_devmap_bootstrap_table = &pmap_devmap[0]; pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); Modified: stable/8/sys/arm/mv/mvreg.h ============================================================================== --- stable/8/sys/arm/mv/mvreg.h Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/mvreg.h Wed Sep 16 12:07:58 2009 (r197251) @@ -218,6 +218,7 @@ */ #define CPU_PM_CTRL 0x1C #define CPU_PM_CTRL_NONE 0 +#define CPU_PM_CTRL_ALL ~0x0 #if defined(SOC_MV_KIRKWOOD) #define CPU_PM_CTRL_GE0 (1 << 0) @@ -234,8 +235,11 @@ #define CPU_PM_CTRL_SATA1 (1 << 15) #define CPU_PM_CTRL_XOR1 (1 << 16) #define CPU_PM_CTRL_CRYPTO (1 << 17) -#define CPU_PM_CTRL_GE1 (1 << 18) -#define CPU_PM_CTRL_TDM (1 << 19) +#define CPU_PM_CTRL_GE1 (1 << 19) +#define CPU_PM_CTRL_TDM (1 << 20) +#define CPU_PM_CTRL_XOR (CPU_PM_CTRL_XOR0 | CPU_PM_CTRL_XOR1) +#define CPU_PM_CTRL_USB(u) (CPU_PM_CTRL_USB0) +#define CPU_PM_CTRL_SATA (CPU_PM_CTRL_SATA0 | CPU_PM_CTRL_SATA1) #elif defined(SOC_MV_DISCOVERY) #define CPU_PM_CTRL_GE0 (1 << 1) #define CPU_PM_CTRL_GE1 (1 << 2) @@ -258,6 +262,14 @@ #define CPU_PM_CTRL_XOR (1 << 21) #define CPU_PM_CTRL_CRYPTO (1 << 22) #define CPU_PM_CTRL_DEVICE (1 << 23) +#define CPU_PM_CTRL_USB(u) (1 << (17 + (u))) +#define CPU_PM_CTRL_SATA (CPU_PM_CTRL_SATA0 | CPU_PM_CTRL_SATA1) +#else +#define CPU_PM_CTRL_CRYPTO (CPU_PM_CTRL_NONE) +#define CPU_PM_CTRL_IDMA (CPU_PM_CTRL_NONE) +#define CPU_PM_CTRL_XOR (CPU_PM_CTRL_NONE) +#define CPU_PM_CTRL_SATA (CPU_PM_CTRL_NONE) +#define CPU_PM_CTRL_USB(u) (CPU_PM_CTRL_NONE) #endif /* Modified: stable/8/sys/arm/mv/mvvar.h ============================================================================== --- stable/8/sys/arm/mv/mvvar.h Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/mvvar.h Wed Sep 16 12:07:58 2009 (r197251) @@ -41,6 +41,10 @@ #define _MVVAR_H_ #include +#include +#include +#include +#include #define MV_TYPE_PCI 0 #define MV_TYPE_PCIE 1 @@ -104,6 +108,7 @@ struct decode_win { int remap; }; +extern const struct pmap_devmap pmap_devmap[]; extern const struct obio_pci mv_pci_info[]; extern const struct gpio_config mv_gpio_config[]; extern bus_space_tag_t obio_tag; @@ -124,13 +129,13 @@ int mv_gpio_configure(uint32_t pin, uint void mv_gpio_out(uint32_t pin, uint8_t val, uint8_t enable); uint8_t mv_gpio_in(uint32_t pin); -int platform_pmap_init(void); void platform_mpp_init(void); int soc_decode_win(void); void soc_id(uint32_t *dev, uint32_t *rev); void soc_identify(void); void soc_dump_decode_win(void); uint32_t soc_power_ctrl_get(uint32_t mask); +void soc_power_ctrl_set(uint32_t mask); int decode_win_cpu_set(int target, int attr, vm_paddr_t base, uint32_t size, int remap); Modified: stable/8/sys/arm/mv/orion/db88f5xxx.c ============================================================================== --- stable/8/sys/arm/mv/orion/db88f5xxx.c Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/arm/mv/orion/db88f5xxx.c Wed Sep 16 12:07:58 2009 (r197251) @@ -70,12 +70,10 @@ __FBSDID("$FreeBSD$"); * 0xffff_2000 - 0xffff_ffff : unused (~55KB) */ -const struct pmap_devmap *pmap_devmap_bootstrap_table; -vm_offset_t pmap_bootstrap_lastaddr; int platform_pci_get_irq(u_int bus, u_int slot, u_int func, u_int pin); /* Static device mappings. */ -static const struct pmap_devmap pmap_devmap[] = { +const struct pmap_devmap pmap_devmap[] = { /* * Map the on-board devices VA == PA so that we can access them * with the MMU on or off. @@ -184,16 +182,6 @@ const struct gpio_config mv_gpio_config[ }; #endif -int -platform_pmap_init(void) -{ - - pmap_bootstrap_lastaddr = MV_BASE - ARM_NOCACHE_KVA_SIZE; - pmap_devmap_bootstrap_table = &pmap_devmap[0]; - - return (0); -} - void platform_mpp_init(void) { Modified: stable/8/sys/conf/options.arm ============================================================================== --- stable/8/sys/conf/options.arm Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/conf/options.arm Wed Sep 16 12:07:58 2009 (r197251) @@ -24,6 +24,7 @@ KERNVIRTADDR opt_global.h LOADERRAMADDR opt_global.h PHYSADDR opt_global.h PHYSMEM_SIZE opt_global.h +MII_ADDR_BASE opt_global.h SKYEYE_WORKAROUNDS opt_global.h SOC_MV_DISCOVERY opt_global.h SOC_MV_KIRKWOOD opt_global.h Modified: stable/8/sys/dev/mge/if_mge.c ============================================================================== --- stable/8/sys/dev/mge/if_mge.c Wed Sep 16 11:56:44 2009 (r197250) +++ stable/8/sys/dev/mge/if_mge.c Wed Sep 16 12:07:58 2009 (r197251) @@ -69,7 +69,9 @@ __FBSDID("$FreeBSD$"); #include #include -#define MV_PHY_ADDR_BASE 8 +#ifndef MII_ADDR_BASE +#define MII_ADDR_BASE 8 +#endif #include #include @@ -1264,14 +1266,15 @@ mge_miibus_readreg(device_t dev, int phy /* * We assume static PHY address <=> device unit mapping: - * PHY Address = MV_PHY_ADDR_BASE + devce unit. + * PHY Address = MII_ADDR_BASE + devce unit. * This is true for most Marvell boards. * * Code below grants proper PHY detection on each device * unit. */ - if ((MV_PHY_ADDR_BASE + device_get_unit(dev)) != phy) + + if ((MII_ADDR_BASE + device_get_unit(dev)) != phy) return (0); MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff & @@ -1292,7 +1295,7 @@ mge_miibus_writereg(device_t dev, int ph { uint32_t retries; - if ((MV_PHY_ADDR_BASE + device_get_unit(dev)) != phy) + if ((MII_ADDR_BASE + device_get_unit(dev)) != phy) return (0); MGE_WRITE(sc_mge0, MGE_REG_SMI, 0x1fffffff & From owner-svn-src-stable@FreeBSD.ORG Wed Sep 16 13:24:38 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 15A1F106566C; Wed, 16 Sep 2009 13:24:38 +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 010E78FC0A; Wed, 16 Sep 2009 13:24:38 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8GDObdG025618; Wed, 16 Sep 2009 13:24:37 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8GDObjv025613; Wed, 16 Sep 2009 13:24:37 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <200909161324.n8GDObjv025613@svn.freebsd.org> From: Konstantin Belousov Date: Wed, 16 Sep 2009 13:24:37 +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: r197255 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris compat/freebsd32 compat/linux contrib/dev/acpica contrib/pf dev/xen/xenpci kern sys X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2009 13:24:38 -0000 Author: kib Date: Wed Sep 16 13:24:37 2009 New Revision: 197255 URL: http://svn.freebsd.org/changeset/base/197255 Log: MFC r197049: Calculate the amount of bytes to copy for select filedescriptor masks taking into account size of fd_set for the current process ABI. Approved by: re (kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/compat/freebsd32/freebsd32_misc.c stable/8/sys/compat/linux/linux_misc.c stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/kern/sys_generic.c stable/8/sys/sys/syscallsubr.h Modified: stable/8/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- stable/8/sys/compat/freebsd32/freebsd32_misc.c Wed Sep 16 13:11:37 2009 (r197254) +++ stable/8/sys/compat/freebsd32/freebsd32_misc.c Wed Sep 16 13:24:37 2009 (r197255) @@ -589,7 +589,8 @@ freebsd32_select(struct thread *td, stru * XXX big-endian needs to convert the fd_sets too. * XXX Do pointers need PTRIN()? */ - return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp)); + return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp, + sizeof(int32_t) * 8)); } /* Modified: stable/8/sys/compat/linux/linux_misc.c ============================================================================== --- stable/8/sys/compat/linux/linux_misc.c Wed Sep 16 13:11:37 2009 (r197254) +++ stable/8/sys/compat/linux/linux_misc.c Wed Sep 16 13:24:37 2009 (r197255) @@ -522,7 +522,7 @@ linux_select(struct thread *td, struct l tvp = NULL; error = kern_select(td, args->nfds, args->readfds, args->writefds, - args->exceptfds, tvp); + args->exceptfds, tvp, sizeof(l_int) * 8); #ifdef DEBUG if (ldebug(select)) Modified: stable/8/sys/kern/sys_generic.c ============================================================================== --- stable/8/sys/kern/sys_generic.c Wed Sep 16 13:11:37 2009 (r197254) +++ stable/8/sys/kern/sys_generic.c Wed Sep 16 13:24:37 2009 (r197255) @@ -774,12 +774,13 @@ select(td, uap) } else tvp = NULL; - return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp)); + return (kern_select(td, uap->nd, uap->in, uap->ou, uap->ex, tvp, + NFDBITS)); } int kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou, - fd_set *fd_ex, struct timeval *tvp) + fd_set *fd_ex, struct timeval *tvp, int abi_nfdbits) { struct filedesc *fdp; /* @@ -792,7 +793,7 @@ kern_select(struct thread *td, int nd, f fd_mask *ibits[3], *obits[3], *selbits, *sbp; struct timeval atv, rtv, ttv; int error, timo; - u_int nbufbytes, ncpbytes, nfdbits; + u_int nbufbytes, ncpbytes, ncpubytes, nfdbits; if (nd < 0) return (EINVAL); @@ -806,6 +807,7 @@ kern_select(struct thread *td, int nd, f */ nfdbits = roundup(nd, NFDBITS); ncpbytes = nfdbits / NBBY; + ncpubytes = roundup(nd, abi_nfdbits) / NBBY; nbufbytes = 0; if (fd_in != NULL) nbufbytes += 2 * ncpbytes; @@ -832,9 +834,11 @@ kern_select(struct thread *td, int nd, f ibits[x] = sbp + nbufbytes / 2 / sizeof *sbp; \ obits[x] = sbp; \ sbp += ncpbytes / sizeof *sbp; \ - error = copyin(name, ibits[x], ncpbytes); \ + error = copyin(name, ibits[x], ncpubytes); \ if (error != 0) \ goto done; \ + bzero((char *)ibits[x] + ncpubytes, \ + ncpbytes - ncpubytes); \ } \ } while (0) getbits(fd_in, 0); @@ -888,7 +892,7 @@ done: if (error == EWOULDBLOCK) error = 0; #define putbits(name, x) \ - if (name && (error2 = copyout(obits[x], name, ncpbytes))) \ + if (name && (error2 = copyout(obits[x], name, ncpubytes))) \ error = error2; if (error == 0) { int error2; Modified: stable/8/sys/sys/syscallsubr.h ============================================================================== --- stable/8/sys/sys/syscallsubr.h Wed Sep 16 13:11:37 2009 (r197254) +++ stable/8/sys/sys/syscallsubr.h Wed Sep 16 13:24:37 2009 (r197255) @@ -170,7 +170,7 @@ int kern_sched_rr_get_interval(struct th int kern_semctl(struct thread *td, int semid, int semnum, int cmd, union semun *arg, register_t *rval); int kern_select(struct thread *td, int nd, fd_set *fd_in, fd_set *fd_ou, - fd_set *fd_ex, struct timeval *tvp); + fd_set *fd_ex, struct timeval *tvp, int abi_nfdbits); int kern_sendfile(struct thread *td, struct sendfile_args *uap, struct uio *hdr_uio, struct uio *trl_uio, int compat); int kern_sendit(struct thread *td, int s, struct msghdr *mp, int flags, From owner-svn-src-stable@FreeBSD.ORG Wed Sep 16 13:44:12 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F06931065670; Wed, 16 Sep 2009 13:44:12 +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 DCCC38FC15; Wed, 16 Sep 2009 13:44:12 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8GDiCr7026107; Wed, 16 Sep 2009 13:44:12 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8GDiCAX026105; Wed, 16 Sep 2009 13:44:12 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <200909161344.n8GDiCAX026105@svn.freebsd.org> From: Michael Tuexen Date: Wed, 16 Sep 2009 13:44: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: r197256 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2009 13:44:13 -0000 Author: tuexen Date: Wed Sep 16 13:44:12 2009 New Revision: 197256 URL: http://svn.freebsd.org/changeset/base/197256 Log: Fixes two bugs: 1) A lock issue, if we ever had to try again we would double lock the INP lock. 2) We were allowing (at wrap) associd 0... which really we cannot allow since 0 normally means in most socket API calls that we are wishing to effect something on the INP not TCB. Approved by: re, rrs (mentor) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) stable/8/sys/netinet/sctp_pcb.c Modified: stable/8/sys/netinet/sctp_pcb.c ============================================================================== --- stable/8/sys/netinet/sctp_pcb.c Wed Sep 16 13:24:37 2009 (r197255) +++ stable/8/sys/netinet/sctp_pcb.c Wed Sep 16 13:44:12 2009 (r197256) @@ -3926,12 +3926,20 @@ sctp_aloc_a_assoc_id(struct sctp_inpcb * struct sctpasochead *head; struct sctp_tcb *lstcb; + SCTP_INP_WLOCK(inp); try_again: if (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) { /* TSNH */ + SCTP_INP_WUNLOCK(inp); return (0); } - SCTP_INP_WLOCK(inp); + /* + * We don't allow assoc id to be 0, this is needed otherwise if the + * id were to wrap we would have issues with some socket options. + */ + if (inp->sctp_associd_counter == 0) { + inp->sctp_associd_counter++; + } id = inp->sctp_associd_counter; inp->sctp_associd_counter++; lstcb = sctp_findasoc_ep_asocid_locked(inp, (sctp_assoc_t) id, 0); From owner-svn-src-stable@FreeBSD.ORG Wed Sep 16 14:47:50 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0C461065672; Wed, 16 Sep 2009 14:47:50 +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 A377A8FC1E; Wed, 16 Sep 2009 14:47:50 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8GEloK4028107; Wed, 16 Sep 2009 14:47:50 GMT (envelope-from tuexen@svn.freebsd.org) Received: (from tuexen@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8GEloIj028105; Wed, 16 Sep 2009 14:47:50 GMT (envelope-from tuexen@svn.freebsd.org) Message-Id: <200909161447.n8GEloIj028105@svn.freebsd.org> From: Michael Tuexen Date: Wed, 16 Sep 2009 14: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: r197258 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/xen/xenpci netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Sep 2009 14:47:50 -0000 Author: tuexen Date: Wed Sep 16 14:47:50 2009 New Revision: 197258 URL: http://svn.freebsd.org/changeset/base/197258 Log: MFC 197257: Fix a bug reported by Daniel Mentz: When authenticating DATA chunks some DATA chunks might get stuck when the MTU gets decreased via an ICMP message. Approved by: re, rrs (mentor) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/xen/xenpci/ (props changed) stable/8/sys/netinet/sctp_usrreq.c Modified: stable/8/sys/netinet/sctp_usrreq.c ============================================================================== --- stable/8/sys/netinet/sctp_usrreq.c Wed Sep 16 14:23:31 2009 (r197257) +++ stable/8/sys/netinet/sctp_usrreq.c Wed Sep 16 14:47:50 2009 (r197258) @@ -106,6 +106,7 @@ sctp_pathmtu_adjustment(struct sctp_inpc uint16_t nxtsz) { struct sctp_tmit_chunk *chk; + uint16_t overhead; /* Adjust that too */ stcb->asoc.smallest_mtu = nxtsz; @@ -114,13 +115,17 @@ sctp_pathmtu_adjustment(struct sctp_inpc SCTP_PRINTF("sctp_pathmtu_adjust called inp:%p stcb:%p net:%p nxtsz:%d\n", inp, stcb, net, nxtsz); #endif + overhead = IP_HDR_SIZE; + if (sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.peer_auth_chunks)) { + overhead += sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id); + } TAILQ_FOREACH(chk, &stcb->asoc.send_queue, sctp_next) { - if ((chk->send_size + IP_HDR_SIZE) > nxtsz) { + if ((chk->send_size + overhead) > nxtsz) { chk->flags |= CHUNK_FLAGS_FRAGMENT_OK; } } TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) { - if ((chk->send_size + IP_HDR_SIZE) > nxtsz) { + if ((chk->send_size + overhead) > nxtsz) { /* * For this guy we also mark for immediate resend * since we sent to big of chunk From owner-svn-src-stable@FreeBSD.ORG Thu Sep 17 05:27:33 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0FEBC106566B; Thu, 17 Sep 2009 05:27:33 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id F14908FC13; Thu, 17 Sep 2009 05:27:32 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8H5RWKb045942; Thu, 17 Sep 2009 05:27:32 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8H5RW46045941; Thu, 17 Sep 2009 05:27:32 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200909170527.n8H5RW46045941@svn.freebsd.org> From: Scott Long Date: Thu, 17 Sep 2009 05:27: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: r197264 - stable/8/sys/dev/ciss X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2009 05:27:33 -0000 Author: scottl Date: Thu Sep 17 05:27:32 2009 New Revision: 197264 URL: http://svn.freebsd.org/changeset/base/197264 Log: Merge r197260, r197261, r197262 - Prevent a panic on modern controllers by increasing CISS_MAX_PHYSTGT to 256 - Fix MSI and PERFORMANT interrupt programming. Fixes hang on boot. - Fix locking bugs in ioctl handler Most of this has been soaking at Yahoo for several months, if not longer. The quick MFC is due to the impending 8.0-RC1 build. Approved by: re Obtained from: Yahoo! Modified: stable/8/sys/dev/ciss/ (props changed) stable/8/sys/dev/ciss/ciss.c stable/8/sys/dev/ciss/cissreg.h stable/8/sys/dev/ciss/cissvar.h Modified: stable/8/sys/dev/ciss/ciss.c ============================================================================== --- stable/8/sys/dev/ciss/ciss.c Wed Sep 16 23:27:14 2009 (r197263) +++ stable/8/sys/dev/ciss/ciss.c Thu Sep 17 05:27:32 2009 (r197264) @@ -736,11 +736,16 @@ setup: ciss_printf(sc, "PERFORMANT Transport\n"); if ((ciss_force_interrupt != 1) && (ciss_setup_msix(sc) == 0)) { intr = ciss_perf_msi_intr; - sc->ciss_interrupt_mask = CISS_TL_PERF_INTR_MSI; } else { intr = ciss_perf_intr; - sc->ciss_interrupt_mask = CISS_TL_PERF_INTR_OPQ; } + /* XXX The docs say that the 0x01 bit is only for SAS controllers. + * Unfortunately, there is no good way to know if this is a SAS + * controller. Hopefully enabling this bit universally will work OK. + * It seems to work fine for SA6i controllers. + */ + sc->ciss_interrupt_mask = CISS_TL_PERF_INTR_OPQ | CISS_TL_PERF_INTR_MSI; + } else { ciss_printf(sc, "SIMPLE Transport\n"); /* MSIX doesn't seem to work in SIMPLE mode, only enable if it forced */ @@ -834,7 +839,10 @@ ciss_setup_msix(struct ciss_softc *sc) return (EINVAL); val = pci_msix_count(sc->ciss_dev); - if ((val != CISS_MSI_COUNT) || (pci_alloc_msix(sc->ciss_dev, &val) != 0)) + if (val < CISS_MSI_COUNT) + return (EINVAL); + val = MIN(val, CISS_MSI_COUNT); + if (pci_alloc_msix(sc->ciss_dev, &val) != 0) return (EINVAL); sc->ciss_msi = val; @@ -2559,15 +2567,16 @@ ciss_user_command(struct ciss_softc *sc, /* * Allocate an in-kernel databuffer if required, copy in user data. */ + mtx_unlock(&sc->ciss_mtx); cr->cr_length = ioc->buf_size; if (ioc->buf_size > 0) { if ((cr->cr_data = malloc(ioc->buf_size, CISS_MALLOC_CLASS, M_NOWAIT)) == NULL) { error = ENOMEM; - goto out; + goto out_unlocked; } if ((error = copyin(ioc->buf, cr->cr_data, ioc->buf_size))) { debug(0, "copyin: bad data buffer %p/%d", ioc->buf, ioc->buf_size); - goto out; + goto out_unlocked; } } @@ -2578,6 +2587,7 @@ ciss_user_command(struct ciss_softc *sc, bcopy(&ioc->Request, &cc->cdb, sizeof(cc->cdb)); /* XXX anything else to populate here? */ + mtx_lock(&sc->ciss_mtx); /* * Run the command. @@ -2598,15 +2608,19 @@ ciss_user_command(struct ciss_softc *sc, * Copy the results back to the user. */ bcopy(ce, &ioc->error_info, sizeof(*ce)); + mtx_unlock(&sc->ciss_mtx); if ((ioc->buf_size > 0) && (error = copyout(cr->cr_data, ioc->buf, ioc->buf_size))) { debug(0, "copyout: bad data buffer %p/%d", ioc->buf, ioc->buf_size); - goto out; + goto out_unlocked; } /* done OK */ error = 0; +out_unlocked: + mtx_lock(&sc->ciss_mtx); + out: if ((cr != NULL) && (cr->cr_data != NULL)) free(cr->cr_data, CISS_MALLOC_CLASS); Modified: stable/8/sys/dev/ciss/cissreg.h ============================================================================== --- stable/8/sys/dev/ciss/cissreg.h Wed Sep 16 23:27:14 2009 (r197263) +++ stable/8/sys/dev/ciss/cissreg.h Thu Sep 17 05:27:32 2009 (r197264) @@ -736,7 +736,8 @@ struct ciss_bmic_flush_cache { #define CISS_TL_PERF_CLEAR_INT(sc) CISS_TL_SIMPLE_WRITE(sc, CISS_TL_SIMPLE_ODC, CISS_TL_SIMPLE_ODC_CLEAR) #define CISS_CYCLE_MASK 0x00000001 -#define CISS_MSI_COUNT 4 +/* Only need one MSI/MSI-X vector */ +#define CISS_MSI_COUNT 1 #define CISS_TL_SIMPLE_DISABLE_INTERRUPTS(sc) \ CISS_TL_SIMPLE_WRITE(sc, CISS_TL_SIMPLE_IMR, \ Modified: stable/8/sys/dev/ciss/cissvar.h ============================================================================== --- stable/8/sys/dev/ciss/cissvar.h Wed Sep 16 23:27:14 2009 (r197263) +++ stable/8/sys/dev/ciss/cissvar.h Thu Sep 17 05:27:32 2009 (r197264) @@ -176,7 +176,7 @@ struct ciss_pdrive #define CISS_PHYSICAL_SHIFT 5 #define CISS_PHYSICAL_BASE (1 << CISS_PHYSICAL_SHIFT) -#define CISS_MAX_PHYSTGT 15 +#define CISS_MAX_PHYSTGT 256 #define CISS_IS_PHYSICAL(bus) (bus >= CISS_PHYSICAL_BASE) #define CISS_CAM_TO_PBUS(bus) (bus - CISS_PHYSICAL_BASE) From owner-svn-src-stable@FreeBSD.ORG Thu Sep 17 05:30:55 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA379106566B; Thu, 17 Sep 2009 05:30:55 +0000 (UTC) (envelope-from scottl@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B69848FC14; Thu, 17 Sep 2009 05:30:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8H5UtPa046067; Thu, 17 Sep 2009 05:30:55 GMT (envelope-from scottl@svn.freebsd.org) Received: (from scottl@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8H5UtfL046063; Thu, 17 Sep 2009 05:30:55 GMT (envelope-from scottl@svn.freebsd.org) Message-Id: <200909170530.n8H5UtfL046063@svn.freebsd.org> From: Scott Long Date: Thu, 17 Sep 2009 05:30: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: r197265 - stable/8/sys/dev/ciss X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2009 05:30:55 -0000 Author: scottl Date: Thu Sep 17 05:30:55 2009 New Revision: 197265 URL: http://svn.freebsd.org/changeset/base/197265 Log: Merge rev 197263: - Enable MSI support (MSIX support was already present) - Performance improvements Approved by: re Obtained from: Yahoo! Modified: stable/8/sys/dev/ciss/ (props changed) stable/8/sys/dev/ciss/ciss.c stable/8/sys/dev/ciss/cissreg.h stable/8/sys/dev/ciss/cissvar.h Modified: stable/8/sys/dev/ciss/ciss.c ============================================================================== --- stable/8/sys/dev/ciss/ciss.c Thu Sep 17 05:27:32 2009 (r197264) +++ stable/8/sys/dev/ciss/ciss.c Thu Sep 17 05:30:55 2009 (r197265) @@ -279,8 +279,10 @@ TUNABLE_INT("hw.ciss.force_interrupt", & * stick with matching against subvendor/subdevice, and thus have to * be updated for every new CISS adapter that appears. */ -#define CISS_BOARD_SA5 (1<<0) -#define CISS_BOARD_SA5B (1<<1) +#define CISS_BOARD_UNKNWON 0 +#define CISS_BOARD_SA5 1 +#define CISS_BOARD_SA5B 2 +#define CISS_BOARD_NOMSI (1<<4) static struct { @@ -289,10 +291,10 @@ static struct int flags; char *desc; } ciss_vendor_data[] = { - { 0x0e11, 0x4070, CISS_BOARD_SA5, "Compaq Smart Array 5300" }, - { 0x0e11, 0x4080, CISS_BOARD_SA5B, "Compaq Smart Array 5i" }, - { 0x0e11, 0x4082, CISS_BOARD_SA5B, "Compaq Smart Array 532" }, - { 0x0e11, 0x4083, CISS_BOARD_SA5B, "HP Smart Array 5312" }, + { 0x0e11, 0x4070, CISS_BOARD_SA5|CISS_BOARD_NOMSI, "Compaq Smart Array 5300" }, + { 0x0e11, 0x4080, CISS_BOARD_SA5B|CISS_BOARD_NOMSI, "Compaq Smart Array 5i" }, + { 0x0e11, 0x4082, CISS_BOARD_SA5B|CISS_BOARD_NOMSI, "Compaq Smart Array 532" }, + { 0x0e11, 0x4083, CISS_BOARD_SA5B|CISS_BOARD_NOMSI, "HP Smart Array 5312" }, { 0x0e11, 0x4091, CISS_BOARD_SA5, "HP Smart Array 6i" }, { 0x0e11, 0x409A, CISS_BOARD_SA5, "HP Smart Array 641" }, { 0x0e11, 0x409B, CISS_BOARD_SA5, "HP Smart Array 642" }, @@ -661,7 +663,6 @@ ciss_init_pci(struct ciss_softc *sc) (CISS_TRANSPORT_METHOD_SIMPLE | CISS_TRANSPORT_METHOD_PERF))) { ciss_printf(sc, "No supported transport layers: 0x%x\n", sc->ciss_cfg->supported_methods); - return(ENXIO); } switch (ciss_force_transport) { @@ -677,7 +678,7 @@ ciss_init_pci(struct ciss_softc *sc) } setup: - if (supported_methods & CISS_TRANSPORT_METHOD_PERF) { + if ((supported_methods & CISS_TRANSPORT_METHOD_PERF) != 0) { method = CISS_TRANSPORT_METHOD_PERF; sc->ciss_perf = (struct ciss_perf_config *)(cbase + cofs + sc->ciss_cfg->transport_offset); @@ -744,7 +745,7 @@ setup: * controller. Hopefully enabling this bit universally will work OK. * It seems to work fine for SA6i controllers. */ - sc->ciss_interrupt_mask = CISS_TL_PERF_INTR_OPQ | CISS_TL_PERF_INTR_MSI; + sc->ciss_interrupt_mask = CISS_TL_PERF_INTR_OPQ | CISS_TL_PERF_INTR_MSI; } else { ciss_printf(sc, "SIMPLE Transport\n"); @@ -792,7 +793,7 @@ setup: BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ - CISS_COMMAND_SG_LENGTH, /* nsegments */ + CISS_MAX_SG_ELEMENTS, /* nsegments */ BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ 0, /* flags */ NULL, NULL, /* lockfunc, lockarg */ @@ -810,7 +811,7 @@ setup: BUS_SPACE_MAXADDR, /* lowaddr */ BUS_SPACE_MAXADDR, /* highaddr */ NULL, NULL, /* filter, filterarg */ - MAXBSIZE, CISS_COMMAND_SG_LENGTH, /* maxsize, nsegments */ + MAXBSIZE, CISS_MAX_SG_ELEMENTS, /* maxsize, nsegments */ BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ BUS_DMA_ALLOCNOW, /* flags */ busdma_lock_mutex, &sc->ciss_mtx, /* lockfunc, lockarg */ @@ -823,32 +824,42 @@ setup: /************************************************************************ * Setup MSI/MSIX operation (Performant only) - * Four interrupts are available, but we only use 1 right now. + * Four interrupts are available, but we only use 1 right now. If MSI-X + * isn't avaialble, try using MSI instead. */ static int ciss_setup_msix(struct ciss_softc *sc) { - uint32_t id; int val, i; /* Weed out devices that don't actually support MSI */ - id = (pci_get_subvendor(sc->ciss_dev) << 16) | - pci_get_subdevice(sc->ciss_dev); - if ((id == 0x0e114070) || (id == 0x0e114080) || (id == 0x0e114082) || - (id == 0x0e114083)) + i = ciss_lookup(sc->ciss_dev); + if (ciss_vendor_data[i].flags & CISS_BOARD_NOMSI) return (EINVAL); + /* + * Only need to use the minimum number of MSI vectors, as the driver + * doesn't support directed MSIX interrupts. + */ val = pci_msix_count(sc->ciss_dev); - if (val < CISS_MSI_COUNT) - return (EINVAL); + if (val < CISS_MSI_COUNT) { + val = pci_msi_count(sc->ciss_dev); + device_printf(sc->ciss_dev, "got %d MSI messages]\n", val); + if (val < CISS_MSI_COUNT) + return (EINVAL); + } val = MIN(val, CISS_MSI_COUNT); - if (pci_alloc_msix(sc->ciss_dev, &val) != 0) - return (EINVAL); + if (pci_alloc_msix(sc->ciss_dev, &val) != 0) { + if (pci_alloc_msi(sc->ciss_dev, &val) != 0) + return (EINVAL); + } sc->ciss_msi = val; - ciss_printf(sc, "Using MSIX interrupt\n"); + if (bootverbose) + ciss_printf(sc, "Using %d MSIX interrupt%s\n", val, + (val != 1) ? "s" : ""); - for (i = 0; i < CISS_MSI_COUNT; i++) + for (i = 0; i < val; i++) sc->ciss_irq_rid[i] = i + 1; return (0); @@ -1031,7 +1042,7 @@ ciss_soft_reset(struct ciss_softc *sc) NULL, 0)) != 0) break; - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cc->header.address = sc->ciss_controllers[i]; if ((error = ciss_synch_request(cr, 60 * 1000)) != 0) @@ -1104,6 +1115,9 @@ ciss_init_requests(struct ciss_softc *sc cr = &sc->ciss_request[i]; cr->cr_sc = sc; cr->cr_tag = i; + cr->cr_cc = (struct ciss_command *)((uintptr_t)sc->ciss_command + + CISS_COMMAND_ALLOC_SIZE * i); + cr->cr_ccphys = sc->ciss_command_phys + CISS_COMMAND_ALLOC_SIZE * i; bus_dmamap_create(sc->ciss_buffer_dmat, 0, &cr->cr_datamap); ciss_enqueue_free(cr); } @@ -1257,7 +1271,7 @@ ciss_report_luns(struct ciss_softc *sc, /* * Build the Report Logical/Physical LUNs command. */ - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cr->cr_data = cll; cr->cr_length = report_size; cr->cr_flags = CISS_REQ_DATAIN; @@ -1582,7 +1596,7 @@ ciss_inquiry_logical(struct ciss_softc * if ((error = ciss_get_request(sc, &cr)) != 0) goto out; - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cr->cr_data = &ld->cl_geometry; cr->cr_length = sizeof(ld->cl_geometry); cr->cr_flags = CISS_REQ_DATAIN; @@ -1646,7 +1660,7 @@ ciss_identify_logical(struct ciss_softc (void **)&ld->cl_ldrive, sizeof(*ld->cl_ldrive))) != 0) goto out; - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cc->header.address = *ld->cl_controller; /* target controller */ cbc = (struct ciss_bmic_cdb *)&(cc->cdb.cdb[0]); cbc->log_drive = CISS_LUN_TO_TARGET(ld->cl_address.logical.lun); @@ -1742,7 +1756,7 @@ ciss_get_ldrive_status(struct ciss_softc (void **)&ld->cl_lstatus, sizeof(*ld->cl_lstatus))) != 0) goto out; - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cc->header.address = *ld->cl_controller; /* target controller */ cbc = (struct ciss_bmic_cdb *)&(cc->cdb.cdb[0]); cbc->log_drive = CISS_LUN_TO_TARGET(ld->cl_address.logical.lun); @@ -1832,7 +1846,7 @@ ciss_accept_media(struct ciss_softc *sc, if ((error = ciss_get_bmic_request(sc, &cr, CISS_BMIC_ACCEPT_MEDIA, NULL, 0)) != 0) goto out; - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cc->header.address = *ld->cl_controller; /* target controller */ cbc = (struct ciss_bmic_cdb *)&(cc->cdb.cdb[0]); cbc->log_drive = ldrive; @@ -2000,7 +2014,7 @@ ciss_start(struct ciss_request *cr) struct ciss_command *cc; /* XXX debugging only */ int error; - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; debug(2, "post command %d tag %d ", cr->cr_tag, cc->header.host_tag); /* @@ -2056,7 +2070,7 @@ ciss_done(struct ciss_softc *sc, cr_qhea continue; } cr = &(sc->ciss_request[index]); - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cc->header.host_tag = tag; /* not updated by adapter */ ciss_enqueue_complete(cr, qh); } @@ -2085,7 +2099,7 @@ ciss_perf_done(struct ciss_softc *sc, cr (tag & CISS_HDR_HOST_TAG_ERROR) ? " with error" : ""); if (index < sc->ciss_max_requests) { cr = &(sc->ciss_request[index]); - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cc->header.host_tag = tag; /* not updated by adapter */ ciss_enqueue_complete(cr, qh); } else { @@ -2222,7 +2236,7 @@ _ciss_report_request(struct ciss_request debug_called(2); - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; ce = (struct ciss_error_info *)&(cc->sg[0]); /* @@ -2369,7 +2383,7 @@ ciss_abort_request(struct ciss_request * return(error); /* build the abort command */ - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cc->header.address.mode.mode = CISS_HDR_ADDRESS_MODE_PERIPHERAL; /* addressing? */ cc->header.address.physical.target = 0; cc->header.address.physical.bus = 0; @@ -2438,12 +2452,12 @@ ciss_preen_command(struct ciss_request * * Note that we set up the error_info structure here, since the * length can be overwritten by any command. */ - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cc->header.sg_in_list = 0; /* kinda inefficient this way */ cc->header.sg_total = 0; cc->header.host_tag = cr->cr_tag << 2; cc->header.host_tag_zeroes = 0; - cmdphys = CISS_FIND_COMMANDPHYS(cr); + cmdphys = cr->cr_ccphys; cc->error_info.error_info_address = cmdphys + sizeof(struct ciss_command); cc->error_info.error_info_length = CISS_COMMAND_ALLOC_SIZE - sizeof(struct ciss_command); } @@ -2514,7 +2528,7 @@ ciss_get_bmic_request(struct ciss_softc if (!dataout) cr->cr_flags = CISS_REQ_DATAIN; - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cc->header.address.physical.mode = CISS_HDR_ADDRESS_MODE_PERIPHERAL; cc->header.address.physical.bus = 0; cc->header.address.physical.target = 0; @@ -2562,7 +2576,7 @@ ciss_user_command(struct ciss_softc *sc, */ while (ciss_get_request(sc, &cr) != 0) msleep(sc, &sc->ciss_mtx, PPAUSE, "cissREQ", hz); - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; /* * Allocate an in-kernel databuffer if required, copy in user data. @@ -2667,7 +2681,7 @@ ciss_map_request(struct ciss_request *cr if (sc->ciss_perf) CISS_TL_PERF_POST_CMD(sc, cr); else - CISS_TL_SIMPLE_POST_CMD(sc, CISS_FIND_COMMANDPHYS(cr)); + CISS_TL_SIMPLE_POST_CMD(sc, cr->cr_ccphys); } return(0); @@ -2685,7 +2699,7 @@ ciss_request_map_helper(void *arg, bus_d cr = (struct ciss_request *)arg; sc = cr->cr_sc; - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; for (i = 0; i < nseg; i++) { cc->sg[i].address = segs[i].ds_addr; @@ -2725,7 +2739,7 @@ ciss_request_map_helper(void *arg, bus_d if (sc->ciss_perf) CISS_TL_PERF_POST_CMD(sc, cr); else - CISS_TL_SIMPLE_POST_CMD(sc, CISS_FIND_COMMANDPHYS(cr)); + CISS_TL_SIMPLE_POST_CMD(sc, cr->cr_ccphys); } /************************************************************************ @@ -3091,7 +3105,7 @@ ciss_cam_action_io(struct cam_sim *sim, /* * Build the command. */ - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cr->cr_data = csio->data_ptr; cr->cr_length = csio->dxfer_len; cr->cr_complete = ciss_cam_complete; @@ -3235,7 +3249,7 @@ ciss_cam_complete(struct ciss_request *c debug_called(2); sc = cr->cr_sc; - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; ce = (struct ciss_error_info *)&(cc->sg[0]); csio = (struct ccb_scsiio *)cr->cr_private; @@ -3414,7 +3428,7 @@ ciss_periodic(void *arg) * Send the NOP message and wait for a response. */ if (ciss_nop_message_heartbeat != 0 && (error = ciss_get_request(sc, &cr)) == 0) { - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cr->cr_complete = ciss_nop_complete; cc->cdb.cdb_length = 1; cc->cdb.type = CISS_CDB_TYPE_MESSAGE; @@ -3484,7 +3498,7 @@ ciss_disable_adapter(struct ciss_softc * if ((cr->cr_flags & CISS_REQ_BUSY) == 0) continue; - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; ce = (struct ciss_error_info *)&(cc->sg[0]); ce->command_status = CISS_CMD_STATUS_HARDWARE_ERROR; ciss_enqueue_complete(cr, &qh); @@ -3561,7 +3575,7 @@ ciss_notify_event(struct ciss_softc *sc) ciss_preen_command(cr); /* (re)build the notify event command */ - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cc->header.address.physical.mode = CISS_HDR_ADDRESS_MODE_PERIPHERAL; cc->header.address.physical.bus = 0; cc->header.address.physical.target = 0; @@ -3615,7 +3629,7 @@ ciss_notify_complete(struct ciss_request int command_status; debug_called(1); - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cn = (struct ciss_notify *)cr->cr_data; sc = cr->cr_sc; @@ -3715,7 +3729,7 @@ ciss_notify_abort(struct ciss_softc *sc) cr->cr_length = CISS_NOTIFY_DATA_SIZE; /* build the CDB */ - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; cc->header.address.physical.mode = CISS_HDR_ADDRESS_MODE_PERIPHERAL; cc->header.address.physical.bus = 0; cc->header.address.physical.target = 0; @@ -4174,7 +4188,7 @@ ciss_print_request(struct ciss_request * int i; sc = cr->cr_sc; - cc = CISS_FIND_COMMAND(cr); + cc = cr->cr_cc; ciss_printf(sc, "REQUEST @ %p\n", cr); ciss_printf(sc, " data %p/%d tag %d flags %b\n", Modified: stable/8/sys/dev/ciss/cissreg.h ============================================================================== --- stable/8/sys/dev/ciss/cissreg.h Thu Sep 17 05:27:32 2009 (r197264) +++ stable/8/sys/dev/ciss/cissreg.h Thu Sep 17 05:30:55 2009 (r197265) @@ -731,7 +731,7 @@ struct ciss_bmic_flush_cache { #define CISS_TL_PERF_INTR_OPQ (CISS_TL_SIMPLE_INTR_OPQ_SA5 | CISS_TL_SIMPLE_INTR_OPQ_SA5B) #define CISS_TL_PERF_INTR_MSI 0x01 -#define CISS_TL_PERF_POST_CMD(sc, cr) CISS_TL_SIMPLE_WRITE(sc, CISS_TL_SIMPLE_IPQ, CISS_FIND_COMMANDPHYS(cr) | (cr)->cr_sg_tag) +#define CISS_TL_PERF_POST_CMD(sc, cr) CISS_TL_SIMPLE_WRITE(sc, CISS_TL_SIMPLE_IPQ, cr->cr_ccphys | (cr)->cr_sg_tag) #define CISS_TL_PERF_FLUSH_INT(sc) CISS_TL_SIMPLE_READ(sc, CISS_TL_SIMPLE_OSR) #define CISS_TL_PERF_CLEAR_INT(sc) CISS_TL_SIMPLE_WRITE(sc, CISS_TL_SIMPLE_ODC, CISS_TL_SIMPLE_ODC_CLEAR) #define CISS_CYCLE_MASK 0x00000001 @@ -747,4 +747,5 @@ struct ciss_bmic_flush_cache { CISS_TL_SIMPLE_READ(sc, CISS_TL_SIMPLE_IMR) & ~(sc)->ciss_interrupt_mask) + #endif /* _KERNEL */ Modified: stable/8/sys/dev/ciss/cissvar.h ============================================================================== --- stable/8/sys/dev/ciss/cissvar.h Thu Sep 17 05:27:32 2009 (r197264) +++ stable/8/sys/dev/ciss/cissvar.h Thu Sep 17 05:30:55 2009 (r197265) @@ -103,6 +103,8 @@ struct ciss_request void *cr_data; /* data buffer */ u_int32_t cr_length; /* data length */ bus_dmamap_t cr_datamap; /* DMA map for data */ + struct ciss_command *cr_cc; + uint32_t cr_ccphys; int cr_tag; int cr_flags; #define CISS_REQ_MAPPED (1<<0) /* data mapped */ @@ -131,18 +133,16 @@ struct ciss_request * scatter-gather list, and we also want to avoid having commands * cross page boundaries. * - * Note that 512 bytes yields 28 scatter/gather entries, or the - * ability to map (26 * PAGE_SIZE) + 2 bytes of data. On x86, this is - * 104kB. 256 bytes would only yield 12 entries, giving a mere 40kB, - * too small. + * The size of the ciss_command is 52 bytes. 65 s/g elements are reserved + * to allow a max i/o size of 256k. This gives a total command size of + * 1120 bytes, including the 32 byte alignment padding. Modern controllers + * seem to saturate nicely at this value. */ -#define CISS_COMMAND_ALLOC_SIZE 512 /* XXX tune to get sensible s/g list length */ -#define CISS_COMMAND_SG_LENGTH ((CISS_COMMAND_ALLOC_SIZE - sizeof(struct ciss_command)) \ - / sizeof(struct ciss_sg_entry)) - -/* XXX Prep for increasing max i/o */ -#define CISS_MAX_SG_ELEMENTS 17 +#define CISS_MAX_SG_ELEMENTS 65 +#define CISS_COMMAND_ALIGN 32 +#define CISS_COMMAND_SG_LENGTH (sizeof(struct ciss_sg_entry) * CISS_MAX_SG_ELEMENTS) +#define CISS_COMMAND_ALLOC_SIZE (roundup2(sizeof(struct ciss_command) + CISS_COMMAND_SG_LENGTH, CISS_COMMAND_ALIGN)) /* * Per-logical-drive data. @@ -259,20 +259,6 @@ struct ciss_softc struct ciss_qstat ciss_qstat[CISSQ_COUNT]; /* queue statistics */ }; -/* - * Given a request tag, find the corresponding command in virtual or - * physical space. - * - * The arithmetic here is due to the allocation of ciss_command structures - * inside CISS_COMMAND_ALLOC_SIZE blocks. See the comment at the definition - * of CISS_COMMAND_ALLOC_SIZE above. - */ -#define CISS_FIND_COMMAND(cr) \ - (struct ciss_command *)((u_int8_t *)(cr)->cr_sc->ciss_command + \ - ((cr)->cr_tag * CISS_COMMAND_ALLOC_SIZE)) -#define CISS_FIND_COMMANDPHYS(cr) ((cr)->cr_sc->ciss_command_phys + \ - ((cr)->cr_tag * CISS_COMMAND_ALLOC_SIZE)) - /************************************************************************ * Debugging/diagnostic output. */ From owner-svn-src-stable@FreeBSD.ORG Thu Sep 17 06:32:00 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3E65B106566C; Thu, 17 Sep 2009 06:32:00 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 122408FC1D; Thu, 17 Sep 2009 06:32:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8H6Vxag047303; Thu, 17 Sep 2009 06:31:59 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8H6VxVg047300; Thu, 17 Sep 2009 06:31:59 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200909170631.n8H6VxVg047300@svn.freebsd.org> From: Tim Kientzle Date: Thu, 17 Sep 2009 06:31:59 +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: r197266 - in stable/8/lib/libarchive: . test X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2009 06:32:00 -0000 Author: kientzle Date: Thu Sep 17 06:31:59 2009 New Revision: 197266 URL: http://svn.freebsd.org/changeset/base/197266 Log: MFC r196962: Fix /usr/bin/unzip: A bug deep in libarchive's read-ahead logic (incorrect handling of zero-length reads before the copy buffer is allocated) is masked by the iso9660 taster. Tar and cpio both enable that taster so were protected from the bug; unzip is susceptible. This both fixes the bug and updates the test harness to exercise this case. Submitted by: Ed Schouten diagnosed the bug and drafted a patch Approved by: re (kib) Modified: stable/8/lib/libarchive/ (props changed) stable/8/lib/libarchive/archive_read.c stable/8/lib/libarchive/test/test_compat_zip.c Modified: stable/8/lib/libarchive/archive_read.c ============================================================================== --- stable/8/lib/libarchive/archive_read.c Thu Sep 17 05:30:55 2009 (r197265) +++ stable/8/lib/libarchive/archive_read.c Thu Sep 17 06:31:59 2009 (r197266) @@ -928,9 +928,12 @@ __archive_read_filter_ahead(struct archi for (;;) { /* - * If we can satisfy from the copy buffer, we're done. + * If we can satisfy from the copy buffer (and the + * copy buffer isn't empty), we're done. In particular, + * note that min == 0 is a perfectly well-defined + * request. */ - if (filter->avail >= min) { + if (filter->avail >= min && filter->avail > 0) { if (avail != NULL) *avail = filter->avail; return (filter->next); Modified: stable/8/lib/libarchive/test/test_compat_zip.c ============================================================================== --- stable/8/lib/libarchive/test/test_compat_zip.c Thu Sep 17 05:30:55 2009 (r197265) +++ stable/8/lib/libarchive/test/test_compat_zip.c Thu Sep 17 06:31:59 2009 (r197266) @@ -36,7 +36,7 @@ test_compat_zip_1(void) assert((a = archive_read_new()) != NULL); assertEqualIntA(a, ARCHIVE_OK, archive_read_support_compression_all(a)); - assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_all(a)); + assertEqualIntA(a, ARCHIVE_OK, archive_read_support_format_zip(a)); extract_reference_file(name); assertEqualIntA(a, ARCHIVE_OK, archive_read_open_filename(a, name, 10240)); From owner-svn-src-stable@FreeBSD.ORG Thu Sep 17 11:03:37 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E9DB4106566C; Thu, 17 Sep 2009 11:03:37 +0000 (UTC) (envelope-from zec@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D77DB8FC12; Thu, 17 Sep 2009 11:03:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8HB3bRg054762; Thu, 17 Sep 2009 11:03:37 GMT (envelope-from zec@svn.freebsd.org) Received: (from zec@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8HB3br6054760; Thu, 17 Sep 2009 11:03:37 GMT (envelope-from zec@svn.freebsd.org) Message-Id: <200909171103.n8HB3br6054760@svn.freebsd.org> From: Marko Zec Date: Thu, 17 Sep 2009 11:03:37 +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: r197267 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris compat/linux contrib/dev/acpica contrib/pf dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2009 11:03:38 -0000 Author: zec Date: Thu Sep 17 11:03:37 2009 New Revision: 197267 URL: http://svn.freebsd.org/changeset/base/197267 Log: MFC r197176: Lock the ifnet list while iterating over it. Submitted by: julian MFC after: 3 days Approved by: re (kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/compat/linux/linux_ioctl.c stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/8/sys/compat/linux/linux_ioctl.c Thu Sep 17 06:31:59 2009 (r197266) +++ stable/8/sys/compat/linux/linux_ioctl.c Thu Sep 17 11:03:37 2009 (r197267) @@ -2152,6 +2152,7 @@ linux_ifconf(struct thread *td, struct i /* handle the 'request buffer size' case */ if (ifc.ifc_buf == PTROUT(NULL)) { ifc.ifc_len = 0; + IFNET_RLOCK(); TAILQ_FOREACH(ifp, &V_ifnet, if_link) { TAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { struct sockaddr *sa = ifa->ifa_addr; @@ -2159,6 +2160,7 @@ linux_ifconf(struct thread *td, struct i ifc.ifc_len += sizeof(ifr); } } + IFNET_RUNLOCK(); error = copyout(&ifc, uifc, sizeof(ifc)); CURVNET_RESTORE(); return (error); From owner-svn-src-stable@FreeBSD.ORG Thu Sep 17 12:41:27 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B5CCA10656F3; Thu, 17 Sep 2009 12:41:27 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 883398FC27; Thu, 17 Sep 2009 12:41:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8HCfR56056870; Thu, 17 Sep 2009 12:41:27 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8HCfRFC056867; Thu, 17 Sep 2009 12:41:27 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200909171241.n8HCfRFC056867@svn.freebsd.org> From: Andriy Gapon Date: Thu, 17 Sep 2009 12:41:27 +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: r197270 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ciss dev/pci dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2009 12:41:27 -0000 Author: avg Date: Thu Sep 17 12:41:27 2009 New Revision: 197270 URL: http://svn.freebsd.org/changeset/base/197270 Log: MFC r197077: pci: remove definitions of duplicate constants Suggested by: jhb Reviewed by: jhb Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/ciss/ (props changed) stable/8/sys/dev/pci/pcireg.h stable/8/sys/dev/pci/pcivar.h stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/pci/pcireg.h ============================================================================== --- stable/8/sys/dev/pci/pcireg.h Thu Sep 17 12:35:13 2009 (r197269) +++ stable/8/sys/dev/pci/pcireg.h Thu Sep 17 12:41:27 2009 (r197270) @@ -39,11 +39,11 @@ */ /* some PCI bus constants */ - -#define PCI_BUSMAX 255 -#define PCI_SLOTMAX 31 -#define PCI_FUNCMAX 7 -#define PCI_REGMAX 255 +#define PCI_DOMAINMAX 65535 /* highest supported domain number */ +#define PCI_BUSMAX 255 /* highest supported bus number */ +#define PCI_SLOTMAX 31 /* highest supported slot number */ +#define PCI_FUNCMAX 7 /* highest supported function number */ +#define PCI_REGMAX 255 /* highest supported config register addr. */ #define PCI_MAXHDRTYPE 2 /* PCI config header registers for all devices */ Modified: stable/8/sys/dev/pci/pcivar.h ============================================================================== --- stable/8/sys/dev/pci/pcivar.h Thu Sep 17 12:35:13 2009 (r197269) +++ stable/8/sys/dev/pci/pcivar.h Thu Sep 17 12:41:27 2009 (r197270) @@ -33,13 +33,6 @@ #include /* some PCI bus constants */ - -#define PCI_DOMAINMAX 65535 /* highest supported domain number */ -#define PCI_BUSMAX 255 /* highest supported bus number */ -#define PCI_SLOTMAX 31 /* highest supported slot number */ -#define PCI_FUNCMAX 7 /* highest supported function number */ -#define PCI_REGMAX 255 /* highest supported config register addr. */ - #define PCI_MAXMAPS_0 6 /* max. no. of memory/port maps */ #define PCI_MAXMAPS_1 2 /* max. no. of maps for PCI to PCI bridge */ #define PCI_MAXMAPS_2 1 /* max. no. of maps for CardBus bridge */ From owner-svn-src-stable@FreeBSD.ORG Thu Sep 17 12:44:59 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 70E20106566C; Thu, 17 Sep 2009 12:44:59 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 453068FC1F; Thu, 17 Sep 2009 12:44:59 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8HCixGv056994; Thu, 17 Sep 2009 12:44:59 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8HCix5Y056991; Thu, 17 Sep 2009 12:44:59 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200909171244.n8HCix5Y056991@svn.freebsd.org> From: Andriy Gapon Date: Thu, 17 Sep 2009 12:44:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197271 - in stable/7/sys: . contrib/pf dev/pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2009 12:44:59 -0000 Author: avg Date: Thu Sep 17 12:44:58 2009 New Revision: 197271 URL: http://svn.freebsd.org/changeset/base/197271 Log: MFC r197077: pci: remove definitions of duplicate constants Suggested by: jhb Reviewed by: jhb Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/pci/pcireg.h stable/7/sys/dev/pci/pcivar.h Modified: stable/7/sys/dev/pci/pcireg.h ============================================================================== --- stable/7/sys/dev/pci/pcireg.h Thu Sep 17 12:41:27 2009 (r197270) +++ stable/7/sys/dev/pci/pcireg.h Thu Sep 17 12:44:58 2009 (r197271) @@ -39,11 +39,11 @@ */ /* some PCI bus constants */ - -#define PCI_BUSMAX 255 -#define PCI_SLOTMAX 31 -#define PCI_FUNCMAX 7 -#define PCI_REGMAX 255 +#define PCI_DOMAINMAX 65535 /* highest supported domain number */ +#define PCI_BUSMAX 255 /* highest supported bus number */ +#define PCI_SLOTMAX 31 /* highest supported slot number */ +#define PCI_FUNCMAX 7 /* highest supported function number */ +#define PCI_REGMAX 255 /* highest supported config register addr. */ #define PCI_MAXHDRTYPE 2 /* PCI config header registers for all devices */ Modified: stable/7/sys/dev/pci/pcivar.h ============================================================================== --- stable/7/sys/dev/pci/pcivar.h Thu Sep 17 12:41:27 2009 (r197270) +++ stable/7/sys/dev/pci/pcivar.h Thu Sep 17 12:44:58 2009 (r197271) @@ -33,13 +33,6 @@ #include /* some PCI bus constants */ - -#define PCI_DOMAINMAX 65535 /* highest supported domain number */ -#define PCI_BUSMAX 255 /* highest supported bus number */ -#define PCI_SLOTMAX 31 /* highest supported slot number */ -#define PCI_FUNCMAX 7 /* highest supported function number */ -#define PCI_REGMAX 255 /* highest supported config register addr. */ - #define PCI_MAXMAPS_0 6 /* max. no. of memory/port maps */ #define PCI_MAXMAPS_1 2 /* max. no. of maps for PCI to PCI bridge */ #define PCI_MAXMAPS_2 1 /* max. no. of maps for CardBus bridge */ From owner-svn-src-stable@FreeBSD.ORG Thu Sep 17 13:42:00 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2B21F1065696; Thu, 17 Sep 2009 13:42:00 +0000 (UTC) (envelope-from bms@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 163F48FC13; Thu, 17 Sep 2009 13:42:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8HDfxCn058752; Thu, 17 Sep 2009 13:41:59 GMT (envelope-from bms@svn.freebsd.org) Received: (from bms@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8HDfxSK058750; Thu, 17 Sep 2009 13:41:59 GMT (envelope-from bms@svn.freebsd.org) Message-Id: <200909171341.n8HDfxSK058750@svn.freebsd.org> From: Bruce M Simpson Date: Thu, 17 Sep 2009 13:41:59 +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: r197280 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ciss dev/xen/xenpci netinet X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2009 13:42:00 -0000 Author: bms Date: Thu Sep 17 13:41:59 2009 New Revision: 197280 URL: http://svn.freebsd.org/changeset/base/197280 Log: MFC revs 197129,197130,197132: Fixes to mcast userland API. -- Fix an API issue in leave processing for IPv4 multicast groups. * Do not assume that the group lookup performed by imo_match_group() is valid when ifp is NULL in this case. * Instead, return EADDRNOTAVAIL if the ifp cannot be resolved for the membership we are being asked to leave. Caveat user: * The way IPv4 multicast memberships are implemented in the inpcb layer at the moment, has the side-effect that struct ip_moptions will still hold the membership, under the old ifp, until ip_freemoptions() is called for the parent inpcb. * The underlying issue is: the inpcb layer does not get notification of ifp being detached going away in a thread-safe manner. This is non-trivial to fix. -- Fix an obvious logic error in the IPv4 multicast leave processing, where the filter mode vector was not updated correctly after the leave. -- Tighten input checking in inp_join_group(): * Don't try to use the source address, when its family is unspecified. * If we get a join without a source, on an existing inclusive mode group, this is an error, as it would change the filter mode. Fix a problem with the handling of in_mfilter for new memberships: * Do not rely on imf being NULL; it is explicitly initialized to a non-NULL pointer when constructing a membership. * Explicitly initialize *imf to EX mode when the source address is unspecified. This fixes a problem with in_mfilter slot recycling in the join path. -- Don't allow joins w/o source on an existing group. This is almost always pilot error. We don't need to check for group filter UNDEFINED state at t1, because we only ever allocate filters with their groups, so we unconditionally reject such calls with EINVAL. Trying to change the active filter mode w/o going through IP_MSFILTER is also disallowed. Deals with the case described in PR 137164 upfront, cumulative with the fix in svn rev 197132 which only calls imo_match_source() if the source address family was not unspecified. -- Revision 197136 has a text conflict, however it is a comment only change. PR: 137164, 138689, 138690, 138691 Submitted by: Stef Walter (with fixups) Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/ciss/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/netinet/in_mcast.c Modified: stable/8/sys/netinet/in_mcast.c ============================================================================== --- stable/8/sys/netinet/in_mcast.c Thu Sep 17 13:33:40 2009 (r197279) +++ stable/8/sys/netinet/in_mcast.c Thu Sep 17 13:41:59 2009 (r197280) @@ -1957,11 +1957,6 @@ inp_join_group(struct inpcb *inp, struct if (ifp == NULL || (ifp->if_flags & IFF_MULTICAST) == 0) return (EADDRNOTAVAIL); - /* - * MCAST_JOIN_SOURCE on an exclusive membership is an error. - * On an existing inclusive membership, it just adds the - * source to the filter list. - */ imo = inp_findmoptions(inp); idx = imo_match_group(imo, ifp, &gsa->sa); if (idx == -1) { @@ -1969,15 +1964,33 @@ inp_join_group(struct inpcb *inp, struct } else { inm = imo->imo_membership[idx]; imf = &imo->imo_mfilters[idx]; - if (ssa->ss.ss_family != AF_UNSPEC && - imf->imf_st[1] != MCAST_INCLUDE) { - error = EINVAL; - goto out_inp_locked; - } - lims = imo_match_source(imo, idx, &ssa->sa); - if (lims != NULL) { - error = EADDRNOTAVAIL; - goto out_inp_locked; + if (ssa->ss.ss_family != AF_UNSPEC) { + /* + * MCAST_JOIN_SOURCE on an exclusive membership + * is an error. On an existing inclusive membership, + * it just adds the source to the filter list. + */ + if (imf->imf_st[1] != MCAST_INCLUDE) { + error = EINVAL; + goto out_inp_locked; + } + /* Throw out duplicates. */ + lims = imo_match_source(imo, idx, &ssa->sa); + if (lims != NULL) { + error = EADDRNOTAVAIL; + goto out_inp_locked; + } + } else { + /* + * MCAST_JOIN_GROUP on an existing inclusive + * membership is an error; if you want to change + * filter mode, you must use the userland API + * setsourcefilter(). + */ + if (imf->imf_st[1] == MCAST_INCLUDE) { + error = EINVAL; + goto out_inp_locked; + } } } @@ -2010,7 +2023,8 @@ inp_join_group(struct inpcb *inp, struct /* * Graft new source into filter list for this inpcb's * membership of the group. The in_multi may not have - * been allocated yet if this is a new membership. + * been allocated yet if this is a new membership, however, + * the in_mfilter slot will be allocated and must be initialized. */ if (ssa->ss.ss_family != AF_UNSPEC) { /* Membership starts in IN mode */ @@ -2027,6 +2041,12 @@ inp_join_group(struct inpcb *inp, struct error = ENOMEM; goto out_imo_free; } + } else { + /* No address specified; Membership starts in EX mode */ + if (is_new) { + CTR1(KTR_IGMPV3, "%s: new join w/o source", __func__); + imf_init(imf, MCAST_UNDEFINED, MCAST_EXCLUDE); + } } /* @@ -2189,6 +2209,9 @@ inp_leave_group(struct inpcb *inp, struc if (!IN_MULTICAST(ntohl(gsa->sin.sin_addr.s_addr))) return (EINVAL); + if (ifp == NULL) + return (EADDRNOTAVAIL); + /* * Find the membership in the membership array. */ @@ -2275,9 +2298,11 @@ out_imf_rollback: imf_reap(imf); if (is_final) { - /* Remove the gap in the membership array. */ - for (++idx; idx < imo->imo_num_memberships; ++idx) + /* Remove the gap in the membership and filter array. */ + for (++idx; idx < imo->imo_num_memberships; ++idx) { imo->imo_membership[idx-1] = imo->imo_membership[idx]; + imo->imo_mfilters[idx-1] = imo->imo_mfilters[idx]; + } imo->imo_num_memberships--; } From owner-svn-src-stable@FreeBSD.ORG Thu Sep 17 14:05:06 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EAF9D106566B; Thu, 17 Sep 2009 14:05:06 +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 D85218FC14; Thu, 17 Sep 2009 14:05:06 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8HE56Bl059471; Thu, 17 Sep 2009 14:05:06 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8HE56c1059469; Thu, 17 Sep 2009 14:05:06 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200909171405.n8HE56c1059469@svn.freebsd.org> From: Ken Smith Date: Thu, 17 Sep 2009 14:05: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: r197281 - stable/8/sys/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2009 14:05:07 -0000 Author: kensmith Date: Thu Sep 17 14:05:06 2009 New Revision: 197281 URL: http://svn.freebsd.org/changeset/base/197281 Log: Get ready for 8.0-RC1 builds. Approved by: re (implicit) Modified: stable/8/sys/conf/newvers.sh Modified: stable/8/sys/conf/newvers.sh ============================================================================== --- stable/8/sys/conf/newvers.sh Thu Sep 17 13:41:59 2009 (r197280) +++ stable/8/sys/conf/newvers.sh Thu Sep 17 14:05:06 2009 (r197281) @@ -32,7 +32,7 @@ TYPE="FreeBSD" REVISION="8.0" -BRANCH="BETA4" +BRANCH="RC1" if [ "X${BRANCH_OVERRIDE}" != "X" ]; then BRANCH=${BRANCH_OVERRIDE} fi From owner-svn-src-stable@FreeBSD.ORG Thu Sep 17 14:12:22 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 22B07106568F; Thu, 17 Sep 2009 14:12:22 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 0E4508FC16; Thu, 17 Sep 2009 14:12:22 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8HECLTo059695; Thu, 17 Sep 2009 14:12:21 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8HECLSl059693; Thu, 17 Sep 2009 14:12:21 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200909171412.n8HECLSl059693@svn.freebsd.org> From: Takahashi Yoshihiro Date: Thu, 17 Sep 2009 14:12:21 +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: r197282 - in stable/8/sys: . amd64/include/xen boot/pc98 cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ciss dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2009 14:12:22 -0000 Author: nyan Date: Thu Sep 17 14:12:21 2009 New Revision: 197282 URL: http://svn.freebsd.org/changeset/base/197282 Log: MFC: r197156 MFi386: Move the loader's entry point to 0x200000. This change is also needed for pc98. Approved by: re (kensmith) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/boot/pc98/Makefile.inc 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/ciss/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/boot/pc98/Makefile.inc ============================================================================== --- stable/8/sys/boot/pc98/Makefile.inc Thu Sep 17 14:05:06 2009 (r197281) +++ stable/8/sys/boot/pc98/Makefile.inc Thu Sep 17 14:12:21 2009 (r197282) @@ -4,7 +4,7 @@ BINDIR?= /boot -LOADER_ADDRESS?=0x100000 +LOADER_ADDRESS?=0x200000 CFLAGS+= -ffreestanding -mpreferred-stack-boundary=2 \ -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \ -Os From owner-svn-src-stable@FreeBSD.ORG Thu Sep 17 14:23:51 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9DDF21065670; Thu, 17 Sep 2009 14:23:51 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8ACB48FC1B; Thu, 17 Sep 2009 14:23:51 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8HENpbv060086; Thu, 17 Sep 2009 14:23:51 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8HENpJt060084; Thu, 17 Sep 2009 14:23:51 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200909171423.n8HENpJt060084@svn.freebsd.org> From: Takahashi Yoshihiro Date: Thu, 17 Sep 2009 14:23:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197283 - in stable/7/sys: . boot/pc98 contrib/pf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2009 14:23:51 -0000 Author: nyan Date: Thu Sep 17 14:23:51 2009 New Revision: 197283 URL: http://svn.freebsd.org/changeset/base/197283 Log: MFC: r197156 MFi386: Move the loader's entry point to 0x200000. This change is also needed for pc98. Modified: stable/7/sys/ (props changed) stable/7/sys/boot/pc98/Makefile.inc stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/boot/pc98/Makefile.inc ============================================================================== --- stable/7/sys/boot/pc98/Makefile.inc Thu Sep 17 14:12:21 2009 (r197282) +++ stable/7/sys/boot/pc98/Makefile.inc Thu Sep 17 14:23:51 2009 (r197283) @@ -4,7 +4,7 @@ BINDIR?= /boot -LOADER_ADDRESS?=0x100000 +LOADER_ADDRESS?=0x200000 CFLAGS+= -ffreestanding -mpreferred-stack-boundary=2 \ -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \ -Os From owner-svn-src-stable@FreeBSD.ORG Thu Sep 17 14:30:14 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E91581065670; Thu, 17 Sep 2009 14:30:14 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id D5C2E8FC14; Thu, 17 Sep 2009 14:30:14 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8HEUE4s060340; Thu, 17 Sep 2009 14:30:14 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8HEUE9Z060338; Thu, 17 Sep 2009 14:30:14 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <200909171430.n8HEUE9Z060338@svn.freebsd.org> From: Takahashi Yoshihiro Date: Thu, 17 Sep 2009 14:30:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-6@freebsd.org X-SVN-Group: stable-6 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197284 - in stable/6/sys: . boot/pc98 conf contrib/pf dev/cxgb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2009 14:30:15 -0000 Author: nyan Date: Thu Sep 17 14:30:14 2009 New Revision: 197284 URL: http://svn.freebsd.org/changeset/base/197284 Log: MFC: r197156 MFi386: Move the loader's entry point to 0x200000. This change is also needed for pc98. Modified: stable/6/sys/ (props changed) stable/6/sys/boot/pc98/Makefile.inc stable/6/sys/conf/ (props changed) stable/6/sys/contrib/pf/ (props changed) stable/6/sys/dev/cxgb/ (props changed) Modified: stable/6/sys/boot/pc98/Makefile.inc ============================================================================== --- stable/6/sys/boot/pc98/Makefile.inc Thu Sep 17 14:23:51 2009 (r197283) +++ stable/6/sys/boot/pc98/Makefile.inc Thu Sep 17 14:30:14 2009 (r197284) @@ -4,7 +4,7 @@ BINDIR?= /boot -LOADER_ADDRESS?=0x100000 +LOADER_ADDRESS?=0x200000 CFLAGS+= -ffreestanding -mpreferred-stack-boundary=2 \ -mno-mmx -mno-3dnow -mno-sse -mno-sse2 -mno-sse3 \ -Os From owner-svn-src-stable@FreeBSD.ORG Fri Sep 18 14:12:40 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D57681065670; Fri, 18 Sep 2009 14:12:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C22AA8FC27; Fri, 18 Sep 2009 14:12:40 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8IECe11093025; Fri, 18 Sep 2009 14:12:40 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8IECecw093023; Fri, 18 Sep 2009 14:12:40 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200909181412.n8IECecw093023@svn.freebsd.org> From: Andriy Gapon Date: Fri, 18 Sep 2009 14:12:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197311 - in stable/7/sys: . contrib/pf dev/pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Sep 2009 14:12:40 -0000 Author: avg Date: Fri Sep 18 14:12:40 2009 New Revision: 197311 URL: http://svn.freebsd.org/changeset/base/197311 Log: MFC r197099: pci(4): don't perform maximum register number check Different sub-kinds of PCI buses may have different rules and thus it is up for the bus backends to do proper input checks. For example, PCIe allows configuration register numbers < 0x1000, while for PCI proper the limit is 0x100. And, in fact, the buses already do the checks. Reviewed by: jhb Modified: stable/7/sys/ (props changed) stable/7/sys/contrib/pf/ (props changed) stable/7/sys/dev/pci/pci_user.c Modified: stable/7/sys/dev/pci/pci_user.c ============================================================================== --- stable/7/sys/dev/pci/pci_user.c Fri Sep 18 14:05:56 2009 (r197310) +++ stable/7/sys/dev/pci/pci_user.c Fri Sep 18 14:12:40 2009 (r197311) @@ -605,9 +605,8 @@ getconfexit: case 4: case 2: case 1: - /* Make sure register is in bounds and aligned. */ + /* Make sure register is not negative and aligned. */ if (io->pi_reg < 0 || - io->pi_reg + io->pi_width > PCI_REGMAX + 1 || io->pi_reg & (io->pi_width - 1)) { error = EINVAL; break; From owner-svn-src-stable@FreeBSD.ORG Fri Sep 18 20:35:05 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7BE5E106566B; Fri, 18 Sep 2009 20:35:05 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4F9638FC0A; Fri, 18 Sep 2009 20:35:05 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8IKZ5ux000628; Fri, 18 Sep 2009 20:35:05 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8IKZ523000626; Fri, 18 Sep 2009 20:35:05 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <200909182035.n8IKZ523000626@svn.freebsd.org> From: "Kenneth D. Merry" Date: Fri, 18 Sep 2009 20:35: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: r197318 - in stable/8/sys: . amd64/include/xen cam cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ciss dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 18 Sep 2009 20:35:05 -0000 Author: ken Date: Fri Sep 18 20:35:05 2009 New Revision: 197318 URL: http://svn.freebsd.org/changeset/base/197318 Log: Merge change r197208 from head to stable/8: Fix some instances where CAM rescans get hung up or take a long time to complete. Also, allow xpt_rescan() to rescan a LUN instead of a full bus. Sponsored by: Copan Systems, Inc. Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cam/cam_xpt.c 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/ciss/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/cam/cam_xpt.c ============================================================================== --- stable/8/sys/cam/cam_xpt.c Fri Sep 18 17:09:33 2009 (r197317) +++ stable/8/sys/cam/cam_xpt.c Fri Sep 18 20:35:05 2009 (r197318) @@ -794,8 +794,9 @@ xpt_scanner_thread(void *dummy) * processed. */ xpt_lock_buses(); - msleep(&xsoftc.ccb_scanq, &xsoftc.xpt_topo_lock, PRIBIO, - "ccb_scanq", 0); + if (TAILQ_EMPTY(&xsoftc.ccb_scanq)) + msleep(&xsoftc.ccb_scanq, &xsoftc.xpt_topo_lock, PRIBIO, + "ccb_scanq", 0); TAILQ_INIT(&queue); TAILQ_CONCAT(&queue, &xsoftc.ccb_scanq, sim_links.tqe); xpt_unlock_buses(); @@ -806,9 +807,12 @@ xpt_scanner_thread(void *dummy) sim = ccb->ccb_h.path->bus->sim; CAM_SIM_LOCK(sim); - ccb->ccb_h.func_code = XPT_SCAN_BUS; + if( ccb->ccb_h.path->target->target_id == CAM_TARGET_WILDCARD ) + ccb->ccb_h.func_code = XPT_SCAN_BUS; + else + ccb->ccb_h.func_code = XPT_SCAN_LUN; ccb->ccb_h.cbfcnp = xptdone; - xpt_setup_ccb(&ccb->ccb_h, ccb->ccb_h.path, 5); + xpt_setup_ccb(&ccb->ccb_h, ccb->ccb_h.path, 1); cam_periph_runccb(ccb, NULL, 0, 0, NULL); xpt_free_path(ccb->ccb_h.path); xpt_free_ccb(ccb); @@ -828,6 +832,7 @@ xpt_rescan(union ccb *ccb) xpt_lock_buses(); TAILQ_FOREACH(hdr, &xsoftc.ccb_scanq, sim_links.tqe) { if (xpt_path_comp(hdr->path, ccb->ccb_h.path) == 0) { + wakeup(&xsoftc.ccb_scanq); xpt_unlock_buses(); xpt_print(ccb->ccb_h.path, "rescan already queued\n"); xpt_free_path(ccb->ccb_h.path); From owner-svn-src-stable@FreeBSD.ORG Sat Sep 19 01:48:13 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3CA79106566B; Sat, 19 Sep 2009 01:48:13 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 28B028FC18; Sat, 19 Sep 2009 01:48:13 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8J1mD1J006295; Sat, 19 Sep 2009 01:48:13 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8J1mDNm006293; Sat, 19 Sep 2009 01:48:13 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200909190148.n8J1mDNm006293@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 19 Sep 2009 01:48:13 +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: r197320 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ciss dev/xen/xenpci powerpc/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Sep 2009 01:48:13 -0000 Author: nwhitehorn Date: Sat Sep 19 01:48:12 2009 New Revision: 197320 URL: http://svn.freebsd.org/changeset/base/197320 Log: MFC r196993 Remove some debugging (KTR_VERBOSE) that crept into ppc GENERIC long ago and is present on no other architectures by default. Reviewed by: grehan Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/ciss/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/powerpc/conf/GENERIC Modified: stable/8/sys/powerpc/conf/GENERIC ============================================================================== --- stable/8/sys/powerpc/conf/GENERIC Fri Sep 18 21:39:59 2009 (r197319) +++ stable/8/sys/powerpc/conf/GENERIC Sat Sep 19 01:48:12 2009 (r197320) @@ -162,7 +162,3 @@ device pmu device iicbus # I2C bus code device kiic # Keywest I2C -options KTR -options KTR_COMPILE=0xffffffff -#options KTR_MASK=KTR_SIG -options KTR_VERBOSE From owner-svn-src-stable@FreeBSD.ORG Sat Sep 19 01:49:37 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 47E09106566C; Sat, 19 Sep 2009 01:49:37 +0000 (UTC) (envelope-from nwhitehorn@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 341DC8FC1E; Sat, 19 Sep 2009 01:49:37 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8J1nbeY006369; Sat, 19 Sep 2009 01:49:37 GMT (envelope-from nwhitehorn@svn.freebsd.org) Received: (from nwhitehorn@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8J1nbLQ006367; Sat, 19 Sep 2009 01:49:37 GMT (envelope-from nwhitehorn@svn.freebsd.org) Message-Id: <200909190149.n8J1nbLQ006367@svn.freebsd.org> From: Nathan Whitehorn Date: Sat, 19 Sep 2009 01:49:37 +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: r197321 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ciss dev/xen/xenpci powerpc/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Sep 2009 01:49:37 -0000 Author: nwhitehorn Date: Sat Sep 19 01:49:36 2009 New Revision: 197321 URL: http://svn.freebsd.org/changeset/base/197321 Log: MFC r197080 Add a few SCSI controllers to GENERIC that can be found in Powermacs. This allows installation onto SCSI disks as shipped, for example, as an option with the Powermac G3. PR: powerpc/138543 Reviewed by: grehan Approved by: re (kib) Obtained from: sparc64 Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/ciss/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/powerpc/conf/GENERIC Modified: stable/8/sys/powerpc/conf/GENERIC ============================================================================== --- stable/8/sys/powerpc/conf/GENERIC Sat Sep 19 01:48:12 2009 (r197320) +++ stable/8/sys/powerpc/conf/GENERIC Sat Sep 19 01:49:36 2009 (r197321) @@ -83,6 +83,16 @@ device atapicd # ATAPI CDROM drives #device atapifd # ATAPI floppy drives #device atapist # ATAPI tape drives +# SCSI Controllers +device ahc # AHA2940 and onboard AIC7xxx devices +options AHC_ALLOW_MEMIO # Attempt to use memory mapped I/O +options AHC_REG_PRETTY_PRINT # Print register bitfields in debug + # output. Adds ~128k to driver. +device isp # Qlogic family +device ispfw # Firmware module for Qlogic host adapters +device mpt # LSI-Logic MPT-Fusion +device sym # NCR/Symbios/LSI Logic 53C8XX/53C1010/53C1510D + # SCSI peripherals device scbus # SCSI bus (required for SCSI) device da # Direct Access (disks) @@ -119,6 +129,7 @@ device md # Memory "disks" device ofwd # Open Firmware disks device gif # IPv6 and IPv4 tunneling device faith # IPv6-to-IPv4 relaying/(translation) +device firmware # firmware assist module # The `bpf' device enables the Berkeley Packet Filter. # Be aware of the administrative consequences of enabling this! From owner-svn-src-stable@FreeBSD.ORG Sat Sep 19 08:13:11 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5632B1065672; Sat, 19 Sep 2009 08:13:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 42EC28FC15; Sat, 19 Sep 2009 08:13:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8J8DAHg017723; Sat, 19 Sep 2009 08:13:10 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8J8DAmE017722; Sat, 19 Sep 2009 08:13:10 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <200909190813.n8J8DAmE017722@svn.freebsd.org> From: Andriy Gapon Date: Sat, 19 Sep 2009 08:13:10 +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: r197324 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ciss dev/pci dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Sep 2009 08:13:11 -0000 Author: avg Date: Sat Sep 19 08:13:10 2009 New Revision: 197324 URL: http://svn.freebsd.org/changeset/base/197324 Log: MFC r197099: pci(4): don't perform maximum register number check Different sub-kinds of PCI buses may have different rules and thus it is up for the bus backends to do proper input checks. For example, PCIe allows configuration register numbers < 0x1000, while for PCI proper the limit is 0x100. And, in fact, the buses already do the checks. Reviewed by: jhb Approved by: re (kib) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/ciss/ (props changed) stable/8/sys/dev/pci/pci_user.c stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/pci/pci_user.c ============================================================================== --- stable/8/sys/dev/pci/pci_user.c Sat Sep 19 04:36:38 2009 (r197323) +++ stable/8/sys/dev/pci/pci_user.c Sat Sep 19 08:13:10 2009 (r197324) @@ -605,9 +605,8 @@ getconfexit: case 4: case 2: case 1: - /* Make sure register is in bounds and aligned. */ + /* Make sure register is not negative and aligned. */ if (io->pi_reg < 0 || - io->pi_reg + io->pi_width > PCI_REGMAX + 1 || io->pi_reg & (io->pi_width - 1)) { error = EINVAL; break; From owner-svn-src-stable@FreeBSD.ORG Sat Sep 19 15:49:00 2009 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 239C5106566C; Sat, 19 Sep 2009 15:49: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 104648FC08; Sat, 19 Sep 2009 15:49:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8JFmx2t029362; Sat, 19 Sep 2009 15:48:59 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8JFmxRx029361; Sat, 19 Sep 2009 15:48:59 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200909191548.n8JFmxRx029361@svn.freebsd.org> From: John Baldwin Date: Sat, 19 Sep 2009 15:48:59 +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: r197329 - in stable/8/sys: . amd64/include/xen cddl/contrib/opensolaris contrib/dev/acpica contrib/pf dev/ciss dev/xen/xenpci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Sep 2009 15:49:00 -0000 Author: jhb Date: Sat Sep 19 15:48:59 2009 New Revision: 197329 URL: http://svn.freebsd.org/changeset/base/197329 Log: Move mergeinfo for 197260-197263 up to sys/. Approved by: re (mergeinfo blanket) Modified: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (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/ciss/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed)