From owner-svn-src-stable-8@FreeBSD.ORG Sun Feb 21 04:10:25 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6810B1065676; Sun, 21 Feb 2010 04:10:25 +0000 (UTC) (envelope-from alc@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5634E8FC16; Sun, 21 Feb 2010 04:10: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 o1L4APqO012392; Sun, 21 Feb 2010 04:10:25 GMT (envelope-from alc@svn.freebsd.org) Received: (from alc@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1L4AP1H012390; Sun, 21 Feb 2010 04:10:25 GMT (envelope-from alc@svn.freebsd.org) Message-Id: <201002210410.o1L4AP1H012390@svn.freebsd.org> From: Alan Cox Date: Sun, 21 Feb 2010 04:10: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: r204162 - stable/8/sys/i386/i386 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2010 04:10:25 -0000 Author: alc Date: Sun Feb 21 04:10:25 2010 New Revision: 204162 URL: http://svn.freebsd.org/changeset/base/204162 Log: MFC r203085 Optimize pmap_demote_pde() by using the new KPTmap to access a kernel page table page instead of creating a temporary mapping to it. Set the PG_G bit on the page table entries that implement the KPTmap. Locore initializes the unused portions of the NKPT kernel page table pages that it allocates to zero. So, pmap_bootstrap() needn't zero the page table entries referenced by CMAP1 and CMAP3. Simplify pmap_set_pg(). Modified: stable/8/sys/i386/i386/pmap.c Directory Properties: 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/ (props changed) Modified: stable/8/sys/i386/i386/pmap.c ============================================================================== --- stable/8/sys/i386/i386/pmap.c Sun Feb 21 03:49:39 2010 (r204161) +++ stable/8/sys/i386/i386/pmap.c Sun Feb 21 04:10:25 2010 (r204162) @@ -423,7 +423,6 @@ pmap_bootstrap(vm_paddr_t firstaddr) } SYSMAP(caddr_t, CMAP1, CADDR1, 1) SYSMAP(caddr_t, CMAP3, CADDR3, 1) - *CMAP3 = 0; /* * Crashdump maps. @@ -446,7 +445,7 @@ pmap_bootstrap(vm_paddr_t firstaddr) SYSMAP(pt_entry_t *, KPTD, KPTmap, KVA_PAGES) for (i = 0; i < NKPT; i++) - KPTD[i] = (KPTphys + (i << PAGE_SHIFT)) | PG_RW | PG_V; + KPTD[i] = (KPTphys + (i << PAGE_SHIFT)) | pgeflag | PG_RW | PG_V; /* * Adjust the start of the KPTD and KPTmap so that the implementation @@ -458,15 +457,13 @@ pmap_bootstrap(vm_paddr_t firstaddr) /* * ptemap is used for pmap_pte_quick */ - SYSMAP(pt_entry_t *, PMAP1, PADDR1, 1); - SYSMAP(pt_entry_t *, PMAP2, PADDR2, 1); + SYSMAP(pt_entry_t *, PMAP1, PADDR1, 1) + SYSMAP(pt_entry_t *, PMAP2, PADDR2, 1) mtx_init(&PMAP2mutex, "PMAP2", NULL, MTX_DEF); virtual_avail = va; - *CMAP1 = 0; - /* * Leave in place an identity mapping (virt == phys) for the low 1 MB * physical memory region that is used by the ACPI wakeup code. This @@ -539,25 +536,19 @@ pmap_init_pat(void) void pmap_set_pg(void) { - pd_entry_t pdir; pt_entry_t *pte; vm_offset_t va, endva; - int i; if (pgeflag == 0) return; - i = KERNLOAD/NBPDR; endva = KERNBASE + KERNend; if (pseflag) { va = KERNBASE + KERNLOAD; while (va < endva) { - pdir = kernel_pmap->pm_pdir[KPTDI+i]; - pdir |= pgeflag; - kernel_pmap->pm_pdir[KPTDI+i] = PTD[KPTDI+i] = pdir; + pdir_pde(PTD, va) |= pgeflag; invltlb(); /* Play it safe, invltlb() every time */ - i++; va += NBPDR; } } else { @@ -1885,7 +1876,7 @@ pmap_growkernel(vm_offset_t addr) pmap_zero_page(nkpg); ptppaddr = VM_PAGE_TO_PHYS(nkpg); newpdir = (pd_entry_t) (ptppaddr | PG_V | PG_RW | PG_A | PG_M); - pdir_pde(KPTD, kernel_vm_end) = newpdir; + pdir_pde(KPTD, kernel_vm_end) = pgeflag | newpdir; updated_PTD = FALSE; mtx_lock_spin(&allpmaps_lock); @@ -2381,10 +2372,14 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t mptepa = VM_PAGE_TO_PHYS(mpte); /* - * Temporarily map the page table page (mpte) into the kernel's - * address space at either PADDR1 or PADDR2. - */ - if (curthread->td_pinned > 0 && mtx_owned(&vm_page_queue_mtx)) { + * If the page mapping is in the kernel's address space, then the + * KPTmap can provide access to the page table page. Otherwise, + * temporarily map the page table page (mpte) into the kernel's + * address space at either PADDR1 or PADDR2. + */ + if (va >= KERNBASE) + firstpte = &KPTmap[i386_btop(trunc_4mpage(va))]; + else if (curthread->td_pinned > 0 && mtx_owned(&vm_page_queue_mtx)) { if ((*PMAP1 & PG_FRAME) != mptepa) { *PMAP1 = mptepa | PG_RW | PG_V | PG_A | PG_M; #ifdef SMP @@ -2448,10 +2443,9 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t /* * A harmless race exists between this loop and the bcopy() * in pmap_pinit() that initializes the kernel segment of - * the new page table. Specifically, that bcopy() may copy - * the new PDE from the PTD, which is first in allpmaps, to - * the new page table before this loop updates that new - * page table. + * the new page table directory. Specifically, that bcopy() + * may copy the new PDE from the PTD to the new page table + * before this loop updates that new page table. */ mtx_lock_spin(&allpmaps_lock); LIST_FOREACH(allpmaps_entry, &allpmaps, pm_list) { From owner-svn-src-stable-8@FreeBSD.ORG Sun Feb 21 11:13:15 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CE5B6106566B; Sun, 21 Feb 2010 11:13: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 BCDBA8FC14; Sun, 21 Feb 2010 11:13: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 o1LBDFDK006148; Sun, 21 Feb 2010 11:13:15 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1LBDFaT006146; Sun, 21 Feb 2010 11:13:15 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201002211113.o1LBDFaT006146@svn.freebsd.org> From: Konstantin Belousov Date: Sun, 21 Feb 2010 11:13: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: r204167 - stable/8/sys/fs/msdosfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2010 11:13:15 -0000 Author: kib Date: Sun Feb 21 11:13:15 2010 New Revision: 204167 URL: http://svn.freebsd.org/changeset/base/204167 Log: MFC r203866: Invalid filesystem might cause the bp to be never read. Modified: stable/8/sys/fs/msdosfs/msdosfs_fat.c Directory Properties: 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/ (props changed) Modified: stable/8/sys/fs/msdosfs/msdosfs_fat.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_fat.c Sun Feb 21 10:29:45 2010 (r204166) +++ stable/8/sys/fs/msdosfs/msdosfs_fat.c Sun Feb 21 11:13:15 2010 (r204167) @@ -944,7 +944,8 @@ fillinusemap(pmp) if (readcn == 0) usemap_free(pmp, cn); } - brelse(bp); + if (bp != NULL) + brelse(bp); return (0); } From owner-svn-src-stable-8@FreeBSD.ORG Sun Feb 21 11:22:02 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2A9451065672; Sun, 21 Feb 2010 11:22:02 +0000 (UTC) (envelope-from antoine@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1943E8FC12; Sun, 21 Feb 2010 11:22:02 +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 o1LBM2A2008110; Sun, 21 Feb 2010 11:22:02 GMT (envelope-from antoine@svn.freebsd.org) Received: (from antoine@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1LBM10u008108; Sun, 21 Feb 2010 11:22:01 GMT (envelope-from antoine@svn.freebsd.org) Message-Id: <201002211122.o1LBM10u008108@svn.freebsd.org> From: Antoine Brodin Date: Sun, 21 Feb 2010 11:22:01 +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: r204168 - stable/8 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2010 11:22:02 -0000 Author: antoine Date: Sun Feb 21 11:22:01 2010 New Revision: 204168 URL: http://svn.freebsd.org/changeset/base/204168 Log: Merge r200413 and r202755 from head to stable/8: reduces white space diff between head and stable/8 Suggested by: ru@ Modified: stable/8/Makefile.inc1 (contents, props changed) Modified: stable/8/Makefile.inc1 ============================================================================== --- stable/8/Makefile.inc1 Sun Feb 21 11:13:15 2010 (r204167) +++ stable/8/Makefile.inc1 Sun Feb 21 11:22:01 2010 (r204168) @@ -1096,8 +1096,8 @@ _prebuild_libs= ${_kerberos5_lib_libasn1 lib/libkiconv lib/libkvm lib/libmd \ lib/ncurses/ncurses lib/ncurses/ncursesw \ lib/libopie lib/libpam ${_lib_libthr} \ - lib/libradius lib/libsbuf lib/libtacplus lib/libutil \ - ${_lib_libypclnt} lib/libz lib/msun \ + lib/libradius lib/libsbuf lib/libtacplus \ + lib/libutil ${_lib_libypclnt} lib/libz lib/msun \ ${_secure_lib_libcrypto} ${_secure_lib_libssh} \ ${_secure_lib_libssl} From owner-svn-src-stable-8@FreeBSD.ORG Sun Feb 21 13:17:35 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D77A4106566B; Sun, 21 Feb 2010 13:17:35 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C63308FC14; Sun, 21 Feb 2010 13:17: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 o1LDHZ5L034930; Sun, 21 Feb 2010 13:17:35 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1LDHZQ5034927; Sun, 21 Feb 2010 13:17:35 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201002211317.o1LDHZQ5034927@svn.freebsd.org> From: Jaakko Heinonen Date: Sun, 21 Feb 2010 13:17: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: r204169 - stable/8/usr.bin/kdump X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2010 13:17:36 -0000 Author: jh Date: Sun Feb 21 13:17:35 2010 New Revision: 204169 URL: http://svn.freebsd.org/changeset/base/204169 Log: MFC r203551: - Cast intptr_t, pid_t and time_t values to intmax_t and use %jd with printf. - Cast the system call return value to long and use %ld in a printf in ktrsysret(). PR: bin/123774 Modified: stable/8/usr.bin/kdump/kdump.c Directory Properties: stable/8/usr.bin/kdump/ (props changed) Modified: stable/8/usr.bin/kdump/kdump.c ============================================================================== --- stable/8/usr.bin/kdump/kdump.c Sun Feb 21 11:22:01 2010 (r204168) +++ stable/8/usr.bin/kdump/kdump.c Sun Feb 21 13:17:35 2010 (r204169) @@ -182,14 +182,16 @@ main(int argc, char *argv[]) if (ktr_header.ktr_type & KTR_DROP) { ktr_header.ktr_type &= ~KTR_DROP; if (!drop_logged && threads) { - (void)printf("%6d %6d %-8.*s Events dropped.\n", - ktr_header.ktr_pid, ktr_header.ktr_tid > - 0 ? ktr_header.ktr_tid : 0, MAXCOMLEN, - ktr_header.ktr_comm); + (void)printf( + "%6jd %6jd %-8.*s Events dropped.\n", + (intmax_t)ktr_header.ktr_pid, + ktr_header.ktr_tid > 0 ? + (intmax_t)ktr_header.ktr_tid : 0, + MAXCOMLEN, ktr_header.ktr_comm); drop_logged = 1; } else if (!drop_logged) { - (void)printf("%6d %-8.*s Events dropped.\n", - ktr_header.ktr_pid, MAXCOMLEN, + (void)printf("%6jd %-8.*s Events dropped.\n", + (intmax_t)ktr_header.ktr_pid, MAXCOMLEN, ktr_header.ktr_comm); drop_logged = 1; } @@ -309,10 +311,11 @@ dumpheader(struct ktr_header *kth) * negative tid's as 0. */ if (threads) - (void)printf("%6d %6d %-8.*s ", kth->ktr_pid, kth->ktr_tid > - 0 ? kth->ktr_tid : 0, MAXCOMLEN, kth->ktr_comm); + (void)printf("%6jd %6jd %-8.*s ", (intmax_t)kth->ktr_pid, + kth->ktr_tid > 0 ? (intmax_t)kth->ktr_tid : 0, + MAXCOMLEN, kth->ktr_comm); else - (void)printf("%6d %-8.*s ", kth->ktr_pid, MAXCOMLEN, + (void)printf("%6jd %-8.*s ", (intmax_t)kth->ktr_pid, MAXCOMLEN, kth->ktr_comm); if (timestamp) { if (timestamp == 3) { @@ -325,8 +328,8 @@ dumpheader(struct ktr_header *kth) timevalsub(&kth->ktr_time, &prevtime); prevtime = temp; } - (void)printf("%ld.%06ld ", - kth->ktr_time.tv_sec, kth->ktr_time.tv_usec); + (void)printf("%jd.%06ld ", (intmax_t)kth->ktr_time.tv_sec, + kth->ktr_time.tv_usec); } (void)printf("%s ", type); } @@ -821,7 +824,7 @@ ktrsysret(struct ktr_sysret *ktr) if (error == 0) { if (fancy) { - (void)printf("%d", ret); + (void)printf("%ld", (long)ret); if (ret < 0 || ret > 9) (void)printf("/%#lx", (long)ret); } else { @@ -1270,7 +1273,7 @@ ktrstat(struct stat *statp) printf("rdev=%ju, ", (uintmax_t)statp->st_rdev); printf("atime="); if (resolv == 0) - printf("%ld", statp->st_atimespec.tv_sec); + printf("%jd", (intmax_t)statp->st_atimespec.tv_sec); else { tm = localtime(&statp->st_atimespec.tv_sec); (void)strftime(timestr, sizeof(timestr), TIME_FORMAT, tm); @@ -1282,7 +1285,7 @@ ktrstat(struct stat *statp) printf(", "); printf("stime="); if (resolv == 0) - printf("%ld", statp->st_mtimespec.tv_sec); + printf("%jd", (intmax_t)statp->st_mtimespec.tv_sec); else { tm = localtime(&statp->st_mtimespec.tv_sec); (void)strftime(timestr, sizeof(timestr), TIME_FORMAT, tm); @@ -1294,7 +1297,7 @@ ktrstat(struct stat *statp) printf(", "); printf("ctime="); if (resolv == 0) - printf("%ld", statp->st_ctimespec.tv_sec); + printf("%jd", (intmax_t)statp->st_ctimespec.tv_sec); else { tm = localtime(&statp->st_ctimespec.tv_sec); (void)strftime(timestr, sizeof(timestr), TIME_FORMAT, tm); @@ -1306,7 +1309,7 @@ ktrstat(struct stat *statp) printf(", "); printf("birthtime="); if (resolv == 0) - printf("%ld", statp->st_birthtimespec.tv_sec); + printf("%jd", (intmax_t)statp->st_birthtimespec.tv_sec); else { tm = localtime(&statp->st_birthtimespec.tv_sec); (void)strftime(timestr, sizeof(timestr), TIME_FORMAT, tm); From owner-svn-src-stable-8@FreeBSD.ORG Sun Feb 21 23:39:13 2010 Return-Path: Delivered-To: svn-src-stable-8@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id CA2AB106566B; Sun, 21 Feb 2010 23:39:13 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id 212CB8FC13; Sun, 21 Feb 2010 23:39:13 +0000 (UTC) Received: from lawrence1.loshell.room52.net (unknown [59.167.184.191]) by lauren.room52.net (Postfix) with ESMTPSA id 9EAFE7E87D; Mon, 22 Feb 2010 10:39:11 +1100 (EST) Message-ID: <4B81C41F.2080601@freebsd.org> Date: Mon, 22 Feb 2010 10:39:11 +1100 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-AU; rv:1.9.1.5) Gecko/20100105 Thunderbird/3.0 MIME-Version: 1.0 To: Alexander Motin References: <201002141938.o1EJcRpx065470@svn.freebsd.org> <4B7D4962.8070706@freebsd.org> <4B7EC763.4090507@FreeBSD.org> In-Reply-To: <4B7EC763.4090507@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: r203889 - in stable/8/sys: cam cam/ata cam/scsi dev/ahci dev/asr dev/ata dev/ciss dev/hptiop dev/hptrr dev/mly dev/mpt dev/ppbus dev/siis dev/trm dev/twa dev/usb/storage X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 21 Feb 2010 23:39:14 -0000 On 02/20/10 04:16, Alexander Motin wrote: > Lawrence Stewart wrote: >> A couple of times it has gotten even more upset reporting things like this: >> >> mpt0: mpt_cam_event: 0x16 >> mpt0: mpt_cam_event: 0x16 >> mpt0: request 0xffffff80002f1400:54058 timed out for ccb >> 0xffffff0001c65000 (req->ccb 0xffffff0001c65000) >> mpt0: attempting to abort req 0xffffff80002f1400:54058 function 0 >> mpt0: request 0xffffff80002fd100:54059 timed out for ccb >> 0xffffff009f3ec800 (req->ccb 0xffffff009f3ec800) >> mpt0: request 0xffffff80002efcf0:54060 timed out for ccb >> 0xffffff0001bd2000 (req->ccb 0xffffff0001bd2000) >> mpt0: mpt_recover_commands: IOC Status 0x4a. Resetting controller. >> mpt0: mpt_cam_event: 0x0 >> mpt0: mpt_cam_event: 0x0 >> mpt0: completing timedout/aborted req 0xffffff80002f1400:54058 >> mpt0: completing timedout/aborted req 0xffffff80002fd100:54059 >> mpt0: completing timedout/aborted req 0xffffff80002efcf0:54060 >> mpt0: mpt_cam_event: 0x16 >> mpt0: mpt_cam_event: 0x12 >> mpt0: mpt_cam_event: 0x12 >> mpt0: mpt_cam_event: 0x16 >> mpt0: Volume(0:2): Volume Status Changed >> mpt0: request 0xffffff80002f8990:0 timed out for ccb 0xffffff009f3cb800 >> (req->ccb 0) >> >> No ill effects are observed after such an episode and the array remains >> in healthy as-normal state. The only observable problem is the stall of >> all disk IO while these events occur. > > I have no idea how mpt driver works, neither I have hardware to play, > but quick look shows that 0x12 event is MPI_EVENT_SAS_PHY_LINK_STATUS, > and 0x16 is MPI_EVENT_SAS_DISCOVERY. Both are not handled by mpt driver > and so logged. I would say something is going on at physical level of > your SAN. Timeouts are also could be the result of physical issues. Ok, I'll try and figure out what's possibly going on. > >> As best I can tell, the hardware is ok, both disks report as fine >> without SMART errors and are only 2 months old, so wanted to rule out >> software issues. On upgrading to recent 8-STABLE, I got a page fault >> kernel panic on boot in the mpt driver mpt_raid0 kproc. After some trial >> and error, r203888 is the most recent revision that boots fine, whilst >> r203889 exhibits the page fault. I should also note that r203888 still >> sees the "mpt0: mpt_cam_event: 0x16" messages and associated disk IO >> stalls. >> >> I compiled DDB into my r203889 kernel. Unfortunately my ILO emulates a >> USB keyboard so I can't do anything in DDB which is a huge pain, but >> here's the info I did get (hand transcribed): >> >> Fatal trap 12: page fault while in kernel mode >> current process: mpt_raid0 >> Stopped at xpt_rescan+0x1d: movq 0x10(%rsi),%rdx >> >> 1. Any thoughts on how to resolve the regression in the mpt driver with >> the r203889 commit? > > Any thoughts where to find a good telepath? :) > > For the beginning, show at least verbose boot messages up to the crash. > Full panic message could also be useful, it may show address of the > fault instruction, which may be resolved to source line with addr2line > tool. If you could find a good old PS/2 keyboard, backtrace would be > interesting to see. 2 issues: - The server is in colocated rack space and not easy to get to - I'm not even sure that this server has PS2 ports on it Perhaps this commit should be backed out of 8-STABLE until we get a chance to diagnose a bit more? Cheers, Lawrence From owner-svn-src-stable-8@FreeBSD.ORG Mon Feb 22 07:06:12 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 000DE1065676; Mon, 22 Feb 2010 07:06:11 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-fx0-f215.google.com (mail-fx0-f215.google.com [209.85.220.215]) by mx1.freebsd.org (Postfix) with ESMTP id AAFCC8FC1A; Mon, 22 Feb 2010 07:06:10 +0000 (UTC) Received: by fxm7 with SMTP id 7so2087073fxm.34 for ; Sun, 21 Feb 2010 23:06:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:sender:message-id:date:from :user-agent:mime-version:to:cc:subject:references:in-reply-to :x-enigmail-version:content-type:content-transfer-encoding; bh=EeUXo0RfmHTHaKvfjagFpAZDIW+oto8jpvqMqkufm5U=; b=QFdT/WS5ecVARq1CsnrZsCsxI4HFLwh8NUzjQcV5D2v49OOnOfl/lq12ucBOwHfqaB WS6uIoU61RmFiwt3/U93z54+A/ium+tu6NdyDmQZpzc5YW0Q7G81mkcSOJb1qrscj52t J9Pyw2HZ2AP2ZmgTn+0Q2Mb+JU5R2p+ojcakc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:x-enigmail-version:content-type :content-transfer-encoding; b=c311kLoWLueJfjcJftXUj64K23H/CFVc0hhXJMq+iJNl68jG9eba+JXpKwRblxFuaX sXqZBHeDO2RFy/cNFtFuFYExeyguSFR1R11OGGZwk4CAkSs8SunI+mVF5f4XX+57mqvp Q3LE80dFd4B80eLM1LKJUKr2+OoWsvtIlH7mQ= Received: by 10.87.56.18 with SMTP id i18mr2732606fgk.44.1266822359393; Sun, 21 Feb 2010 23:05:59 -0800 (PST) Received: from mavbook.mavhome.dp.ua (pc.mavhome.dp.ua [212.86.226.226]) by mx.google.com with ESMTPS id 16sm1275895fxm.15.2010.02.21.23.05.57 (version=SSLv3 cipher=RC4-MD5); Sun, 21 Feb 2010 23:05:58 -0800 (PST) Sender: Alexander Motin Message-ID: <4B822CD4.5080604@FreeBSD.org> Date: Mon, 22 Feb 2010 09:05:56 +0200 From: Alexander Motin User-Agent: Thunderbird 2.0.0.23 (X11/20091212) MIME-Version: 1.0 To: Lawrence Stewart References: <201002141938.o1EJcRpx065470@svn.freebsd.org> <4B7D4962.8070706@freebsd.org> <4B7EC763.4090507@FreeBSD.org> <4B81C41F.2080601@freebsd.org> In-Reply-To: <4B81C41F.2080601@freebsd.org> X-Enigmail-Version: 0.96.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: r203889 - in stable/8/sys: cam cam/ata cam/scsi dev/ahci dev/asr dev/ata dev/ciss dev/hptiop dev/hptrr dev/mly dev/mpt dev/ppbus dev/siis dev/trm dev/twa dev/usb/storage X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 07:06:12 -0000 Lawrence Stewart wrote: > On 02/20/10 04:16, Alexander Motin wrote: >> Lawrence Stewart wrote: >>> I compiled DDB into my r203889 kernel. Unfortunately my ILO emulates a >>> USB keyboard so I can't do anything in DDB which is a huge pain, but >>> here's the info I did get (hand transcribed): >>> >>> Fatal trap 12: page fault while in kernel mode >>> current process: mpt_raid0 >>> Stopped at xpt_rescan+0x1d: movq 0x10(%rsi),%rdx >>> >>> 1. Any thoughts on how to resolve the regression in the mpt driver with >>> the r203889 commit? >> > Perhaps this commit should be backed out of 8-STABLE until we get a > chance to diagnose a bit more? I also have successful reports with this driver, so problem is not common. So I don't think it is reasonable to back-out it now. As soon as you are the only complaining now, it is only you who can debug the issue. So could you be so kind to provide more info? Even without keyboard you should be able to get verbose boot messages and full panic message. -- Alexander Motin From owner-svn-src-stable-8@FreeBSD.ORG Mon Feb 22 07:19:11 2010 Return-Path: Delivered-To: svn-src-stable-8@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 9EEA6106566B; Mon, 22 Feb 2010 07:19:11 +0000 (UTC) (envelope-from lstewart@freebsd.org) Received: from lauren.room52.net (lauren.room52.net [210.50.193.198]) by mx1.freebsd.org (Postfix) with ESMTP id F15B18FC12; Mon, 22 Feb 2010 07:19:10 +0000 (UTC) Received: from lstewart.caia.swin.edu.au (lstewart.caia.swin.edu.au [136.186.229.95]) by lauren.room52.net (Postfix) with ESMTPSA id 910BC7E878; Mon, 22 Feb 2010 18:19:08 +1100 (EST) Message-ID: <4B822FEB.5030901@freebsd.org> Date: Mon, 22 Feb 2010 18:19:07 +1100 From: Lawrence Stewart User-Agent: Mozilla/5.0 (X11; U; FreeBSD amd64; en-US; rv:1.9.1.5) Gecko/20100105 Thunderbird/3.0 MIME-Version: 1.0 To: Alexander Motin References: <201002141938.o1EJcRpx065470@svn.freebsd.org> <4B7D4962.8070706@freebsd.org> <4B7EC763.4090507@FreeBSD.org> <4B81C41F.2080601@freebsd.org> <4B822CD4.5080604@FreeBSD.org> In-Reply-To: <4B822CD4.5080604@FreeBSD.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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: r203889 - in stable/8/sys: cam cam/ata cam/scsi dev/ahci dev/asr dev/ata dev/ciss dev/hptiop dev/hptrr dev/mly dev/mpt dev/ppbus dev/siis dev/trm dev/twa dev/usb/storage X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 07:19:11 -0000 On 02/22/10 18:05, Alexander Motin wrote: > Lawrence Stewart wrote: >> On 02/20/10 04:16, Alexander Motin wrote: >>> Lawrence Stewart wrote: >>>> I compiled DDB into my r203889 kernel. Unfortunately my ILO emulates a >>>> USB keyboard so I can't do anything in DDB which is a huge pain, but >>>> here's the info I did get (hand transcribed): >>>> >>>> Fatal trap 12: page fault while in kernel mode >>>> current process: mpt_raid0 >>>> Stopped at xpt_rescan+0x1d: movq 0x10(%rsi),%rdx >>>> >>>> 1. Any thoughts on how to resolve the regression in the mpt driver with >>>> the r203889 commit? >>> >> Perhaps this commit should be backed out of 8-STABLE until we get a >> chance to diagnose a bit more? > > I also have successful reports with this driver, so problem is not > common. So I don't think it is reasonable to back-out it now. As soon as > you are the only complaining now, it is only you who can debug the > issue. So could you be so kind to provide more info? Even without > keyboard you should be able to get verbose boot messages and full panic > message. Fair enough, if I'm the only person complaining and you've had other success reports, then that's cool. I will get some more info and report back but will have to wait until later in the week before the machine can be scheduled for some out-of-hours downtime. Cheers, Lawrence From owner-svn-src-stable-8@FreeBSD.ORG Mon Feb 22 15:58:10 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F068810656E7; Mon, 22 Feb 2010 15:58:10 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DE1248FC1A; Mon, 22 Feb 2010 15:58: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 o1MFwAQD089822; Mon, 22 Feb 2010 15:58:10 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1MFwANN089820; Mon, 22 Feb 2010 15:58:10 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201002221558.o1MFwANN089820@svn.freebsd.org> From: Ruslan Ermilov Date: Mon, 22 Feb 2010 15:58: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: r204203 - stable/8/lib/libjail X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 15:58:11 -0000 Author: ru Date: Mon Feb 22 15:58:10 2010 New Revision: 204203 URL: http://svn.freebsd.org/changeset/base/204203 Log: MFC: r204008: realloc() with a proper amount of memory. Modified: stable/8/lib/libjail/jail.c Directory Properties: stable/8/lib/libjail/ (props changed) Modified: stable/8/lib/libjail/jail.c ============================================================================== --- stable/8/lib/libjail/jail.c Mon Feb 22 15:57:36 2010 (r204202) +++ stable/8/lib/libjail/jail.c Mon Feb 22 15:58:10 2010 (r204203) @@ -191,7 +191,7 @@ jailparam_all(struct jailparam **jpp) /* Add the parameter to the list */ if (njp >= nlist) { nlist *= 2; - jp = realloc(jp, nlist * sizeof(jp)); + jp = realloc(jp, nlist * sizeof(*jp)); if (jp == NULL) { jailparam_free(jp, njp); return (-1); From owner-svn-src-stable-8@FreeBSD.ORG Mon Feb 22 16:00:55 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id AAD721065679; Mon, 22 Feb 2010 16:00:55 +0000 (UTC) (envelope-from ru@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 986398FC13; Mon, 22 Feb 2010 16:00: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 o1MG0tmb090489; Mon, 22 Feb 2010 16:00:55 GMT (envelope-from ru@svn.freebsd.org) Received: (from ru@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1MG0tUY090487; Mon, 22 Feb 2010 16:00:55 GMT (envelope-from ru@svn.freebsd.org) Message-Id: <201002221600.o1MG0tUY090487@svn.freebsd.org> From: Ruslan Ermilov Date: Mon, 22 Feb 2010 16:00: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: r204204 - stable/8/usr.sbin/arp X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 16:00:55 -0000 Author: ru Date: Mon Feb 22 16:00:55 2010 New Revision: 204204 URL: http://svn.freebsd.org/changeset/base/204204 Log: MFC: r203919: Show when an ARP entry expires (now that this info cannot be obtained with netstat(1)). Modified: stable/8/usr.sbin/arp/arp.c Directory Properties: stable/8/usr.sbin/arp/ (props changed) Modified: stable/8/usr.sbin/arp/arp.c ============================================================================== --- stable/8/usr.sbin/arp/arp.c Mon Feb 22 15:58:10 2010 (r204203) +++ stable/8/usr.sbin/arp/arp.c Mon Feb 22 16:00:55 2010 (r204204) @@ -101,7 +101,8 @@ static int valid_type(int type); static int nflag; /* no reverse dns lookups */ static char *rifname; -static int expire_time, flags, doing_proxy, proxy_only; +static time_t expire_time; +static int flags, doing_proxy, proxy_only; /* which function we're supposed to do */ #define F_GET 1 @@ -594,6 +595,15 @@ print_entry(struct sockaddr_dl *sdl, printf(" on %s", ifname); if (rtm->rtm_rmx.rmx_expire == 0) printf(" permanent"); + else { + static struct timeval tv; + if (tv.tv_sec == 0) + gettimeofday(&tv, 0); + if ((expire_time = rtm->rtm_rmx.rmx_expire - tv.tv_sec) > 0) + printf(" expires in %d seconds", (int)expire_time); + else + printf(" expired"); + } if (addr->sin_other & SIN_PROXY) printf(" published (proxy only)"); if (rtm->rtm_flags & RTF_ANNOUNCE) From owner-svn-src-stable-8@FreeBSD.ORG Mon Feb 22 17:10:47 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 75493106566C; Mon, 22 Feb 2010 17:10:47 +0000 (UTC) (envelope-from bschmidt@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 621208FC1F; Mon, 22 Feb 2010 17:10:47 +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 o1MHAlB1006473; Mon, 22 Feb 2010 17:10:47 GMT (envelope-from bschmidt@svn.freebsd.org) Received: (from bschmidt@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1MHAl5L006471; Mon, 22 Feb 2010 17:10:47 GMT (envelope-from bschmidt@svn.freebsd.org) Message-Id: <201002221710.o1MHAl5L006471@svn.freebsd.org> From: Bernhard Schmidt Date: Mon, 22 Feb 2010 17:10:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204215 - stable/8/sys/net80211 X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 17:10:47 -0000 Author: bschmidt Date: Mon Feb 22 17:10:47 2010 New Revision: 204215 URL: http://svn.freebsd.org/changeset/base/204215 Log: MFC r203673: Ensure that tkip_mixing_phase1() is called after a rekeying event when using plain s/w crypto. PR: bin/142547 Approved by: rpaulo (mentor) Modified: stable/8/sys/net80211/ieee80211_crypto_tkip.c Directory Properties: 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/ (props changed) Modified: stable/8/sys/net80211/ieee80211_crypto_tkip.c ============================================================================== --- stable/8/sys/net80211/ieee80211_crypto_tkip.c Mon Feb 22 17:03:45 2010 (r204214) +++ stable/8/sys/net80211/ieee80211_crypto_tkip.c Mon Feb 22 17:10:47 2010 (r204215) @@ -144,6 +144,7 @@ tkip_setkey(struct ieee80211_key *k) return 0; } k->wk_keytsc = 1; /* TSC starts at 1 */ + ctx->rx_phase1_done = 0; return 1; } From owner-svn-src-stable-8@FreeBSD.ORG Mon Feb 22 21:45:21 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 6B88B106568B; Mon, 22 Feb 2010 21:45:21 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5867E8FC0C; Mon, 22 Feb 2010 21:45: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 o1MLjLLo067345; Mon, 22 Feb 2010 21:45:21 GMT (envelope-from marius@svn.freebsd.org) Received: (from marius@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1MLjLqC067333; Mon, 22 Feb 2010 21:45:21 GMT (envelope-from marius@svn.freebsd.org) Message-Id: <201002222145.o1MLjLqC067333@svn.freebsd.org> From: Marius Strobl Date: Mon, 22 Feb 2010 21:45: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: r204224 - in stable/8/sys: modules modules/nfs_common modules/nfsclient modules/nfsserver nfs nfsclient nfsserver X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 21:45:21 -0000 Author: marius Date: Mon Feb 22 21:45:20 2010 New Revision: 204224 URL: http://svn.freebsd.org/changeset/base/204224 Log: - Factor out the code shared between NFS client and server into its own module so it's not present twice. - Move nfs_realign() from the NFS client to the shared NFS code and remove the NFS server version in order to reduce code duplication. The shared version now uses a second parameter how, which is passed on to m_get(9) and m_getcl(9) as the server used M_WAIT while the client requires M_DONTWAIT, and replaces the the previously unused parameter hsiz. - Change nfs_realign() to use nfsm_aligned() so as with other NFS code the alignment check isn't actually performed on platforms without strict alignment requirements for performance reasons because as the comment suggests unaligned data only occasionally occurs with TCP. - Change fha_extract_info() to use nfs_realign() with M_DONTWAIT rather than M_WAIT because it's called with the RPC sp_lock held. Added: stable/8/sys/modules/nfs_common/ - copied from r203968, head/sys/modules/nfs_common/ Modified: stable/8/sys/modules/Makefile stable/8/sys/modules/nfsclient/Makefile stable/8/sys/modules/nfsserver/Makefile stable/8/sys/nfs/nfs_common.c stable/8/sys/nfs/nfs_common.h stable/8/sys/nfsclient/nfs_krpc.c stable/8/sys/nfsclient/nfs_vfsops.c stable/8/sys/nfsserver/nfs.h stable/8/sys/nfsserver/nfs_fha.c stable/8/sys/nfsserver/nfs_srvkrpc.c stable/8/sys/nfsserver/nfs_srvsubs.c Directory Properties: 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/ (props changed) Modified: stable/8/sys/modules/Makefile ============================================================================== --- stable/8/sys/modules/Makefile Mon Feb 22 21:03:15 2010 (r204223) +++ stable/8/sys/modules/Makefile Mon Feb 22 21:45:20 2010 (r204224) @@ -193,6 +193,7 @@ SUBDIR= ${_3dfx} \ ${_ndis} \ ${_netgraph} \ ${_nfe} \ + nfs_common \ nfscl \ nfsclient \ nfscommon \ Modified: stable/8/sys/modules/nfsclient/Makefile ============================================================================== --- stable/8/sys/modules/nfsclient/Makefile Mon Feb 22 21:03:15 2010 (r204223) +++ stable/8/sys/modules/nfsclient/Makefile Mon Feb 22 21:45:20 2010 (r204224) @@ -1,11 +1,11 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../nfsclient ${.CURDIR}/../../nfs ${.CURDIR}/../../rpc +.PATH: ${.CURDIR}/../../nfsclient ${.CURDIR}/../../rpc KMOD= nfsclient SRCS= vnode_if.h \ nfs_bio.c nfs_lock.c nfs_node.c nfs_subs.c nfs_nfsiod.c \ - nfs_vfsops.c nfs_vnops.c nfs_common.c nfs_krpc.c \ + nfs_vfsops.c nfs_vnops.c nfs_krpc.c \ opt_inet.h opt_nfs.h opt_bootp.h opt_nfsroot.h SRCS+= opt_inet6.h opt_kdtrace.h opt_kgssapi.h Modified: stable/8/sys/modules/nfsserver/Makefile ============================================================================== --- stable/8/sys/modules/nfsserver/Makefile Mon Feb 22 21:03:15 2010 (r204223) +++ stable/8/sys/modules/nfsserver/Makefile Mon Feb 22 21:45:20 2010 (r204224) @@ -1,9 +1,9 @@ # $FreeBSD$ -.PATH: ${.CURDIR}/../../nfsserver ${.CURDIR}/../../nfs +.PATH: ${.CURDIR}/../../nfsserver KMOD= nfsserver SRCS= vnode_if.h \ - nfs_fha.c nfs_serv.c nfs_srvkrpc.c nfs_srvsubs.c nfs_common.c \ + nfs_fha.c nfs_serv.c nfs_srvkrpc.c nfs_srvsubs.c \ opt_mac.h \ opt_kgssapi.h \ opt_nfs.h Modified: stable/8/sys/nfs/nfs_common.c ============================================================================== --- stable/8/sys/nfs/nfs_common.c Mon Feb 22 21:03:15 2010 (r204223) +++ stable/8/sys/nfs/nfs_common.c Mon Feb 22 21:45:20 2010 (r204224) @@ -54,8 +54,10 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include +#include #include #include @@ -77,6 +79,16 @@ nfstype nfsv3_type[9] = { static void *nfsm_dissect_xx_sub(int s, struct mbuf **md, caddr_t *dpos, int how); +SYSCTL_NODE(_vfs, OID_AUTO, nfs_common, CTLFLAG_RD, 0, "NFS common support"); + +static int nfs_realign_test; +SYSCTL_INT(_vfs_nfs_common, OID_AUTO, realign_test, CTLFLAG_RD, + &nfs_realign_test, 0, "Number of realign tests done"); + +static int nfs_realign_count; +SYSCTL_INT(_vfs_nfs_common, OID_AUTO, realign_count, CTLFLAG_RD, + &nfs_realign_count, 0, "Number of mbuf realignments done"); + u_quad_t nfs_curusec(void) { @@ -334,3 +346,68 @@ nfsm_adv_xx(int s, struct mbuf **md, cad return t1; return 0; } + +/* + * Check for badly aligned mbuf data and realign by copying the unaligned + * portion of the data into a new mbuf chain and freeing the portions of the + * old chain that were replaced. + * + * We cannot simply realign the data within the existing mbuf chain because + * the underlying buffers may contain other rpc commands and we cannot afford + * to overwrite them. + * + * We would prefer to avoid this situation entirely. The situation does not + * occur with NFS/UDP and is supposed to only occassionally occur with TCP. + * Use vfs.nfs.realign_count and realign_test to check this. + */ +int +nfs_realign(struct mbuf **pm, int how) +{ + struct mbuf *m, *n; + int off; + + ++nfs_realign_test; + while ((m = *pm) != NULL) { + if (!nfsm_aligned(m->m_len, u_int32_t) || + !nfsm_aligned(mtod(m, intptr_t), u_int32_t)) { + /* + * NB: we can't depend on m_pkthdr.len to help us + * decide what to do here. May not be worth doing + * the m_length calculation as m_copyback will + * expand the mbuf chain below as needed. + */ + if (m_length(m, NULL) >= MINCLSIZE) { + /* NB: m_copyback handles space > MCLBYTES */ + n = m_getcl(how, MT_DATA, 0); + } else + n = m_get(how, MT_DATA); + if (n == NULL) + return (ENOMEM); + /* + * Align the remainder of the mbuf chain. + */ + n->m_len = 0; + off = 0; + while (m != NULL) { + m_copyback(n, off, m->m_len, mtod(m, caddr_t)); + off += m->m_len; + m = m->m_next; + } + m_freem(*pm); + *pm = n; + ++nfs_realign_count; + break; + } + pm = &m->m_next; + } + return (0); +} + +static moduledata_t nfs_common_mod = { + "nfs_common", + NULL, + NULL +}; + +DECLARE_MODULE(nfs_common, nfs_common_mod, SI_SUB_VFS, SI_ORDER_ANY); +MODULE_VERSION(nfs_common, 1); Modified: stable/8/sys/nfs/nfs_common.h ============================================================================== --- stable/8/sys/nfs/nfs_common.h Mon Feb 22 21:03:15 2010 (r204223) +++ stable/8/sys/nfs/nfs_common.h Mon Feb 22 21:45:20 2010 (r204224) @@ -49,6 +49,7 @@ extern nfstype nfsv3_type[]; int nfs_adv(struct mbuf **, caddr_t *, int, int); u_quad_t nfs_curusec(void); void *nfsm_disct(struct mbuf **, caddr_t *, int, int, int); +int nfs_realign(struct mbuf **, int); /* ****************************** */ /* Build request/reply phase macros */ Modified: stable/8/sys/nfsclient/nfs_krpc.c ============================================================================== --- stable/8/sys/nfsclient/nfs_krpc.c Mon Feb 22 21:03:15 2010 (r204223) +++ stable/8/sys/nfsclient/nfs_krpc.c Mon Feb 22 21:45:20 2010 (r204224) @@ -87,8 +87,6 @@ uint32_t nfsclient_nfs3_start_probes[NFS uint32_t nfsclient_nfs3_done_probes[NFS_NPROCS]; #endif -static int nfs_realign_test; -static int nfs_realign_count; static int nfs_bufpackets = 4; static int nfs_reconnects; static int nfs3_jukebox_delay = 10; @@ -97,10 +95,6 @@ static int fake_wchan; SYSCTL_DECL(_vfs_nfs); -SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_test, CTLFLAG_RW, &nfs_realign_test, 0, - "Number of realign tests done"); -SYSCTL_INT(_vfs_nfs, OID_AUTO, realign_count, CTLFLAG_RW, &nfs_realign_count, 0, - "Number of mbuf realignments done"); SYSCTL_INT(_vfs_nfs, OID_AUTO, bufpackets, CTLFLAG_RW, &nfs_bufpackets, 0, "Buffer reservation size 2 < x < 64"); SYSCTL_INT(_vfs_nfs, OID_AUTO, reconnects, CTLFLAG_RD, &nfs_reconnects, 0, @@ -404,65 +398,6 @@ nfs_feedback(int type, int proc, void *a } /* - * nfs_realign: - * - * Check for badly aligned mbuf data and realign by copying the unaligned - * portion of the data into a new mbuf chain and freeing the portions - * of the old chain that were replaced. - * - * We cannot simply realign the data within the existing mbuf chain - * because the underlying buffers may contain other rpc commands and - * we cannot afford to overwrite them. - * - * We would prefer to avoid this situation entirely. The situation does - * not occur with NFS/UDP and is supposed to only occassionally occur - * with TCP. Use vfs.nfs.realign_count and realign_test to check this. - * - */ -static int -nfs_realign(struct mbuf **pm, int hsiz) -{ - struct mbuf *m, *n; - int off, space; - - ++nfs_realign_test; - while ((m = *pm) != NULL) { - if ((m->m_len & 0x3) || (mtod(m, intptr_t) & 0x3)) { - /* - * NB: we can't depend on m_pkthdr.len to help us - * decide what to do here. May not be worth doing - * the m_length calculation as m_copyback will - * expand the mbuf chain below as needed. - */ - space = m_length(m, NULL); - if (space >= MINCLSIZE) { - /* NB: m_copyback handles space > MCLBYTES */ - n = m_getcl(M_DONTWAIT, MT_DATA, 0); - } else - n = m_get(M_DONTWAIT, MT_DATA); - if (n == NULL) - return (ENOMEM); - /* - * Align the remainder of the mbuf chain. - */ - n->m_len = 0; - off = 0; - while (m != NULL) { - m_copyback(n, off, m->m_len, mtod(m, caddr_t)); - off += m->m_len; - m = m->m_next; - } - m_freem(*pm); - *pm = n; - ++nfs_realign_count; - break; - } - pm = &m->m_next; - } - return (0); -} - -/* * nfs_request - goes something like this * - fill in request struct * - links it into list @@ -592,7 +527,7 @@ tryagain: * These could cause pointer alignment problems, so copy them to * well aligned mbufs. */ - error = nfs_realign(&mrep, 2 * NFSX_UNSIGNED); + error = nfs_realign(&mrep, M_DONTWAIT); if (error == ENOMEM) { m_freem(mrep); AUTH_DESTROY(auth); Modified: stable/8/sys/nfsclient/nfs_vfsops.c ============================================================================== --- stable/8/sys/nfsclient/nfs_vfsops.c Mon Feb 22 21:03:15 2010 (r204223) +++ stable/8/sys/nfsclient/nfs_vfsops.c Mon Feb 22 21:45:20 2010 (r204224) @@ -147,6 +147,7 @@ MODULE_DEPEND(nfs, krpc, 1, 1, 1); #ifdef KGSSAPI MODULE_DEPEND(nfs, kgssapi, 1, 1, 1); #endif +MODULE_DEPEND(nfs, nfs_common, 1, 1, 1); static struct nfs_rpcops nfs_rpcops = { nfs_readrpc, Modified: stable/8/sys/nfsserver/nfs.h ============================================================================== --- stable/8/sys/nfsserver/nfs.h Mon Feb 22 21:03:15 2010 (r204223) +++ stable/8/sys/nfsserver/nfs.h Mon Feb 22 21:45:20 2010 (r204224) @@ -239,7 +239,6 @@ extern int nfs_debug; #endif -void nfs_realign(struct mbuf **); struct mbuf *nfs_rephead(int, struct nfsrv_descript *, int, struct mbuf **, caddr_t *); void nfsm_srvfattr(struct nfsrv_descript *, struct vattr *, Modified: stable/8/sys/nfsserver/nfs_fha.c ============================================================================== --- stable/8/sys/nfsserver/nfs_fha.c Mon Feb 22 21:03:15 2010 (r204223) +++ stable/8/sys/nfsserver/nfs_fha.c Mon Feb 22 21:45:20 2010 (r204224) @@ -202,7 +202,9 @@ fha_extract_info(struct svc_req *req, st procnum == NFSPROC_NULL) goto out; - nfs_realign(&req->rq_args); + error = nfs_realign(&req->rq_args, M_DONTWAIT); + if (error) + goto out; md = req->rq_args; dpos = mtod(md, caddr_t); Modified: stable/8/sys/nfsserver/nfs_srvkrpc.c ============================================================================== --- stable/8/sys/nfsserver/nfs_srvkrpc.c Mon Feb 22 21:03:15 2010 (r204223) +++ stable/8/sys/nfsserver/nfs_srvkrpc.c Mon Feb 22 21:45:20 2010 (r204224) @@ -96,8 +96,6 @@ SYSCTL_DECL(_vfs_nfsrv); SVCPOOL *nfsrv_pool; int nfsd_waiting = 0; int nfsrv_numnfsd = 0; -static int nfs_realign_test; -static int nfs_realign_count; struct callout nfsrv_callout; static eventhandler_tag nfsrv_nmbclusters_tag; @@ -111,10 +109,6 @@ SYSCTL_INT(_vfs_nfsrv, OID_AUTO, gatherd SYSCTL_INT(_vfs_nfsrv, OID_AUTO, gatherdelay_v3, CTLFLAG_RW, &nfsrvw_procrastinate_v3, 0, "Delay in seconds for NFSv3 write gathering"); -SYSCTL_INT(_vfs_nfsrv, OID_AUTO, realign_test, CTLFLAG_RW, - &nfs_realign_test, 0, ""); -SYSCTL_INT(_vfs_nfsrv, OID_AUTO, realign_count, CTLFLAG_RW, - &nfs_realign_count, 0, ""); static int nfssvc_addsock(struct file *, struct thread *); static int nfssvc_nfsd(struct thread *, struct nfsd_nfsd_args *); @@ -250,57 +244,6 @@ nfs_rephead(int siz, struct nfsrv_descri return (mreq); } -/* - * nfs_realign: - * - * Check for badly aligned mbuf data and realign by copying the unaligned - * portion of the data into a new mbuf chain and freeing the portions - * of the old chain that were replaced. - * - * We cannot simply realign the data within the existing mbuf chain - * because the underlying buffers may contain other rpc commands and - * we cannot afford to overwrite them. - * - * We would prefer to avoid this situation entirely. The situation does - * not occur with NFS/UDP and is supposed to only occassionally occur - * with TCP. Use vfs.nfs.realign_count and realign_test to check this. - */ -void -nfs_realign(struct mbuf **pm) /* XXX COMMON */ -{ - struct mbuf *m; - struct mbuf *n = NULL; - int off = 0; - - ++nfs_realign_test; - while ((m = *pm) != NULL) { - if ((m->m_len & 0x3) || (mtod(m, intptr_t) & 0x3)) { - MGET(n, M_WAIT, MT_DATA); - if (m->m_len >= MINCLSIZE) { - MCLGET(n, M_WAIT); - } - n->m_len = 0; - break; - } - pm = &m->m_next; - } - - /* - * If n is non-NULL, loop on m copying data, then replace the - * portion of the chain that had to be realigned. - */ - if (n != NULL) { - ++nfs_realign_count; - while (m) { - m_copyback(n, off, m->m_len, mtod(m, caddr_t)); - off += m->m_len; - m = m->m_next; - } - m_freem(*pm); - *pm = n; - } -} - static void nfssvc_program(struct svc_req *rqst, SVCXPRT *xprt) { @@ -334,7 +277,7 @@ nfssvc_program(struct svc_req *rqst, SVC mreq = mrep = NULL; mreq = rqst->rq_args; rqst->rq_args = NULL; - nfs_realign(&mreq); + (void)nfs_realign(&mreq, M_WAIT); /* * Note: we want rq_addr, not svc_getrpccaller for nd_nam2 - Modified: stable/8/sys/nfsserver/nfs_srvsubs.c ============================================================================== --- stable/8/sys/nfsserver/nfs_srvsubs.c Mon Feb 22 21:03:15 2010 (r204223) +++ stable/8/sys/nfsserver/nfs_srvsubs.c Mon Feb 22 21:45:20 2010 (r204224) @@ -560,6 +560,7 @@ DECLARE_MODULE(nfsserver, nfsserver_mod, MODULE_VERSION(nfsserver, 1); MODULE_DEPEND(nfsserver, nfssvc, 1, 1, 1); MODULE_DEPEND(nfsserver, krpc, 1, 1, 1); +MODULE_DEPEND(nfsserver, nfs_common, 1, 1, 1); /* * Set up nameidata for a lookup() call and do it. From owner-svn-src-stable-8@FreeBSD.ORG Mon Feb 22 22:27:27 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07A1A1065670; Mon, 22 Feb 2010 22:27:27 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E92678FC19; Mon, 22 Feb 2010 22:27:26 +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 o1MMRQ4e076626; Mon, 22 Feb 2010 22:27:26 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1MMRQRK076625; Mon, 22 Feb 2010 22:27:26 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201002222227.o1MMRQRK076625@svn.freebsd.org> From: Xin LI Date: Mon, 22 Feb 2010 22:27:26 +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: r204226 - stable/8/sys/cddl/contrib/opensolaris/uts/common/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Feb 2010 22:27:27 -0000 Author: delphij Date: Mon Feb 22 22:27:26 2010 New Revision: 204226 URL: http://svn.freebsd.org/changeset/base/204226 Log: MFC r203533: Remove two files that are not needed by FreeBSD. Approved by: pjd Deleted: stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/dkio.h stable/8/sys/cddl/contrib/opensolaris/uts/common/sys/dklabel.h Modified: Directory Properties: 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/ (props changed) From owner-svn-src-stable-8@FreeBSD.ORG Tue Feb 23 00:40:02 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA335106566B; Tue, 23 Feb 2010 00:40:02 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A94B08FC1C; Tue, 23 Feb 2010 00:40:02 +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 o1N0e2o5006071; Tue, 23 Feb 2010 00:40:02 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1N0e2xS006069; Tue, 23 Feb 2010 00:40:02 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201002230040.o1N0e2xS006069@svn.freebsd.org> From: Xin LI Date: Tue, 23 Feb 2010 00:40:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204232 - stable/8/sys/compat/linux X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2010 00:40:02 -0000 Author: delphij Date: Tue Feb 23 00:40:02 2010 New Revision: 204232 URL: http://svn.freebsd.org/changeset/base/204232 Log: MFC r203728: - Return EAFNOSUPPORT instead of EINVAL for unsupported address family, this matches the Linux behavior. - Check if we have sufficient space allocated for socket structure, which fixes a buffer overflow when wrong length is being passed into the emulation layer. [1] PR: kern/138860 Submitted by: Mateusz Guzik Reported by: Alexander Best [1] Modified: stable/8/sys/compat/linux/linux_socket.c Directory Properties: 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/ (props changed) Modified: stable/8/sys/compat/linux/linux_socket.c ============================================================================== --- stable/8/sys/compat/linux/linux_socket.c Tue Feb 23 00:34:20 2010 (r204231) +++ stable/8/sys/compat/linux/linux_socket.c Tue Feb 23 00:40:02 2010 (r204232) @@ -128,7 +128,7 @@ do_sa_get(struct sockaddr **sap, const s bdom = linux_to_bsd_domain(kosa->sa_family); if (bdom == -1) { - error = EINVAL; + error = EAFNOSUPPORT; goto out; } @@ -157,8 +157,13 @@ do_sa_get(struct sockaddr **sap, const s } } else #endif - if (bdom == AF_INET) + if (bdom == AF_INET) { alloclen = sizeof(struct sockaddr_in); + if (*osalen < alloclen) { + error = EINVAL; + goto out; + } + } sa = (struct sockaddr *) kosa; sa->sa_family = bdom; From owner-svn-src-stable-8@FreeBSD.ORG Tue Feb 23 01:00:15 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id EE02B1065670; Tue, 23 Feb 2010 01:00:15 +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 DD1988FC0C; Tue, 23 Feb 2010 01:00: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 o1N10F0s010709; Tue, 23 Feb 2010 01:00:15 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1N10F3r010706; Tue, 23 Feb 2010 01:00:15 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201002230100.o1N10F3r010706@svn.freebsd.org> From: Ed Maste Date: Tue, 23 Feb 2010 01:00: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: r204234 - stable/8/sys/dev/ichwd X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2010 01:00:16 -0000 Author: emaste Date: Tue Feb 23 01:00:15 2010 New Revision: 204234 URL: http://svn.freebsd.org/changeset/base/204234 Log: MFC r202812: Add H55 ID from Mike Tancsa, with minor rewording from avg@. PR: kern/143068 Submitted by: Mike Tancsa (Sentex) Modified: stable/8/sys/dev/ichwd/ichwd.c stable/8/sys/dev/ichwd/ichwd.h Directory Properties: 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/ (props changed) Modified: stable/8/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.c Tue Feb 23 00:41:40 2010 (r204233) +++ stable/8/sys/dev/ichwd/ichwd.c Tue Feb 23 01:00:15 2010 (r204234) @@ -109,6 +109,7 @@ static struct ichwd_device ichwd_devices { DEVICEID_ICH10D, "Intel ICH10D watchdog timer", 10 }, { DEVICEID_ICH10DO, "Intel ICH10DO watchdog timer", 10 }, { DEVICEID_ICH10R, "Intel ICH10R watchdog timer", 10 }, + { DEVICEID_H55, "Intel H55 watchdog timer", 10 }, { 0, NULL, 0 }, }; Modified: stable/8/sys/dev/ichwd/ichwd.h ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.h Tue Feb 23 00:41:40 2010 (r204233) +++ stable/8/sys/dev/ichwd/ichwd.h Tue Feb 23 01:00:15 2010 (r204234) @@ -99,6 +99,7 @@ struct ichwd_softc { #define DEVICEID_ICH10D 0x3a1a #define DEVICEID_ICH10DO 0x3a14 #define DEVICEID_ICH10R 0x3a16 +#define DEVICEID_H55 0x3b06 /* ICH LPC Interface Bridge Registers (ICH5 and older) */ #define ICH_GEN_STA 0xd4 From owner-svn-src-stable-8@FreeBSD.ORG Tue Feb 23 16:46:35 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1024E106566B; Tue, 23 Feb 2010 16:46: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 F2E1E8FC0A; Tue, 23 Feb 2010 16:46: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 o1NGkYg7022315; Tue, 23 Feb 2010 16:46:34 GMT (envelope-from pjd@svn.freebsd.org) Received: (from pjd@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1NGkYSx022313; Tue, 23 Feb 2010 16:46:34 GMT (envelope-from pjd@svn.freebsd.org) Message-Id: <201002231646.o1NGkYSx022313@svn.freebsd.org> From: Pawel Jakub Dawidek Date: Tue, 23 Feb 2010 16:46: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: r204251 - stable/8/sys/cddl/boot/zfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 23 Feb 2010 16:46:35 -0000 Author: pjd Date: Tue Feb 23 16:46:34 2010 New Revision: 204251 URL: http://svn.freebsd.org/changeset/base/204251 Log: MFC r201684. Teach the (gpt)zfsboot and zfsloader raidz code to use its buffers more efficiently. Before this patch, in the worst case memory use would increase exponentially on the number of drives in the raidz vdev. Submitted by: Matt Reimer Sponsored by: VPOP Technologies, Inc. Silence from: dfr Modified: stable/8/sys/cddl/boot/zfs/zfssubr.c Directory Properties: 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/ (props changed) Modified: stable/8/sys/cddl/boot/zfs/zfssubr.c ============================================================================== --- stable/8/sys/cddl/boot/zfs/zfssubr.c Tue Feb 23 16:39:53 2010 (r204250) +++ stable/8/sys/cddl/boot/zfs/zfssubr.c Tue Feb 23 16:46:34 2010 (r204251) @@ -454,7 +454,7 @@ vdev_raidz_reconstruct_q(raidz_col_t *co static void vdev_raidz_reconstruct_pq(raidz_col_t *cols, int nparity, int acols, - int x, int y) + int x, int y, void *temp_p, void *temp_q) { uint8_t *p, *q, *pxy, *qxy, *xd, *yd, tmp, a, b, aexp, bexp; void *pdata, *qdata; @@ -478,10 +478,8 @@ vdev_raidz_reconstruct_pq(raidz_col_t *c xsize = cols[x].rc_size; ysize = cols[y].rc_size; - cols[VDEV_RAIDZ_P].rc_data = - zfs_alloc_temp(cols[VDEV_RAIDZ_P].rc_size); - cols[VDEV_RAIDZ_Q].rc_data = - zfs_alloc_temp(cols[VDEV_RAIDZ_Q].rc_size); + cols[VDEV_RAIDZ_P].rc_data = temp_p; + cols[VDEV_RAIDZ_Q].rc_data = temp_q; cols[x].rc_size = 0; cols[y].rc_size = 0; @@ -551,9 +549,12 @@ vdev_raidz_read(vdev_t *vdev, const blkp uint64_t f = b % dcols; uint64_t o = (b / dcols) << unit_shift; uint64_t q, r, coff; - int c, c1, bc, col, acols, devidx, asize, n; + int c, c1, bc, col, acols, devidx, asize, n, max_rc_size; static raidz_col_t cols[16]; raidz_col_t *rc, *rc1; + void *orig, *orig1, *temp_p, *temp_q; + + orig = orig1 = temp_p = temp_q = NULL; q = s / (dcols - nparity); r = s - q * (dcols - nparity); @@ -561,6 +562,7 @@ vdev_raidz_read(vdev_t *vdev, const blkp acols = (q == 0 ? bc : dcols); asize = 0; + max_rc_size = 0; for (c = 0; c < acols; c++) { col = f + c; @@ -577,6 +579,8 @@ vdev_raidz_read(vdev_t *vdev, const blkp cols[c].rc_tried = 0; cols[c].rc_skipped = 0; asize += cols[c].rc_size; + if (cols[c].rc_size > max_rc_size) + max_rc_size = cols[c].rc_size; } asize = roundup(asize, (nparity + 1) << unit_shift); @@ -777,8 +781,13 @@ reconstruct: //ASSERT(c != acols); //ASSERT(!rc->rc_skipped || rc->rc_error == ENXIO || rc->rc_error == ESTALE); + if (temp_p == NULL) + temp_p = zfs_alloc_temp(max_rc_size); + if (temp_q == NULL) + temp_q = zfs_alloc_temp(max_rc_size); + vdev_raidz_reconstruct_pq(cols, nparity, acols, - c1, c); + c1, c, temp_p, temp_q); if (zio_checksum_error(bp, buf) == 0) return (0); @@ -845,18 +854,12 @@ reconstruct: return (EIO); } - asize = 0; - for (c = 0; c < acols; c++) { - rc = &cols[c]; - if (rc->rc_size > asize) - asize = rc->rc_size; - } if (cols[VDEV_RAIDZ_P].rc_error == 0) { /* * Attempt to reconstruct the data from parity P. */ - void *orig; - orig = zfs_alloc_temp(asize); + if (orig == NULL) + orig = zfs_alloc_temp(max_rc_size); for (c = nparity; c < acols; c++) { rc = &cols[c]; @@ -874,8 +877,8 @@ reconstruct: /* * Attempt to reconstruct the data from parity Q. */ - void *orig; - orig = zfs_alloc_temp(asize); + if (orig == NULL) + orig = zfs_alloc_temp(max_rc_size); for (c = nparity; c < acols; c++) { rc = &cols[c]; @@ -895,9 +898,14 @@ reconstruct: /* * Attempt to reconstruct the data from both P and Q. */ - void *orig, *orig1; - orig = zfs_alloc_temp(asize); - orig1 = zfs_alloc_temp(asize); + if (orig == NULL) + orig = zfs_alloc_temp(max_rc_size); + if (orig1 == NULL) + orig1 = zfs_alloc_temp(max_rc_size); + if (temp_p == NULL) + temp_p = zfs_alloc_temp(max_rc_size); + if (temp_q == NULL) + temp_q = zfs_alloc_temp(max_rc_size); for (c = nparity; c < acols - 1; c++) { rc = &cols[c]; @@ -909,7 +917,7 @@ reconstruct: memcpy(orig1, rc1->rc_data, rc1->rc_size); vdev_raidz_reconstruct_pq(cols, nparity, - acols, c, c1); + acols, c, c1, temp_p, temp_q); if (zio_checksum_error(bp, buf) == 0) return (0); From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 24 15:27:32 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 632971065672; Wed, 24 Feb 2010 15:27:32 +0000 (UTC) (envelope-from jh@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 518F48FC18; Wed, 24 Feb 2010 15: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 o1OFRVCX025837; Wed, 24 Feb 2010 15:27:32 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1OFRV9P025833; Wed, 24 Feb 2010 15:27:31 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201002241527.o1OFRV9P025833@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 24 Feb 2010 15:27:31 +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: r204277 - stable/8/bin/ls X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2010 15:27:32 -0000 Author: jh Date: Wed Feb 24 15:27:31 2010 New Revision: 204277 URL: http://svn.freebsd.org/changeset/base/204277 Log: MFC r202945: Fixes for ls(1) long format (-l) output: - Allow -h option to work if the listing contains at least one device file. - Align major and minor device numbers correctly to the size field. PR: bin/125678 Modified: stable/8/bin/ls/ls.c stable/8/bin/ls/ls.h stable/8/bin/ls/print.c Directory Properties: stable/8/bin/ls/ (props changed) Modified: stable/8/bin/ls/ls.c ============================================================================== --- stable/8/bin/ls/ls.c Wed Feb 24 14:19:56 2010 (r204276) +++ stable/8/bin/ls/ls.c Wed Feb 24 15:27:31 2010 (r204277) @@ -559,7 +559,8 @@ display(const FTSENT *p, FTSENT *list, i long maxblock; u_long btotal, labelstrlen, maxinode, maxlen, maxnlink; u_long maxlabelstr; - int bcfile, maxflags; + u_int devstrlen; + int maxflags; gid_t maxgroup; uid_t maxuser; size_t flen, ulen, glen; @@ -651,7 +652,7 @@ display(const FTSENT *p, FTSENT *list, i MAKENINES(maxsize); free(jinitmax); } - bcfile = 0; + devstrlen = 0; flags = NULL; for (cur = list, entries = 0; cur; cur = cur->fts_link) { if (cur->fts_info == FTS_ERR || cur->fts_info == FTS_NS) { @@ -791,9 +792,15 @@ label_out: np->group = &np->data[ulen + 1]; (void)strcpy(np->group, group); - if (S_ISCHR(sp->st_mode) || - S_ISBLK(sp->st_mode)) - bcfile = 1; + if ((S_ISCHR(sp->st_mode) || + S_ISBLK(sp->st_mode)) && + devstrlen < DEVSTR_HEX_LEN) { + if (minor(sp->st_rdev) > 255 || + minor(sp->st_rdev) < 0) + devstrlen = DEVSTR_HEX_LEN; + else + devstrlen = DEVSTR_LEN; + } if (f_flags) { np->flags = &np->data[ulen + glen + 2]; @@ -825,7 +832,6 @@ label_out: d.entries = entries; d.maxlen = maxlen; if (needstats) { - d.bcfile = bcfile; d.btotal = btotal; (void)snprintf(buf, sizeof(buf), "%lu", maxblock); d.s_block = strlen(buf); @@ -836,8 +842,14 @@ label_out: d.s_inode = strlen(buf); (void)snprintf(buf, sizeof(buf), "%lu", maxnlink); d.s_nlink = strlen(buf); - (void)snprintf(buf, sizeof(buf), "%ju", maxsize); - d.s_size = strlen(buf); + if (f_humanval) + d.s_size = HUMANVALSTR_LEN; + else { + (void)snprintf(buf, sizeof(buf), "%ju", maxsize); + d.s_size = strlen(buf); + } + if (d.s_size < devstrlen) + d.s_size = devstrlen; d.s_user = maxuser; } printfcn(&d); Modified: stable/8/bin/ls/ls.h ============================================================================== --- stable/8/bin/ls/ls.h Wed Feb 24 14:19:56 2010 (r204276) +++ stable/8/bin/ls/ls.h Wed Feb 24 15:27:31 2010 (r204277) @@ -35,6 +35,10 @@ #define NO_PRINT 1 +#define HUMANVALSTR_LEN 5 +#define DEVSTR_LEN 8 +#define DEVSTR_HEX_LEN 15 + extern long blocksize; /* block size units */ extern int f_accesstime; /* use time of last access */ @@ -62,7 +66,6 @@ extern int f_color; /* add type in colo typedef struct { FTSENT *list; u_long btotal; - int bcfile; int entries; int maxlen; u_int s_block; Modified: stable/8/bin/ls/print.c ============================================================================== --- stable/8/bin/ls/print.c Wed Feb 24 14:19:56 2010 (r204276) +++ stable/8/bin/ls/print.c Wed Feb 24 15:27:31 2010 (r204277) @@ -62,6 +62,7 @@ __FBSDID("$FreeBSD$"); #include "extern.h" static int printaname(const FTSENT *, u_long, u_long); +static void printdev(size_t, dev_t); static void printlink(const FTSENT *); static void printtime(time_t); static int printtype(u_int); @@ -165,16 +166,7 @@ printlong(const DISPLAY *dp) if (f_label) (void)printf("%-*s ", dp->s_label, np->label); if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode)) - if (minor(sp->st_rdev) > 255 || minor(sp->st_rdev) < 0) - (void)printf("%3d, 0x%08x ", - major(sp->st_rdev), - (u_int)minor(sp->st_rdev)); - else - (void)printf("%3d, %3d ", - major(sp->st_rdev), minor(sp->st_rdev)); - else if (dp->bcfile) - (void)printf("%*s%*jd ", - 8 - dp->s_size, "", dp->s_size, sp->st_size); + printdev(dp->s_size, sp->st_rdev); else printsize(dp->s_size, sp->st_size); if (f_accesstime) @@ -353,6 +345,24 @@ printaname(const FTSENT *p, u_long inode return (chcnt); } +/* + * Print device special file major and minor numbers. + */ +static void +printdev(size_t width, dev_t dev) +{ + char buf[DEVSTR_HEX_LEN + 1]; + + if (minor(dev) > 255 || minor(dev) < 0) + (void)snprintf(buf, sizeof(buf), "%3d, 0x%08x", + major(dev), (u_int)minor(dev)); + else + (void)snprintf(buf, sizeof(buf), "%3d, %3d", + major(dev), minor(dev)); + + (void)printf("%*s ", (u_int)width, buf); +} + static void printtime(time_t ftime) { @@ -592,11 +602,15 @@ printsize(size_t width, off_t bytes) { if (f_humanval) { - char buf[5]; + /* + * Reserve one space before the size and allocate room for + * the trailing '\0'. + */ + char buf[HUMANVALSTR_LEN - 1 + 1]; humanize_number(buf, sizeof(buf), (int64_t)bytes, "", HN_AUTOSCALE, HN_B | HN_NOSPACE | HN_DECIMAL); - (void)printf("%5s ", buf); + (void)printf("%*s ", (u_int)width, buf); } else (void)printf("%*jd ", (u_int)width, bytes); } From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 24 20:20:03 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 047731065678; Wed, 24 Feb 2010 20:20:03 +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 E6D8C8FC0A; Wed, 24 Feb 2010 20:20:02 +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 o1OKK2Wd094298; Wed, 24 Feb 2010 20:20:02 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1OKK2Lh094296; Wed, 24 Feb 2010 20:20:02 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201002242020.o1OKK2Lh094296@svn.freebsd.org> From: Rafal Jaworowski Date: Wed, 24 Feb 2010 20:20:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204282 - stable/8/sys/powerpc/booke X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2010 20:20:03 -0000 Author: raj Date: Wed Feb 24 20:20:02 2010 New Revision: 204282 URL: http://svn.freebsd.org/changeset/base/204282 Log: MFC r203924: Call the proper linkup routine in PowerPC Book-E machdep. Submitted by: attilio Modified: stable/8/sys/powerpc/booke/machdep.c Directory Properties: 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/ (props changed) Modified: stable/8/sys/powerpc/booke/machdep.c ============================================================================== --- stable/8/sys/powerpc/booke/machdep.c Wed Feb 24 20:13:34 2010 (r204281) +++ stable/8/sys/powerpc/booke/machdep.c Wed Feb 24 20:20:02 2010 (r204282) @@ -384,7 +384,7 @@ e500_init(u_int32_t startkernel, u_int32 init_param1(); /* Start initializing proc0 and thread0. */ - proc_linkup(&proc0, &thread0); + proc_linkup0(&proc0, &thread0); thread0.td_frame = &frame0; /* Set up per-cpu data and store the pointer in SPR general 0. */ From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 24 21:20:26 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3390E1065673; Wed, 24 Feb 2010 21:20:26 +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 080458FC17; Wed, 24 Feb 2010 21:20:26 +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 o1OLKPIF007736; Wed, 24 Feb 2010 21:20:25 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1OLKPap007734; Wed, 24 Feb 2010 21:20:25 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201002242120.o1OLKPap007734@svn.freebsd.org> From: John Baldwin Date: Wed, 24 Feb 2010 21:20: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: r204284 - stable/8/usr.sbin/mptutil X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2010 21:20:26 -0000 Author: jhb Date: Wed Feb 24 21:20:25 2010 New Revision: 204284 URL: http://svn.freebsd.org/changeset/base/204284 Log: MFC 204086: - Don't emit a warning in 'show adapter' if the IOC2 or IOC6 pages are not present. mpt(4) controllers that do not support RAID do not have an IOC6 page, for example. - Correct a check for a missing page error in a debug function. Modified: stable/8/usr.sbin/mptutil/mpt_show.c Directory Properties: stable/8/usr.sbin/mptutil/ (props changed) Modified: stable/8/usr.sbin/mptutil/mpt_show.c ============================================================================== --- stable/8/usr.sbin/mptutil/mpt_show.c Wed Feb 24 20:31:00 2010 (r204283) +++ stable/8/usr.sbin/mptutil/mpt_show.c Wed Feb 24 21:20:25 2010 (r204284) @@ -78,6 +78,7 @@ show_adapter(int ac, char **av) CONFIG_PAGE_MANUFACTURING_0 *man0; CONFIG_PAGE_IOC_2 *ioc2; CONFIG_PAGE_IOC_6 *ioc6; + U16 IOCStatus; int fd, comma; if (ac != 1) { @@ -108,7 +109,7 @@ show_adapter(int ac, char **av) free(man0); - ioc2 = mpt_read_ioc_page(fd, 2, NULL); + ioc2 = mpt_read_ioc_page(fd, 2, &IOCStatus); if (ioc2 != NULL) { printf(" RAID Levels:"); comma = 0; @@ -151,9 +152,11 @@ show_adapter(int ac, char **av) printf(" none"); printf("\n"); free(ioc2); - } + } else if ((IOCStatus & MPI_IOCSTATUS_MASK) != + MPI_IOCSTATUS_CONFIG_INVALID_PAGE) + warnx("mpt_read_ioc_page(2): %s", mpt_ioc_status(IOCStatus)); - ioc6 = mpt_read_ioc_page(fd, 6, NULL); + ioc6 = mpt_read_ioc_page(fd, 6, &IOCStatus); if (ioc6 != NULL) { display_stripe_map(" RAID0 Stripes", ioc6->SupportedStripeSizeMapIS); @@ -172,7 +175,9 @@ show_adapter(int ac, char **av) printf("-%u", ioc6->MaxDrivesIME); printf("\n"); free(ioc6); - } + } else if ((IOCStatus & MPI_IOCSTATUS_MASK) != + MPI_IOCSTATUS_CONFIG_INVALID_PAGE) + warnx("mpt_read_ioc_page(6): %s", mpt_ioc_status(IOCStatus)); /* TODO: Add an ioctl to fetch IOC_FACTS and print firmware version. */ @@ -541,7 +546,8 @@ show_physdisks(int ac, char **av) for (i = 0; i <= 0xff; i++) { pinfo = mpt_pd_info(fd, i, &IOCStatus); if (pinfo == NULL) { - if (IOCStatus != MPI_IOCSTATUS_CONFIG_INVALID_PAGE) + if ((IOCStatus & MPI_IOCSTATUS_MASK) != + MPI_IOCSTATUS_CONFIG_INVALID_PAGE) warnx("mpt_pd_info(%d): %s", i, mpt_ioc_status(IOCStatus)); continue; From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 24 21:29:18 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BCF0A106564A; Wed, 24 Feb 2010 21:29:18 +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 AA3D68FC18; Wed, 24 Feb 2010 21:29: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 o1OLTIVl009812; Wed, 24 Feb 2010 21:29:18 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1OLTI6Z009810; Wed, 24 Feb 2010 21:29:18 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201002242129.o1OLTI6Z009810@svn.freebsd.org> From: John Baldwin Date: Wed, 24 Feb 2010 21:29: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: r204286 - stable/8/usr.sbin/mptutil X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2010 21:29:18 -0000 Author: jhb Date: Wed Feb 24 21:29:18 2010 New Revision: 204286 URL: http://svn.freebsd.org/changeset/base/204286 Log: MFC 204090: Fix mptutil's method for locating disk devices attached to a specific mpt(4) controller. Previously, the code assumed that multiple match patterns provided to an XPT_DEV_MATCH request were ANDed together. Instead, they are ORed. Instead, to match peripherals for a specific bus, one query needs to be performed to lookup the path ID of the bus. A second query can then be performed matching peripherals attached to that path. This approach also makes the code a bit cleaner as the returned match results do not mix buses and perphierals. Modified: stable/8/usr.sbin/mptutil/mpt_cam.c Directory Properties: stable/8/usr.sbin/mptutil/ (props changed) Modified: stable/8/usr.sbin/mptutil/mpt_cam.c ============================================================================== --- stable/8/usr.sbin/mptutil/mpt_cam.c Wed Feb 24 21:26:27 2010 (r204285) +++ stable/8/usr.sbin/mptutil/mpt_cam.c Wed Feb 24 21:29:18 2010 (r204286) @@ -56,15 +56,75 @@ xpt_open(void) return (xptfd); } +/* Fetch the path id of bus 0 for the opened mpt controller. */ +static int +fetch_path_id(path_id_t *path_id) +{ + struct bus_match_pattern *b; + union ccb ccb; + size_t bufsize; + + if (xpt_open() < 0) + return (ENXIO); + + /* First, find the path id of bus 0 for this mpt controller. */ + bzero(&ccb, sizeof(ccb)); + + ccb.ccb_h.func_code = XPT_DEV_MATCH; + + bufsize = sizeof(struct dev_match_result) * 1; + ccb.cdm.num_matches = 0; + ccb.cdm.match_buf_len = bufsize; + ccb.cdm.matches = calloc(1, bufsize); + + bufsize = sizeof(struct dev_match_pattern) * 1; + ccb.cdm.num_patterns = 1; + ccb.cdm.pattern_buf_len = bufsize; + ccb.cdm.patterns = calloc(1, bufsize); + + /* Match mptX bus 0. */ + ccb.cdm.patterns[0].type = DEV_MATCH_BUS; + b = &ccb.cdm.patterns[0].pattern.bus_pattern; + snprintf(b->dev_name, sizeof(b->dev_name), "mpt"); + b->unit_number = mpt_unit; + b->bus_id = 0; + b->flags = BUS_MATCH_NAME | BUS_MATCH_UNIT | BUS_MATCH_BUS_ID; + + if (ioctl(xptfd, CAMIOCOMMAND, &ccb) < 0) { + free(ccb.cdm.matches); + free(ccb.cdm.patterns); + return (errno); + } + free(ccb.cdm.patterns); + + if (((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) || + (ccb.cdm.status != CAM_DEV_MATCH_LAST)) { + warnx("fetch_path_id got CAM error %#x, CDM error %d\n", + ccb.ccb_h.status, ccb.cdm.status); + free(ccb.cdm.matches); + return (EIO); + } + + /* We should have exactly 1 match for the bus. */ + if (ccb.cdm.num_matches != 1 || + ccb.cdm.matches[0].type != DEV_MATCH_BUS) { + free(ccb.cdm.matches); + return (ENOENT); + } + *path_id = ccb.cdm.matches[0].result.bus_result.path_id; + free(ccb.cdm.matches); + return (0); +} + int mpt_query_disk(U8 VolumeBus, U8 VolumeID, struct mpt_query_disk *qd) { - struct bus_match_pattern *b; struct periph_match_pattern *p; struct periph_match_result *r; union ccb ccb; + path_id_t path_id; size_t bufsize; - int i; + int error, i; /* mpt(4) only handles devices on bus 0. */ if (VolumeBus != 0) @@ -73,6 +133,11 @@ mpt_query_disk(U8 VolumeBus, U8 VolumeID if (xpt_open() < 0) return (ENXIO); + /* Find the path ID of bus 0. */ + error = fetch_path_id(&path_id); + if (error) + return (error); + bzero(&ccb, sizeof(ccb)); ccb.ccb_h.func_code = XPT_DEV_MATCH; @@ -85,25 +150,18 @@ mpt_query_disk(U8 VolumeBus, U8 VolumeID ccb.cdm.match_buf_len = bufsize; ccb.cdm.matches = calloc(1, bufsize); - bufsize = sizeof(struct dev_match_pattern) * 2; - ccb.cdm.num_patterns = 2; + bufsize = sizeof(struct dev_match_pattern) * 1; + ccb.cdm.num_patterns = 1; ccb.cdm.pattern_buf_len = bufsize; ccb.cdm.patterns = calloc(1, bufsize); - /* Match mptX bus 0. */ - ccb.cdm.patterns[0].type = DEV_MATCH_BUS; - b = &ccb.cdm.patterns[0].pattern.bus_pattern; - snprintf(b->dev_name, sizeof(b->dev_name), "mpt"); - b->unit_number = mpt_unit; - b->bus_id = 0; - b->flags = BUS_MATCH_NAME | BUS_MATCH_UNIT | BUS_MATCH_BUS_ID; - /* Look for a "da" device at the specified target and lun. */ - ccb.cdm.patterns[1].type = DEV_MATCH_PERIPH; - p = &ccb.cdm.patterns[1].pattern.periph_pattern; + ccb.cdm.patterns[0].type = DEV_MATCH_PERIPH; + p = &ccb.cdm.patterns[0].pattern.periph_pattern; + p->path_id = path_id; snprintf(p->periph_name, sizeof(p->periph_name), "da"); p->target_id = VolumeID; - p->flags = PERIPH_MATCH_NAME | PERIPH_MATCH_TARGET; + p->flags = PERIPH_MATCH_PATH | PERIPH_MATCH_NAME | PERIPH_MATCH_TARGET; if (ioctl(xptfd, CAMIOCOMMAND, &ccb) < 0) { i = errno; @@ -122,25 +180,22 @@ mpt_query_disk(U8 VolumeBus, U8 VolumeID } /* - * We should have exactly 2 matches, 1 for the bus and 1 for - * the peripheral. However, if we only have 1 match and it is - * for the bus, don't print an error message and return - * ENOENT. + * We should have exactly 1 match for the peripheral. + * However, if we don't get a match, don't print an error + * message and return ENOENT. */ - if (ccb.cdm.num_matches == 1 && - ccb.cdm.matches[0].type == DEV_MATCH_BUS) { + if (ccb.cdm.num_matches == 0) { free(ccb.cdm.matches); return (ENOENT); } - if (ccb.cdm.num_matches != 2) { - warnx("mpt_query_disk got %d matches, expected 2", + if (ccb.cdm.num_matches != 1) { + warnx("mpt_query_disk got %d matches, expected 1", ccb.cdm.num_matches); free(ccb.cdm.matches); return (EIO); } - if (ccb.cdm.matches[0].type != DEV_MATCH_BUS || - ccb.cdm.matches[1].type != DEV_MATCH_PERIPH) { - warnx("mpt_query_disk got wrong CAM matches"); + if (ccb.cdm.matches[0].type != DEV_MATCH_PERIPH) { + warnx("mpt_query_disk got wrong CAM match"); free(ccb.cdm.matches); return (EIO); } @@ -336,47 +391,44 @@ mpt_fetch_disks(int fd, int *ndisks, str { CONFIG_PAGE_IOC_2 *ioc2; struct mpt_standalone_disk *disks; - struct bus_match_pattern *b; struct periph_match_pattern *p; struct periph_match_result *r; struct cam_device *dev; union ccb ccb; + path_id_t path_id; size_t bufsize; u_int i; - int count; + int count, error; if (xpt_open() < 0) return (ENXIO); + error = fetch_path_id(&path_id); + if (error) + return (error); + for (count = 100;; count+= 100) { /* Try to fetch 'count' disks in one go. */ bzero(&ccb, sizeof(ccb)); ccb.ccb_h.func_code = XPT_DEV_MATCH; - bufsize = sizeof(struct dev_match_result) * (count + 2); + bufsize = sizeof(struct dev_match_result) * (count + 1); ccb.cdm.num_matches = 0; ccb.cdm.match_buf_len = bufsize; ccb.cdm.matches = calloc(1, bufsize); - bufsize = sizeof(struct dev_match_pattern) * 2; - ccb.cdm.num_patterns = 2; + bufsize = sizeof(struct dev_match_pattern) * 1; + ccb.cdm.num_patterns = 1; ccb.cdm.pattern_buf_len = bufsize; ccb.cdm.patterns = calloc(1, bufsize); - /* Match mptX bus 0. */ - ccb.cdm.patterns[0].type = DEV_MATCH_BUS; - b = &ccb.cdm.patterns[0].pattern.bus_pattern; - snprintf(b->dev_name, sizeof(b->dev_name), "mpt"); - b->unit_number = mpt_unit; - b->bus_id = 0; - b->flags = BUS_MATCH_NAME | BUS_MATCH_UNIT | BUS_MATCH_BUS_ID; - /* Match any "da" peripherals. */ - ccb.cdm.patterns[1].type = DEV_MATCH_PERIPH; - p = &ccb.cdm.patterns[1].pattern.periph_pattern; + ccb.cdm.patterns[0].type = DEV_MATCH_PERIPH; + p = &ccb.cdm.patterns[0].pattern.periph_pattern; + p->path_id = path_id; snprintf(p->periph_name, sizeof(p->periph_name), "da"); - p->flags = PERIPH_MATCH_NAME; + p->flags = PERIPH_MATCH_PATH | PERIPH_MATCH_NAME; if (ioctl(xptfd, CAMIOCOMMAND, &ccb) < 0) { i = errno; @@ -406,21 +458,16 @@ mpt_fetch_disks(int fd, int *ndisks, str break; } - /* - * We should have N + 1 matches, 1 for the bus and 1 for each - * "da" device. - */ - if (ccb.cdm.num_matches < 1) { - warnx("mpt_fetch_disks didn't get any matches"); - free(ccb.cdm.matches); - return (EIO); - } - if (ccb.cdm.matches[0].type != DEV_MATCH_BUS) { - warnx("mpt_fetch_disks got wrong CAM matches"); + /* Shortcut if we don't have any "da" devices. */ + if (ccb.cdm.num_matches == 0) { free(ccb.cdm.matches); - return (EIO); + *ndisks = 0; + *disksp = NULL; + return (0); } - for (i = 1; i < ccb.cdm.num_matches; i++) { + + /* We should have N matches, 1 for each "da" device. */ + for (i = 0; i < ccb.cdm.num_matches; i++) { if (ccb.cdm.matches[i].type != DEV_MATCH_PERIPH) { warnx("mpt_fetch_disks got wrong CAM matches"); free(ccb.cdm.matches); @@ -428,14 +475,6 @@ mpt_fetch_disks(int fd, int *ndisks, str } } - /* Shortcut if we don't have any "da" devices. */ - if (ccb.cdm.num_matches == 1) { - free(ccb.cdm.matches); - *ndisks = 0; - *disksp = NULL; - return (0); - } - /* * Some of the "da" peripherals may be for RAID volumes, so * fetch the IOC 2 page (list of RAID volumes) so we can @@ -444,7 +483,7 @@ mpt_fetch_disks(int fd, int *ndisks, str ioc2 = mpt_read_ioc_page(fd, 2, NULL); disks = calloc(ccb.cdm.num_matches, sizeof(*disks)); count = 0; - for (i = 1; i < ccb.cdm.num_matches; i++) { + for (i = 0; i < ccb.cdm.num_matches; i++) { r = &ccb.cdm.matches[i].result.periph_result; if (periph_is_volume(ioc2, r)) continue; @@ -480,10 +519,9 @@ mpt_fetch_disks(int fd, int *ndisks, str int mpt_rescan_bus(int bus, int id) { - struct bus_match_pattern *b; union ccb ccb; path_id_t path_id; - size_t bufsize; + int error; /* mpt(4) only handles devices on bus 0. */ if (bus != -1 && bus != 0) @@ -492,54 +530,12 @@ mpt_rescan_bus(int bus, int id) if (xpt_open() < 0) return (ENXIO); - /* First, find the path id of bus 0 for this mpt controller. */ - bzero(&ccb, sizeof(ccb)); - - ccb.ccb_h.func_code = XPT_DEV_MATCH; - - bufsize = sizeof(struct dev_match_result) * 1; - ccb.cdm.num_matches = 0; - ccb.cdm.match_buf_len = bufsize; - ccb.cdm.matches = calloc(1, bufsize); - - bufsize = sizeof(struct dev_match_pattern) * 1; - ccb.cdm.num_patterns = 1; - ccb.cdm.pattern_buf_len = bufsize; - ccb.cdm.patterns = calloc(1, bufsize); - - /* Match mptX bus 0. */ - ccb.cdm.patterns[0].type = DEV_MATCH_BUS; - b = &ccb.cdm.patterns[0].pattern.bus_pattern; - snprintf(b->dev_name, sizeof(b->dev_name), "mpt"); - b->unit_number = mpt_unit; - b->bus_id = 0; - b->flags = BUS_MATCH_NAME | BUS_MATCH_UNIT | BUS_MATCH_BUS_ID; - - if (ioctl(xptfd, CAMIOCOMMAND, &ccb) < 0) { - free(ccb.cdm.matches); - free(ccb.cdm.patterns); - return (errno); - } - free(ccb.cdm.patterns); - - if (((ccb.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) || - (ccb.cdm.status != CAM_DEV_MATCH_LAST)) { - warnx("mpt_rescan_bus got CAM error %#x, CDM error %d\n", - ccb.ccb_h.status, ccb.cdm.status); - free(ccb.cdm.matches); - return (EIO); - } - - /* We should have exactly 1 match for the bus. */ - if (ccb.cdm.num_matches != 1 || - ccb.cdm.matches[0].type != DEV_MATCH_BUS) { - free(ccb.cdm.matches); - return (ENOENT); - } - path_id = ccb.cdm.matches[0].result.bus_result.path_id; - free(ccb.cdm.matches); + error = fetch_path_id(&path_id); + if (error) + return (error); - /* Now perform the actual rescan. */ + /* Perform the actual rescan. */ + bzero(&ccb, sizeof(ccb)); ccb.ccb_h.path_id = path_id; if (id == -1) { ccb.ccb_h.func_code = XPT_SCAN_BUS; From owner-svn-src-stable-8@FreeBSD.ORG Wed Feb 24 22:16:17 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 78CA2106566C; Wed, 24 Feb 2010 22:16:17 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 658F58FC17; Wed, 24 Feb 2010 22: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 o1OMGHnI020603; Wed, 24 Feb 2010 22:16:17 GMT (envelope-from brooks@svn.freebsd.org) Received: (from brooks@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1OMGHVj020591; Wed, 24 Feb 2010 22:16:17 GMT (envelope-from brooks@svn.freebsd.org) Message-Id: <201002242216.o1OMGHVj020591@svn.freebsd.org> From: Brooks Davis Date: Wed, 24 Feb 2010 22: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: r204293 - in stable/8/sys: boot/forth compat/linux compat/svr4 i386/ibcs2 kern rpc security/audit sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Feb 2010 22:16:17 -0000 Author: brooks Date: Wed Feb 24 22:16:16 2010 New Revision: 204293 URL: http://svn.freebsd.org/changeset/base/204293 Log: MFC r202143,202163,202341,202342,204278 Replace the static NGROUPS=NGROUPS_MAX+1=1024 with a dynamic kern.ngroups+1. kern.ngroups can range from NGROUPS_MAX=1023 to somewhere in the neighborhood of INT_MAX/4 one a system with sufficent RAM and memory bandwidth. Given that the Windows group limit is 1024, this range should be sufficient for most applications r202342: Only allocate the space we need before calling kern_getgroups instead of allocating what ever the user asks for up to "ngroups_max + 1". On systems with large values of kern.ngroups this will be more efficient. The now redundant check that the array is large enough in kern_getgroups() is deliberate to allow this change to be merged to stable/8 without breaking potential third party consumers of the API. Modified: stable/8/sys/boot/forth/loader.conf stable/8/sys/compat/linux/linux_misc.c stable/8/sys/compat/linux/linux_uid16.c stable/8/sys/compat/svr4/svr4_misc.c stable/8/sys/i386/ibcs2/ibcs2_misc.c stable/8/sys/kern/kern_mib.c stable/8/sys/kern/kern_prot.c stable/8/sys/kern/subr_param.c stable/8/sys/rpc/authunix_prot.c stable/8/sys/security/audit/audit_arg.c stable/8/sys/sys/systm.h Directory Properties: 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/ (props changed) Modified: stable/8/sys/boot/forth/loader.conf ============================================================================== --- stable/8/sys/boot/forth/loader.conf Wed Feb 24 22:04:49 2010 (r204292) +++ stable/8/sys/boot/forth/loader.conf Wed Feb 24 22:16:16 2010 (r204293) @@ -101,6 +101,7 @@ module_path="/boot/modules" # Set the mo #kern.maxusers="32" # Set size of various static tables #kern.nbuf="" # Set the number of buffer headers #kern.ncallout="" # Set the maximum # of timer events +#kern.ngroups="1023" # Set the maximum # of supplemental groups #kern.sgrowsiz="" # Set the amount to grow stack #kern.cam.scsi_delay="2000" # Delay (in ms) before probing SCSI #kern.ipc.maxsockets="" # Set the maximum number of sockets avaliable Modified: stable/8/sys/compat/linux/linux_misc.c ============================================================================== --- stable/8/sys/compat/linux/linux_misc.c Wed Feb 24 22:04:49 2010 (r204292) +++ stable/8/sys/compat/linux/linux_misc.c Wed Feb 24 22:16:16 2010 (r204293) @@ -1138,7 +1138,7 @@ linux_setgroups(struct thread *td, struc struct proc *p; ngrp = args->gidsetsize; - if (ngrp < 0 || ngrp >= NGROUPS) + if (ngrp < 0 || ngrp >= ngroups_max + 1) return (EINVAL); linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_TEMP, M_WAITOK); error = copyin(args->grouplist, linux_gidset, ngrp * sizeof(l_gid_t)); Modified: stable/8/sys/compat/linux/linux_uid16.c ============================================================================== --- stable/8/sys/compat/linux/linux_uid16.c Wed Feb 24 22:04:49 2010 (r204292) +++ stable/8/sys/compat/linux/linux_uid16.c Wed Feb 24 22:16:16 2010 (r204293) @@ -109,7 +109,7 @@ linux_setgroups16(struct thread *td, str #endif ngrp = args->gidsetsize; - if (ngrp < 0 || ngrp >= NGROUPS) + if (ngrp < 0 || ngrp >= ngroups_max + 1) return (EINVAL); linux_gidset = malloc(ngrp * sizeof(*linux_gidset), M_TEMP, M_WAITOK); error = copyin(args->gidset, linux_gidset, ngrp * sizeof(l_gid16_t)); Modified: stable/8/sys/compat/svr4/svr4_misc.c ============================================================================== --- stable/8/sys/compat/svr4/svr4_misc.c Wed Feb 24 22:04:49 2010 (r204292) +++ stable/8/sys/compat/svr4/svr4_misc.c Wed Feb 24 22:16:16 2010 (r204293) @@ -708,7 +708,7 @@ svr4_sys_sysconfig(td, uap) switch (uap->name) { case SVR4_CONFIG_NGROUPS: - *retval = NGROUPS_MAX; + *retval = ngroups_max; break; case SVR4_CONFIG_CHILD_MAX: *retval = maxproc; Modified: stable/8/sys/i386/ibcs2/ibcs2_misc.c ============================================================================== --- stable/8/sys/i386/ibcs2/ibcs2_misc.c Wed Feb 24 22:04:49 2010 (r204292) +++ stable/8/sys/i386/ibcs2/ibcs2_misc.c Wed Feb 24 22:16:16 2010 (r204293) @@ -663,9 +663,13 @@ ibcs2_getgroups(td, uap) u_int i, ngrp; int error; - if (uap->gidsetsize < 0) - return (EINVAL); - ngrp = MIN(uap->gidsetsize, NGROUPS); + if (uap->gidsetsize < td->td_ucred->cr_ngroups) { + if (uap->gidsetsize == 0) + ngrp = 0; + else + return (EINVAL); + } else + ngrp = td->td_ucred->cr_ngroups; gp = malloc(ngrp * sizeof(*gp), M_TEMP, M_WAITOK); error = kern_getgroups(td, &ngrp, gp); if (error) @@ -693,7 +697,7 @@ ibcs2_setgroups(td, uap) gid_t *gp; int error, i; - if (uap->gidsetsize < 0 || uap->gidsetsize > NGROUPS) + if (uap->gidsetsize < 0 || uap->gidsetsize > ngroups_max + 1) return (EINVAL); if (uap->gidsetsize && uap->gidset == NULL) return (EINVAL); Modified: stable/8/sys/kern/kern_mib.c ============================================================================== --- stable/8/sys/kern/kern_mib.c Wed Feb 24 22:04:49 2010 (r204292) +++ stable/8/sys/kern/kern_mib.c Wed Feb 24 22:16:16 2010 (r204293) @@ -124,8 +124,8 @@ SYSCTL_INT(_kern, KERN_ARGMAX, argmax, C SYSCTL_INT(_kern, KERN_POSIX1, posix1version, CTLFLAG_RD, 0, _POSIX_VERSION, "Version of POSIX attempting to comply to"); -SYSCTL_INT(_kern, KERN_NGROUPS, ngroups, CTLFLAG_RD, - 0, NGROUPS_MAX, +SYSCTL_INT(_kern, KERN_NGROUPS, ngroups, CTLFLAG_RDTUN, + &ngroups_max, 0, "Maximum number of supplemental groups a user can belong to"); SYSCTL_INT(_kern, KERN_JOB_CONTROL, job_control, CTLFLAG_RD, Modified: stable/8/sys/kern/kern_prot.c ============================================================================== --- stable/8/sys/kern/kern_prot.c Wed Feb 24 22:04:49 2010 (r204292) +++ stable/8/sys/kern/kern_prot.c Wed Feb 24 22:16:16 2010 (r204293) @@ -283,7 +283,13 @@ getgroups(struct thread *td, register st u_int ngrp; int error; - ngrp = MIN(uap->gidsetsize, NGROUPS); + if (uap->gidsetsize < td->td_ucred->cr_ngroups) { + if (uap->gidsetsize == 0) + ngrp = 0; + else + return (EINVAL); + } else + ngrp = td->td_ucred->cr_ngroups; groups = malloc(ngrp * sizeof(*groups), M_TEMP, M_WAITOK); error = kern_getgroups(td, &ngrp, groups); if (error) @@ -796,7 +802,7 @@ setgroups(struct thread *td, struct setg gid_t *groups = NULL; int error; - if (uap->gidsetsize > NGROUPS) + if (uap->gidsetsize > ngroups_max + 1) return (EINVAL); groups = malloc(uap->gidsetsize * sizeof(gid_t), M_TEMP, M_WAITOK); error = copyin(uap->gidset, groups, uap->gidsetsize * sizeof(gid_t)); @@ -815,7 +821,7 @@ kern_setgroups(struct thread *td, u_int struct ucred *newcred, *oldcred; int error; - if (ngrp > NGROUPS) + if (ngrp > ngroups_max + 1) return (EINVAL); AUDIT_ARG_GROUPSET(groups, ngrp); newcred = crget(); @@ -2022,14 +2028,14 @@ crsetgroups_locked(struct ucred *cr, int /* * Copy groups in to a credential after expanding it if required. - * Truncate the list to NGROUPS if it is too large. + * Truncate the list to (ngroups_max + 1) if it is too large. */ void crsetgroups(struct ucred *cr, int ngrp, gid_t *groups) { - if (ngrp > NGROUPS) - ngrp = NGROUPS; + if (ngrp > ngroups_max + 1) + ngrp = ngroups_max + 1; crextend(cr, ngrp); crsetgroups_locked(cr, ngrp, groups); Modified: stable/8/sys/kern/subr_param.c ============================================================================== --- stable/8/sys/kern/subr_param.c Wed Feb 24 22:04:49 2010 (r204292) +++ stable/8/sys/kern/subr_param.c Wed Feb 24 22:16:16 2010 (r204293) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include "opt_param.h" #include "opt_maxusers.h" +#include #include #include #include @@ -88,6 +89,7 @@ int maxfiles; /* sys. wide open files int maxfilesperproc; /* per-proc open files limit */ int ncallout; /* maximum # of timer events */ int nbuf; +int ngroups_max; /* max # groups per process */ int nswbuf; long maxswzone; /* max swmeta KVA storage */ long maxbcache; /* max buffer cache KVA storage */ @@ -228,6 +230,16 @@ init_param1(void) TUNABLE_ULONG_FETCH("kern.maxssiz", &maxssiz); sgrowsiz = SGROWSIZ; TUNABLE_ULONG_FETCH("kern.sgrowsiz", &sgrowsiz); + + /* + * Let the administrator set {NGROUPS_MAX}, but disallow values + * less than NGROUPS_MAX which would violate POSIX.1-2008 or + * greater than INT_MAX-1 which would result in overflow. + */ + ngroups_max = NGROUPS_MAX; + TUNABLE_INT_FETCH("kern.ngroups", &ngroups_max); + if (ngroups_max < NGROUPS_MAX) + ngroups_max = NGROUPS_MAX; } /* Modified: stable/8/sys/rpc/authunix_prot.c ============================================================================== --- stable/8/sys/rpc/authunix_prot.c Wed Feb 24 22:04:49 2010 (r204292) +++ stable/8/sys/rpc/authunix_prot.c Wed Feb 24 22:16:16 2010 (r204293) @@ -110,7 +110,7 @@ xdr_authunix_parms(XDR *xdrs, uint32_t * if (!xdr_uint32_t(xdrs, &ngroups)) return (FALSE); for (i = 0; i < ngroups; i++) { - if (i + 1 < NGROUPS) { + if (i + 1 < ngroups_max + 1) { if (!xdr_uint32_t(xdrs, &cred->cr_groups[i + 1])) return (FALSE); } else { @@ -120,8 +120,8 @@ xdr_authunix_parms(XDR *xdrs, uint32_t * } if (xdrs->x_op == XDR_DECODE) { - if (ngroups + 1 > NGROUPS) - cred->cr_ngroups = NGROUPS; + if (ngroups + 1 > ngroups_max + 1) + cred->cr_ngroups = ngroups_max + 1; else cred->cr_ngroups = ngroups + 1; } Modified: stable/8/sys/security/audit/audit_arg.c ============================================================================== --- stable/8/sys/security/audit/audit_arg.c Wed Feb 24 22:04:49 2010 (r204292) +++ stable/8/sys/security/audit/audit_arg.c Wed Feb 24 22:16:16 2010 (r204293) @@ -262,8 +262,8 @@ audit_arg_groupset(gid_t *gidset, u_int u_int i; struct kaudit_record *ar; - KASSERT(gidset_size <= NGROUPS, - ("audit_arg_groupset: gidset_size > NGROUPS")); + KASSERT(gidset_size <= ngroups_max + 1, + ("audit_arg_groupset: gidset_size > (kern.ngroups + 1)")); ar = currecord(); if (ar == NULL) Modified: stable/8/sys/sys/systm.h ============================================================================== --- stable/8/sys/sys/systm.h Wed Feb 24 22:04:49 2010 (r204292) +++ stable/8/sys/sys/systm.h Wed Feb 24 22:16:16 2010 (r204293) @@ -64,6 +64,7 @@ extern int boothowto; /* reboot flags, extern int bootverbose; /* nonzero to print verbose messages */ extern int maxusers; /* system tune hint */ +extern int ngroups_max; /* max # of supplemental groups */ #ifdef INVARIANTS /* The option is always available */ #define KASSERT(exp,msg) do { \ From owner-svn-src-stable-8@FreeBSD.ORG Thu Feb 25 00:46:51 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA1491065673; Thu, 25 Feb 2010 00:46:51 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A93FB8FC15; Thu, 25 Feb 2010 00:46: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 o1P0kpsY053825; Thu, 25 Feb 2010 00:46:51 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1P0kpoG053823; Thu, 25 Feb 2010 00:46:51 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201002250046.o1P0kpoG053823@svn.freebsd.org> From: Xin LI Date: Thu, 25 Feb 2010 00:46:51 +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: r204295 - stable/8/sys/cddl/compat/opensolaris/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2010 00:46:51 -0000 Author: delphij Date: Thu Feb 25 00:46:51 2010 New Revision: 204295 URL: http://svn.freebsd.org/changeset/base/204295 Log: MFC r202964: On FreeBSD, time_t is 64-bit for all platforms except i386 and powerpc, where the type is 32-bit. ZFS can handle 64-bit timestamp internally but zfs_setattr() would check if the time value can fit, we change the checking macros to match 64-bit timestamp if the platform supports it. This change has some downsides like, while you can import zfs on 32-bit platforms, the timestamp would overflow if they are out of the range. This fixes the Y2.038K issue on platforms using 64-bit timestamps. Reviewed by: pjd Modified: stable/8/sys/cddl/compat/opensolaris/sys/time.h Directory Properties: 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/ (props changed) Modified: stable/8/sys/cddl/compat/opensolaris/sys/time.h ============================================================================== --- stable/8/sys/cddl/compat/opensolaris/sys/time.h Wed Feb 24 23:00:16 2010 (r204294) +++ stable/8/sys/cddl/compat/opensolaris/sys/time.h Thu Feb 25 00:46:51 2010 (r204295) @@ -40,8 +40,13 @@ typedef longlong_t hrtime_t; #define LBOLT ((gethrtime() * hz) / NANOSEC) +#if defined(__i386__) || defined(__powerpc__) #define TIMESPEC_OVERFLOW(ts) \ ((ts)->tv_sec < INT32_MIN || (ts)->tv_sec > INT32_MAX) +#else +#define TIMESPEC_OVERFLOW(ts) \ + ((ts)->tv_sec < INT64_MIN || (ts)->tv_sec > INT64_MAX) +#endif #ifdef _KERNEL #define lbolt64 (int64_t)(LBOLT) From owner-svn-src-stable-8@FreeBSD.ORG Thu Feb 25 10:40:52 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5A9F6106566B; Thu, 25 Feb 2010 10:40:52 +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 4A3D58FC08; Thu, 25 Feb 2010 10:40:52 +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 o1PAeqUG086302; Thu, 25 Feb 2010 10:40:52 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1PAeqLS086300; Thu, 25 Feb 2010 10:40:52 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201002251040.o1PAeqLS086300@svn.freebsd.org> From: Konstantin Belousov Date: Thu, 25 Feb 2010 10:40:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204304 - stable/8/sys/vm X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2010 10:40:52 -0000 Author: kib Date: Thu Feb 25 10:40:52 2010 New Revision: 204304 URL: http://svn.freebsd.org/changeset/base/204304 Log: MFC r204205: Remove write-only variable. Modified: stable/8/sys/vm/vnode_pager.c Directory Properties: 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/ (props changed) Modified: stable/8/sys/vm/vnode_pager.c ============================================================================== --- stable/8/sys/vm/vnode_pager.c Thu Feb 25 09:51:14 2010 (r204303) +++ stable/8/sys/vm/vnode_pager.c Thu Feb 25 10:40:52 2010 (r204304) @@ -1016,7 +1016,6 @@ vnode_pager_putpages(object, m, count, s { int rtval; struct vnode *vp; - struct mount *mp; int bytes = count * PAGE_SIZE; /* @@ -1039,8 +1038,6 @@ vnode_pager_putpages(object, m, count, s */ vp = object->handle; VM_OBJECT_UNLOCK(object); - if (vp->v_type != VREG) - mp = NULL; rtval = VOP_PUTPAGES(vp, m, bytes, sync, rtvals, 0); KASSERT(rtval != EOPNOTSUPP, ("vnode_pager: stale FS putpages\n")); From owner-svn-src-stable-8@FreeBSD.ORG Thu Feb 25 13:28:05 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E0908106566B; Thu, 25 Feb 2010 13:28:05 +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 B42E78FC13; Thu, 25 Feb 2010 13:28: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 o1PDS5JO023207; Thu, 25 Feb 2010 13:28:05 GMT (envelope-from raj@svn.freebsd.org) Received: (from raj@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1PDS5aj023205; Thu, 25 Feb 2010 13:28:05 GMT (envelope-from raj@svn.freebsd.org) Message-Id: <201002251328.o1PDS5aj023205@svn.freebsd.org> From: Rafal Jaworowski Date: Thu, 25 Feb 2010 13:28: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: r204306 - stable/8/sys/dev/mge X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Feb 2010 13:28:06 -0000 Author: raj Date: Thu Feb 25 13:28:05 2010 New Revision: 204306 URL: http://svn.freebsd.org/changeset/base/204306 Log: MFC r204009 Assorted fixes for mge(4). - Use proper map for the busdma sync on mge descriptor. - Remove unnecesary busdma sync. - Eliminate redundant locking in mge_reinit_rx() (just assert). - Kill unused variable. Submitted by: Grzegorz Bernacki Obtained from: Semihalf Modified: stable/8/sys/dev/mge/if_mge.c Directory Properties: 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/ (props changed) Modified: stable/8/sys/dev/mge/if_mge.c ============================================================================== --- stable/8/sys/dev/mge/if_mge.c Thu Feb 25 11:54:10 2010 (r204305) +++ stable/8/sys/dev/mge/if_mge.c Thu Feb 25 13:28:05 2010 (r204306) @@ -457,10 +457,7 @@ mge_allocate_dma(struct mge_softc *sc) { int error; struct mge_desc_wrapper *dw; - int num, i; - - - num = MGE_TX_DESC_NUM + MGE_RX_DESC_NUM; + int i; /* Allocate a busdma tag and DMA safe memory for TX/RX descriptors. */ error = bus_dma_tag_create(NULL, /* parent */ @@ -543,7 +540,7 @@ mge_reinit_rx(struct mge_softc *sc) struct mge_desc_wrapper *dw; int i; - MGE_RECEIVE_LOCK(sc); + MGE_RECEIVE_LOCK_ASSERT(sc); mge_free_desc(sc, sc->mge_rx_desc, MGE_RX_DESC_NUM, sc->mge_rx_dtag, 1); @@ -564,8 +561,6 @@ mge_reinit_rx(struct mge_softc *sc) /* Enable RX queue */ MGE_WRITE(sc, MGE_RX_QUEUE_CMD, MGE_ENABLE_RXQ(MGE_RX_DEFAULT_QUEUE)); - - MGE_RECEIVE_UNLOCK(sc); } #ifdef DEVICE_POLLING @@ -1369,9 +1364,6 @@ mge_encap(struct mge_softc *sc, struct m dw = &sc->mge_tx_desc[desc_no]; mapp = dw->buffer_dmap; - bus_dmamap_sync(sc->mge_desc_dtag, mapp, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); - /* Create mapping in DMA memory */ error = bus_dmamap_load_mbuf_sg(sc->mge_tx_dtag, mapp, m0, segs, &nsegs, BUS_DMA_NOWAIT); @@ -1395,7 +1387,7 @@ mge_encap(struct mge_softc *sc, struct m mge_offload_setup_descriptor(sc, dw); } - bus_dmamap_sync(sc->mge_desc_dtag, mapp, + bus_dmamap_sync(sc->mge_desc_dtag, dw->desc_dmap, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); sc->tx_desc_curr = (++sc->tx_desc_curr) % MGE_TX_DESC_NUM; From owner-svn-src-stable-8@FreeBSD.ORG Fri Feb 26 00:11:18 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 08D811065690; Fri, 26 Feb 2010 00:11:18 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DA7518FC22; Fri, 26 Feb 2010 00:11: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 o1Q0BHYY095985; Fri, 26 Feb 2010 00:11:17 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1Q0BHGc095982; Fri, 26 Feb 2010 00:11:17 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201002260011.o1Q0BHGc095982@svn.freebsd.org> From: Jung-uk Kim Date: Fri, 26 Feb 2010 00:11: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: r204341 - stable/8/sys/net X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2010 00:11:18 -0000 Author: jkim Date: Fri Feb 26 00:11:17 2010 New Revision: 204341 URL: http://svn.freebsd.org/changeset/base/204341 Log: MFC: r204105 Return partially filled buffer for non-blocking read(2) in non-immediate mode. PR: kern/143855 Submitted by: Guy Harris (guy at alum dot mit dot edu) Modified: stable/8/sys/net/bpf.c Directory Properties: 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/ (props changed) Modified: stable/8/sys/net/bpf.c ============================================================================== --- stable/8/sys/net/bpf.c Thu Feb 25 22:44:23 2010 (r204340) +++ stable/8/sys/net/bpf.c Fri Feb 26 00:11:17 2010 (r204341) @@ -661,8 +661,9 @@ static int bpfread(struct cdev *dev, struct uio *uio, int ioflag) { struct bpf_d *d; - int timed_out; int error; + int non_block; + int timed_out; error = devfs_get_cdevpriv((void **)&d); if (error != 0) @@ -675,6 +676,8 @@ bpfread(struct cdev *dev, struct uio *ui if (uio->uio_resid != d->bd_bufsize) return (EINVAL); + non_block = ((ioflag & O_NONBLOCK) != 0); + BPFD_LOCK(d); d->bd_pid = curthread->td_proc->p_pid; if (d->bd_bufmode != BPF_BUFMODE_BUFFER) { @@ -691,14 +694,20 @@ bpfread(struct cdev *dev, struct uio *ui * have arrived to fill the store buffer. */ while (d->bd_hbuf == NULL) { - if ((d->bd_immediate || timed_out) && d->bd_slen != 0) { + if (d->bd_slen != 0) { /* * A packet(s) either arrived since the previous * read or arrived while we were asleep. - * Rotate the buffers and return what's here. */ - ROTATE_BUFFERS(d); - break; + if (d->bd_immediate || non_block || timed_out) { + /* + * Rotate the buffers and return what's here + * if we are in immediate mode, non-blocking + * flag is set, or this descriptor timed out. + */ + ROTATE_BUFFERS(d); + break; + } } /* @@ -712,7 +721,7 @@ bpfread(struct cdev *dev, struct uio *ui return (ENXIO); } - if (ioflag & O_NONBLOCK) { + if (non_block) { BPFD_UNLOCK(d); return (EWOULDBLOCK); } From owner-svn-src-stable-8@FreeBSD.ORG Fri Feb 26 00:54:48 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A48251065670; Fri, 26 Feb 2010 00:54:48 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 4B4E68FC16; Fri, 26 Feb 2010 00:54:48 +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 o1Q0smVJ038240; Fri, 26 Feb 2010 00:54:48 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1Q0smhm038224; Fri, 26 Feb 2010 00:54:48 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201002260054.o1Q0smhm038224@svn.freebsd.org> From: Xin LI Date: Fri, 26 Feb 2010 00:54:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r204344 - in stable/8: contrib/libpcap sbin/ifconfig share/man/man4 sys/kern sys/net sys/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2010 00:54:48 -0000 Author: delphij Date: Fri Feb 26 00:54:47 2010 New Revision: 204344 URL: http://svn.freebsd.org/changeset/base/204344 Log: MFC 203052: Add interface description capability as inspired by OpenBSD. Thanks for rwatson@, jhb@, brooks@ and others for feedback to the old implementation! Sponsored by: iXsystems, Inc. Modified: stable/8/contrib/libpcap/inet.c stable/8/sbin/ifconfig/ifconfig.8 stable/8/sbin/ifconfig/ifconfig.c stable/8/share/man/man4/netintro.4 stable/8/sys/kern/kern_jail.c stable/8/sys/net/if.c stable/8/sys/net/if.h stable/8/sys/net/if_var.h stable/8/sys/sys/param.h stable/8/sys/sys/priv.h stable/8/sys/sys/sockio.h Directory Properties: stable/8/contrib/libpcap/ (props changed) stable/8/sbin/ifconfig/ (props changed) stable/8/share/man/man4/ (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) stable/8/sys/netinet/ (props changed) Modified: stable/8/contrib/libpcap/inet.c ============================================================================== --- stable/8/contrib/libpcap/inet.c Fri Feb 26 00:37:49 2010 (r204343) +++ stable/8/contrib/libpcap/inet.c Fri Feb 26 00:54:47 2010 (r204344) @@ -401,10 +401,15 @@ add_addr_to_iflist(pcap_if_t **alldevs, pcap_if_t *curdev; char *description = NULL; pcap_addr_t *curaddr, *prevaddr, *nextaddr; + int s; #ifdef SIOCGIFDESCR struct ifreq ifrdesc; +#ifndef IFDESCRSIZE +#define _IFDESCRSIZE 64 + char ifdescr[_IFDESCRSIZE]; +#else char ifdescr[IFDESCRSIZE]; - int s; +#endif #endif #ifdef SIOCGIFDESCR @@ -413,12 +418,17 @@ add_addr_to_iflist(pcap_if_t **alldevs, */ memset(&ifrdesc, 0, sizeof ifrdesc); strlcpy(ifrdesc.ifr_name, name, sizeof ifrdesc.ifr_name); +#ifdef __FreeBSD__ + ifrdesc.ifr_buffer.buffer = ifdescr; + ifrdesc.ifr_buffer.length = sizeof(ifdescr); +#else ifrdesc.ifr_data = (caddr_t)&ifdescr; +#endif s = socket(AF_INET, SOCK_DGRAM, 0); if (s >= 0) { if (ioctl(s, SIOCGIFDESCR, &ifrdesc) == 0 && - strlen(ifrdesc.ifr_data) != 0) - description = ifrdesc.ifr_data; + strlen(ifdescr) != 0) + description = ifdescr; close(s); } #endif Modified: stable/8/sbin/ifconfig/ifconfig.8 ============================================================================== --- stable/8/sbin/ifconfig/ifconfig.8 Fri Feb 26 00:37:49 2010 (r204343) +++ stable/8/sbin/ifconfig/ifconfig.8 Fri Feb 26 00:54:47 2010 (r204344) @@ -28,7 +28,7 @@ .\" From: @(#)ifconfig.8 8.3 (Berkeley) 1/5/94 .\" $FreeBSD$ .\" -.Dd December 7, 2009 +.Dd January 26, 2010 .Dt IFCONFIG 8 .Os .Sh NAME @@ -258,6 +258,12 @@ Disable permanently promiscuous mode. Another name for the .Fl alias parameter. +.It Cm description Ar value , Cm descr Ar value +Specify a description of the interface. +This can be used to label interfaces in situations where they may +otherwise be difficult to distinguish. +.It Cm -description , Cm -descr +Clear the interface description. .It Cm down Mark an interface .Dq down . @@ -2493,6 +2499,10 @@ Configure the interface to use 100baseTX, full duplex Ethernet media options: .Dl # ifconfig xl0 media 100baseTX mediaopt full-duplex .Pp +Label the em0 interface as an uplink: +.Pp +.Dl # ifconfig em0 description \&"Uplink to Gigabit Switch 2\&" +.Pp Create the software network interface .Li gif1 : .Dl # ifconfig gif1 create Modified: stable/8/sbin/ifconfig/ifconfig.c ============================================================================== --- stable/8/sbin/ifconfig/ifconfig.c Fri Feb 26 00:37:49 2010 (r204343) +++ stable/8/sbin/ifconfig/ifconfig.c Fri Feb 26 00:54:47 2010 (r204344) @@ -44,7 +44,6 @@ static const char rcsid[] = #include #include #include -#include #include #include #include @@ -83,6 +82,8 @@ static const char rcsid[] = struct ifreq ifr; char name[IFNAMSIZ]; +char *descr = NULL; +size_t descrlen = 64; int setaddr; int setmask; int doalias; @@ -822,6 +823,40 @@ setifname(const char *val, int dummy __u free(newname); } +/* ARGSUSED */ +static void +setifdescr(const char *val, int dummy __unused, int s, + const struct afswtch *afp) +{ + char *newdescr; + + ifr.ifr_buffer.length = strlen(val) + 1; + if (ifr.ifr_buffer.length == 1) { + ifr.ifr_buffer.buffer = newdescr = NULL; + ifr.ifr_buffer.length = 0; + } else { + newdescr = strdup(val); + ifr.ifr_buffer.buffer = newdescr; + if (newdescr == NULL) { + warn("no memory to set ifdescr"); + return; + } + } + + if (ioctl(s, SIOCSIFDESCR, (caddr_t)&ifr) < 0) + warn("ioctl (set descr)"); + + free(newdescr); +} + +/* ARGSUSED */ +static void +unsetifdescr(const char *val, int value, int s, const struct afswtch *afp) +{ + + setifdescr("", 0, s, 0); +} + #define IFFBITS \ "\020\1UP\2BROADCAST\3DEBUG\4LOOPBACK\5POINTOPOINT\6SMART\7RUNNING" \ "\10NOARP\11PROMISC\12ALLMULTI\13OACTIVE\14SIMPLEX\15LINK0\16LINK1\17LINK2" \ @@ -866,6 +901,25 @@ status(const struct afswtch *afp, const printf(" mtu %d", ifr.ifr_mtu); putchar('\n'); + for (;;) { + if ((descr = reallocf(descr, descrlen)) != NULL) { + ifr.ifr_buffer.buffer = descr; + ifr.ifr_buffer.length = descrlen; + if (ioctl(s, SIOCGIFDESCR, &ifr) == 0) { + if (strlen(descr) > 0) + printf("\tdescription: %s\n", descr); + break; + } else if (errno == ENAMETOOLONG) + descrlen = ifr.ifr_buffer.length; + else + break; + } else { + warn("unable to allocate memory for interface" + "description"); + break; + } + }; + if (ioctl(s, SIOCGIFCAP, (caddr_t)&ifr) == 0) { if (ifr.ifr_curcap != 0) { printb("\toptions", ifr.ifr_curcap, IFCAPBITS); @@ -1035,6 +1089,10 @@ static struct cmd basic_cmds[] = { DEF_CMD("-arp", IFF_NOARP, setifflags), DEF_CMD("debug", IFF_DEBUG, setifflags), DEF_CMD("-debug", -IFF_DEBUG, setifflags), + DEF_CMD_ARG("description", setifdescr), + DEF_CMD_ARG("descr", setifdescr), + DEF_CMD("-description", 0, unsetifdescr), + DEF_CMD("-descr", 0, unsetifdescr), DEF_CMD("promisc", IFF_PPROMISC, setifflags), DEF_CMD("-promisc", -IFF_PPROMISC, setifflags), DEF_CMD("add", IFF_UP, notealias), Modified: stable/8/share/man/man4/netintro.4 ============================================================================== --- stable/8/share/man/man4/netintro.4 Fri Feb 26 00:37:49 2010 (r204343) +++ stable/8/share/man/man4/netintro.4 Fri Feb 26 00:54:47 2010 (r204344) @@ -32,7 +32,7 @@ .\" @(#)netintro.4 8.2 (Berkeley) 11/30/93 .\" $FreeBSD$ .\" -.Dd June 18, 2004 +.Dd January 26, 2010 .Dt NETINTRO 4 .Os .Sh NAME @@ -204,6 +204,7 @@ struct ifreq { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; + struct ifreq_buffer ifru_buffer; short ifru_flags[2]; short ifru_index; int ifru_metric; @@ -216,6 +217,7 @@ struct ifreq { #define ifr_addr ifr_ifru.ifru_addr /* address */ #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_buffer ifr_ifru.ifru_buffer /* user supplied buffer with its length */ #define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */ #define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */ #define ifr_metric ifr_ifru.ifru_metric /* metric */ @@ -277,6 +279,33 @@ and fields of the .Vt ifreq structure, respectively. +.It Dv SIOCGIFDESCR +Get the interface description, returned in the +.Va buffer +field of +.Va ifru_buffer +struct. +The user supplied buffer length should be defined in the +.Va length +field of +.Va ifru_buffer +struct passed in as parameter, and the length would include +the terminating nul character. +If there is not enough space to hold the interface length, +no copy would be done and an +error would be returned. +The kernel will store the buffer length in the +.Va length +field upon return, regardless whether the buffer itself is +sufficient to hold the data. +.It Dv SIOCSIFDESCR +Set the interface description to the value of the +.Va buffer +field of +.Va ifru_buffer +struct, with +.Va length +field specifying its length (counting the terminating nul). .It Dv SIOCSIFFLAGS Set interface flags field. If the interface is marked down, @@ -404,6 +433,13 @@ struct if_clonereq { char *ifcr_buffer; /* buffer for cloner names */ }; .Ed +.Bd -literal +/* Structure used in SIOCGIFDESCR and SIOCSIFDESCR requests */ +struct ifreq_buffer { + size_t length; /* length of the buffer */ + void *buffer; /* pointer to userland space buffer */ +}; +.Ed .Sh SEE ALSO .Xr ioctl 2 , .Xr socket 2 , Modified: stable/8/sys/kern/kern_jail.c ============================================================================== --- stable/8/sys/kern/kern_jail.c Fri Feb 26 00:37:49 2010 (r204343) +++ stable/8/sys/kern/kern_jail.c Fri Feb 26 00:54:47 2010 (r204344) @@ -3592,6 +3592,7 @@ prison_priv_check(struct ucred *cred, in case PRIV_NET_SETIFMTU: case PRIV_NET_SETIFFLAGS: case PRIV_NET_SETIFCAP: + case PRIV_NET_SETIFDESCR: case PRIV_NET_SETIFNAME : case PRIV_NET_SETIFMETRIC: case PRIV_NET_SETIFPHYS: Modified: stable/8/sys/net/if.c ============================================================================== --- stable/8/sys/net/if.c Fri Feb 26 00:37:49 2010 (r204343) +++ stable/8/sys/net/if.c Fri Feb 26 00:54:47 2010 (r204344) @@ -108,6 +108,18 @@ SYSCTL_INT(_net_link, OID_AUTO, log_link &log_link_state_change, 0, "log interface link state change events"); +/* Interface description */ +static unsigned int ifdescr_maxlen = 1024; +SYSCTL_UINT(_net, OID_AUTO, ifdescr_maxlen, CTLFLAG_RW, + &ifdescr_maxlen, 0, + "administrative maximum length for interface description"); + +MALLOC_DEFINE(M_IFDESCR, "ifdescr", "ifnet descriptions"); + +/* global sx for non-critical path ifdescr */ +static struct sx ifdescr_sx; +SX_SYSINIT(ifdescr_sx, &ifdescr_sx, "ifnet descr"); + void (*bstp_linkstate_p)(struct ifnet *ifp, int state); void (*ng_ether_link_state_p)(struct ifnet *ifp, int state); void (*lagg_linkstate_p)(struct ifnet *ifp, int state); @@ -463,6 +475,8 @@ if_free_internal(struct ifnet *ifp) #ifdef MAC mac_ifnet_destroy(ifp); #endif /* MAC */ + if (ifp->if_description != NULL) + free(ifp->if_description, M_IFDESCR); IF_AFDATA_DESTROY(ifp); IF_ADDR_LOCK_DESTROY(ifp); ifq_delete(&ifp->if_snd); @@ -2045,6 +2059,8 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, int error = 0; int new_flags, temp_flags; size_t namelen, onamelen; + size_t descrlen; + char *descrbuf, *odescrbuf; char new_name[IFNAMSIZ]; struct ifaddr *ifa; struct sockaddr_dl *sdl; @@ -2084,6 +2100,60 @@ ifhwioctl(u_long cmd, struct ifnet *ifp, ifr->ifr_phys = ifp->if_physical; break; + case SIOCGIFDESCR: + error = 0; + sx_slock(&ifdescr_sx); + if (ifp->if_description == NULL) { + ifr->ifr_buffer.length = 0; + error = ENOMSG; + } else { + /* space for terminating nul */ + descrlen = strlen(ifp->if_description) + 1; + if (ifr->ifr_buffer.length < descrlen) + error = ENAMETOOLONG; + else + error = copyout(ifp->if_description, + ifr->ifr_buffer.buffer, descrlen); + ifr->ifr_buffer.length = descrlen; + } + sx_sunlock(&ifdescr_sx); + break; + + case SIOCSIFDESCR: + error = priv_check(td, PRIV_NET_SETIFDESCR); + if (error) + return (error); + + /* + * Copy only (length-1) bytes to make sure that + * if_description is always nul terminated. The + * length parameter is supposed to count the + * terminating nul in. + */ + if (ifr->ifr_buffer.length > ifdescr_maxlen) + return (ENAMETOOLONG); + else if (ifr->ifr_buffer.length == 0) + descrbuf = NULL; + else { + descrbuf = malloc(ifr->ifr_buffer.length, M_IFDESCR, + M_WAITOK | M_ZERO); + error = copyin(ifr->ifr_buffer.buffer, descrbuf, + ifr->ifr_buffer.length - 1); + if (error) { + free(descrbuf, M_IFDESCR); + break; + } + } + + sx_xlock(&ifdescr_sx); + odescrbuf = ifp->if_description; + ifp->if_description = descrbuf; + sx_xunlock(&ifdescr_sx); + + getmicrotime(&ifp->if_lastchange); + free(odescrbuf, M_IFDESCR); + break; + case SIOCSIFFLAGS: error = priv_check(td, PRIV_NET_SETIFFLAGS); if (error) Modified: stable/8/sys/net/if.h ============================================================================== --- stable/8/sys/net/if.h Fri Feb 26 00:37:49 2010 (r204343) +++ stable/8/sys/net/if.h Fri Feb 26 00:54:47 2010 (r204344) @@ -284,6 +284,14 @@ struct if_announcemsghdr { #define IFAN_DEPARTURE 1 /* interface departure */ /* + * Buffer with length to be used in SIOCGIFDESCR/SIOCSIFDESCR requests + */ +struct ifreq_buffer { + size_t length; + void *buffer; +}; + +/* * Interface request structure used for socket * ioctl's. All interface ioctl's must have parameter * definitions which begin with ifr_name. The @@ -295,6 +303,7 @@ struct ifreq { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; + struct ifreq_buffer ifru_buffer; short ifru_flags[2]; short ifru_index; int ifru_jid; @@ -308,6 +317,7 @@ struct ifreq { #define ifr_addr ifr_ifru.ifru_addr /* address */ #define ifr_dstaddr ifr_ifru.ifru_dstaddr /* other end of p-to-p link */ #define ifr_broadaddr ifr_ifru.ifru_broadaddr /* broadcast address */ +#define ifr_buffer ifr_ifru.ifru_buffer /* user supplied buffer with its length */ #define ifr_flags ifr_ifru.ifru_flags[0] /* flags (low 16 bits) */ #define ifr_flagshigh ifr_ifru.ifru_flags[1] /* flags (high 16 bits) */ #define ifr_jid ifr_ifru.ifru_jid /* jail/vnet */ Modified: stable/8/sys/net/if_var.h ============================================================================== --- stable/8/sys/net/if_var.h Fri Feb 26 00:37:49 2010 (r204343) +++ stable/8/sys/net/if_var.h Fri Feb 26 00:54:47 2010 (r204344) @@ -205,7 +205,8 @@ struct ifnet { * be used with care where binary compatibility is required. */ char if_cspare[3]; - void *if_pspare[8]; + char *if_description; /* interface description */ + void *if_pspare[7]; int if_ispare[4]; }; Modified: stable/8/sys/sys/param.h ============================================================================== --- stable/8/sys/sys/param.h Fri Feb 26 00:37:49 2010 (r204343) +++ stable/8/sys/sys/param.h Fri Feb 26 00:54:47 2010 (r204344) @@ -58,7 +58,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 800502 /* Master, propagated to newvers */ +#define __FreeBSD_version 800503 /* Master, propagated to newvers */ #ifndef LOCORE #include Modified: stable/8/sys/sys/priv.h ============================================================================== --- stable/8/sys/sys/priv.h Fri Feb 26 00:37:49 2010 (r204343) +++ stable/8/sys/sys/priv.h Fri Feb 26 00:54:47 2010 (r204344) @@ -335,6 +335,7 @@ #define PRIV_NET_LAGG 415 /* Administer lagg interface. */ #define PRIV_NET_GIF 416 /* Administer gif interface. */ #define PRIV_NET_SETIFVNET 417 /* Move interface to vnet. */ +#define PRIV_NET_SETIFDESCR 418 /* Set interface description. */ /* * 802.11-related privileges. Modified: stable/8/sys/sys/sockio.h ============================================================================== --- stable/8/sys/sys/sockio.h Fri Feb 26 00:37:49 2010 (r204343) +++ stable/8/sys/sys/sockio.h Fri Feb 26 00:54:47 2010 (r204344) @@ -82,6 +82,8 @@ #define SIOCGIFMAC _IOWR('i', 38, struct ifreq) /* get IF MAC label */ #define SIOCSIFMAC _IOW('i', 39, struct ifreq) /* set IF MAC label */ #define SIOCSIFNAME _IOW('i', 40, struct ifreq) /* set IF name */ +#define SIOCSIFDESCR _IOW('i', 41, struct ifreq) /* set ifnet descr */ +#define SIOCGIFDESCR _IOWR('i', 42, struct ifreq) /* get ifnet descr */ #define SIOCADDMULTI _IOW('i', 49, struct ifreq) /* add m'cast addr */ #define SIOCDELMULTI _IOW('i', 50, struct ifreq) /* del m'cast addr */ From owner-svn-src-stable-8@FreeBSD.ORG Fri Feb 26 18:46:17 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2ADF3106566C; Fri, 26 Feb 2010 18:46:17 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 193CB8FC1C; Fri, 26 Feb 2010 18:46: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 o1QIkGgc022402; Fri, 26 Feb 2010 18:46:16 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1QIkGDl022399; Fri, 26 Feb 2010 18:46:16 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201002261846.o1QIkGDl022399@svn.freebsd.org> From: Rui Paulo Date: Fri, 26 Feb 2010 18:46:16 +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: r204364 - stable/8/sys/dev/ath X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2010 18:46:17 -0000 Author: rpaulo Date: Fri Feb 26 18:46:16 2010 New Revision: 204364 URL: http://svn.freebsd.org/changeset/base/204364 Log: MFC r203683: Add multicast key search support. This fixes corrupted mcast packets when we have more than one hostap vap. Modified: stable/8/sys/dev/ath/if_ath.c stable/8/sys/dev/ath/if_athvar.h Directory Properties: 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/ (props changed) Modified: stable/8/sys/dev/ath/if_ath.c ============================================================================== --- stable/8/sys/dev/ath/if_ath.c Fri Feb 26 18:18:02 2010 (r204363) +++ stable/8/sys/dev/ath/if_ath.c Fri Feb 26 18:46:16 2010 (r204364) @@ -621,6 +621,13 @@ ath_attach(u_int16_t devid, struct ath_s sc->sc_wmetkipmic = 1; } sc->sc_hasclrkey = ath_hal_ciphersupported(ah, HAL_CIPHER_CLR); + /* + * Check for multicast key sarch support. + */ + if (ath_hal_hasmcastkeysearch(sc->sc_ah) && + !ath_hal_getmcastkeysearch(sc->sc_ah)) { + ath_hal_setmcastkeysearch(sc->sc_ah, 1); + } sc->sc_mcastkey = ath_hal_getmcastkeysearch(ah); /* * Mark key cache slots associated with global keys @@ -2039,7 +2046,7 @@ ath_keyset(struct ath_softc *sc, const s if ((k->wk_flags & IEEE80211_KEY_GROUP) && sc->sc_mcastkey) { /* * Group keys on hardware that supports multicast frame - * key search use a mac that is the sender's address with + * key search use a MAC that is the sender's address with * the high bit set instead of the app-specified address. */ IEEE80211_ADDR_COPY(gmac, bss->ni_macaddr); @@ -2219,8 +2226,10 @@ ath_key_alloc(struct ieee80211vap *vap, * it permits us to support multiple users for adhoc and/or * multi-station operation. */ - if (k->wk_keyix != IEEE80211_KEYIX_NONE || /* global key */ - ((k->wk_flags & IEEE80211_KEY_GROUP) && !sc->sc_mcastkey)) { + if (k->wk_keyix != IEEE80211_KEYIX_NONE) { + /* + * Only global keys should have key index assigned. + */ if (!(&vap->iv_nw_keys[0] <= k && k < &vap->iv_nw_keys[IEEE80211_WEP_NKID])) { /* should not happen */ @@ -2228,12 +2237,22 @@ ath_key_alloc(struct ieee80211vap *vap, "%s: bogus group key\n", __func__); return 0; } + */ + if (vap->iv_opmode != IEEE80211_M_HOSTAP || + !(k->wk_flags & IEEE80211_KEY_GROUP) || + !sc->sc_mcastkey) { + /* + * XXX we pre-allocate the global keys so + * have no way to check if they've already + * been allocated. + */ + *keyix = *rxkeyix = k - vap->iv_nw_keys; + return 1; + } /* - * XXX we pre-allocate the global keys so - * have no way to check if they've already been allocated. + * Group key and device supports multicast key search. */ - *keyix = *rxkeyix = k - vap->iv_nw_keys; - return 1; + k->wk_keyix = IEEE80211_KEYIX_NONE; } /* @@ -6945,6 +6964,8 @@ ath_announce(struct ath_softc *sc) if_printf(ifp, "using %u rx buffers\n", ath_rxbuf); if (ath_txbuf != ATH_TXBUF) if_printf(ifp, "using %u tx buffers\n", ath_txbuf); + if (sc->sc_mcastkey && bootverbose) + if_printf(ifp, "using multicast key search\n"); } #ifdef IEEE80211_SUPPORT_TDMA Modified: stable/8/sys/dev/ath/if_athvar.h ============================================================================== --- stable/8/sys/dev/ath/if_athvar.h Fri Feb 26 18:18:02 2010 (r204363) +++ stable/8/sys/dev/ath/if_athvar.h Fri Feb 26 18:46:16 2010 (r204364) @@ -580,14 +580,12 @@ void ath_intr(void *); ath_hal_setcapability(_ah, HAL_CAP_TPC, 1, _v, NULL) #define ath_hal_hasbursting(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_BURST, 0, NULL) == HAL_OK) -#ifdef notyet +#define ath_hal_setmcastkeysearch(_ah, _v) \ + ath_hal_setcapability(_ah, HAL_CAP_MCAST_KEYSRCH, 0, _v, NULL) #define ath_hal_hasmcastkeysearch(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_MCAST_KEYSRCH, 0, NULL) == HAL_OK) #define ath_hal_getmcastkeysearch(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_MCAST_KEYSRCH, 1, NULL) == HAL_OK) -#else -#define ath_hal_getmcastkeysearch(_ah) 0 -#endif #define ath_hal_hasfastframes(_ah) \ (ath_hal_getcapability(_ah, HAL_CAP_FASTFRAME, 0, NULL) == HAL_OK) #define ath_hal_hasbssidmask(_ah) \ From owner-svn-src-stable-8@FreeBSD.ORG Fri Feb 26 20:25:31 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 42E22106566B; Fri, 26 Feb 2010 20:25:31 +0000 (UTC) (envelope-from rpaulo@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 317EB8FC1A; Fri, 26 Feb 2010 20:25: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 o1QKPVjk044434; Fri, 26 Feb 2010 20:25:31 GMT (envelope-from rpaulo@svn.freebsd.org) Received: (from rpaulo@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1QKPVWw044432; Fri, 26 Feb 2010 20:25:31 GMT (envelope-from rpaulo@svn.freebsd.org) Message-Id: <201002262025.o1QKPVWw044432@svn.freebsd.org> From: Rui Paulo Date: Fri, 26 Feb 2010 20:25:30 +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: r204369 - stable/8/sys/dev/ath X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2010 20:25:31 -0000 Author: rpaulo Date: Fri Feb 26 20:25:30 2010 New Revision: 204369 URL: http://svn.freebsd.org/changeset/base/204369 Log: MFC r203695, r203751 Fix spelling mistake and compile error. Modified: stable/8/sys/dev/ath/if_ath.c Directory Properties: 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/ (props changed) Modified: stable/8/sys/dev/ath/if_ath.c ============================================================================== --- stable/8/sys/dev/ath/if_ath.c Fri Feb 26 20:17:17 2010 (r204368) +++ stable/8/sys/dev/ath/if_ath.c Fri Feb 26 20:25:30 2010 (r204369) @@ -622,7 +622,7 @@ ath_attach(u_int16_t devid, struct ath_s } sc->sc_hasclrkey = ath_hal_ciphersupported(ah, HAL_CIPHER_CLR); /* - * Check for multicast key sarch support. + * Check for multicast key search support. */ if (ath_hal_hasmcastkeysearch(sc->sc_ah) && !ath_hal_getmcastkeysearch(sc->sc_ah)) { @@ -2237,7 +2237,6 @@ ath_key_alloc(struct ieee80211vap *vap, "%s: bogus group key\n", __func__); return 0; } - */ if (vap->iv_opmode != IEEE80211_M_HOSTAP || !(k->wk_flags & IEEE80211_KEY_GROUP) || !sc->sc_mcastkey) { From owner-svn-src-stable-8@FreeBSD.ORG Fri Feb 26 21:49:12 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4F5091065670; Fri, 26 Feb 2010 21:49:12 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 3B1358FC08; Fri, 26 Feb 2010 21:49: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 o1QLnCWZ063155; Fri, 26 Feb 2010 21:49:12 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1QLnCFJ063145; Fri, 26 Feb 2010 21:49:12 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201002262149.o1QLnCFJ063145@svn.freebsd.org> From: Kirk McKusick Date: Fri, 26 Feb 2010 21:49: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: r204375 - in stable/8: lib/libufs sbin/growfs sbin/newfs sbin/tunefs sys/ufs/ffs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Feb 2010 21:49:12 -0000 Author: mckusick Date: Fri Feb 26 21:49:11 2010 New Revision: 204375 URL: http://svn.freebsd.org/changeset/base/204375 Log: MFC of 203763, 203764, 203768, 203769, 203770, 203782, and 203784. These fixes correct a problem in the file system that treats large inode numbers as negative rather than unsigned. For a default (16K block) file system, this bug began to show up at a file system size above about 16Tb. These fixes also update newfs to ensure that it will never create a filesystem with more than 2^32 inodes. They also update libufs, tunefs, and growfs so that they properly handle inode numbers as unsigned. Reported by: Scott Burns, John Kilburg, and Bruce Evans Followup by: Jeff Roberson PR: 133980 Modified: stable/8/lib/libufs/cgroup.c stable/8/lib/libufs/sblock.c stable/8/sbin/growfs/growfs.c stable/8/sbin/newfs/mkfs.c stable/8/sbin/newfs/newfs.c stable/8/sbin/newfs/newfs.h stable/8/sbin/tunefs/tunefs.c stable/8/sys/ufs/ffs/ffs_alloc.c stable/8/sys/ufs/ffs/fs.h Directory Properties: stable/8/lib/libufs/ (props changed) stable/8/sbin/growfs/ (props changed) stable/8/sbin/newfs/ (props changed) stable/8/sbin/tunefs/ (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) stable/8/sys/netinet/ (props changed) Modified: stable/8/lib/libufs/cgroup.c ============================================================================== --- stable/8/lib/libufs/cgroup.c Fri Feb 26 21:26:07 2010 (r204374) +++ stable/8/lib/libufs/cgroup.c Fri Feb 26 21:49:11 2010 (r204375) @@ -59,7 +59,7 @@ cgread1(struct uufsd *disk, int c) fs = &disk->d_fs; - if (c >= fs->fs_ncg) { + if ((unsigned)c >= fs->fs_ncg) { return (0); } ccg = fsbtodb(fs, cgtod(fs, c)) * disk->d_bsize; Modified: stable/8/lib/libufs/sblock.c ============================================================================== --- stable/8/lib/libufs/sblock.c Fri Feb 26 21:26:07 2010 (r204374) +++ stable/8/lib/libufs/sblock.c Fri Feb 26 21:49:11 2010 (r204375) @@ -93,7 +93,7 @@ int sbwrite(struct uufsd *disk, int all) { struct fs *fs; - int i; + unsigned i; ERROR(disk, NULL); Modified: stable/8/sbin/growfs/growfs.c ============================================================================== --- stable/8/sbin/growfs/growfs.c Fri Feb 26 21:26:07 2010 (r204374) +++ stable/8/sbin/growfs/growfs.c Fri Feb 26 21:49:11 2010 (r204375) @@ -174,10 +174,9 @@ static void growfs(int fsi, int fso, unsigned int Nflag) { DBG_FUNC("growfs") - int i; - int cylno, j; time_t utime; - int width; + uint cylno; + int i, j, width; char tmpbuf[100]; #ifdef FSIRAND static int randinit=0; @@ -373,10 +372,11 @@ initcg(int cylno, time_t utime, int fso, { DBG_FUNC("initcg") static void *iobuf; - long d, dlower, dupper, blkno, start; + long blkno, start; ufs2_daddr_t i, cbase, dmax; struct ufs1_dinode *dp1; struct csum *cs; + uint d, dupper, dlower; if (iobuf == NULL && (iobuf = malloc(sblock.fs_bsize)) == NULL) { errx(37, "panic: cannot allocate I/O buffer"); @@ -431,7 +431,7 @@ initcg(int cylno, time_t utime, int fso, acg.cg_nextfreeoff = acg.cg_clusteroff + howmany(fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT); } - if (acg.cg_nextfreeoff > sblock.fs_cgsize) { + if (acg.cg_nextfreeoff > (unsigned)sblock.fs_cgsize) { /* * This should never happen as we would have had that panic * already on file system creation @@ -746,7 +746,7 @@ updjcg(int cylno, time_t utime, int fsi, * needed, update the free space in the superblock. */ acg.cg_time = utime; - if (cylno == sblock.fs_ncg - 1) { + if ((unsigned)cylno == sblock.fs_ncg - 1) { /* * This is still the last cylinder group. */ @@ -940,8 +940,8 @@ updcsloc(time_t utime, int fsi, int fso, int ocscg, ncscg; int blocks; ufs2_daddr_t cbase, dupper, odupper, d, f, g; - int ind; - int cylno, inc; + int ind, inc; + uint cylno; struct gfs_bpp *bp; int i, l; int lcs=0; Modified: stable/8/sbin/newfs/mkfs.c ============================================================================== --- stable/8/sbin/newfs/mkfs.c Fri Feb 26 21:26:07 2010 (r204374) +++ stable/8/sbin/newfs/mkfs.c Fri Feb 26 21:49:11 2010 (r204375) @@ -114,10 +114,13 @@ void mkfs(struct partition *pp, char *fsys) { int fragsperinode, optimalfpg, origdensity, minfpg, lastminfpg; - long i, j, cylno, csfrags; + long i, j, csfrags; + uint cg; time_t utime; quad_t sizepb; int width; + ino_t maxinum; + int minfragsperinode; /* minimum ratio of frags to inodes */ char tmpbuf[100]; /* XXX this will break in about 2,500 years */ union { struct fs fdummy; @@ -170,6 +173,8 @@ mkfs(struct partition *pp, char *fsys) if (sblock.fs_avgfpdir <= 0) printf("illegal expected number of files per directory %d\n", sblock.fs_avgfpdir), exit(15); + +restart: /* * collect and verify the block and fragment sizes */ @@ -216,6 +221,8 @@ mkfs(struct partition *pp, char *fsys) sblock.fs_fsize, MAXFRAG, sblock.fs_bsize / MAXFRAG); sblock.fs_fsize = sblock.fs_bsize / MAXFRAG; } + if (maxbsize == 0) + maxbsize = bsize; if (maxbsize < bsize || !POWEROF2(maxbsize)) { sblock.fs_maxbsize = sblock.fs_bsize; printf("Extent size set to %d\n", sblock.fs_maxbsize); @@ -225,6 +232,14 @@ mkfs(struct partition *pp, char *fsys) } else { sblock.fs_maxbsize = maxbsize; } + /* + * Maxcontig sets the default for the maximum number of blocks + * that may be allocated sequentially. With file system clustering + * it is possible to allocate contiguous blocks up to the maximum + * transfer size permitted by the controller or buffering. + */ + if (maxcontig == 0) + maxcontig = MAX(1, MAXPHYS / bsize); sblock.fs_maxcontig = maxcontig; if (sblock.fs_maxcontig < sblock.fs_maxbsize / sblock.fs_bsize) { sblock.fs_maxcontig = sblock.fs_maxbsize / sblock.fs_bsize; @@ -315,9 +330,26 @@ mkfs(struct partition *pp, char *fsys) * can put into each cylinder group. If this is too big, we reduce * the density until it fits. */ + maxinum = (((int64_t)(1)) << 32) - INOPB(&sblock); + minfragsperinode = 1 + fssize / maxinum; + if (density == 0) { + density = MAX(NFPI, minfragsperinode) * fsize; + } else if (density < minfragsperinode * fsize) { + origdensity = density; + density = minfragsperinode * fsize; + fprintf(stderr, "density increased from %d to %d\n", + origdensity, density); + } origdensity = density; for (;;) { fragsperinode = MAX(numfrags(&sblock, density), 1); + if (fragsperinode < minfragsperinode) { + bsize <<= 1; + fsize <<= 1; + printf("Block size too small for a file system %s %d\n", + "of this size. Increasing blocksize to", bsize); + goto restart; + } minfpg = fragsperinode * INOPB(&sblock); if (minfpg > sblock.fs_size) minfpg = sblock.fs_size; @@ -406,7 +438,10 @@ mkfs(struct partition *pp, char *fsys) if (sblock.fs_sbsize > SBLOCKSIZE) sblock.fs_sbsize = SBLOCKSIZE; sblock.fs_minfree = minfree; - sblock.fs_maxbpg = maxbpg; + if (maxbpg == 0) + sblock.fs_maxbpg = MAXBLKPG(sblock.fs_bsize); + else + sblock.fs_maxbpg = maxbpg; sblock.fs_optim = opt; sblock.fs_cgrotor = 0; sblock.fs_pendingblocks = 0; @@ -476,9 +511,9 @@ mkfs(struct partition *pp, char *fsys) fsdummy.fs_magic = 0; bwrite(&disk, part_ofs + SBLOCK_UFS1 / disk.d_bsize, chdummy, SBLOCKSIZE); - for (i = 0; i < fsdummy.fs_ncg; i++) + for (cg = 0; cg < fsdummy.fs_ncg; cg++) bwrite(&disk, part_ofs + fsbtodb(&fsdummy, - cgsblock(&fsdummy, i)), chdummy, SBLOCKSIZE); + cgsblock(&fsdummy, cg)), chdummy, SBLOCKSIZE); } } if (!Nflag) @@ -516,11 +551,11 @@ mkfs(struct partition *pp, char *fsys) * writing out in each cylinder group. */ bcopy((char *)&sblock, iobuf, SBLOCKSIZE); - for (cylno = 0; cylno < sblock.fs_ncg; cylno++) { - initcg(cylno, utime); + for (cg = 0; cg < sblock.fs_ncg; cg++) { + initcg(cg, utime); j = snprintf(tmpbuf, sizeof(tmpbuf), " %jd%s", - (intmax_t)fsbtodb(&sblock, cgsblock(&sblock, cylno)), - cylno < (sblock.fs_ncg-1) ? "," : ""); + (intmax_t)fsbtodb(&sblock, cgsblock(&sblock, cg)), + cg < (sblock.fs_ncg-1) ? "," : ""); if (j < 0) tmpbuf[j = 0] = '\0'; if (i + j >= width) { @@ -574,7 +609,8 @@ mkfs(struct partition *pp, char *fsys) void initcg(int cylno, time_t utime) { - long i, j, d, dlower, dupper, blkno, start; + long blkno, start; + uint i, j, d, dlower, dupper; ufs2_daddr_t cbase, dmax; struct ufs1_dinode *dp1; struct ufs2_dinode *dp2; @@ -631,7 +667,7 @@ initcg(int cylno, time_t utime) acg.cg_nextfreeoff = acg.cg_clusteroff + howmany(fragstoblks(&sblock, sblock.fs_fpg), CHAR_BIT); } - if (acg.cg_nextfreeoff > sblock.fs_cgsize) { + if (acg.cg_nextfreeoff > (unsigned)sblock.fs_cgsize) { printf("Panic: cylinder group too big\n"); exit(37); } @@ -880,7 +916,8 @@ makedir(struct direct *protodir, int ent ufs2_daddr_t alloc(int size, int mode) { - int i, d, blkno, frag; + int i, blkno, frag; + uint d; bread(&disk, part_ofs + fsbtodb(&sblock, cgtod(&sblock, 0)), (char *)&acg, sblock.fs_cgsize); Modified: stable/8/sbin/newfs/newfs.c ============================================================================== --- stable/8/sbin/newfs/newfs.c Fri Feb 26 21:26:07 2010 (r204374) +++ stable/8/sbin/newfs/newfs.c Fri Feb 26 21:49:11 2010 (r204375) @@ -79,38 +79,6 @@ __FBSDID("$FreeBSD$"); #include "newfs.h" -/* - * The following two constants set the default block and fragment sizes. - * Both constants must be a power of 2 and meet the following constraints: - * MINBSIZE <= DESBLKSIZE <= MAXBSIZE - * sectorsize <= DESFRAGSIZE <= DESBLKSIZE - * DESBLKSIZE / DESFRAGSIZE <= 8 - */ -#define DFL_FRAGSIZE 2048 -#define DFL_BLKSIZE 16384 - -/* - * Cylinder groups may have up to MAXBLKSPERCG blocks. The actual - * number used depends upon how much information can be stored - * in a cylinder group map which must fit in a single file system - * block. The default is to use as many as possible blocks per group. - */ -#define MAXBLKSPERCG 0x7fffffff /* desired fs_fpg ("infinity") */ - -/* - * MAXBLKPG determines the maximum number of data blocks which are - * placed in a single cylinder group. The default is one indirect - * block worth of data blocks. - */ -#define MAXBLKPG(bsize) ((bsize) / sizeof(ufs2_daddr_t)) - -/* - * Each file system has a number of inodes statically allocated. - * We allocate one inode slot per NFPI fragments, expecting this - * to be far more than we will ever need. - */ -#define NFPI 4 - int Eflag; /* Erase previous disk contents */ int Lflag; /* add a volume label */ int Nflag; /* run without writing file system */ @@ -387,25 +355,11 @@ main(int argc, char *argv[]) fsize = MAX(DFL_FRAGSIZE, sectorsize); if (bsize <= 0) bsize = MIN(DFL_BLKSIZE, 8 * fsize); - if (maxbsize == 0) - maxbsize = bsize; - /* - * Maxcontig sets the default for the maximum number of blocks - * that may be allocated sequentially. With file system clustering - * it is possible to allocate contiguous blocks up to the maximum - * transfer size permitted by the controller or buffering. - */ - if (maxcontig == 0) - maxcontig = MAX(1, MAXPHYS / bsize); - if (density == 0) - density = NFPI * fsize; if (minfree < MINFREE && opt != FS_OPTSPACE) { fprintf(stderr, "Warning: changing optimization to space "); fprintf(stderr, "because minfree is less than %d%%\n", MINFREE); opt = FS_OPTSPACE; } - if (maxbpg == 0) - maxbpg = MAXBLKPG(bsize); realsectorsize = sectorsize; if (sectorsize != DEV_BSIZE) { /* XXX */ int secperblk = sectorsize / DEV_BSIZE; Modified: stable/8/sbin/newfs/newfs.h ============================================================================== --- stable/8/sbin/newfs/newfs.h Fri Feb 26 21:26:07 2010 (r204374) +++ stable/8/sbin/newfs/newfs.h Fri Feb 26 21:49:11 2010 (r204375) @@ -41,6 +41,38 @@ #include /* + * The following two constants set the default block and fragment sizes. + * Both constants must be a power of 2 and meet the following constraints: + * MINBSIZE <= DESBLKSIZE <= MAXBSIZE + * sectorsize <= DESFRAGSIZE <= DESBLKSIZE + * DESBLKSIZE / DESFRAGSIZE <= 8 + */ +#define DFL_FRAGSIZE 2048 +#define DFL_BLKSIZE 16384 + +/* + * Cylinder groups may have up to MAXBLKSPERCG blocks. The actual + * number used depends upon how much information can be stored + * in a cylinder group map which must fit in a single file system + * block. The default is to use as many as possible blocks per group. + */ +#define MAXBLKSPERCG 0x7fffffff /* desired fs_fpg ("infinity") */ + +/* + * MAXBLKPG determines the maximum number of data blocks which are + * placed in a single cylinder group. The default is one indirect + * block worth of data blocks. + */ +#define MAXBLKPG(bsize) ((bsize) / sizeof(ufs2_daddr_t)) + +/* + * Each file system has a number of inodes statically allocated. + * We allocate one inode slot per NFPI fragments, expecting this + * to be far more than we will ever need. + */ +#define NFPI 4 + +/* * variables set up by front end. */ extern int Eflag; /* Erase previous disk contents */ Modified: stable/8/sbin/tunefs/tunefs.c ============================================================================== --- stable/8/sbin/tunefs/tunefs.c Fri Feb 26 21:26:07 2010 (r204374) +++ stable/8/sbin/tunefs/tunefs.c Fri Feb 26 21:49:11 2010 (r204375) @@ -286,7 +286,7 @@ main(int argc, char *argv[]) } if (fflag) { name = "average file size"; - if (sblock.fs_avgfilesize == fvalue) { + if (sblock.fs_avgfilesize == (unsigned)fvalue) { warnx("%s remains unchanged as %d", name, fvalue); } else { @@ -389,7 +389,7 @@ main(int argc, char *argv[]) } if (sflag) { name = "expected number of files per directory"; - if (sblock.fs_avgfpdir == svalue) { + if (sblock.fs_avgfpdir == (unsigned)svalue) { warnx("%s remains unchanged as %d", name, svalue); } else { Modified: stable/8/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- stable/8/sys/ufs/ffs/ffs_alloc.c Fri Feb 26 21:26:07 2010 (r204374) +++ stable/8/sys/ufs/ffs/ffs_alloc.c Fri Feb 26 21:49:11 2010 (r204375) @@ -88,24 +88,25 @@ __FBSDID("$FreeBSD$"); #include #include -typedef ufs2_daddr_t allocfcn_t(struct inode *ip, int cg, ufs2_daddr_t bpref, +typedef ufs2_daddr_t allocfcn_t(struct inode *ip, u_int cg, ufs2_daddr_t bpref, int size); -static ufs2_daddr_t ffs_alloccg(struct inode *, int, ufs2_daddr_t, int); +static ufs2_daddr_t ffs_alloccg(struct inode *, u_int, ufs2_daddr_t, int); static ufs2_daddr_t ffs_alloccgblk(struct inode *, struct buf *, ufs2_daddr_t); #ifdef INVARIANTS static int ffs_checkblk(struct inode *, ufs2_daddr_t, long); #endif -static ufs2_daddr_t ffs_clusteralloc(struct inode *, int, ufs2_daddr_t, int); +static ufs2_daddr_t ffs_clusteralloc(struct inode *, u_int, ufs2_daddr_t, int); static void ffs_clusteracct(struct ufsmount *, struct fs *, struct cg *, ufs1_daddr_t, int); static ino_t ffs_dirpref(struct inode *); -static ufs2_daddr_t ffs_fragextend(struct inode *, int, ufs2_daddr_t, int, int); +static ufs2_daddr_t ffs_fragextend(struct inode *, u_int, ufs2_daddr_t, + int, int); static void ffs_fserr(struct fs *, ino_t, char *); static ufs2_daddr_t ffs_hashalloc - (struct inode *, int, ufs2_daddr_t, int, allocfcn_t *); -static ufs2_daddr_t ffs_nodealloccg(struct inode *, int, ufs2_daddr_t, int); + (struct inode *, u_int, ufs2_daddr_t, int, allocfcn_t *); +static ufs2_daddr_t ffs_nodealloccg(struct inode *, u_int, ufs2_daddr_t, int); static ufs1_daddr_t ffs_mapsearch(struct fs *, struct cg *, ufs2_daddr_t, int); static int ffs_reallocblks_ufs1(struct vop_reallocblks_args *); static int ffs_reallocblks_ufs2(struct vop_reallocblks_args *); @@ -140,7 +141,7 @@ ffs_alloc(ip, lbn, bpref, size, flags, c struct fs *fs; struct ufsmount *ump; ufs2_daddr_t bno; - int cg, reclaimed; + u_int cg, reclaimed; static struct timeval lastfail; static int curfail; int64_t delta; @@ -243,7 +244,8 @@ ffs_realloccg(ip, lbprev, bprev, bpref, struct fs *fs; struct buf *bp; struct ufsmount *ump; - int cg, request, error, reclaimed; + u_int cg, request, reclaimed; + int error; ufs2_daddr_t bno; static struct timeval lastfail; static int curfail; @@ -930,7 +932,8 @@ ffs_valloc(pvp, mode, cred, vpp) struct timespec ts; struct ufsmount *ump; ino_t ino, ipref; - int cg, error, error1; + u_int cg; + int error, error1; static struct timeval lastfail; static int curfail; @@ -1040,11 +1043,11 @@ ffs_dirpref(pip) struct inode *pip; { struct fs *fs; - int cg, prefcg, dirsize, cgsize; - int avgifree, avgbfree, avgndir, curdirsize; - int minifree, minbfree, maxndir; - int mincg, minndir; - int maxcontigdirs; + u_int cg, prefcg, dirsize, cgsize; + u_int avgifree, avgbfree, avgndir, curdirsize; + u_int minifree, minbfree, maxndir; + u_int mincg, minndir; + u_int maxcontigdirs; mtx_assert(UFS_MTX(pip->i_ump), MA_OWNED); fs = pip->i_fs; @@ -1168,8 +1171,8 @@ ffs_blkpref_ufs1(ip, lbn, indx, bap) ufs1_daddr_t *bap; { struct fs *fs; - int cg; - int avgbfree, startcg; + u_int cg; + u_int avgbfree, startcg; mtx_assert(UFS_MTX(ip->i_ump), MA_OWNED); fs = ip->i_fs; @@ -1218,8 +1221,8 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap) ufs2_daddr_t *bap; { struct fs *fs; - int cg; - int avgbfree, startcg; + u_int cg; + u_int avgbfree, startcg; mtx_assert(UFS_MTX(ip->i_ump), MA_OWNED); fs = ip->i_fs; @@ -1272,14 +1275,14 @@ ffs_blkpref_ufs2(ip, lbn, indx, bap) static ufs2_daddr_t ffs_hashalloc(ip, cg, pref, size, allocator) struct inode *ip; - int cg; + u_int cg; ufs2_daddr_t pref; int size; /* size for data blocks, mode for inodes */ allocfcn_t *allocator; { struct fs *fs; ufs2_daddr_t result; - int i, icg = cg; + u_int i, icg = cg; mtx_assert(UFS_MTX(ip->i_ump), MA_OWNED); #ifdef INVARIANTS @@ -1330,7 +1333,7 @@ ffs_hashalloc(ip, cg, pref, size, alloca static ufs2_daddr_t ffs_fragextend(ip, cg, bprev, osize, nsize) struct inode *ip; - int cg; + u_int cg; ufs2_daddr_t bprev; int osize, nsize; { @@ -1413,7 +1416,7 @@ fail: static ufs2_daddr_t ffs_alloccg(ip, cg, bpref, size) struct inode *ip; - int cg; + u_int cg; ufs2_daddr_t bpref; int size; { @@ -1583,7 +1586,7 @@ gotit: static ufs2_daddr_t ffs_clusteralloc(ip, cg, bpref, len) struct inode *ip; - int cg; + u_int cg; ufs2_daddr_t bpref; int len; { @@ -1707,7 +1710,7 @@ fail: static ufs2_daddr_t ffs_nodealloccg(ip, cg, ipref, mode) struct inode *ip; - int cg; + u_int cg; ufs2_daddr_t ipref; int mode; { @@ -1808,7 +1811,7 @@ gotit: bdwrite(bp); if (ibp != NULL) bawrite(ibp); - return (cg * fs->fs_ipg + ipref); + return ((ino_t)(cg * fs->fs_ipg + ipref)); } /* @@ -1853,7 +1856,8 @@ ffs_blkfree(ump, fs, devvp, bno, size, i struct buf *bp; ufs1_daddr_t fragno, cgbno; ufs2_daddr_t cgblkno; - int i, cg, blk, frags, bbase; + int i, blk, frags, bbase; + u_int cg; u_int8_t *blksfree; struct cdev *dev; @@ -2051,7 +2055,8 @@ ffs_freefile(ump, fs, devvp, ino, mode) struct cg *cgp; struct buf *bp; ufs2_daddr_t cgbno; - int error, cg; + int error; + u_int cg; u_int8_t *inosused; struct cdev *dev; @@ -2065,7 +2070,7 @@ ffs_freefile(ump, fs, devvp, ino, mode) dev = devvp->v_rdev; cgbno = fsbtodb(fs, cgtod(fs, cg)); } - if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg) + if (ino >= fs->fs_ipg * fs->fs_ncg) panic("ffs_freefile: range: dev = %s, ino = %lu, fs = %s", devtoname(dev), (u_long)ino, fs->fs_fsmnt); if ((error = bread(devvp, cgbno, (int)fs->fs_cgsize, NOCRED, &bp))) { @@ -2082,8 +2087,8 @@ ffs_freefile(ump, fs, devvp, ino, mode) inosused = cg_inosused(cgp); ino %= fs->fs_ipg; if (isclr(inosused, ino)) { - printf("dev = %s, ino = %lu, fs = %s\n", devtoname(dev), - (u_long)ino + cg * fs->fs_ipg, fs->fs_fsmnt); + printf("dev = %s, ino = %u, fs = %s\n", devtoname(dev), + ino + cg * fs->fs_ipg, fs->fs_fsmnt); if (fs->fs_ronly == 0) panic("ffs_freefile: freeing free inode"); } @@ -2118,7 +2123,8 @@ ffs_checkfreefile(fs, devvp, ino) struct cg *cgp; struct buf *bp; ufs2_daddr_t cgbno; - int ret, cg; + int ret; + u_int cg; u_int8_t *inosused; cg = ino_to_cg(fs, ino); @@ -2129,7 +2135,7 @@ ffs_checkfreefile(fs, devvp, ino) /* devvp is a normal disk device */ cgbno = fsbtodb(fs, cgtod(fs, cg)); } - if ((u_int)ino >= fs->fs_ipg * fs->fs_ncg) + if (ino >= fs->fs_ipg * fs->fs_ncg) return (1); if (bread(devvp, cgbno, (int)fs->fs_cgsize, NOCRED, &bp)) { brelse(bp); Modified: stable/8/sys/ufs/ffs/fs.h ============================================================================== --- stable/8/sys/ufs/ffs/fs.h Fri Feb 26 21:26:07 2010 (r204374) +++ stable/8/sys/ufs/ffs/fs.h Fri Feb 26 21:49:11 2010 (r204375) @@ -261,7 +261,7 @@ struct fs { int32_t fs_old_time; /* last time written */ int32_t fs_old_size; /* number of blocks in fs */ int32_t fs_old_dsize; /* number of data blocks in fs */ - int32_t fs_ncg; /* number of cylinder groups */ + u_int32_t fs_ncg; /* number of cylinder groups */ int32_t fs_bsize; /* size of basic blocks in fs */ int32_t fs_fsize; /* size of frag blocks in fs */ int32_t fs_frag; /* number of frags in a block in fs */ @@ -301,7 +301,7 @@ struct fs { int32_t fs_old_spc; /* sectors per cylinder */ int32_t fs_old_ncyl; /* cylinders in filesystem */ int32_t fs_old_cpg; /* cylinders per group */ - int32_t fs_ipg; /* inodes per group */ + u_int32_t fs_ipg; /* inodes per group */ int32_t fs_fpg; /* blocks per group * fs_frag */ /* this data must be re-computed after crashes */ struct csum fs_old_cstotal; /* cylinder summary information */ @@ -332,10 +332,10 @@ struct fs { int64_t fs_dsize; /* number of data blocks in fs */ ufs2_daddr_t fs_csaddr; /* blk addr of cyl grp summary area */ int64_t fs_pendingblocks; /* (u) blocks being freed */ - int32_t fs_pendinginodes; /* (u) inodes being freed */ - int32_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */ - int32_t fs_avgfilesize; /* expected average file size */ - int32_t fs_avgfpdir; /* expected # of files per directory */ + u_int32_t fs_pendinginodes; /* (u) inodes being freed */ + ino_t fs_snapinum[FSMAXSNAP];/* list of snapshot inode numbers */ + u_int32_t fs_avgfilesize; /* expected average file size */ + u_int32_t fs_avgfpdir; /* expected # of files per directory */ int32_t fs_save_cgsize; /* save real cg size to use fs_bsize */ int32_t fs_sparecon32[26]; /* reserved for future constants */ int32_t fs_flags; /* see FS_ flags below */ @@ -458,26 +458,26 @@ struct cg { int32_t cg_firstfield; /* historic cyl groups linked list */ int32_t cg_magic; /* magic number */ int32_t cg_old_time; /* time last written */ - int32_t cg_cgx; /* we are the cgx'th cylinder group */ + u_int32_t cg_cgx; /* we are the cgx'th cylinder group */ int16_t cg_old_ncyl; /* number of cyl's this cg */ int16_t cg_old_niblk; /* number of inode blocks this cg */ - int32_t cg_ndblk; /* number of data blocks this cg */ - struct csum cg_cs; /* cylinder summary information */ - int32_t cg_rotor; /* position of last used block */ - int32_t cg_frotor; /* position of last used frag */ - int32_t cg_irotor; /* position of last used inode */ - int32_t cg_frsum[MAXFRAG]; /* counts of available frags */ + u_int32_t cg_ndblk; /* number of data blocks this cg */ + struct csum cg_cs; /* cylinder summary information */ + u_int32_t cg_rotor; /* position of last used block */ + u_int32_t cg_frotor; /* position of last used frag */ + u_int32_t cg_irotor; /* position of last used inode */ + u_int32_t cg_frsum[MAXFRAG]; /* counts of available frags */ int32_t cg_old_btotoff; /* (int32) block totals per cylinder */ int32_t cg_old_boff; /* (u_int16) free block positions */ - int32_t cg_iusedoff; /* (u_int8) used inode map */ - int32_t cg_freeoff; /* (u_int8) free block map */ - int32_t cg_nextfreeoff; /* (u_int8) next available space */ - int32_t cg_clustersumoff; /* (u_int32) counts of avail clusters */ - int32_t cg_clusteroff; /* (u_int8) free cluster map */ - int32_t cg_nclusterblks; /* number of clusters this cg */ - int32_t cg_niblk; /* number of inode blocks this cg */ - int32_t cg_initediblk; /* last initialized inode */ - int32_t cg_unrefs; /* number of unreferenced inodes */ + u_int32_t cg_iusedoff; /* (u_int8) used inode map */ + u_int32_t cg_freeoff; /* (u_int8) free block map */ + u_int32_t cg_nextfreeoff; /* (u_int8) next available space */ + u_int32_t cg_clustersumoff; /* (u_int32) counts of avail clusters */ + u_int32_t cg_clusteroff; /* (u_int8) free cluster map */ + u_int32_t cg_nclusterblks; /* number of clusters this cg */ + u_int32_t cg_niblk; /* number of inode blocks this cg */ + u_int32_t cg_initediblk; /* last initialized inode */ + u_int32_t cg_unrefs; /* number of unreferenced inodes */ int32_t cg_sparecon32[2]; /* reserved for future use */ ufs_time_t cg_time; /* time last written */ int64_t cg_sparecon64[3]; /* reserved for future use */ @@ -524,11 +524,11 @@ struct cg { * inode number to cylinder group number. * inode number to filesystem block address. */ -#define ino_to_cg(fs, x) ((x) / (fs)->fs_ipg) +#define ino_to_cg(fs, x) (((ino_t)(x)) / (fs)->fs_ipg) #define ino_to_fsba(fs, x) \ - ((ufs2_daddr_t)(cgimin(fs, ino_to_cg(fs, x)) + \ - (blkstofrags((fs), (((x) % (fs)->fs_ipg) / INOPB(fs)))))) -#define ino_to_fsbo(fs, x) ((x) % INOPB(fs)) + ((ufs2_daddr_t)(cgimin(fs, ino_to_cg(fs, (ino_t)(x))) + \ + (blkstofrags((fs), ((((ino_t)(x)) % (fs)->fs_ipg) / INOPB(fs)))))) +#define ino_to_fsbo(fs, x) (((ino_t)(x)) % INOPB(fs)) /* * Give cylinder group number for a filesystem block. From owner-svn-src-stable-8@FreeBSD.ORG Sat Feb 27 03:47:23 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1A25A1065670; Sat, 27 Feb 2010 03:47:23 +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 08A4B8FC0C; Sat, 27 Feb 2010 03:47: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 o1R3lMrq042912; Sat, 27 Feb 2010 03:47:22 GMT (envelope-from emaste@svn.freebsd.org) Received: (from emaste@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1R3lMwV042910; Sat, 27 Feb 2010 03:47:22 GMT (envelope-from emaste@svn.freebsd.org) Message-Id: <201002270347.o1R3lMwV042910@svn.freebsd.org> From: Ed Maste Date: Sat, 27 Feb 2010 03:47: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: r204392 - stable/8/sys/sys X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 03:47:23 -0000 Author: emaste Date: Sat Feb 27 03:47:22 2010 New Revision: 204392 URL: http://svn.freebsd.org/changeset/base/204392 Log: MFC r204106: Avoid corrupting the list or queue if _REMOVE is invoked with a reference to the head. PR: kern/119307 Modified: stable/8/sys/sys/queue.h Directory Properties: 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/ (props changed) Modified: stable/8/sys/sys/queue.h ============================================================================== --- stable/8/sys/sys/queue.h Sat Feb 27 03:38:38 2010 (r204391) +++ stable/8/sys/sys/queue.h Sat Feb 27 03:47:22 2010 (r204392) @@ -112,6 +112,7 @@ struct qm_trace { #define TRACEBUF struct qm_trace trace; #define TRASHIT(x) do {(x) = (void *)-1;} while (0) +#define QMD_SAVELINK(name, link) void **name = (void *)&(link) #define QMD_TRACE_HEAD(head) do { \ (head)->trace.prevline = (head)->trace.lastline; \ @@ -130,6 +131,7 @@ struct qm_trace { #else #define QMD_TRACE_ELEM(elem) #define QMD_TRACE_HEAD(head) +#define QMD_SAVELINK(name, link) #define TRACEBUF #define TRASHIT(x) #endif /* QUEUE_MACRO_DEBUG */ @@ -189,6 +191,7 @@ struct { \ #define SLIST_NEXT(elm, field) ((elm)->field.sle_next) #define SLIST_REMOVE(head, elm, type, field) do { \ + QMD_SAVELINK(oldnext, (elm)->field.sle_next); \ if (SLIST_FIRST((head)) == (elm)) { \ SLIST_REMOVE_HEAD((head), field); \ } \ @@ -198,7 +201,7 @@ struct { \ curelm = SLIST_NEXT(curelm, field); \ SLIST_REMOVE_AFTER(curelm, field); \ } \ - TRASHIT((elm)->field.sle_next); \ + TRASHIT(*oldnext); \ } while (0) #define SLIST_REMOVE_AFTER(elm, field) do { \ @@ -285,6 +288,7 @@ struct { \ #define STAILQ_NEXT(elm, field) ((elm)->field.stqe_next) #define STAILQ_REMOVE(head, elm, type, field) do { \ + QMD_SAVELINK(oldnext, (elm)->field.stqe_next); \ if (STAILQ_FIRST((head)) == (elm)) { \ STAILQ_REMOVE_HEAD((head), field); \ } \ @@ -294,7 +298,7 @@ struct { \ curelm = STAILQ_NEXT(curelm, field); \ STAILQ_REMOVE_AFTER(head, curelm, field); \ } \ - TRASHIT((elm)->field.stqe_next); \ + TRASHIT(*oldnext); \ } while (0) #define STAILQ_REMOVE_HEAD(head, field) do { \ @@ -415,14 +419,16 @@ struct { \ #define LIST_NEXT(elm, field) ((elm)->field.le_next) #define LIST_REMOVE(elm, field) do { \ + QMD_SAVELINK(oldnext, (elm)->field.le_next); \ + QMD_SAVELINK(oldprev, (elm)->field.le_prev); \ QMD_LIST_CHECK_NEXT(elm, field); \ QMD_LIST_CHECK_PREV(elm, field); \ if (LIST_NEXT((elm), field) != NULL) \ LIST_NEXT((elm), field)->field.le_prev = \ (elm)->field.le_prev; \ *(elm)->field.le_prev = LIST_NEXT((elm), field); \ - TRASHIT((elm)->field.le_next); \ - TRASHIT((elm)->field.le_prev); \ + TRASHIT(*oldnext); \ + TRASHIT(*oldprev); \ } while (0) #define LIST_SWAP(head1, head2, type, field) do { \ @@ -587,6 +593,8 @@ struct { \ (*(((struct headname *)((elm)->field.tqe_prev))->tqh_last)) #define TAILQ_REMOVE(head, elm, field) do { \ + QMD_SAVELINK(oldnext, (elm)->field.tqe_next); \ + QMD_SAVELINK(oldprev, (elm)->field.tqe_prev); \ QMD_TAILQ_CHECK_NEXT(elm, field); \ QMD_TAILQ_CHECK_PREV(elm, field); \ if ((TAILQ_NEXT((elm), field)) != NULL) \ @@ -597,8 +605,8 @@ struct { \ QMD_TRACE_HEAD(head); \ } \ *(elm)->field.tqe_prev = TAILQ_NEXT((elm), field); \ - TRASHIT((elm)->field.tqe_next); \ - TRASHIT((elm)->field.tqe_prev); \ + TRASHIT(*oldnext); \ + TRASHIT(*oldprev); \ QMD_TRACE_ELEM(&(elm)->field); \ } while (0) From owner-svn-src-stable-8@FreeBSD.ORG Sat Feb 27 16:51:23 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B04B51065670; Sat, 27 Feb 2010 16:51:23 +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 9DBEA8FC12; Sat, 27 Feb 2010 16:51: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 o1RGpNcY016847; Sat, 27 Feb 2010 16:51:23 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1RGpN4s016840; Sat, 27 Feb 2010 16:51:23 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201002271651.o1RGpN4s016840@svn.freebsd.org> From: Konstantin Belousov Date: Sat, 27 Feb 2010 16:51: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: r204414 - stable/8/sys/fs/msdosfs X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 16:51:23 -0000 Author: kib Date: Sat Feb 27 16:51:23 2010 New Revision: 204414 URL: http://svn.freebsd.org/changeset/base/204414 Log: MFC r203827: - Add idempotency guards so the structures can be used in other utilities. - Update bpb structs with reserved fields. - In direntry struct join deName with deExtension. Although a fix was attempted in the past, these fields were being overflowed, Now this is consistent with the spec, and we can now share the WinChksum code with NetBSD. Modified: stable/8/sys/fs/msdosfs/bootsect.h stable/8/sys/fs/msdosfs/bpb.h stable/8/sys/fs/msdosfs/direntry.h stable/8/sys/fs/msdosfs/msdosfs_conv.c stable/8/sys/fs/msdosfs/msdosfs_lookup.c stable/8/sys/fs/msdosfs/msdosfs_vnops.c Directory Properties: 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/ (props changed) Modified: stable/8/sys/fs/msdosfs/bootsect.h ============================================================================== --- stable/8/sys/fs/msdosfs/bootsect.h Sat Feb 27 15:32:49 2010 (r204413) +++ stable/8/sys/fs/msdosfs/bootsect.h Sat Feb 27 16:51:23 2010 (r204414) @@ -16,6 +16,8 @@ * * October 1992 */ +#ifndef _FS_MSDOSFS_BOOTSECT_H_ +#define _FS_MSDOSFS_BOOTSECT_H_ /* * Format of a boot sector. This is the first sector on a DOS floppy disk @@ -91,3 +93,5 @@ union bootsector { #define bsHiddenSecs bsBPB.bpbHiddenSecs #define bsHugeSectors bsBPB.bpbHugeSectors #endif + +#endif /* !_FS_MSDOSFS_BOOTSECT_H_ */ Modified: stable/8/sys/fs/msdosfs/bpb.h ============================================================================== --- stable/8/sys/fs/msdosfs/bpb.h Sat Feb 27 15:32:49 2010 (r204413) +++ stable/8/sys/fs/msdosfs/bpb.h Sat Feb 27 16:51:23 2010 (r204414) @@ -17,6 +17,9 @@ * October 1992 */ +#ifndef _FS_MSDOSFS_BPB_H_ +#define _FS_MSDOSFS_BPB_H_ + /* * BIOS Parameter Block (BPB) for DOS 3.3 */ @@ -78,7 +81,7 @@ struct bpb710 { u_int32_t bpbRootClust; /* start cluster for root directory */ u_int16_t bpbFSInfo; /* filesystem info structure sector */ u_int16_t bpbBackup; /* backup boot sector */ - /* There is a 12 byte filler here, but we ignore it */ + u_int8_t bpbReserved[12]; /* reserved for future expansion */ }; /* @@ -153,7 +156,7 @@ struct byte_bpb710 { u_int8_t bpbRootClust[4]; /* start cluster for root directory */ u_int8_t bpbFSInfo[2]; /* filesystem info structure sector */ u_int8_t bpbBackup[2]; /* backup boot sector */ - /* There is a 12 byte filler here, but we ignore it */ + u_int8_t bpbReserved[12]; /* reserved for future expansion */ }; /* @@ -168,3 +171,4 @@ struct fsinfo { u_int8_t fsifill2[12]; u_int8_t fsisig3[4]; }; +#endif /* !_FS_MSDOSFS_BPB_H_ */ Modified: stable/8/sys/fs/msdosfs/direntry.h ============================================================================== --- stable/8/sys/fs/msdosfs/direntry.h Sat Feb 27 15:32:49 2010 (r204413) +++ stable/8/sys/fs/msdosfs/direntry.h Sat Feb 27 16:51:23 2010 (r204414) @@ -47,16 +47,17 @@ * * October 1992 */ +#ifndef _FS_MSDOSFS_DIRENTRY_H_ +#define _FS_MSDOSFS_DIRENTRY_H_ /* * Structure of a dos directory entry. */ struct direntry { - u_int8_t deName[8]; /* filename, blank filled */ + u_int8_t deName[11]; /* filename, blank filled */ #define SLOT_EMPTY 0x00 /* slot has never been used */ #define SLOT_E5 0x05 /* the real value is 0xe5 */ #define SLOT_DELETED 0xe5 /* file in this slot deleted */ - u_int8_t deExtension[3]; /* extension, blank filled */ u_int8_t deAttributes; /* file attributes */ #define ATTR_NORMAL 0x00 /* normal file */ #define ATTR_READONLY 0x01 /* file is readonly */ @@ -155,7 +156,8 @@ int winChkName(struct mbnambuf *nbp, con int chksum, struct msdosfsmount *pmp); int win2unixfn(struct mbnambuf *nbp, struct winentry *wep, int chksum, struct msdosfsmount *pmp); -u_int8_t winChksum(struct direntry *dep); +u_int8_t winChksum(u_int8_t *name); int winSlotCnt(const u_char *un, size_t unlen, struct msdosfsmount *pmp); size_t winLenFixup(const u_char *un, size_t unlen); #endif /* _KERNEL */ +#endif /* !_FS_MSDOSFS_DIRENTRY_H_ */ Modified: stable/8/sys/fs/msdosfs/msdosfs_conv.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_conv.c Sat Feb 27 15:32:49 2010 (r204413) +++ stable/8/sys/fs/msdosfs/msdosfs_conv.c Sat Feb 27 16:51:23 2010 (r204414) @@ -741,22 +741,13 @@ win2unixfn(nbp, wep, chksum, pmp) * Compute the unrolled checksum of a DOS filename for Win95 LFN use. */ u_int8_t -winChksum(struct direntry *dep) +winChksum(u_int8_t *name) { + int i; u_int8_t s; - s = dep->deName[0]; - s = ((s << 7) | (s >> 1)) + dep->deName[1]; - s = ((s << 7) | (s >> 1)) + dep->deName[2]; - s = ((s << 7) | (s >> 1)) + dep->deName[3]; - s = ((s << 7) | (s >> 1)) + dep->deName[4]; - s = ((s << 7) | (s >> 1)) + dep->deName[5]; - s = ((s << 7) | (s >> 1)) + dep->deName[6]; - s = ((s << 7) | (s >> 1)) + dep->deName[7]; - s = ((s << 7) | (s >> 1)) + dep->deExtension[0]; - s = ((s << 7) | (s >> 1)) + dep->deExtension[1]; - s = ((s << 7) | (s >> 1)) + dep->deExtension[2]; - + for (s = 0, i = 11; --i >= 0; s += *name++) + s = (s << 7)|(s >> 1); return (s); } Modified: stable/8/sys/fs/msdosfs/msdosfs_lookup.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_lookup.c Sat Feb 27 15:32:49 2010 (r204413) +++ stable/8/sys/fs/msdosfs/msdosfs_lookup.c Sat Feb 27 16:51:23 2010 (r204414) @@ -276,7 +276,7 @@ msdosfs_lookup(ap) /* * Check for a checksum or name match */ - chksum_ok = (chksum == winChksum(dep)); + chksum_ok = (chksum == winChksum(dep->deName)); if (!chksum_ok && (!olddos || bcmp(dosfilename, dep->deName, 11))) { chksum = -1; @@ -617,7 +617,7 @@ createde(dep, ddep, depp, cnp) * Now write the Win95 long name */ if (ddep->de_fndcnt > 0) { - u_int8_t chksum = winChksum(ndep); + u_int8_t chksum = winChksum(ndep->deName); const u_char *un = (const u_char *)cnp->cn_nameptr; int unlen = cnp->cn_namelen; int cnt = 1; Modified: stable/8/sys/fs/msdosfs/msdosfs_vnops.c ============================================================================== --- stable/8/sys/fs/msdosfs/msdosfs_vnops.c Sat Feb 27 15:32:49 2010 (r204413) +++ stable/8/sys/fs/msdosfs/msdosfs_vnops.c Sat Feb 27 16:51:23 2010 (r204414) @@ -1287,7 +1287,7 @@ static struct { struct direntry dot; struct direntry dotdot; } dosdirtemplate = { - { ". ", " ", /* the . entry */ + { ". ", /* the . entry */ ATTR_DIRECTORY, /* file attribute */ 0, /* reserved */ 0, { 0, 0 }, { 0, 0 }, /* create time & date */ @@ -1297,7 +1297,7 @@ static struct { { 0, 0 }, /* startcluster */ { 0, 0, 0, 0 } /* filesize */ }, - { ".. ", " ", /* the .. entry */ + { ".. ", /* the .. entry */ ATTR_DIRECTORY, /* file attribute */ 0, /* reserved */ 0, { 0, 0 }, { 0, 0 }, /* create time & date */ @@ -1729,7 +1729,7 @@ msdosfs_readdir(ap) } else dirbuf.d_fileno = (uint32_t)fileno; - if (chksum != winChksum(dentp)) { + if (chksum != winChksum(dentp->deName)) { dirbuf.d_namlen = dos2unixfn(dentp->deName, (u_char *)dirbuf.d_name, dentp->deLowerCase | From owner-svn-src-stable-8@FreeBSD.ORG Sat Feb 27 18:19:13 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 87CCD106564A; Sat, 27 Feb 2010 18:19:13 +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 6BF3F8FC13; Sat, 27 Feb 2010 18:19: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 o1RIJDPb036387; Sat, 27 Feb 2010 18:19:13 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1RIJDmD036382; Sat, 27 Feb 2010 18:19:13 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201002271819.o1RIJDmD036382@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sat, 27 Feb 2010 18:19: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: r204421 - in stable/8/etc: . defaults rc.d X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 18:19:13 -0000 Author: ume Date: Sat Feb 27 18:19:13 2010 New Revision: 204421 URL: http://svn.freebsd.org/changeset/base/204421 Log: MFC r203433: Add rc.d script for the rtsold(8) daemon. The rtsol(8) handles just one RA then exit. So, the OtherConfig flag may not be handled well by rtsol(8) in the environment where there are multiple RA servers on the segment. In such case, rtsold(8) will be your friend. Added: stable/8/etc/rc.d/rtsold - copied unchanged from r203433, head/etc/rc.d/rtsold Modified: stable/8/etc/defaults/rc.conf stable/8/etc/network.subr stable/8/etc/rc.d/Makefile Directory Properties: stable/8/etc/ (props changed) Modified: stable/8/etc/defaults/rc.conf ============================================================================== --- stable/8/etc/defaults/rc.conf Sat Feb 27 18:00:57 2010 (r204420) +++ stable/8/etc/defaults/rc.conf Sat Feb 27 18:19:13 2010 (r204421) @@ -450,6 +450,10 @@ ipv6_default_interface="NO" # Default ou # Now this works only for IPv6 link local # multicast addrs. rtsol_flags="" # Flags to IPv6 router solicitation. +rtsold_enable="NO" # Set to YES to enable an IPv6 router + # solicitation daemon. +rtsold_flags="-a" # Flags to an IPv6 router solicitation + # daemon. rtadvd_enable="NO" # Set to YES to enable an IPv6 router # advertisement daemon. If set to YES, # this router becomes a possible candidate Modified: stable/8/etc/network.subr ============================================================================== --- stable/8/etc/network.subr Sat Feb 27 18:00:57 2010 (r204420) +++ stable/8/etc/network.subr Sat Feb 27 18:19:13 2010 (r204421) @@ -985,7 +985,9 @@ network6_interface_setup() sysctl net.inet6.ip6.accept_rtadv=1 set ${rtsol_interfaces} ifconfig $1 up - rtsol ${rtsol_flags} $1 + if ! checkyesno rtsold_enable; then + rtsol ${rtsol_flags} $1 + fi fi for i in $interfaces; do Modified: stable/8/etc/rc.d/Makefile ============================================================================== --- stable/8/etc/rc.d/Makefile Sat Feb 27 18:00:57 2010 (r204420) +++ stable/8/etc/rc.d/Makefile Sat Feb 27 18:19:13 2010 (r204421) @@ -30,7 +30,7 @@ FILES= DAEMON FILESYSTEMS LOGIN NETWORKI powerd power_profile ppp pppoed pwcheck \ quota \ random rarpd resolv rfcomm_pppd_server root \ - route6d routed routing rpcbind rtadvd rwho \ + route6d routed routing rpcbind rtadvd rtsold rwho \ savecore sdpd securelevel sendmail \ serial sppp statd static_arp swap1 \ syscons sysctl syslogd \ Copied: stable/8/etc/rc.d/rtsold (from r203433, head/etc/rc.d/rtsold) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/8/etc/rc.d/rtsold Sat Feb 27 18:19:13 2010 (r204421, copy of r203433, head/etc/rc.d/rtsold) @@ -0,0 +1,26 @@ +#!/bin/sh +# +# $FreeBSD$ +# + +# PROVIDE: rtsold +# REQUIRE: netif +# BEFORE: NETWORKING +# KEYWORD: nojail + +. /etc/rc.subr + +name="rtsold" +rcvar=`set_rcvar` +command="/usr/sbin/${name}" +pidfile="/var/run/${name}.pid" +start_postcmd="rtsold_poststart" + +rtsold_poststart() +{ + # wait for DAD + sleep $(($(${SYSCTL_N} net.inet6.ip6.dad_count) + 1)) +} + +load_rc_config $name +run_rc_command "$1" From owner-svn-src-stable-8@FreeBSD.ORG Sat Feb 27 18:27:32 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3BA6106566B; Sat, 27 Feb 2010 18:27:32 +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 B7B898FC15; Sat, 27 Feb 2010 18: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 o1RIRWsx038261; Sat, 27 Feb 2010 18:27:32 GMT (envelope-from ume@svn.freebsd.org) Received: (from ume@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o1RIRWCf038258; Sat, 27 Feb 2010 18:27:32 GMT (envelope-from ume@svn.freebsd.org) Message-Id: <201002271827.o1RIRWCf038258@svn.freebsd.org> From: Hajimu UMEMOTO Date: Sat, 27 Feb 2010 18: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: r204422 - in stable/8/sbin: mount_nfs umount X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 18:27:33 -0000 Author: ume Date: Sat Feb 27 18:27:32 2010 New Revision: 204422 URL: http://svn.freebsd.org/changeset/base/204422 Log: MFC r203490: Introduce '[ipaddr]:path' notation. Since the existing implementation searches ':' backward, a path which includes ':' could not be mounted. You can now mount such path by enclosing an IP address by '[]'. Though we should change to search ':' forward, it will break 'ipv6addr:path' which is currently working. So, it still searches ':' backward, at least for now. Modified: stable/8/sbin/mount_nfs/mount_nfs.c stable/8/sbin/umount/umount.c Directory Properties: stable/8/sbin/mount_nfs/ (props changed) stable/8/sbin/umount/ (props changed) Modified: stable/8/sbin/mount_nfs/mount_nfs.c ============================================================================== --- stable/8/sbin/mount_nfs/mount_nfs.c Sat Feb 27 18:19:13 2010 (r204421) +++ stable/8/sbin/mount_nfs/mount_nfs.c Sat Feb 27 18:27:32 2010 (r204422) @@ -698,12 +698,17 @@ getnfsargs(char *spec, struct iovec **io { struct addrinfo hints, *ai_nfs, *ai; enum tryret ret; - int ecode, speclen, remoteerr; + int ecode, speclen, remoteerr, offset, have_bracket = 0; char *hostp, *delimp, *errstr; size_t len; static char nam[MNAMELEN + 1], pname[MAXHOSTNAMELEN + 5]; - if ((delimp = strrchr(spec, ':')) != NULL) { + if (*spec == '[' && (delimp = strchr(spec + 1, ']')) != NULL && + *(delimp + 1) == ':') { + hostp = spec + 1; + spec = delimp + 2; + have_bracket = 1; + } else if ((delimp = strrchr(spec, ':')) != NULL) { hostp = spec; spec = delimp + 1; } else if ((delimp = strrchr(spec, '@')) != NULL) { @@ -731,10 +736,15 @@ getnfsargs(char *spec, struct iovec **io /* Make both '@' and ':' notations equal */ if (*hostp != '\0') { len = strlen(hostp); - memmove(nam, hostp, len); - nam[len] = ':'; - memmove(nam + len + 1, spec, speclen); - nam[len + speclen + 1] = '\0'; + offset = 0; + if (have_bracket) + nam[offset++] = '['; + memmove(nam + offset, hostp, len); + if (have_bracket) + nam[len + offset++] = ']'; + nam[len + offset++] = ':'; + memmove(nam + len + offset, spec, speclen); + nam[len + speclen + offset] = '\0'; } /* Modified: stable/8/sbin/umount/umount.c ============================================================================== --- stable/8/sbin/umount/umount.c Sat Feb 27 18:19:13 2010 (r204421) +++ stable/8/sbin/umount/umount.c Sat Feb 27 18:27:32 2010 (r204422) @@ -325,14 +325,21 @@ umountfs(struct statfs *sfs) if ((nfsdirname = strdup(sfs->f_mntfromname)) == NULL) err(1, "strdup"); orignfsdirname = nfsdirname; - if ((delimp = strrchr(nfsdirname, ':')) != NULL) { - *delimp = '\0'; + if (*nfsdirname == '[' && + (delimp = strchr(nfsdirname + 1, ']')) != NULL && + *(delimp + 1) == ':') { + hostp = nfsdirname + 1; + nfsdirname = delimp + 2; + } else if ((delimp = strrchr(nfsdirname, ':')) != NULL) { hostp = nfsdirname; + nfsdirname = delimp + 1; + } + if (hostp != NULL) { + *delimp = '\0'; getaddrinfo(hostp, NULL, &hints, &ai); if (ai == NULL) { warnx("can't get net id for host"); } - nfsdirname = delimp + 1; } /* From owner-svn-src-stable-8@FreeBSD.ORG Sat Feb 27 18:51:34 2010 Return-Path: Delivered-To: svn-src-stable-8@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 676571065674 for ; Sat, 27 Feb 2010 18:51:34 +0000 (UTC) (envelope-from dougb@FreeBSD.org) Received: from mail2.fluidhosting.com (mx21.fluidhosting.com [204.14.89.4]) by mx1.freebsd.org (Postfix) with ESMTP id E11648FC0A for ; Sat, 27 Feb 2010 18:51:33 +0000 (UTC) Received: (qmail 8479 invoked by uid 399); 27 Feb 2010 18:51:33 -0000 Received: from localhost (HELO foreign.dougb.net) (dougb@dougbarton.us@127.0.0.1) by localhost with ESMTPAM; 27 Feb 2010 18:51:33 -0000 X-Originating-IP: 127.0.0.1 X-Sender: dougb@dougbarton.us Message-ID: <4B8969B3.4040207@FreeBSD.org> Date: Sat, 27 Feb 2010 10:51:31 -0800 From: Doug Barton Organization: http://SupersetSolutions.com/ User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.9.1.7) Gecko/20100218 Thunderbird/3.0.1 MIME-Version: 1.0 To: Hajimu UMEMOTO References: <201002271819.o1RIJDmD036382@svn.freebsd.org> In-Reply-To: <201002271819.o1RIJDmD036382@svn.freebsd.org> X-Enigmail-Version: 1.0.1 OpenPGP: id=D5B2F0FB Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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: r204421 - in stable/8/etc: . defaults rc.d X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 18:51:34 -0000 On 02/27/10 10:19, Hajimu UMEMOTO wrote: > Author: ume > Date: Sat Feb 27 18:19:13 2010 > New Revision: 204421 > URL: http://svn.freebsd.org/changeset/base/204421 > > Log: > MFC r203433: > > Add rc.d script for the rtsold(8) daemon. > > The rtsol(8) handles just one RA then exit. So, the OtherConfig flag > may not be handled well by rtsol(8) in the environment where there are > multiple RA servers on the segment. In such case, rtsold(8) will be > your friend. > Copied: stable/8/etc/rc.d/rtsold (from r203433, head/etc/rc.d/rtsold) > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ stable/8/etc/rc.d/rtsold Sat Feb 27 18:19:13 2010 (r204421, copy of r203433, head/etc/rc.d/rtsold) > @@ -0,0 +1,26 @@ > +#!/bin/sh > +# > +# $FreeBSD$ > +# > + > +# PROVIDE: rtsold > +# REQUIRE: netif > +# BEFORE: NETWORKING > +# KEYWORD: nojail Sorry for not speaking up sooner. This needs the shutdown KEYWORD added since it starts a persistent service. Otherwise it looks good! Doug -- ... and that's just a little bit of history repeating. -- Propellerheads Improve the effectiveness of your Internet presence with a domain name makeover! http://SupersetSolutions.com/ From owner-svn-src-stable-8@FreeBSD.ORG Sat Feb 27 19:05:04 2010 Return-Path: Delivered-To: svn-src-stable-8@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 85B971065672; Sat, 27 Feb 2010 19:05:04 +0000 (UTC) (envelope-from ume@mahoroba.org) Received: from mail.mahoroba.org (ent.mahoroba.org [IPv6:2001:2f0:104:8010::1]) by mx1.freebsd.org (Postfix) with ESMTP id 39D168FC16; Sat, 27 Feb 2010 19:05:04 +0000 (UTC) Received: from ameno.mahoroba.org (IDENT:UdPBBjMJv9xcquac+/TNXpWlVxSd9BFN9TZfYq3ZduFnxjQHiQ7Yg1t9vq66d0RF@ameno.mahoroba.org [IPv6:2001:2f0:104:8010:20a:79ff:fe69:ee6b]) (user=ume mech=DIGEST-MD5 bits=0) by mail.mahoroba.org (8.14.4/8.14.4) with ESMTP/inet6 id o1RJ4vxO028337 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 28 Feb 2010 04:04:58 +0900 (JST) (envelope-from ume@mahoroba.org) Date: Sun, 28 Feb 2010 04:04:57 +0900 Message-ID: From: Hajimu UMEMOTO To: Doug Barton In-Reply-To: <4B8969B3.4040207@FreeBSD.org> References: <201002271819.o1RIJDmD036382@svn.freebsd.org> <4B8969B3.4040207@FreeBSD.org> User-Agent: xcite1.58> Wanderlust/2.15.9 (Almost Unreal) SEMI/1.14.6 (Maruoka) FLIM/1.14.9 (=?ISO-2022-JP-2?B?R29qGyQoRCtXGyhC?=) APEL/10.7 Emacs/23.1 (i386-portbld-freebsd8.0) MULE/6.0 (HANACHIRUSATO) X-Operating-System: FreeBSD 8.0-RELEASE-p2 X-PGP-Key: http://www.imasy.or.jp/~ume/publickey.asc X-PGP-Fingerprint: 1F00 0B9E 2164 70FC 6DC5 BF5F 04E9 F086 BF90 71FE Organization: Internet Mutual Aid Society, YOKOHAMA MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=US-ASCII X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.3 (mail.mahoroba.org [IPv6:2001:2f0:104:8010::1]); Sun, 28 Feb 2010 04:04:58 +0900 (JST) X-Virus-Scanned: clamav-milter 0.95.3 at asuka.mahoroba.org X-Virus-Status: Clean X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham version=3.3.0 X-Spam-Checker-Version: SpamAssassin 3.3.0 (2010-01-18) on asuka.mahoroba.org 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: r204421 - in stable/8/etc: . defaults rc.d X-BeenThere: svn-src-stable-8@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for only the 8-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 27 Feb 2010 19:05:04 -0000 Hi, >>>>> On Sat, 27 Feb 2010 10:51:31 -0800 >>>>> Doug Barton said: dougb> Sorry for not speaking up sooner. This needs the shutdown KEYWORD added dougb> since it starts a persistent service. Otherwise it looks good! No problem. I've just committed the fix. Thank you for pointing this out. Sincerely, -- Hajimu UMEMOTO @ Internet Mutual Aid Society Yokohama, Japan ume@mahoroba.org ume@{,jp.}FreeBSD.org http://www.imasy.org/~ume/