From owner-svn-src-stable-6@FreeBSD.ORG Sun Oct 19 06:45:03 2008 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B535B106568A; Sun, 19 Oct 2008 06:45:03 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A2EC68FC16; Sun, 19 Oct 2008 06:45:03 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9J6j3Kn036233; Sun, 19 Oct 2008 06:45:03 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9J6j3LT036231; Sun, 19 Oct 2008 06:45:03 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200810190645.m9J6j3LT036231@svn.freebsd.org> From: Pyun YongHyeon Date: Sun, 19 Oct 2008 06:45:03 +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: r184046 - in stable/6/sys: . dev/jme X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 19 Oct 2008 06:45:03 -0000 Author: yongari Date: Sun Oct 19 06:45:03 2008 New Revision: 184046 URL: http://svn.freebsd.org/changeset/base/184046 Log: MFC r183814: Read PCI device id instead of PCI revision id. Also checks the read device id is JMC260 family. Previously it just verified the deivce is JMC260 Rev A0. This will make it easy for newer JMC2xx support. Pointed out by: bouyer at NetBSD MFC r183859: Make sure to read the last byte of EEPROM descriptor. Previously the last byte of the ethernet address was not read which in turn resulted in getting 5 out of the 6 bytes of ethernet address and always returned ENOENT. I did not notice the bug on FPGA version because of additional configuration data in EEPROM. Pointed out by: bouyer at NetBSD Approved by: re (gnn) Modified: stable/6/sys/ (props changed) stable/6/sys/dev/jme/if_jme.c stable/6/sys/dev/jme/if_jmereg.h Modified: stable/6/sys/dev/jme/if_jme.c ============================================================================== --- stable/6/sys/dev/jme/if_jme.c Sun Oct 19 06:38:34 2008 (r184045) +++ stable/6/sys/dev/jme/if_jme.c Sun Oct 19 06:45:03 2008 (r184046) @@ -439,11 +439,8 @@ jme_eeprom_macaddr(struct jme_softc *sc) do { if (jme_eeprom_read_byte(sc, offset, &fup) != 0) break; - /* Check for the end of EEPROM descriptor. */ - if ((fup & JME_EEPROM_DESC_END) == JME_EEPROM_DESC_END) - break; - if ((uint8_t)JME_EEPROM_MKDESC(JME_EEPROM_FUNC0, - JME_EEPROM_PAGE_BAR1) == fup) { + if (JME_EEPROM_MKDESC(JME_EEPROM_FUNC0, JME_EEPROM_PAGE_BAR1) == + (fup & (JME_EEPROM_FUNC_MASK | JME_EEPROM_PAGE_MASK))) { if (jme_eeprom_read_byte(sc, offset + 1, ®) != 0) break; if (reg >= JME_PAR0 && @@ -455,6 +452,9 @@ jme_eeprom_macaddr(struct jme_softc *sc) match++; } } + /* Check for the end of EEPROM descriptor. */ + if ((fup & JME_EEPROM_DESC_END) == JME_EEPROM_DESC_END) + break; /* Try next eeprom descriptor. */ offset += JME_EEPROM_DESC_BYTES; } while (match != ETHER_ADDR_LEN && offset < JME_EEPROM_END); @@ -648,8 +648,8 @@ jme_attach(device_t dev) goto fail; } - sc->jme_rev = pci_get_revid(dev); - if (sc->jme_rev == DEVICEID_JMC260) { + sc->jme_rev = pci_get_device(dev); + if ((sc->jme_rev & DEVICEID_JMC2XX_MASK) == DEVICEID_JMC260) { sc->jme_flags |= JME_FLAG_FASTETH; sc->jme_flags |= JME_FLAG_NOJUMBO; } Modified: stable/6/sys/dev/jme/if_jmereg.h ============================================================================== --- stable/6/sys/dev/jme/if_jmereg.h Sun Oct 19 06:38:34 2008 (r184045) +++ stable/6/sys/dev/jme/if_jmereg.h Sun Oct 19 06:45:03 2008 (r184046) @@ -48,6 +48,8 @@ #define DEVICEID_JMC260 0x0260 #define DEVICEREVID_JMC260_A0 0x00 +#define DEVICEID_JMC2XX_MASK 0x0FF0 + /* JMC250 PCI configuration register. */ #define JME_PCI_BAR0 0x10 /* 16KB memory window. */ From owner-svn-src-stable-6@FreeBSD.ORG Tue Oct 21 18:35:24 2008 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5C0CB1065670; Tue, 21 Oct 2008 18:35:24 +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 4A3108FC1F; Tue, 21 Oct 2008 18:35:24 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9LIZOYY005719; Tue, 21 Oct 2008 18:35:24 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9LIZOR4005718; Tue, 21 Oct 2008 18:35:24 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200810211835.m9LIZOR4005718@svn.freebsd.org> From: John Baldwin Date: Tue, 21 Oct 2008 18:35:24 +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: r184132 - stable/6/sys/dev/ata X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 21 Oct 2008 18:35:24 -0000 Author: jhb Date: Tue Oct 21 18:35:23 2008 New Revision: 184132 URL: http://svn.freebsd.org/changeset/base/184132 Log: MFC: Use 32k transfers rather than 63k transfers for chipsets that can't do 64k transfers and use the MIO method to talk to the Serverworks HT1000_S1 SATA controller. Approved by: re (kib) Modified: stable/6/sys/dev/ata/ata-chipset.c Modified: stable/6/sys/dev/ata/ata-chipset.c ============================================================================== --- stable/6/sys/dev/ata/ata-chipset.c Tue Oct 21 18:35:04 2008 (r184131) +++ stable/6/sys/dev/ata/ata-chipset.c Tue Oct 21 18:35:23 2008 (r184132) @@ -1500,7 +1500,7 @@ ata_cyrix_setmode(device_t dev, int mode int error; ch->dma->alignment = 16; - ch->dma->max_iosize = 126 * DEV_BSIZE; + ch->dma->max_iosize = 64 * DEV_BSIZE; mode = ata_limit_mode(dev, mode, ATA_UDMA2); @@ -2892,7 +2892,7 @@ ata_marvell_edma_dmainit(device_t dev) ch->dma->max_address = BUS_SPACE_MAXADDR; /* chip does not reliably do 64K DMA transfers */ - ch->dma->max_iosize = 126 * DEV_BSIZE; + ch->dma->max_iosize = 64 * DEV_BSIZE; } } @@ -2942,7 +2942,7 @@ ata_national_setmode(device_t dev, int m int error; ch->dma->alignment = 16; - ch->dma->max_iosize = 126 * DEV_BSIZE; + ch->dma->max_iosize = 64 * DEV_BSIZE; mode = ata_limit_mode(dev, mode, ATA_UDMA2); @@ -4192,7 +4192,7 @@ ata_serverworks_ident(device_t dev) { ATA_CSB6, 0x00, SWKS100, 0, ATA_UDMA5, "CSB6" }, { ATA_CSB6_1, 0x00, SWKS66, 0, ATA_UDMA4, "CSB6" }, { ATA_HT1000, 0x00, SWKS100, 0, ATA_UDMA5, "HT1000" }, - { ATA_HT1000_S1, 0x00, SWKS100, 4, ATA_SA150, "HT1000" }, + { ATA_HT1000_S1, 0x00, SWKSMIO, 4, ATA_SA150, "HT1000" }, { ATA_HT1000_S2, 0x00, SWKSMIO, 4, ATA_SA150, "HT1000" }, { ATA_K2, 0x00, SWKSMIO, 4, ATA_SA150, "K2" }, { ATA_FRODO4, 0x00, SWKSMIO, 4, ATA_SA150, "Frodo4" }, @@ -4295,7 +4295,7 @@ ata_serverworks_allocate(device_t dev) /* chip does not reliably do 64K DMA transfers */ if (ch->dma) - ch->dma->max_iosize = 126 * DEV_BSIZE; + ch->dma->max_iosize = 64 * DEV_BSIZE; return 0; } From owner-svn-src-stable-6@FreeBSD.ORG Wed Oct 22 09:28:57 2008 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B3E0E1065674; Wed, 22 Oct 2008 09:28:57 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A15828FC17; Wed, 22 Oct 2008 09:28:57 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9M9SvdG024453; Wed, 22 Oct 2008 09:28:57 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9M9SvPO024452; Wed, 22 Oct 2008 09:28:57 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200810220928.m9M9SvPO024452@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 22 Oct 2008 09:28:57 +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: r184158 - in stable/6/sys: . security/mac_partition X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2008 09:28:57 -0000 Author: bz Date: Wed Oct 22 09:28:57 2008 New Revision: 184158 URL: http://svn.freebsd.org/changeset/base/184158 Log: MFC: r183970 Use the label from the socket credential rather than the solabel which was not set by the mac_partition policy. Approved by: re (rwatson) Modified: stable/6/sys/ (props changed) stable/6/sys/security/mac_partition/mac_partition.c Modified: stable/6/sys/security/mac_partition/mac_partition.c ============================================================================== --- stable/6/sys/security/mac_partition/mac_partition.c Wed Oct 22 09:11:35 2008 (r184157) +++ stable/6/sys/security/mac_partition/mac_partition.c Wed Oct 22 09:28:57 2008 (r184158) @@ -244,7 +244,7 @@ mac_partition_check_socket_visible(struc { int error; - error = label_on_label(cred->cr_label, socketlabel); + error = label_on_label(cred->cr_label, socket->so_cred->cr_label); return (error ? ENOENT : 0); } From owner-svn-src-stable-6@FreeBSD.ORG Wed Oct 22 14:56:15 2008 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 697271065670; Wed, 22 Oct 2008 14:56:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 56BE38FC12; Wed, 22 Oct 2008 14:56:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9MEuFHe031433; Wed, 22 Oct 2008 14:56:15 GMT (envelope-from bz@svn.freebsd.org) Received: (from bz@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9MEuFpP031432; Wed, 22 Oct 2008 14:56:15 GMT (envelope-from bz@svn.freebsd.org) Message-Id: <200810221456.m9MEuFpP031432@svn.freebsd.org> From: "Bjoern A. Zeeb" Date: Wed, 22 Oct 2008 14:56:15 +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: r184162 - in stable/6/sys: . netinet6 X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2008 14:56:15 -0000 Author: bz Date: Wed Oct 22 14:56:15 2008 New Revision: 184162 URL: http://svn.freebsd.org/changeset/base/184162 Log: MFC: r183923 Check that the mbuf len is positive (like we do in the v4 case) to avoid possible panics. PR: kern/119123 Approved by: re (kib) Modified: stable/6/sys/ (props changed) stable/6/sys/netinet6/ip6_output.c Modified: stable/6/sys/netinet6/ip6_output.c ============================================================================== --- stable/6/sys/netinet6/ip6_output.c Wed Oct 22 14:45:30 2008 (r184161) +++ stable/6/sys/netinet6/ip6_output.c Wed Oct 22 14:56:15 2008 (r184162) @@ -2979,7 +2979,7 @@ ip6_setpktopts(control, opt, stickyopt, if (control->m_next) return (EINVAL); - for (; control->m_len; control->m_data += CMSG_ALIGN(cm->cmsg_len), + for (; control->m_len > 0; control->m_data += CMSG_ALIGN(cm->cmsg_len), control->m_len -= CMSG_ALIGN(cm->cmsg_len)) { int error; From owner-svn-src-stable-6@FreeBSD.ORG Wed Oct 22 15:28:00 2008 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49A25106566B; Wed, 22 Oct 2008 15:28: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 368AA8FC0A; Wed, 22 Oct 2008 15:28:00 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9MFS0wV032143; Wed, 22 Oct 2008 15:28:00 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9MFS04p032142; Wed, 22 Oct 2008 15:28:00 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <200810221528.m9MFS04p032142@svn.freebsd.org> From: John Baldwin Date: Wed, 22 Oct 2008 15:28:00 +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: r184165 - in stable/6/sys: . kern X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2008 15:28:00 -0000 Author: jhb Date: Wed Oct 22 15:27:59 2008 New Revision: 184165 URL: http://svn.freebsd.org/changeset/base/184165 Log: MFC: Close a race in the kern.ttys sysctl handler that resulted in panics in dev2udev() when a tty was being detached concurrently with the sysctl handler. One difference relative to 7.x+ is that we still leak tty objects in tty_free() since destroy_dev() in 6.x doesn't purge all threads. Approved by: re (kib) Modified: stable/6/sys/ (props changed) stable/6/sys/kern/tty.c Modified: stable/6/sys/kern/tty.c ============================================================================== --- stable/6/sys/kern/tty.c Wed Oct 22 15:00:22 2008 (r184164) +++ stable/6/sys/kern/tty.c Wed Oct 22 15:27:59 2008 (r184165) @@ -3024,16 +3024,19 @@ ttygone(struct tty *tp) * * XXX: This shall sleep until all threads have left the driver. */ - void ttyfree(struct tty *tp) { + struct cdev *dev; u_int unit; mtx_assert(&Giant, MA_OWNED); ttygone(tp); unit = tp->t_devunit; - destroy_dev(tp->t_mdev); + dev = tp->t_mdev; + dev->si_tty = NULL; + tp->t_dev = NULL; + destroy_dev(dev); free_unr(tty_unit, unit); } @@ -3049,8 +3052,9 @@ sysctl_kern_ttys(SYSCTL_HANDLER_ARGS) tp = TAILQ_FIRST(&tty_list); if (tp != NULL) ttyref(tp); - mtx_unlock(&tty_list_mutex); while (tp != NULL) { + if (tp->t_state & TS_GONE) + goto nexttp; bzero(&xt, sizeof xt); xt.xt_size = sizeof xt; #define XT_COPY(field) xt.xt_##field = tp->t_##field @@ -3058,6 +3062,18 @@ sysctl_kern_ttys(SYSCTL_HANDLER_ARGS) xt.xt_cancc = tp->t_canq.c_cc; xt.xt_outcc = tp->t_outq.c_cc; XT_COPY(line); + + /* + * XXX: We hold the tty list lock while doing this to + * work around a race with pty/pts tty destruction. + * They set t_dev to NULL and then call ttyrel() to + * free the structure which will block on the list + * lock before they call destroy_dev() on the cdev + * backing t_dev. + * + * XXX: ttyfree() now does the same since it has been + * fixed to not leak ttys. + */ if (tp->t_dev != NULL) xt.xt_dev = dev2udev(tp->t_dev); XT_COPY(state); @@ -3080,19 +3096,22 @@ sysctl_kern_ttys(SYSCTL_HANDLER_ARGS) XT_COPY(olowat); XT_COPY(ospeedwat); #undef XT_COPY + mtx_unlock(&tty_list_mutex); error = SYSCTL_OUT(req, &xt, sizeof xt); if (error != 0) { ttyrel(tp); return (error); } mtx_lock(&tty_list_mutex); - tp2 = TAILQ_NEXT(tp, t_list); +nexttp: tp2 = TAILQ_NEXT(tp, t_list); if (tp2 != NULL) ttyref(tp2); mtx_unlock(&tty_list_mutex); ttyrel(tp); tp = tp2; + mtx_lock(&tty_list_mutex); } + mtx_unlock(&tty_list_mutex); return (0); } From owner-svn-src-stable-6@FreeBSD.ORG Wed Oct 22 18:07:38 2008 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74E031065699; Wed, 22 Oct 2008 18:07:38 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6120B8FC13; Wed, 22 Oct 2008 18:07:38 +0000 (UTC) (envelope-from alfred@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9MI7cNl035262; Wed, 22 Oct 2008 18:07:38 GMT (envelope-from alfred@svn.freebsd.org) Received: (from alfred@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9MI7b8X035259; Wed, 22 Oct 2008 18:07:37 GMT (envelope-from alfred@svn.freebsd.org) Message-Id: <200810221807.m9MI7b8X035259@svn.freebsd.org> From: Alfred Perlstein Date: Wed, 22 Oct 2008 18:07:37 +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: r184172 - in stable/6: lib/libthr/thread sys/kern X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2008 18:07:38 -0000 Author: alfred Date: Wed Oct 22 18:07:37 2008 New Revision: 184172 URL: http://svn.freebsd.org/changeset/base/184172 Log: Close races in the pthread_condvar implementation in 6.x, note that 7.x and beyond have very different implementations and these fixes do not apply. In the kernel: Move the flag UQF_UMTXQ from the thread's td_flags where it was unlocked to the umtx_q struct where it now has locking. Nuke the UMTX_DYNAMIC_SHARED define while here, it's unused and complex. Refactor do_wait so that if we get a signal or timeout AND woken up, we forward the wakeup to any other waiters pending to avoid a missed wakeup. In userland: Bring over some fixes from DragonFlyBSD for the userland part of pthread_condvars, basically relax the consistency on the number of waiters and signals pending because it was both too strict and incorrect causing lost wakeups. Reviewed by: davidxu Approved by: re Modified: stable/6/lib/libthr/thread/thr_cond.c stable/6/lib/libthr/thread/thr_private.h stable/6/sys/kern/kern_umtx.c Modified: stable/6/lib/libthr/thread/thr_cond.c ============================================================================== --- stable/6/lib/libthr/thread/thr_cond.c Wed Oct 22 17:50:45 2008 (r184171) +++ stable/6/lib/libthr/thread/thr_cond.c Wed Oct 22 18:07:37 2008 (r184172) @@ -71,7 +71,7 @@ cond_init(pthread_cond_t *cond, const pt _thr_umtx_init(&pcond->c_lock); pcond->c_seqno = 0; pcond->c_waiters = 0; - pcond->c_wakeups = 0; + pcond->c_broadcast = 0; if (cond_attr == NULL || *cond_attr == NULL) { pcond->c_pshared = 0; pcond->c_clockid = CLOCK_REALTIME; @@ -122,7 +122,7 @@ _pthread_cond_destroy(pthread_cond_t *co else { /* Lock the condition variable structure: */ THR_LOCK_ACQUIRE(curthread, &(*cond)->c_lock); - if ((*cond)->c_waiters + (*cond)->c_wakeups != 0) { + if ((*cond)->c_waiters != 0) { THR_LOCK_RELEASE(curthread, &(*cond)->c_lock); return (EBUSY); } @@ -166,14 +166,13 @@ cond_cancel_handler(void *arg) cv = *(cci->cond); THR_LOCK_ACQUIRE(curthread, &cv->c_lock); - if (cv->c_seqno != cci->seqno && cv->c_wakeups != 0) { - if (cv->c_waiters > 0) { - cv->c_seqno++; - _thr_umtx_wake(&cv->c_seqno, 1); - } else - cv->c_wakeups--; - } else { - cv->c_waiters--; + if (--cv->c_waiters == 0) + cv->c_broadcast = 0; + if (cv->c_seqno != cci->seqno) { + _thr_umtx_wake(&cv->c_seqno, 1); + /* cv->c_seqno++; XXX why was this here? */ + _thr_umtx_wake(&cv->c_seqno, 1); + } THR_LOCK_RELEASE(curthread, &cv->c_lock); @@ -191,6 +190,7 @@ cond_wait_common(pthread_cond_t *cond, p long seq, oldseq; int oldcancel; int ret = 0; + int loops = -1; /* * If the condition variable is statically initialized, @@ -202,18 +202,24 @@ cond_wait_common(pthread_cond_t *cond, p cv = *cond; THR_LOCK_ACQUIRE(curthread, &cv->c_lock); + oldseq = cv->c_seqno; ret = _mutex_cv_unlock(mutex); if (ret) { THR_LOCK_RELEASE(curthread, &cv->c_lock); return (ret); } - oldseq = seq = cv->c_seqno; + seq = cv->c_seqno; cci.mutex = mutex; cci.cond = cond; cci.seqno = oldseq; cv->c_waiters++; - do { + /* + * loop if we have never been told to wake up + * or we lost a race. + */ + while (seq == oldseq /* || cv->c_wakeups == 0*/) { + loops++; THR_LOCK_RELEASE(curthread, &cv->c_lock); if (abstime != NULL) { @@ -232,24 +238,23 @@ cond_wait_common(pthread_cond_t *cond, p } else { ret = _thr_umtx_wait(&cv->c_seqno, seq, tsp); } + /* + * If we get back EINTR we want to loop as condvars + * do NOT return EINTR, they just restart. + */ THR_LOCK_ACQUIRE(curthread, &cv->c_lock); seq = cv->c_seqno; if (abstime != NULL && ret == ETIMEDOUT) break; - /* - * loop if we have never been told to wake up - * or we lost a race. - */ - } while (seq == oldseq || cv->c_wakeups == 0); - - if (seq != oldseq && cv->c_wakeups != 0) { - cv->c_wakeups--; - ret = 0; - } else { - cv->c_waiters--; } + + if (--cv->c_waiters == 0) + cv->c_broadcast = 0; + if (seq != oldseq) + ret = 0; + THR_LOCK_RELEASE(curthread, &cv->c_lock); _mutex_cv_lock(mutex); return (ret); @@ -298,7 +303,7 @@ cond_signal_common(pthread_cond_t *cond, { struct pthread *curthread = _get_curthread(); pthread_cond_t cv; - int ret = 0, oldwaiters; + int ret = 0; /* * If the condition variable is statically initialized, perform dynamic @@ -311,19 +316,15 @@ cond_signal_common(pthread_cond_t *cond, cv = *cond; /* Lock the condition variable structure. */ THR_LOCK_ACQUIRE(curthread, &cv->c_lock); + cv->c_seqno++; + if (cv->c_broadcast == 0) + cv->c_broadcast = broadcast; + if (cv->c_waiters) { - if (!broadcast) { - cv->c_wakeups++; - cv->c_waiters--; - cv->c_seqno++; + if (cv->c_broadcast) + _thr_umtx_wake(&cv->c_seqno, INT_MAX); + else _thr_umtx_wake(&cv->c_seqno, 1); - } else { - oldwaiters = cv->c_waiters; - cv->c_wakeups += cv->c_waiters; - cv->c_waiters = 0; - cv->c_seqno++; - _thr_umtx_wake(&cv->c_seqno, oldwaiters); - } } THR_LOCK_RELEASE(curthread, &cv->c_lock); return (ret); Modified: stable/6/lib/libthr/thread/thr_private.h ============================================================================== --- stable/6/lib/libthr/thread/thr_private.h Wed Oct 22 17:50:45 2008 (r184171) +++ stable/6/lib/libthr/thread/thr_private.h Wed Oct 22 18:07:37 2008 (r184172) @@ -166,7 +166,7 @@ struct pthread_cond { volatile umtx_t c_lock; volatile umtx_t c_seqno; volatile int c_waiters; - volatile int c_wakeups; + volatile int c_broadcast; int c_pshared; int c_clockid; }; Modified: stable/6/sys/kern/kern_umtx.c ============================================================================== --- stable/6/sys/kern/kern_umtx.c Wed Oct 22 17:50:45 2008 (r184171) +++ stable/6/sys/kern/kern_umtx.c Wed Oct 22 18:07:37 2008 (r184172) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -81,6 +82,8 @@ struct umtx_key { struct umtx_q { LIST_ENTRY(umtx_q) uq_next; /* Linked list for the hash. */ struct umtx_key uq_key; /* Umtx key. */ + int uq_flags; +#define UQF_UMTXQ 0x0001 struct thread *uq_thread; /* The thread waits on. */ LIST_ENTRY(umtx_q) uq_rqnext; /* Linked list for requeuing. */ vm_offset_t uq_addr; /* Umtx's virtual address. */ @@ -229,9 +232,7 @@ umtxq_insert(struct umtx_q *uq) mtx_assert(umtxq_mtx(chain), MA_OWNED); head = &umtxq_chains[chain].uc_queue; LIST_INSERT_HEAD(head, uq, uq_next); - mtx_lock_spin(&sched_lock); - uq->uq_thread->td_flags |= TDF_UMTXQ; - mtx_unlock_spin(&sched_lock); + uq->uq_flags |= UQF_UMTXQ; } /* @@ -241,12 +242,10 @@ static inline void umtxq_remove(struct umtx_q *uq) { mtx_assert(umtxq_mtx(umtxq_hash(&uq->uq_key)), MA_OWNED); - if (uq->uq_thread->td_flags & TDF_UMTXQ) { + if (uq->uq_flags & UQF_UMTXQ) { LIST_REMOVE(uq, uq_next); - /* turning off TDF_UMTXQ should be the last thing. */ - mtx_lock_spin(&sched_lock); - uq->uq_thread->td_flags &= ~TDF_UMTXQ; - mtx_unlock_spin(&sched_lock); + /* turning off UQF_UMTXQ should be the last thing. */ + uq->uq_flags &= ~UQF_UMTXQ; } } @@ -308,7 +307,7 @@ umtxq_sleep(struct thread *td, struct um static int umtx_key_get(struct thread *td, void *umtx, struct umtx_key *key) { -#if defined(UMTX_DYNAMIC_SHARED) || defined(UMTX_STATIC_SHARED) +#if defined(UMTX_STATIC_SHARED) vm_map_t map; vm_map_entry_t entry; vm_pindex_t pindex; @@ -321,20 +320,7 @@ umtx_key_get(struct thread *td, void *um &wired) != KERN_SUCCESS) { return EFAULT; } -#endif -#if defined(UMTX_DYNAMIC_SHARED) - key->type = UMTX_SHARED; - key->info.shared.offset = entry->offset + entry->start - - (vm_offset_t)umtx; - /* - * Add object reference, if we don't do this, a buggy application - * deallocates the object, the object will be reused by other - * applications, then unlock will wake wrong thread. - */ - vm_object_reference(key->info.shared.object); - vm_map_lookup_done(map, entry); -#elif defined(UMTX_STATIC_SHARED) if (VM_INHERIT_SHARE == entry->inheritance) { key->type = UMTX_SHARED; key->info.shared.offset = entry->offset + entry->start - @@ -380,74 +366,6 @@ umtxq_queue_me(struct thread *td, void * return (0); } -#if defined(UMTX_DYNAMIC_SHARED) -static void -fork_handler(void *arg, struct proc *p1, struct proc *p2, int flags) -{ - vm_map_t map; - vm_map_entry_t entry; - vm_object_t object; - vm_pindex_t pindex; - vm_prot_t prot; - boolean_t wired; - struct umtx_key key; - LIST_HEAD(, umtx_q) workq; - struct umtx_q *uq; - struct thread *td; - int onq; - - LIST_INIT(&workq); - - /* Collect threads waiting on umtxq */ - PROC_LOCK(p1); - FOREACH_THREAD_IN_PROC(p1, td) { - if (td->td_flags & TDF_UMTXQ) { - uq = td->td_umtxq; - if (uq) - LIST_INSERT_HEAD(&workq, uq, uq_rqnext); - } - } - PROC_UNLOCK(p1); - - LIST_FOREACH(uq, &workq, uq_rqnext) { - map = &p1->p_vmspace->vm_map; - if (vm_map_lookup(&map, uq->uq_addr, VM_PROT_WRITE, - &entry, &object, &pindex, &prot, &wired) != KERN_SUCCESS) { - continue; - } - key.type = UMTX_SHARED; - key.info.shared.object = object; - key.info.shared.offset = entry->offset + entry->start - - uq->uq_addr; - if (umtx_key_match(&key, &uq->uq_key)) { - vm_map_lookup_done(map, entry); - continue; - } - - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - if (uq->uq_thread->td_flags & TDF_UMTXQ) { - umtxq_remove(uq); - onq = 1; - } else - onq = 0; - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); - if (onq) { - vm_object_deallocate(uq->uq_key.info.shared.object); - uq->uq_key = key; - umtxq_lock(&uq->uq_key); - umtxq_busy(&uq->uq_key); - umtxq_insert(uq); - umtxq_unbusy(&uq->uq_key); - umtxq_unlock(&uq->uq_key); - vm_object_reference(uq->uq_key.info.shared.object); - } - vm_map_lookup_done(map, entry); - } -} -#endif - static int _do_lock(struct thread *td, struct umtx *umtx, long id, int timo) { @@ -526,7 +444,7 @@ _do_lock(struct thread *td, struct umtx * unlocking the umtx. */ umtxq_lock(&uq->uq_key); - if (old == owner && (td->td_flags & TDF_UMTXQ)) { + if (old == owner && (uq->uq_flags & UQF_UMTXQ)) { error = umtxq_sleep(td, &uq->uq_key, PCATCH, "umtx", timo); } @@ -705,7 +623,7 @@ _do_lock32(struct thread *td, uint32_t * * unlocking the umtx. */ umtxq_lock(&uq->uq_key); - if (old == owner && (td->td_flags & TDF_UMTXQ)) { + if (old == owner && (uq->uq_flags & UQF_UMTXQ)) { error = umtxq_sleep(td, &uq->uq_key, PCATCH, "umtx", timo); } @@ -825,35 +743,22 @@ do_wait(struct thread *td, struct umtx * tmp = fuword(&umtx->u_owner); else tmp = fuword32(&umtx->u_owner); + umtxq_lock(&uq->uq_key); if (tmp != id) { - umtxq_lock(&uq->uq_key); umtxq_remove(uq); - umtxq_unlock(&uq->uq_key); } else if (timeout == NULL) { - umtxq_lock(&uq->uq_key); - if (td->td_flags & TDF_UMTXQ) + if (uq->uq_flags & UQF_UMTXQ) error = umtxq_sleep(td, &uq->uq_key, PCATCH, "ucond", 0); - if (!(td->td_flags & TDF_UMTXQ)) - error = 0; - else - umtxq_remove(uq); - umtxq_unlock(&uq->uq_key); } else { getnanouptime(&ts); timespecadd(&ts, timeout); TIMESPEC_TO_TIMEVAL(&tv, timeout); for (;;) { - umtxq_lock(&uq->uq_key); - if (td->td_flags & TDF_UMTXQ) { + if (uq->uq_flags & UQF_UMTXQ) { error = umtxq_sleep(td, &uq->uq_key, PCATCH, - "ucond", tvtohz(&tv)); - } - if (!(td->td_flags & TDF_UMTXQ)) { - umtxq_unlock(&uq->uq_key); - goto out; + "ucondt", tvtohz(&tv)); } - umtxq_unlock(&uq->uq_key); if (error != ETIMEDOUT) break; getnanouptime(&ts2); @@ -865,14 +770,28 @@ do_wait(struct thread *td, struct umtx * timespecsub(&ts3, &ts2); TIMESPEC_TO_TIMEVAL(&tv, &ts3); } - umtxq_lock(&uq->uq_key); - umtxq_remove(uq); - umtxq_unlock(&uq->uq_key); } -out: + if (error != 0) { + if ((uq->uq_flags & UQF_UMTXQ) == 0) { + /* + * If we concurrently got do_cv_signal()d + * and we got an error or UNIX signals or a timeout, + * then, perform another umtxq_signal to avoid + * consuming the wakeup. This may cause supurious + * wakeup for another thread which was just queued, + * but SUSV3 explicitly allows supurious wakeup to + * occur, and indeed a kernel based implementation + * can not avoid it. + */ + if (!umtxq_signal(&uq->uq_key, 1)) + error = 0; + } + if (error == ERESTART) + error = EINTR; + } + umtxq_remove(uq); + umtxq_unlock(&uq->uq_key); umtx_key_release(&uq->uq_key); - if (error == ERESTART) - error = EINTR; return (error); } From owner-svn-src-stable-6@FreeBSD.ORG Wed Oct 22 18:25:14 2008 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2655610656A9; Wed, 22 Oct 2008 18:25:14 +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 131B38FC12; Wed, 22 Oct 2008 18:25:14 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9MIPDsO035659; Wed, 22 Oct 2008 18:25:13 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9MIPDSE035658; Wed, 22 Oct 2008 18:25:13 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200810221825.m9MIPDSE035658@svn.freebsd.org> From: Ken Smith Date: Wed, 22 Oct 2008 18:25:13 +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: r184174 - in stable/6/release: . scripts X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Oct 2008 18:25:14 -0000 Author: kensmith Date: Wed Oct 22 18:25:13 2008 New Revision: 184174 URL: http://svn.freebsd.org/changeset/base/184174 Log: MFS r184137 and r184166 from stable/7 Net effect is to add support for building DVD images when the MAKE_DVD knob is enabled, and enable it for amd64 and i386 architectures. Approved by: re (kib) Modified: stable/6/release/ (props changed) stable/6/release/Makefile stable/6/release/scripts/src-install.sh (props changed) Modified: stable/6/release/Makefile ============================================================================== --- stable/6/release/Makefile Wed Oct 22 18:20:45 2008 (r184173) +++ stable/6/release/Makefile Wed Oct 22 18:25:13 2008 (r184174) @@ -192,6 +192,7 @@ MNT= /mnt .undef MAKE_FLOPPIES .if ${TARGET_ARCH} == "i386" MAKE_FLOPPIES= true +MAKE_DVD= .if ${TARGET} == "pc98" SMALLFLOPPYSIZE= 1200 SMALLFLOPPYSPLITSIZE= 1152 @@ -230,6 +231,7 @@ MFSLABEL= auto SEPARATE_LIVEFS= .elif ${TARGET_ARCH} == "amd64" MAKE_FLOPPIES= true +MAKE_DVD= FLOPPYSIZE= 1440 FLOPPYSPLITSIZE= 1392 FLOPPYINODE= 40000 @@ -269,6 +271,9 @@ CD_BOOT= ${CD}/bootonly CD_DISC1= ${CD}/disc1 CD_DISC2= ${CD}/disc2 CD_DISC3= ${CD}/disc3 +.if defined(MAKE_DVD) +CD_DVD1= ${CD}/dvd1 +.endif .if !defined(NODOC) CD_DOCS= ${CD}/docs .endif @@ -488,6 +493,7 @@ release rerelease: KERNELS \ KERNELS_BASE \ KERNEL_FLAGS \ + MAKE_DVD \ MAKE_FLOPPIES \ MAKE_ISOS \ NOCDROM \ @@ -941,6 +947,18 @@ cdrom.1: find . -depth -print | cpio -dumpl ${CD_LIVEFS} ) ; \ fi \ done +.if defined(MAKE_DVD) + @echo "Building DVD filesystem image as well as CDROM" + @mkdir -p ${CD_DVD1}/${BUILDNAME} + @for i in ${DISTRIBUTIONS} ; \ + do \ + if [ -d ${RD}/trees/$${i} ] ; then \ + chflags -R noschg ${RD}/trees/$${i} || true ; \ + ( cd ${RD}/trees/$${i} && \ + find . -depth -print | cpio -dumpl ${CD_DVD1} ) ; \ + fi \ + done +.endif @echo "Copy GENERIC kernel to boot area" @cp -Rp ${RD}/kernels/GENERIC/ ${CD_LIVEFS}/boot/kernel @rm -f ${CD_LIVEFS}/.profile @@ -958,6 +976,23 @@ cdrom.1: @cp ${RD}/trees/base/boot/device.hints ${CD_LIVEFS}/boot/device.hints .endif @echo "CD_VERSION = ${BUILDNAME}" > ${CD_LIVEFS}/cdrom.inf +.if defined(MAKE_DVD) + @cp -Rp ${RD}/kernels/GENERIC/ ${CD_DVD1}/boot/kernel + @rm -f ${CD_DVD1}/boot/kernel/*.symbols + @rm -f ${CD_DVD1}/.profile + @cp ${.CURDIR}/fixit.profile ${CD_DVD1}/.profile + @ln -sf /rescue ${CD_DVD1}/stand + @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DVD1}/cdrom.inf + @rm -f ${CD_DVD1}/boot/loader.conf + @cp ${RD}/mfsroot/mfsroot.gz ${CD_DVD1}/boot/mfsroot.gz + @echo 'mfsroot_load="YES"' > ${CD_DVD1}/boot/loader.conf + @echo 'mfsroot_type="mfs_root"' >> ${CD_DVD1}/boot/loader.conf + @echo 'mfsroot_name="/boot/mfsroot"' >> ${CD_DVD1}/boot/loader.conf +.if exists(${RD}/trees/base/boot/device.hints) + @rm -f ${CD_DVD1}/boot/device.hints + @cp ${RD}/trees/base/boot/device.hints ${CD_DVD1}/boot/device.hints +.endif +.endif touch ${.TARGET} # Build disc1, disc2 and disc3 cdrom images @@ -998,11 +1033,37 @@ cdrom.2: @mkdir -p ${CD_DISC3} @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DISC3}/cdrom.inf @echo "CD_VOLUME = 3" >> ${CD_DISC3}/cdrom.inf +.if defined(MAKE_DVD) +.if defined(MAKE_FLOPPIES) + @cd ${RD} && find floppies -print | cpio -dumpl ${CD_DVD1} +.endif + @cd ${RD}/dists && find . -print | cpio -dumpl ${CD_DVD1}/${BUILDNAME} +.if !defined(NODOC) + @for i in ${DIST_DOCS_ARCH_INDEP}; do \ + cp ${RND}/${RELNOTES_LANG}/$$i/article.txt \ + ${CD_DVD1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ + cp ${RND}/${RELNOTES_LANG}/$$i/article.html \ + ${CD_DVD1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \ + done + @for i in ${DIST_DOCS_ARCH_DEP}; do \ + cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.txt \ + ${CD_DVD1}/`echo $${i} | tr 'a-z' 'A-Z'`.TXT; \ + cp ${RND}/${RELNOTES_LANG}/$$i/${TARGET}/article.html \ + ${CD_DVD1}/`echo $${i} | tr 'a-z' 'A-Z'`.HTM; \ + done + @cp ${RND}/${RELNOTES_LANG}/readme/docbook.css ${CD_DVD1} +.endif + @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DVD1}/cdrom.inf + @echo "CD_VOLUME = 1" >> ${CD_DVD1}/cdrom.inf +.endif .if !defined(NODOC) @echo "Building CDROM docs filesystem image" @mkdir -p ${CD_DOCS} @echo "CD_VERSION = ${BUILDNAME}" > ${CD_DOCS}/cdrom.inf @mkdir -p ${CD_DOCS}/usr/share/doc +.if defined(MAKE_DVD) + @mkdir -p ${CD_DVD1}/usr/share/doc +.endif @for i in `ls ${CD_LIVEFS}/usr/share/doc`; do \ if [ -L ${CD_LIVEFS}/usr/share/doc/$$i -o \ -d /usr/doc/$$i ]; then \ @@ -1010,6 +1071,10 @@ cdrom.2: ${CD_DOCS}/usr/share/doc; \ fi \ done +.if defined(MAKE_DVD) + @cd ${CD_DOCS}/usr/share/doc && find . -print | \ + cpio -dumpl ${CD_DVD1}/usr/share/doc +.endif .endif touch ${.TARGET} @@ -1043,6 +1108,9 @@ CD_DISC2_PKGS= ${CD_PACKAGE_TREE}/disc2 .if exists(${CD_PACKAGE_TREE}/disc3) CD_DISC3_PKGS= ${CD_PACKAGE_TREE}/disc3 .endif +.if exists(${CD_PACKAGE_TREE}/dvd1) +CD_DVD_PKGS= ${CD_PACKAGE_TREE}/dvd1 +.endif .endif .endif @@ -1066,6 +1134,12 @@ iso.1: FreeBSD_Packages_2 \ ${CD}/${BUILDNAME}-${TARGET}-disc3.iso ${CD_DISC3} \ ${CD_DISC3_PKGS} +.if defined(MAKE_DVD) + @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh ${BOOTABLE} \ + FreeBSD_Install \ + ${CD}/${BUILDNAME}-${TARGET}-dvd1.iso ${CD_DVD1} \ + ${CD_DVD1_PKGS} +.endif .if !defined(NODOC) @sh ${.CURDIR}/${TARGET_ARCH}/mkisoimages.sh \ FreeBSD_Documentation \ From owner-svn-src-stable-6@FreeBSD.ORG Thu Oct 23 00:56:01 2008 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9BCB81065670; Thu, 23 Oct 2008 00:56:01 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 8905B8FC08; Thu, 23 Oct 2008 00:56:01 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9N0u19T043270; Thu, 23 Oct 2008 00:56:01 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9N0u1uJ043269; Thu, 23 Oct 2008 00:56:01 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <200810230056.m9N0u1uJ043269@svn.freebsd.org> From: Pyun YongHyeon Date: Thu, 23 Oct 2008 00:56:01 +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: r184191 - in stable/6/sys: . dev/mii X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2008 00:56:01 -0000 Author: yongari Date: Thu Oct 23 00:56:01 2008 New Revision: 184191 URL: http://svn.freebsd.org/changeset/base/184191 Log: MFC r183966: Some 88E1149 PHY's page select is initialized to point to other bank instead of copper/fiber bank which in turn resulted in wrong registers were accessed during PHY operation. It is believed that page 0 should be used for copper PHY so reinitialize E1000_EADR to select default copper PHY. This fixes link establishment issue of nfe(4) on Sun Fire X4140. OpenBSD also has similimar patch but they just reset the E1000_EADR register to page 0. However some Marvell PHYs((88E3082, 88E1000) don't have the extended address register and the meaning of the register is quite different for each PHY model. So selecting copper PHY is limited to 88E1149 PHY which seems to be the only one that exhibits link establishment problem. If parent device know the type of PHY(either copper or fiber) that information should be notified to PHY driver but there is no good way to pass this information yet. Reported by: thompsa Reviewed by: thompsa Approved by: re (gnn) Modified: stable/6/sys/ (props changed) stable/6/sys/dev/mii/e1000phy.c Modified: stable/6/sys/dev/mii/e1000phy.c ============================================================================== --- stable/6/sys/dev/mii/e1000phy.c Thu Oct 23 00:54:07 2008 (r184190) +++ stable/6/sys/dev/mii/e1000phy.c Thu Oct 23 00:56:01 2008 (r184191) @@ -153,6 +153,20 @@ e1000phy_attach(device_t dev) if (PHY_READ(sc, E1000_ESSR) & E1000_ESSR_FIBER_LINK) sc->mii_flags |= MIIF_HAVEFIBER; break; + case MII_MODEL_MARVELL_E1149: + /* + * Some 88E1149 PHY's page select is initialized to + * point to other bank instead of copper/fiber bank + * which in turn resulted in wrong registers were + * accessed during PHY operation. It is believed that + * page 0 should be used for copper PHY so reinitialize + * E1000_EADR to select default copper PHY. If parent + * device know the type of PHY(either copper or fiber), + * that information should be used to select default + * type of PHY. + */ + PHY_WRITE(sc, E1000_EADR, 0); + break; case MII_MODEL_MARVELL_E3082: /* 88E3082 10/100 Fast Ethernet PHY. */ sc->mii_anegticks = MII_ANEGTICKS; From owner-svn-src-stable-6@FreeBSD.ORG Thu Oct 23 04:50:06 2008 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CB466106567E; Thu, 23 Oct 2008 04:50:06 +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 B776D8FC13; Thu, 23 Oct 2008 04:50:06 +0000 (UTC) (envelope-from kientzle@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9N4o6Wx048131; Thu, 23 Oct 2008 04:50:06 GMT (envelope-from kientzle@svn.freebsd.org) Received: (from kientzle@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9N4o62U048127; Thu, 23 Oct 2008 04:50:06 GMT (envelope-from kientzle@svn.freebsd.org) Message-Id: <200810230450.m9N4o62U048127@svn.freebsd.org> From: Tim Kientzle Date: Thu, 23 Oct 2008 04:50:06 +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: r184196 - in stable/6/lib/libarchive: . test X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2008 04:50:06 -0000 Author: kientzle Date: Thu Oct 23 04:50:06 2008 New Revision: 184196 URL: http://svn.freebsd.org/changeset/base/184196 Log: MFC r184038: Restore mtime *after* restoring ACLs. Otherwise, setting the ACL changes the mtime. (Plus a new test to exercise basic ACL restore logic.) PR: kern/128203 Submitted by: Udo Schweigert Approved by: re (Kostik Belousov) Added: stable/6/lib/libarchive/test/test_acl_freebsd.c - copied unchanged from r184038, head/lib/libarchive/test/test_acl_freebsd.c Modified: stable/6/lib/libarchive/ (props changed) stable/6/lib/libarchive/archive_write_disk.c stable/6/lib/libarchive/test/Makefile Modified: stable/6/lib/libarchive/archive_write_disk.c ============================================================================== --- stable/6/lib/libarchive/archive_write_disk.c Thu Oct 23 04:48:48 2008 (r184195) +++ stable/6/lib/libarchive/archive_write_disk.c Thu Oct 23 04:50:06 2008 (r184196) @@ -641,10 +641,6 @@ _archive_write_finish_entry(struct archi int r2 = set_mode(a, a->mode); if (r2 < ret) ret = r2; } - if (a->todo & TODO_TIMES) { - int r2 = set_time(a); - if (r2 < ret) ret = r2; - } if (a->todo & TODO_ACLS) { int r2 = set_acls(a); if (r2 < ret) ret = r2; @@ -657,6 +653,10 @@ _archive_write_finish_entry(struct archi int r2 = set_fflags(a); if (r2 < ret) ret = r2; } + if (a->todo & TODO_TIMES) { + int r2 = set_time(a); + if (r2 < ret) ret = r2; + } /* If there's an fd, we can close it now. */ if (a->fd >= 0) { Modified: stable/6/lib/libarchive/test/Makefile ============================================================================== --- stable/6/lib/libarchive/test/Makefile Thu Oct 23 04:48:48 2008 (r184195) +++ stable/6/lib/libarchive/test/Makefile Thu Oct 23 04:50:06 2008 (r184196) @@ -9,6 +9,7 @@ LA_SRCS!=make -f ${LA_SRCDIR}/Makefile - TESTS= \ test_acl_basic.c \ + test_acl_freebsd.c \ test_acl_pax.c \ test_archive_api_feature.c \ test_bad_fd.c \ Copied: stable/6/lib/libarchive/test/test_acl_freebsd.c (from r184038, head/lib/libarchive/test/test_acl_freebsd.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/6/lib/libarchive/test/test_acl_freebsd.c Thu Oct 23 04:50:06 2008 (r184196, copy of r184038, head/lib/libarchive/test/test_acl_freebsd.c) @@ -0,0 +1,243 @@ +/*- + * Copyright (c) 2003-2008 Tim Kientzle + * 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 AUTHOR(S) ``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 AUTHOR(S) 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 "test.h" +__FBSDID("$FreeBSD$"); + +#if defined(__FreeBSD__) && __FreeBSD__ > 4 +#include + +struct myacl_t { + int type; /* Type of ACL: "access" or "default" */ + int permset; /* Permissions for this class of users. */ + int tag; /* Owner, User, Owning group, group, other, etc. */ + int qual; /* GID or UID of user/group, depending on tag. */ + const char *name; /* Name of user/group, depending on tag. */ +}; + +static struct myacl_t acls2[] = { + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE | ARCHIVE_ENTRY_ACL_READ, + ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" }, + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ, + ARCHIVE_ENTRY_ACL_USER, 77, "user77" }, + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0, + ARCHIVE_ENTRY_ACL_USER, 78, "user78" }, + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ, + ARCHIVE_ENTRY_ACL_GROUP_OBJ, -1, "" }, + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0007, + ARCHIVE_ENTRY_ACL_GROUP, 78, "group78" }, + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_WRITE | ARCHIVE_ENTRY_ACL_EXECUTE, + ARCHIVE_ENTRY_ACL_OTHER, -1, "" }, + { ARCHIVE_ENTRY_ACL_TYPE_ACCESS, + ARCHIVE_ENTRY_ACL_WRITE | ARCHIVE_ENTRY_ACL_READ | ARCHIVE_ENTRY_ACL_EXECUTE, + ARCHIVE_ENTRY_ACL_MASK, -1, "" }, + { 0, 0, 0, 0, NULL } +}; + +static void +set_acls(struct archive_entry *ae, struct myacl_t *acls) +{ + int i; + + archive_entry_acl_clear(ae); + for (i = 0; acls[i].name != NULL; i++) { + archive_entry_acl_add_entry(ae, + acls[i].type, acls[i].permset, acls[i].tag, acls[i].qual, + acls[i].name); + } +} + +static int +acl_match(acl_entry_t aclent, struct myacl_t *myacl) +{ + acl_tag_t tag_type; + acl_permset_t opaque_ps; + int permset = 0; + + acl_get_tag_type(aclent, &tag_type); + + /* translate the silly opaque permset to a bitmap */ + acl_get_permset(aclent, &opaque_ps); + if (acl_get_perm_np(opaque_ps, ACL_EXECUTE)) + permset |= ARCHIVE_ENTRY_ACL_EXECUTE; + if (acl_get_perm_np(opaque_ps, ACL_WRITE)) + permset |= ARCHIVE_ENTRY_ACL_WRITE; + if (acl_get_perm_np(opaque_ps, ACL_READ)) + permset |= ARCHIVE_ENTRY_ACL_READ; + + if (permset != myacl->permset) + return (0); + + switch (tag_type) { + case ACL_USER_OBJ: + if (myacl->tag != ARCHIVE_ENTRY_ACL_USER_OBJ) return (0); + break; + case ACL_USER: + if (myacl->tag != ARCHIVE_ENTRY_ACL_USER) + return (0); + if ((uid_t)myacl->qual != *(uid_t *)acl_get_qualifier(aclent)) + return (0); + break; + case ACL_GROUP_OBJ: + if (myacl->tag != ARCHIVE_ENTRY_ACL_GROUP_OBJ) return (0); + break; + case ACL_GROUP: + if (myacl->tag != ARCHIVE_ENTRY_ACL_GROUP) + return (0); + if ((gid_t)myacl->qual != *(gid_t *)acl_get_qualifier(aclent)) + return (0); + break; + case ACL_MASK: + if (myacl->tag != ARCHIVE_ENTRY_ACL_MASK) return (0); + break; + case ACL_OTHER: + if (myacl->tag != ARCHIVE_ENTRY_ACL_OTHER) return (0); + break; + } + return (1); +} + +static void +compare_acls(acl_t acl, struct myacl_t *myacls) +{ + int *marker; + int entry_id = ACL_FIRST_ENTRY; + int matched; + int i, n; + acl_entry_t acl_entry; + + /* Count ACL entries in myacls array and allocate an indirect array. */ + for (n = 0; myacls[n].name != NULL; ++n) + continue; + marker = malloc(sizeof(marker[0]) * n); + for (i = 0; i < n; i++) + marker[i] = i; + + /* + * Iterate over acls in system acl object, try to match each + * one with an item in the myacls array. + */ + while (1 == acl_get_entry(acl, entry_id, &acl_entry)) { + /* After the first time... */ + entry_id = ACL_NEXT_ENTRY; + + /* Search for a matching entry (tag and qualifier) */ + for (i = 0, matched = 0; i < n && !matched; i++) { + if (acl_match(acl_entry, &myacls[marker[i]])) { + /* We found a match; remove it. */ + marker[i] = marker[n - 1]; + n--; + matched = 1; + } + } + + /* TODO: Print out more details in this case. */ + failure("ACL entry on file that shouldn't be there"); + assert(matched == 1); + } + + /* Dump entries in the myacls array that weren't in the system acl. */ + for (i = 0; i < n; ++i) { + failure(" ACL entry missing from file: " + "type=%d,permset=%d,tag=%d,qual=%d,name=``%s''\n", + myacls[marker[i]].type, myacls[marker[i]].permset, + myacls[marker[i]].tag, myacls[marker[i]].qual, + myacls[marker[i]].name); + assert(0); /* Record this as a failure. */ + } + free(marker); +} + +#endif + + +/* + * Verify ACL restore-to-disk. This test is FreeBSD-specific. + */ + +DEFINE_TEST(test_acl_freebsd) +{ +#if !defined(__FreeBSD__) + skipping("FreeBSD-specific ACL restore test"); +#elif __FreeBSD__ < 5 + skipping("ACL restore supported only on FreeBSD 5.0 and later"); +#else + struct stat st; + struct archive *a; + struct archive_entry *ae; + int n, fd; + acl_t acl; + + /* + * First, do a quick manual set/read of ACL data to + * verify that the local filesystem does support ACLs. + * If it doesn't, we'll simply skip the remaining tests. + */ + acl = acl_from_text("u::rwx,u:1:rw,g::rwx,g:15:rx,o::rwx,m::rwx"); + assert((void *)acl != NULL); + /* Create a test file and try to set an ACL on it. */ + fd = open("pretest", O_WRONLY | O_CREAT | O_EXCL, 0777); + failure("Could not create test file?!"); + n = -1; + if (assert(fd >= 0)) { + n = acl_set_fd(fd, acl); + failure("acl_set_fd(): errno = %d (%s)", + errno, strerror(errno)); + assertEqualInt(0, n); + close(fd); + } + + if (fd < 0 || n != 0) { + skipping("ACL tests require that ACL support be enabled on the filesystem"); + return; + } + + /* Create a write-to-disk object. */ + assert(NULL != (a = archive_write_disk_new())); + archive_write_disk_set_options(a, + ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_ACL); + + /* Populate an archive entry with some metadata, including ACL info */ + ae = archive_entry_new(); + assert(ae != NULL); + archive_entry_set_pathname(ae, "test0"); + archive_entry_set_mtime(ae, 123456, 7890); + archive_entry_set_size(ae, 0); + set_acls(ae, acls2); + assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae)); + archive_entry_free(ae); + + /* Close the archive. */ + assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a)); + assertEqualInt(ARCHIVE_OK, archive_write_finish(a)); + + /* Verify the data on disk. */ + assertEqualInt(0, stat("test0", &st)); + assertEqualInt(st.st_mtime, 123456); + acl = acl_get_file("test0", ACL_TYPE_ACCESS); + assert(acl != (acl_t)NULL); + compare_acls(acl, acls2); +#endif +} From owner-svn-src-stable-6@FreeBSD.ORG Thu Oct 23 13:23:14 2008 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EED8E1065673; Thu, 23 Oct 2008 13:23:14 +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 DCD2A8FC18; Thu, 23 Oct 2008 13:23:14 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9NDNEKo057708; Thu, 23 Oct 2008 13:23:14 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9NDNEaT057707; Thu, 23 Oct 2008 13:23:14 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200810231323.m9NDNEaT057707@svn.freebsd.org> From: Ken Smith Date: Thu, 23 Oct 2008 13:23: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: r184201 - stable/6/release/scripts X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 23 Oct 2008 13:23:15 -0000 Author: kensmith Date: Thu Oct 23 13:23:14 2008 New Revision: 184201 URL: http://svn.freebsd.org/changeset/base/184201 Log: Adjust package set for 6.4-REL. Approved by: re (kib) Modified: stable/6/release/scripts/package-split.py Modified: stable/6/release/scripts/package-split.py ============================================================================== --- stable/6/release/scripts/package-split.py Thu Oct 23 10:38:04 2008 (r184200) +++ stable/6/release/scripts/package-split.py Thu Oct 23 13:23:14 2008 (r184201) @@ -26,13 +26,12 @@ else: # List of packages for disc1. This just includes packages sysinstall can # install as a distribution def disc1_packages(): - pkgs = ['lang/perl5.8'] - pkgs.extend(['x11/xorg', - 'x11-drivers/xorg-drivers', - 'x11-fonts/xorg-fonts', - 'x11-servers/xorg-nestserver', - 'x11-servers/xorg-vfbserver', - 'devel/imake']) + pkgs = ['archivers/unzip', + 'emulators/mtools', + 'lang/perl5.8', + 'misc/compat5x', + 'net/cvsup-without-gui', + 'net/rsync'] if arch == 'alpha': pkgs.append('emulators/osf1_base') elif arch == 'i386': @@ -49,42 +48,45 @@ def disc2_packages(): 'x11/kde-lite'] else: pkgs = ['x11/gnome2', - 'x11/kde3'] + 'x11/kdebase3', + 'x11/kdelibs3'] + pkgs.extend(['x11/xorg', + 'x11-drivers/xorg-drivers', + 'x11-fonts/xorg-fonts', + 'x11-servers/xorg-nestserver', + 'x11-servers/xorg-vfbserver', + 'devel/imake']) return pkgs def disc3_packages(): - pkgs = ['x11-wm/afterstep', + pkgs = ['x11/kde3', + 'x11-wm/afterstep', 'x11-wm/windowmaker', 'x11-wm/fvwm2', # "Nice to have" - 'archivers/unzip', 'astro/xearth', 'devel/gmake', 'editors/emacs', 'editors/vim-lite', 'editors/xemacs', - 'emulators/mtools', 'graphics/png', 'graphics/xv', 'irc/xchat', 'lang/php5', + 'mail/alpine', 'mail/exim', 'mail/fetchmail', 'mail/mutt', - 'mail/pine4', 'mail/popd', 'mail/xfmail', 'mail/postfix', - 'misc/compat5x', - 'net/cvsup-without-gui', - 'net/rsync', 'net/samba3', 'news/slrn', 'news/tin', 'ports-mgmt/portupgrade', 'print/a2ps-letter', 'print/apsfilter', - 'print/ghostscript-gnu-nox11', + 'print/ghostscript7-nox11', 'print/gv', 'print/psutils-letter', 'print/teTeX', From owner-svn-src-stable-6@FreeBSD.ORG Sat Oct 25 01:21:29 2008 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0AAFE106566C; Sat, 25 Oct 2008 01:21:29 +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 E91E38FC08; Sat, 25 Oct 2008 01:21:28 +0000 (UTC) (envelope-from kensmith@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9P1LSdh003860; Sat, 25 Oct 2008 01:21:28 GMT (envelope-from kensmith@svn.freebsd.org) Received: (from kensmith@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9P1LSRR003855; Sat, 25 Oct 2008 01:21:28 GMT (envelope-from kensmith@svn.freebsd.org) Message-Id: <200810250121.m9P1LSRR003855@svn.freebsd.org> From: Ken Smith Date: Sat, 25 Oct 2008 01:21:28 +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: r184237 - stable/6/usr.sbin/sysinstall X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2008 01:21:29 -0000 Author: kensmith Date: Sat Oct 25 01:21:28 2008 New Revision: 184237 URL: http://svn.freebsd.org/changeset/base/184237 Log: MFS r184232: > MFC r183921 and r184180 > When we notice the INDEX had volume numbers (so the media the packages > are coming from has multiple volumes) walk through the dependency tree > for the packages selected by the user once for each volume, only > installing packages on the current volume. If we can't install the > package because its on a higher volume just note that we have looked > at it during the pass for this volume to cut down on time spent checking > dependencies. This stops the excessive disc swapping that users have > complained (a lot...) about. Approved by: re (kib) Modified: stable/6/usr.sbin/sysinstall/ (props changed) stable/6/usr.sbin/sysinstall/config.c stable/6/usr.sbin/sysinstall/globals.c stable/6/usr.sbin/sysinstall/index.c stable/6/usr.sbin/sysinstall/package.c stable/6/usr.sbin/sysinstall/sysinstall.h Modified: stable/6/usr.sbin/sysinstall/config.c ============================================================================== --- stable/6/usr.sbin/sysinstall/config.c Sat Oct 25 00:28:24 2008 (r184236) +++ stable/6/usr.sbin/sysinstall/config.c Sat Oct 25 01:21:28 2008 (r184237) @@ -785,6 +785,7 @@ configPackages(dialogMenuItem *self) while (1) { int ret, pos, scroll; + int current, low, high; /* Bring up the packages menu */ pos = scroll = 0; @@ -799,8 +800,14 @@ configPackages(dialogMenuItem *self) else if (DITEM_STATUS(ret) != DITEM_FAILURE) { dialog_clear(); restoreflag = 1; - for (tmp = Plist.kids; tmp && tmp->name; tmp = tmp->next) - (void)index_extract(mediaDevice, &Top, tmp, FALSE); + if (have_volumes) { + low = low_volume; + high = high_volume; + } else + low = high = 0; + for (current = low; current <= high; current++) + for (tmp = Plist.kids; tmp && tmp->name; tmp = tmp->next) + (void)index_extract(mediaDevice, &Top, tmp, FALSE, current); break; } } Modified: stable/6/usr.sbin/sysinstall/globals.c ============================================================================== --- stable/6/usr.sbin/sysinstall/globals.c Sat Oct 25 00:28:24 2008 (r184236) +++ stable/6/usr.sbin/sysinstall/globals.c Sat Oct 25 01:21:28 2008 (r184237) @@ -48,10 +48,13 @@ Boolean DialogActive; /* Is libdialog i Boolean ColorDisplay; /* Are we on a color display? */ Boolean OnVTY; /* Are we on a VTY? */ Boolean Restarting; /* Are we restarting sysinstall? */ +Boolean have_volumes; /* Media has more than one volume. */ Variable *VarHead; /* The head of the variable chain */ Device *mediaDevice; /* Where we're installing from */ int BootMgr; /* Which boot manager we're using */ int StatusLine; /* Where to stick our status messages */ +int low_volume; /* Lowest volume number */ +int high_volume; /* Highest volume number */ jmp_buf BailOut; /* Beam me up, scotty! The natives are pissed! */ Chunk *HomeChunk; Modified: stable/6/usr.sbin/sysinstall/index.c ============================================================================== --- stable/6/usr.sbin/sysinstall/index.c Sat Oct 25 00:28:24 2008 (r184236) +++ stable/6/usr.sbin/sysinstall/index.c Sat Oct 25 01:21:28 2008 (r184237) @@ -225,7 +225,17 @@ new_index(char *name, char *pathto, char tmp->deps = _strdup(deps); tmp->depc = 0; tmp->installed = package_installed(name); + tmp->vol_checked = 0; tmp->volume = volume; + if (volume != 0) { + have_volumes = TRUE; + if (low_volume == 0) + low_volume = volume; + else if (low_volume > volume) + low_volume = volume; + if (high_volume < volume) + high_volume = volume; + } return tmp; } @@ -681,9 +691,11 @@ recycle: } int -index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended) +index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended, + int current_volume) { int status = DITEM_SUCCESS; + Boolean notyet = FALSE; PkgNodePtr tmp2; IndexEntryPtr id = who->data; WINDOW *w; @@ -698,7 +710,7 @@ index_extract(Device *dev, PkgNodePtr to * a certain faulty INDEX file. */ - if (id->installed == 1) + if (id->installed == 1 || (have_volumes && id->vol_checked == current_volume)) return DITEM_SUCCESS; w = savescr(); @@ -711,9 +723,13 @@ index_extract(Device *dev, PkgNodePtr to if ((cp2 = index(cp, ' ')) != NULL) *cp2 = '\0'; if ((tmp2 = index_search(top, cp, NULL)) != NULL) { - status = index_extract(dev, top, tmp2, TRUE); + status = index_extract(dev, top, tmp2, TRUE, current_volume); if (DITEM_STATUS(status) != DITEM_SUCCESS) { - if (variable_get(VAR_NO_CONFIRM)) + /* package probably on a future disc volume */ + if (status & DITEM_CONTINUE) { + status = DITEM_SUCCESS; + notyet = TRUE; + } else if (variable_get(VAR_NO_CONFIRM)) msgNotify("Loading of dependent package %s failed", cp); else msgConfirm("Loading of dependent package %s failed", cp); @@ -731,10 +747,38 @@ index_extract(Device *dev, PkgNodePtr to cp = NULL; } } - /* Done with the deps? Load the real m'coy */ + + /* + * If iterating through disc volumes one at a time indicate failure if + * dependency install failed due to package being on a higher volume + * numbered disc, but that we should continue anyway. Note that this + * package has already been processed for this disc volume so we don't + * need to do it again. + */ + + if (notyet) { + restorescr(w); + id->vol_checked = current_volume; + return DITEM_FAILURE | DITEM_CONTINUE; + } + + /* + * Done with the deps? Try to load the real m'coy. If iterating + * through a multi-volume disc set fail the install if the package + * is on a higher numbered volume to cut down on disc switches the + * user needs to do, but indicate caller should continue processing + * despite error return. Note this package was processed for the + * current disc being checked. + */ + if (DITEM_STATUS(status) == DITEM_SUCCESS) { /* Prompt user if the package is not available on the current volume. */ if(mediaDevice->type == DEVICE_TYPE_CDROM) { + if (current_volume != 0 && id->volume > current_volume) { + restorescr(w); + id->vol_checked = current_volume; + return DITEM_FAILURE | DITEM_CONTINUE; + } while (id->volume != dev->volume) { if (!msgYesNo("This is disc #%d. Package %s is on disc #%d\n" "Would you like to switch discs now?\n", dev->volume, @@ -800,6 +844,8 @@ index_initialize(char *path) if (!index_initted) { w = savescr(); dialog_clear_norefresh(); + have_volumes = FALSE; + low_volume = high_volume = 0; /* Got any media? */ if (!mediaVerify()) { Modified: stable/6/usr.sbin/sysinstall/package.c ============================================================================== --- stable/6/usr.sbin/sysinstall/package.c Sat Oct 25 00:28:24 2008 (r184236) +++ stable/6/usr.sbin/sysinstall/package.c Sat Oct 25 01:21:28 2008 (r184237) @@ -55,7 +55,7 @@ int package_add(char *name) { PkgNodePtr tmp; - int i; + int i, current, low, high; if (!mediaVerify()) return DITEM_FAILURE; @@ -68,9 +68,16 @@ package_add(char *name) return i; tmp = index_search(&Top, name, &tmp); - if (tmp) - return index_extract(mediaDevice, &Top, tmp, FALSE); - else { + if (tmp) { + if (have_volumes) { + low = low_volume; + high = high_volume; + } else + low = high = 0; + for (current = low; current <= high; current++) + i = index_extract(mediaDevice, &Top, tmp, FALSE, current); + return i; + } else { msgConfirm("Sorry, package %s was not found in the INDEX.", name); return DITEM_FAILURE; } Modified: stable/6/usr.sbin/sysinstall/sysinstall.h ============================================================================== --- stable/6/usr.sbin/sysinstall/sysinstall.h Sat Oct 25 00:28:24 2008 (r184236) +++ stable/6/usr.sbin/sysinstall/sysinstall.h Sat Oct 25 01:21:28 2008 (r184237) @@ -383,6 +383,7 @@ typedef struct _indexEntry { /* A single char *deps; /* packages this depends on */ int depc; /* how many depend on me */ int installed; /* indicates if it is installed */ + int vol_checked; /* disc volume last checked for */ char *maintainer; /* maintainer */ unsigned int volume; /* Volume of package */ } IndexEntry; @@ -415,6 +416,7 @@ extern Boolean RunningAsInit; /* Are w extern Boolean DialogActive; /* Is the dialog() stuff up? */ extern Boolean ColorDisplay; /* Are we on a color display? */ extern Boolean OnVTY; /* On a syscons VTY? */ +extern Boolean have_volumes; /* Media has multiple volumes */ extern Variable *VarHead; /* The head of the variable chain */ extern Device *mediaDevice; /* Where we're getting our distribution from */ extern unsigned int Dists; /* Which distributions we want */ @@ -477,6 +479,8 @@ extern DMenu MenuFixit; /* Fixit flopp extern int FixItMode; /* FixItMode starts shell onc urrent device (ie Serial port) */ extern const char * StartName; /* Which name we were started as */ extern int NCpus; /* # cpus on machine */ +extern int low_volume; /* Lowest volume number */ +extern int high_volume; /* Highest volume number */ /* Important chunks. */ extern Chunk *HomeChunk; @@ -668,7 +672,7 @@ void index_init(PkgNodePtr top, PkgNode void index_node_free(PkgNodePtr top, PkgNodePtr plist); void index_sort(PkgNodePtr top); void index_print(PkgNodePtr top, int level); -int index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended); +int index_extract(Device *dev, PkgNodePtr top, PkgNodePtr who, Boolean depended, int current_volume); int index_initialize(char *path); PkgNodePtr index_search(PkgNodePtr top, char *str, PkgNodePtr *tp); From owner-svn-src-stable-6@FreeBSD.ORG Sat Oct 25 14:01:08 2008 Return-Path: Delivered-To: svn-src-stable-6@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCD8E10656A5; Sat, 25 Oct 2008 14:01:08 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAC798FC17; Sat, 25 Oct 2008 14:01:08 +0000 (UTC) (envelope-from dfr@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9PE183G034003; Sat, 25 Oct 2008 14:01:08 GMT (envelope-from dfr@svn.freebsd.org) Received: (from dfr@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9PE18qX034002; Sat, 25 Oct 2008 14:01:08 GMT (envelope-from dfr@svn.freebsd.org) Message-Id: <200810251401.m9PE18qX034002@svn.freebsd.org> From: Doug Rabson Date: Sat, 25 Oct 2008 14:01:08 +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: r184261 - in stable/6/sys: . kern X-BeenThere: svn-src-stable-6@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 6-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Oct 2008 14:01:08 -0000 Author: dfr Date: Sat Oct 25 14:01:08 2008 New Revision: 184261 URL: http://svn.freebsd.org/changeset/base/184261 Log: MFC: r184227 - don't use *statep without holding the vnode interlock This change is being merged earlier than originally planned at the request of the release engineers. Approved by: re (kib) Modified: stable/6/sys/ (props changed) stable/6/sys/kern/kern_lockf.c Modified: stable/6/sys/kern/kern_lockf.c ============================================================================== --- stable/6/sys/kern/kern_lockf.c Sat Oct 25 14:00:37 2008 (r184260) +++ stable/6/sys/kern/kern_lockf.c Sat Oct 25 14:01:08 2008 (r184261) @@ -467,12 +467,15 @@ lf_advlockasync(struct vop_advlockasync_ /* * Avoid the common case of unlocking when inode has no locks. */ - if ((*statep) == NULL || LIST_EMPTY(&(*statep)->ls_active)) { + VI_LOCK(vp); + if ((*statep) == NULL) { if (ap->a_op != F_SETLK) { fl->l_type = F_UNLCK; + VI_UNLOCK(vp); return (0); } } + VI_UNLOCK(vp); /* * Map our arguments to an existing lock owner or create one