From owner-svn-src-stable@FreeBSD.ORG Sun Aug 14 00:32:44 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57B55106566C; Sun, 14 Aug 2011 00:32:44 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 46A118FC13; Sun, 14 Aug 2011 00:32:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7E0Wi52039449; Sun, 14 Aug 2011 00:32:44 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7E0WioD039447; Sun, 14 Aug 2011 00:32:44 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201108140032.p7E0WioD039447@svn.freebsd.org> From: Rick Macklem Date: Sun, 14 Aug 2011 00:32:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224858 - stable/8/sys/fs/nfsclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 00:32:44 -0000 Author: rmacklem Date: Sun Aug 14 00:32:43 2011 New Revision: 224858 URL: http://svn.freebsd.org/changeset/base/224858 Log: MFC: r224532 The new NFS client failed to vput() the new vnode if a setattr failed after the file was created in nfs_create(). This would probably only happen during a forced dismount. The old NFS client does have a vput() for this case. Detected by pho during recent testing, where an open syscall returned with a vnode still locked. Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.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) Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clvnops.c Sun Aug 14 00:20:37 2011 (r224857) +++ stable/8/sys/fs/nfsclient/nfs_clvnops.c Sun Aug 14 00:32:43 2011 (r224858) @@ -1544,6 +1544,8 @@ again: if (attrflag) (void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL, 0, 1); + if (error != 0) + vput(newvp); } } if (!error) { From owner-svn-src-stable@FreeBSD.ORG Sun Aug 14 00:55:19 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 67E4C106564A; Sun, 14 Aug 2011 00:55:19 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E62378FC12; Sun, 14 Aug 2011 00:55:18 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7E0tIOH040250; Sun, 14 Aug 2011 00:55:18 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7E0tIQD040248; Sun, 14 Aug 2011 00:55:18 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201108140055.p7E0tIQD040248@svn.freebsd.org> From: Rick Macklem Date: Sun, 14 Aug 2011 00:55: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: r224860 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Aug 2011 00:55:19 -0000 Author: rmacklem Date: Sun Aug 14 00:55:18 2011 New Revision: 224860 URL: http://svn.freebsd.org/changeset/base/224860 Log: MFC: r224554 Fix rename in the new NFS server so that it does not require a recursive vnode lock on the directory for the case where the new file name is in the same directory as the old one. The patch handles this as a special case, recognized by the new directory having the same file handle as the old one and just VREF()s the old dir vnode for this case, instead of doing a second VFS_FHTOVP() to get it. This is required so that the server will work for file systems like msdosfs, that do not support recursive vnode locking. This problem was discovered during recent testing by pho@ when exporting an msdosfs file system via the new NFS server. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.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) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Sun Aug 14 00:42:09 2011 (r224859) +++ stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Sun Aug 14 00:55:18 2011 (r224860) @@ -1425,6 +1425,7 @@ nfsrvd_rename(struct nfsrv_descript *nd, struct nfsrvfh tfh; char *bufp, *tbufp = NULL; u_long *hashp; + fhandle_t fh; if (nd->nd_repstat) { nfsrv_wcc(nd, fdirfor_ret, &fdirfor, fdiraft_ret, &fdiraft); @@ -1450,19 +1451,34 @@ nfsrvd_rename(struct nfsrv_descript *nd, tnes = *toexp; tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd->nd_cred, p, 0); } else { + tfh.nfsrvfh_len = 0; error = nfsrv_mtofh(nd, &tfh); + if (error == 0) + error = nfsvno_getfh(dp, &fh, p); if (error) { vput(dp); /* todp is always NULL except NFSv4 */ nfsvno_relpathbuf(&fromnd); goto out; } - nd->nd_cred->cr_uid = nd->nd_saveduid; - nfsd_fhtovp(nd, &tfh, LK_EXCLUSIVE, &tdp, &tnes, NULL, 0, p); - if (tdp) { + + /* If this is the same file handle, just VREF() the vnode. */ + if (tfh.nfsrvfh_len == NFSX_MYFH && + !NFSBCMP(tfh.nfsrvfh_data, &fh, NFSX_MYFH)) { + VREF(dp); + tdp = dp; + tnes = *exp; tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, nd->nd_cred, p, 1); - NFSVOPUNLOCK(tdp, 0); + } else { + nd->nd_cred->cr_uid = nd->nd_saveduid; + nfsd_fhtovp(nd, &tfh, LK_EXCLUSIVE, &tdp, &tnes, NULL, + 0, p); + if (tdp) { + tdirfor_ret = nfsvno_getattr(tdp, &tdirfor, + nd->nd_cred, p, 1); + NFSVOPUNLOCK(tdp, 0); + } } } NFSNAMEICNDSET(&tond.ni_cnd, nd->nd_cred, RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART); From owner-svn-src-stable@FreeBSD.ORG Mon Aug 15 09:26:53 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 884B8106564A; Mon, 15 Aug 2011 09:26:53 +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 6D5FB8FC0C; Mon, 15 Aug 2011 09:26:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7F9Qrgp002418; Mon, 15 Aug 2011 09:26:53 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7F9QrUc002414; Mon, 15 Aug 2011 09:26:53 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108150926.p7F9QrUc002414@svn.freebsd.org> From: Konstantin Belousov Date: Mon, 15 Aug 2011 09:26:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224878 - in stable/8/sys: compat/linprocfs vm X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 09:26:53 -0000 Author: kib Date: Mon Aug 15 09:26:53 2011 New Revision: 224878 URL: http://svn.freebsd.org/changeset/base/224878 Log: MFC r224582: Implement the linprocfs swaps file. Modified: stable/8/sys/compat/linprocfs/linprocfs.c stable/8/sys/vm/swap_pager.c stable/8/sys/vm/swap_pager.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) Modified: stable/8/sys/compat/linprocfs/linprocfs.c ============================================================================== --- stable/8/sys/compat/linprocfs/linprocfs.c Mon Aug 15 09:07:42 2011 (r224877) +++ stable/8/sys/compat/linprocfs/linprocfs.c Mon Aug 15 09:26:53 2011 (r224878) @@ -499,6 +499,33 @@ linprocfs_dostat(PFS_FILL_ARGS) return (0); } +static int +linprocfs_doswaps(PFS_FILL_ARGS) +{ + struct xswdev xsw; + uintmax_t total, used; + int n; + char devname[SPECNAMELEN + 1]; + + sbuf_printf(sb, "Filename\t\t\t\tType\t\tSize\tUsed\tPriority\n"); + mtx_lock(&Giant); + for (n = 0; ; n++) { + if (swap_dev_info(n, &xsw, devname, sizeof(devname)) != 0) + break; + total = (uintmax_t)xsw.xsw_nblks * PAGE_SIZE / 1024; + used = (uintmax_t)xsw.xsw_used * PAGE_SIZE / 1024; + + /* + * The space and not tab after the device name is on + * purpose. Linux does so. + */ + sbuf_printf(sb, "/dev/%-34s unknown\t\t%jd\t%jd\t-1\n", + devname, total, used); + } + mtx_unlock(&Giant); + return (0); +} + /* * Filler function for proc/uptime */ @@ -1453,6 +1480,8 @@ linprocfs_init(PFS_INIT_ARGS) NULL, NULL, NULL, 0); pfs_create_file(root, "stat", &linprocfs_dostat, NULL, NULL, NULL, PFS_RD); + pfs_create_file(root, "swaps", &linprocfs_doswaps, + NULL, NULL, NULL, PFS_RD); pfs_create_file(root, "uptime", &linprocfs_douptime, NULL, NULL, NULL, PFS_RD); pfs_create_file(root, "version", &linprocfs_doversion, Modified: stable/8/sys/vm/swap_pager.c ============================================================================== --- stable/8/sys/vm/swap_pager.c Mon Aug 15 09:07:42 2011 (r224877) +++ stable/8/sys/vm/swap_pager.c Mon Aug 15 09:26:53 2011 (r224878) @@ -2361,35 +2361,53 @@ swap_pager_status(int *total, int *used) mtx_unlock(&sw_dev_mtx); } -static int -sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) +int +swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len) { - int *name = (int *)arg1; - int error, n; - struct xswdev xs; struct swdevt *sp; - - if (arg2 != 1) /* name length */ - return (EINVAL); + char *tmp_devname; + int error, n; n = 0; + error = ENOENT; mtx_lock(&sw_dev_mtx); TAILQ_FOREACH(sp, &swtailq, sw_list) { - if (n == *name) { - mtx_unlock(&sw_dev_mtx); - xs.xsw_version = XSWDEV_VERSION; - xs.xsw_dev = sp->sw_dev; - xs.xsw_flags = sp->sw_flags; - xs.xsw_nblks = sp->sw_nblks; - xs.xsw_used = sp->sw_used; - - error = SYSCTL_OUT(req, &xs, sizeof(xs)); - return (error); + if (n != name) { + n++; + continue; + } + xs->xsw_version = XSWDEV_VERSION; + xs->xsw_dev = sp->sw_dev; + xs->xsw_flags = sp->sw_flags; + xs->xsw_nblks = sp->sw_nblks; + xs->xsw_used = sp->sw_used; + if (devname != NULL) { + if (vn_isdisk(sp->sw_vp, NULL)) + tmp_devname = sp->sw_vp->v_rdev->si_name; + else + tmp_devname = "[file]"; + strncpy(devname, tmp_devname, len); } - n++; + error = 0; + break; } mtx_unlock(&sw_dev_mtx); - return (ENOENT); + return (error); +} + +static int +sysctl_vm_swap_info(SYSCTL_HANDLER_ARGS) +{ + struct xswdev xs; + int error; + + if (arg2 != 1) /* name length */ + return (EINVAL); + error = swap_dev_info(*(int *)arg1, &xs, NULL, 0); + if (error != 0) + return (error); + error = SYSCTL_OUT(req, &xs, sizeof(xs)); + return (error); } SYSCTL_INT(_vm, OID_AUTO, nswapdev, CTLFLAG_RD, &nswapdev, 0, Modified: stable/8/sys/vm/swap_pager.h ============================================================================== --- stable/8/sys/vm/swap_pager.h Mon Aug 15 09:07:42 2011 (r224877) +++ stable/8/sys/vm/swap_pager.h Mon Aug 15 09:26:53 2011 (r224878) @@ -75,7 +75,8 @@ struct swdevt { extern int swap_pager_full; extern int swap_pager_avail; -struct swdevt; +struct xswdev; +int swap_dev_info(int name, struct xswdev *xs, char *devname, size_t len); void swap_pager_copy(vm_object_t, vm_object_t, vm_pindex_t, int); void swap_pager_freespace(vm_object_t, vm_pindex_t, vm_size_t); void swap_pager_swap_init(void); From owner-svn-src-stable@FreeBSD.ORG Mon Aug 15 14:19:26 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BE40910656B6; Mon, 15 Aug 2011 14:19:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AB8F58FC1E; Mon, 15 Aug 2011 14:19:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7FEJQAx013990; Mon, 15 Aug 2011 14:19:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7FEJQeO013986; Mon, 15 Aug 2011 14:19:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108151419.p7FEJQeO013986@svn.freebsd.org> From: Alexander Motin Date: Mon, 15 Aug 2011 14:19: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: r224886 - in stable/8: lib/libusbhid usr.bin/usbhidaction usr.bin/usbhidctl X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 14:19:26 -0000 Author: mav Date: Mon Aug 15 14:19:26 2011 New Revision: 224886 URL: http://svn.freebsd.org/changeset/base/224886 Log: MFC r224511: - Fix usbhidctl and usbhidaction to handle HID devices with multiple report ids, such as multimedia keyboards. - Add collection type and report id to the `usbhidctl -r` output. They are important for proper device understanding and debugging. - Fix usbhidaction tool to properly handle items having report_count more then 1. Modified: stable/8/lib/libusbhid/parse.c stable/8/usr.bin/usbhidaction/usbhidaction.c stable/8/usr.bin/usbhidctl/usbhid.c Directory Properties: stable/8/lib/libusbhid/ (props changed) stable/8/usr.bin/usbhidaction/ (props changed) stable/8/usr.bin/usbhidctl/ (props changed) Modified: stable/8/lib/libusbhid/parse.c ============================================================================== --- stable/8/lib/libusbhid/parse.c Mon Aug 15 14:00:55 2011 (r224885) +++ stable/8/lib/libusbhid/parse.c Mon Aug 15 14:19:26 2011 (r224886) @@ -322,6 +322,8 @@ hid_get_item(hid_data_t s, hid_item_t *h * one and one item: */ c->report_count = 1; + c->usage_minimum = 0; + c->usage_maximum = 0; } else { s->ncount = 1; } @@ -512,13 +514,14 @@ hid_report_size(report_desc_t r, enum hi uint32_t temp; uint32_t hpos; uint32_t lpos; + int report_id = 0; hpos = 0; lpos = 0xFFFFFFFF; memset(&h, 0, sizeof h); for (d = hid_start_parse(r, 1 << k, id); hid_get_item(d, &h); ) { - if (h.report_ID == id && h.kind == k) { + if ((h.report_ID == id || id < 0) && h.kind == k) { /* compute minimum */ if (lpos > h.pos) lpos = h.pos; @@ -527,6 +530,8 @@ hid_report_size(report_desc_t r, enum hi /* compute maximum */ if (hpos < temp) hpos = temp; + if (h.report_ID != 0) + report_id = 1; } } hid_end_parse(d); @@ -537,11 +542,8 @@ hid_report_size(report_desc_t r, enum hi else temp = hpos - lpos; - if (id) - temp += 8; - /* return length in bytes rounded up */ - return ((temp + 7) / 8); + return ((temp + 7) / 8 + report_id); } int Modified: stable/8/usr.bin/usbhidaction/usbhidaction.c ============================================================================== --- stable/8/usr.bin/usbhidaction/usbhidaction.c Mon Aug 15 14:00:55 2011 (r224885) +++ stable/8/usr.bin/usbhidaction/usbhidaction.c Mon Aug 15 14:19:26 2011 (r224886) @@ -99,12 +99,12 @@ main(int argc, char **argv) char buf[100]; char devnamebuf[PATH_MAX]; struct command *cmd; - int reportid; + int reportid = -1; demon = 1; ignore = 0; dieearly = 0; - while ((ch = getopt(argc, argv, "c:def:ip:t:v")) != -1) { + while ((ch = getopt(argc, argv, "c:def:ip:r:t:v")) != -1) { switch(ch) { case 'c': conf = optarg; @@ -124,6 +124,9 @@ main(int argc, char **argv) case 'p': pidfile = optarg; break; + case 'r': + reportid = atoi(optarg); + break; case 't': table = optarg; break; @@ -153,14 +156,13 @@ main(int argc, char **argv) fd = open(dev, O_RDWR); if (fd < 0) err(1, "%s", dev); - reportid = hid_get_report_id(fd); repd = hid_get_report_desc(fd); if (repd == NULL) err(1, "hid_get_report_desc() failed"); commands = parse_conf(conf, repd, reportid, ignore); - sz = (size_t)hid_report_size(repd, hid_input, reportid); + sz = (size_t)hid_report_size(repd, hid_input, -1); if (verbose) printf("report size %zu\n", sz); @@ -204,7 +206,23 @@ main(int argc, char **argv) } #endif for (cmd = commands; cmd; cmd = cmd->next) { - val = hid_get_data(buf, &cmd->item); + if (cmd->item.report_ID != 0 && + buf[0] != cmd->item.report_ID) + continue; + if (cmd->item.flags & HIO_VARIABLE) + val = hid_get_data(buf, &cmd->item); + else { + uint32_t pos = cmd->item.pos; + for (i = 0; i < cmd->item.report_count; i++) { + val = hid_get_data(buf, &cmd->item); + if (val == cmd->value) + break; + cmd->item.pos += cmd->item.report_size; + } + cmd->item.pos = pos; + val = (i < cmd->item.report_count) ? + cmd->value : -1; + } if (cmd->value != val && cmd->anyvalue == 0) goto next; if ((cmd->debounce == 0) || Modified: stable/8/usr.bin/usbhidctl/usbhid.c ============================================================================== --- stable/8/usr.bin/usbhidctl/usbhid.c Mon Aug 15 14:00:55 2011 (r224885) +++ stable/8/usr.bin/usbhidctl/usbhid.c Mon Aug 15 14:19:26 2011 (r224886) @@ -53,7 +53,6 @@ int verbose = 0; int all = 0; int noname = 0; int hexdump = 0; -static int reportid; char **names; int nnames; @@ -108,11 +107,12 @@ dumpitem(const char *label, struct hid_i { if ((h->flags & HIO_CONST) && !verbose) return; - printf("%s size=%d count=%d page=%s usage=%s%s", label, - h->report_size, h->report_count, + printf("%s rid=%d size=%d count=%d page=%s usage=%s%s%s", label, + h->report_ID, h->report_size, h->report_count, hid_usage_page(HID_PAGE(h->usage)), hid_usage_in_page(h->usage), - h->flags & HIO_CONST ? " Const" : ""); + h->flags & HIO_CONST ? " Const" : "", + h->flags & HIO_VARIABLE ? "" : " Array"); printf(", logical range %d..%d", h->logical_minimum, h->logical_maximum); if (h->physical_minimum != h->physical_maximum) @@ -123,6 +123,24 @@ dumpitem(const char *label, struct hid_i printf("\n"); } +static const char * +hid_collection_type(int32_t type) +{ + static char num[8]; + + switch (type) { + case 0: return ("Physical"); + case 1: return ("Application"); + case 2: return ("Logical"); + case 3: return ("Report"); + case 4: return ("Named_Array"); + case 5: return ("Usage_Switch"); + case 6: return ("Usage_Modifier"); + } + snprintf(num, sizeof(num), "0x%02x", type); + return (num); +} + void dumpitems(report_desc_t r) { @@ -130,10 +148,11 @@ dumpitems(report_desc_t r) struct hid_item h; int size; - for (d = hid_start_parse(r, ~0, reportid); hid_get_item(d, &h); ) { + for (d = hid_start_parse(r, ~0, -1); hid_get_item(d, &h); ) { switch (h.kind) { case hid_collection: - printf("Collection page=%s usage=%s\n", + printf("Collection type=%s page=%s usage=%s\n", + hid_collection_type(h.collection), hid_usage_page(HID_PAGE(h.usage)), hid_usage_in_page(h.usage)); break; @@ -152,13 +171,13 @@ dumpitems(report_desc_t r) } } hid_end_parse(d); - size = hid_report_size(r, hid_input, 0); + size = hid_report_size(r, hid_input, -1); printf("Total input size %d bytes\n", size); - size = hid_report_size(r, hid_output, 0); + size = hid_report_size(r, hid_output, -1); printf("Total output size %d bytes\n", size); - size = hid_report_size(r, hid_feature, 0); + size = hid_report_size(r, hid_feature, -1); printf("Total feature size %d bytes\n", size); } @@ -187,14 +206,17 @@ prdata(u_char *buf, struct hid_item *h) pos = h->pos; for (i = 0; i < h->report_count; i++) { data = hid_get_data(buf, h); + if (i > 0) + printf(" "); if (h->logical_minimum < 0) printf("%d", (int)data); else printf("%u", data); if (hexdump) printf(" [0x%x]", data); - pos += h->report_size; + h->pos += h->report_size; } + h->pos = pos; } void @@ -209,7 +231,7 @@ dumpdata(int f, report_desc_t rd, int lo char namebuf[10000], *namep; hids = 0; - for (d = hid_start_parse(rd, 1<next) { + if (n->report_ID != 0 && dbuf[0] != n->report_ID) + continue; namep = namebuf; namep += sprintf(namep, "%s:%s.", hid_usage_page(HID_PAGE(n->collection)), @@ -249,7 +273,7 @@ dumpdata(int f, report_desc_t rd, int lo if (all || gotname(namebuf)) { if (!noname) printf("%s=", namebuf); - prdata(dbuf + (reportid != 0), n); + prdata(dbuf, n); printf("\n"); } } From owner-svn-src-stable@FreeBSD.ORG Mon Aug 15 17:08:55 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5AC36106564A; Mon, 15 Aug 2011 17:08:55 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 49ACC8FC13; Mon, 15 Aug 2011 17:08:55 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7FH8tJB019185; Mon, 15 Aug 2011 17:08:55 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7FH8ti4019182; Mon, 15 Aug 2011 17:08:55 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201108151708.p7FH8ti4019182@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 15 Aug 2011 17:08: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: r224891 - in stable/8/sys: dev/re pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 17:08:55 -0000 Author: yongari Date: Mon Aug 15 17:08:54 2011 New Revision: 224891 URL: http://svn.freebsd.org/changeset/base/224891 Log: MFC r224506: Add new device id of D-Link DGE-530T Rev. C controller. DGE-503T Rev A1 and B1 is supported by sk(4) but the DGE-530T Rev. C controller is re-branded RealTek 8169 controller. PR: kern/159116 Modified: stable/8/sys/dev/re/if_re.c stable/8/sys/pci/if_rlreg.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) Modified: stable/8/sys/dev/re/if_re.c ============================================================================== --- stable/8/sys/dev/re/if_re.c Mon Aug 15 16:06:28 2011 (r224890) +++ stable/8/sys/dev/re/if_re.c Mon Aug 15 17:08:54 2011 (r224891) @@ -174,6 +174,8 @@ TUNABLE_INT("hw.re.prefer_iomap", &prefe static struct rl_type re_devs[] = { { DLINK_VENDORID, DLINK_DEVICEID_528T, 0, "D-Link DGE-528(T) Gigabit Ethernet Adapter" }, + { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0, + "D-Link DGE-530(T) Gigabit Ethernet Adapter" }, { RT_VENDORID, RT_DEVICEID_8139, 0, "RealTek 8139C+ 10/100BaseTX" }, { RT_VENDORID, RT_DEVICEID_8101E, 0, Modified: stable/8/sys/pci/if_rlreg.h ============================================================================== --- stable/8/sys/pci/if_rlreg.h Mon Aug 15 16:06:28 2011 (r224890) +++ stable/8/sys/pci/if_rlreg.h Mon Aug 15 17:08:54 2011 (r224891) @@ -1042,6 +1042,7 @@ struct rl_softc { * D-Link DFE-5280T device ID */ #define DLINK_DEVICEID_528T 0x4300 +#define DLINK_DEVICEID_530T_REVC 0x4302 /* * D-Link DFE-690TXD device ID From owner-svn-src-stable@FreeBSD.ORG Mon Aug 15 17:10:23 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0B38106564A; Mon, 15 Aug 2011 17:10:23 +0000 (UTC) (envelope-from yongari@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id BFC858FC1D; Mon, 15 Aug 2011 17:10:23 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7FHANCu019272; Mon, 15 Aug 2011 17:10:23 GMT (envelope-from yongari@svn.freebsd.org) Received: (from yongari@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7FHANnA019269; Mon, 15 Aug 2011 17:10:23 GMT (envelope-from yongari@svn.freebsd.org) Message-Id: <201108151710.p7FHANnA019269@svn.freebsd.org> From: Pyun YongHyeon Date: Mon, 15 Aug 2011 17:10:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224892 - in stable/7/sys: dev/re pci X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Aug 2011 17:10:23 -0000 Author: yongari Date: Mon Aug 15 17:10:23 2011 New Revision: 224892 URL: http://svn.freebsd.org/changeset/base/224892 Log: MFC r224506: Add new device id of D-Link DGE-530T Rev. C controller. DGE-503T Rev A1 and B1 is supported by sk(4) but the DGE-530T Rev. C controller is re-branded RealTek 8169 controller. PR: kern/159116 Modified: stable/7/sys/dev/re/if_re.c stable/7/sys/pci/if_rlreg.h Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/dev/re/if_re.c ============================================================================== --- stable/7/sys/dev/re/if_re.c Mon Aug 15 17:08:54 2011 (r224891) +++ stable/7/sys/dev/re/if_re.c Mon Aug 15 17:10:23 2011 (r224892) @@ -174,6 +174,8 @@ TUNABLE_INT("hw.re.prefer_iomap", &prefe static struct rl_type re_devs[] = { { DLINK_VENDORID, DLINK_DEVICEID_528T, 0, "D-Link DGE-528(T) Gigabit Ethernet Adapter" }, + { DLINK_VENDORID, DLINK_DEVICEID_530T_REVC, 0, + "D-Link DGE-530(T) Gigabit Ethernet Adapter" }, { RT_VENDORID, RT_DEVICEID_8139, 0, "RealTek 8139C+ 10/100BaseTX" }, { RT_VENDORID, RT_DEVICEID_8101E, 0, Modified: stable/7/sys/pci/if_rlreg.h ============================================================================== --- stable/7/sys/pci/if_rlreg.h Mon Aug 15 17:08:54 2011 (r224891) +++ stable/7/sys/pci/if_rlreg.h Mon Aug 15 17:10:23 2011 (r224892) @@ -1042,6 +1042,7 @@ struct rl_softc { * D-Link DFE-5280T device ID */ #define DLINK_DEVICEID_528T 0x4300 +#define DLINK_DEVICEID_530T_REVC 0x4302 /* * D-Link DFE-690TXD device ID From owner-svn-src-stable@FreeBSD.ORG Tue Aug 16 08:41:10 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 221D9106564A; Tue, 16 Aug 2011 08:41:10 +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 119EE8FC0C; Tue, 16 Aug 2011 08:41:10 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7G8f9WQ048744; Tue, 16 Aug 2011 08:41:09 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7G8f9FZ048742; Tue, 16 Aug 2011 08:41:09 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108160841.p7G8f9FZ048742@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 16 Aug 2011 08:41:09 +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: r224904 - stable/8/sys/fs/devfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 08:41:10 -0000 Author: kib Date: Tue Aug 16 08:41:09 2011 New Revision: 224904 URL: http://svn.freebsd.org/changeset/base/224904 Log: MFC r224743: Do not update mountpoint generation counter to the value which was not yet acted upon by devfs_populate(). Modified: stable/8/sys/fs/devfs/devfs_devs.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) Modified: stable/8/sys/fs/devfs/devfs_devs.c ============================================================================== --- stable/8/sys/fs/devfs/devfs_devs.c Tue Aug 16 08:34:16 2011 (r224903) +++ stable/8/sys/fs/devfs/devfs_devs.c Tue Aug 16 08:41:09 2011 (r224904) @@ -505,13 +505,15 @@ devfs_populate_loop(struct devfs_mount * void devfs_populate(struct devfs_mount *dm) { + unsigned gen; sx_assert(&dm->dm_lock, SX_XLOCKED); - if (dm->dm_generation == devfs_generation) + gen = devfs_generation; + if (dm->dm_generation == gen) return; while (devfs_populate_loop(dm, 0)) continue; - dm->dm_generation = devfs_generation; + dm->dm_generation = gen; } /* From owner-svn-src-stable@FreeBSD.ORG Tue Aug 16 09:06:44 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D3947106566B; Tue, 16 Aug 2011 09:06:44 +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 C33B18FC08; Tue, 16 Aug 2011 09:06:44 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7G96i80049610; Tue, 16 Aug 2011 09:06:44 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7G96iqn049608; Tue, 16 Aug 2011 09:06:44 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201108160906.p7G96iqn049608@svn.freebsd.org> From: Konstantin Belousov Date: Tue, 16 Aug 2011 09:06:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224906 - stable/7/sys/fs/devfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 09:06:44 -0000 Author: kib Date: Tue Aug 16 09:06:44 2011 New Revision: 224906 URL: http://svn.freebsd.org/changeset/base/224906 Log: MFC r224743: Do not update mountpoint generation counter to the value which was not yet acted upon by devfs_populate(). Modified: stable/7/sys/fs/devfs/devfs_devs.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/fs/devfs/devfs_devs.c ============================================================================== --- stable/7/sys/fs/devfs/devfs_devs.c Tue Aug 16 08:41:37 2011 (r224905) +++ stable/7/sys/fs/devfs/devfs_devs.c Tue Aug 16 09:06:44 2011 (r224906) @@ -481,13 +481,15 @@ devfs_populate_loop(struct devfs_mount * void devfs_populate(struct devfs_mount *dm) { + unsigned gen; sx_assert(&dm->dm_lock, SX_XLOCKED); - if (dm->dm_generation == devfs_generation) + gen = devfs_generation; + if (dm->dm_generation == gen) return; while (devfs_populate_loop(dm, 0)) continue; - dm->dm_generation = devfs_generation; + dm->dm_generation = gen; } /* From owner-svn-src-stable@FreeBSD.ORG Tue Aug 16 10:52:29 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id ACBD3106566B; Tue, 16 Aug 2011 10:52:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9C3328FC14; Tue, 16 Aug 2011 10:52:29 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7GAqTfk054837; Tue, 16 Aug 2011 10:52:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7GAqTvK054835; Tue, 16 Aug 2011 10:52:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201108161052.p7GAqTvK054835@svn.freebsd.org> From: Alexander Motin Date: Tue, 16 Aug 2011 10:52:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224908 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Aug 2011 10:52:29 -0000 Author: mav Date: Tue Aug 16 10:52:29 2011 New Revision: 224908 URL: http://svn.freebsd.org/changeset/base/224908 Log: MFC r224728: Do not block zero report ID. It is correct value for devices with single ID. This fixes USB_SET_IMMED call (synchronous operation) of the uhid(4) driver on devices with single report ID. Modified: stable/8/sys/dev/usb/usb_request.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) Modified: stable/8/sys/dev/usb/usb_request.c ============================================================================== --- stable/8/sys/dev/usb/usb_request.c Tue Aug 16 09:07:59 2011 (r224907) +++ stable/8/sys/dev/usb/usb_request.c Tue Aug 16 10:52:29 2011 (r224908) @@ -1769,7 +1769,7 @@ usbd_req_get_report(struct usb_device *u struct usb_interface *iface = usbd_get_iface(udev, iface_index); struct usb_device_request req; - if ((iface == NULL) || (iface->idesc == NULL) || (id == 0)) { + if ((iface == NULL) || (iface->idesc == NULL)) { return (USB_ERR_INVAL); } DPRINTFN(5, "len=%d\n", len); From owner-svn-src-stable@FreeBSD.ORG Wed Aug 17 14:29:33 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76F921065670; Wed, 17 Aug 2011 14:29:33 +0000 (UTC) (envelope-from deischen@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6580C8FC17; Wed, 17 Aug 2011 14:29:33 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HETXoW009108; Wed, 17 Aug 2011 14:29:33 GMT (envelope-from deischen@svn.freebsd.org) Received: (from deischen@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HETXEF009106; Wed, 17 Aug 2011 14:29:33 GMT (envelope-from deischen@svn.freebsd.org) Message-Id: <201108171429.p7HETXEF009106@svn.freebsd.org> From: Daniel Eischen Date: Wed, 17 Aug 2011 14:29:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224941 - stable/7/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 14:29:33 -0000 Author: deischen Date: Wed Aug 17 14:29:33 2011 New Revision: 224941 URL: http://svn.freebsd.org/changeset/base/224941 Log: MFC r218627 Allow SO_SETFIB to select/set the default routing table. Requested by: Andrew Boyer aboyer at averesystems dot com. Modified: stable/7/sys/kern/uipc_socket.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/uipc_socket.c ============================================================================== --- stable/7/sys/kern/uipc_socket.c Wed Aug 17 14:28:58 2011 (r224940) +++ stable/7/sys/kern/uipc_socket.c Wed Aug 17 14:29:33 2011 (r224941) @@ -2207,15 +2207,16 @@ sosetopt(struct socket *so, struct socko case SO_SETFIB: error = sooptcopyin(sopt, &optval, sizeof optval, sizeof optval); - if (optval < 1 || optval > rt_numfibs) { + if (optval < 0 || optval > rt_numfibs) { error = EINVAL; goto bad; } - if ((so->so_proto->pr_domain->dom_family == PF_INET) || - (so->so_proto->pr_domain->dom_family == PF_ROUTE)) { + if (so->so_proto != NULL && + ((so->so_proto->pr_domain->dom_family == PF_INET) || + (so->so_proto->pr_domain->dom_family == PF_ROUTE))) { so->so_fibnum = optval; /* Note: ignore error */ - if (so->so_proto && so->so_proto->pr_ctloutput) + if (so->so_proto->pr_ctloutput) (*so->so_proto->pr_ctloutput)(so, sopt); } else { so->so_fibnum = 0; From owner-svn-src-stable@FreeBSD.ORG Wed Aug 17 15:19:26 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 04441106564A; Wed, 17 Aug 2011 15:19:26 +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 E70768FC16; Wed, 17 Aug 2011 15:19:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HFJPBZ010890; Wed, 17 Aug 2011 15:19:25 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HFJPp1010888; Wed, 17 Aug 2011 15:19:25 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201108171519.p7HFJPp1010888@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 17 Aug 2011 15:19: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: r224944 - stable/8/usr.bin/rs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 15:19:26 -0000 Author: jh Date: Wed Aug 17 15:19:25 2011 New Revision: 224944 URL: http://svn.freebsd.org/changeset/base/224944 Log: MFC r218410: Handle EOF when skipping lines. Modified: stable/8/usr.bin/rs/rs.c Directory Properties: stable/8/usr.bin/rs/ (props changed) Modified: stable/8/usr.bin/rs/rs.c ============================================================================== --- stable/8/usr.bin/rs/rs.c Wed Aug 17 15:13:07 2011 (r224943) +++ stable/8/usr.bin/rs/rs.c Wed Aug 17 15:19:25 2011 (r224944) @@ -130,14 +130,17 @@ getfile(void) char *p; char *endp; char **ep; + int c; int multisep = (flags & ONEISEPONLY ? 0 : 1); int nullpad = flags & NULLPAD; char **padto; while (skip--) { - getline(); + c = getline(); if (flags & SKIPPRINT) puts(curline); + if (c == EOF) + return; } getline(); if (flags & NOARGS && curlen < owidth) From owner-svn-src-stable@FreeBSD.ORG Wed Aug 17 15:22:58 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BD8C81065672; Wed, 17 Aug 2011 15:22:58 +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 92A1C8FC18; Wed, 17 Aug 2011 15:22:58 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HFMwNW011067; Wed, 17 Aug 2011 15:22:58 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HFMwgj011065; Wed, 17 Aug 2011 15:22:58 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201108171522.p7HFMwgj011065@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 17 Aug 2011 15:22:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224945 - stable/8/usr.bin/rs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 15:22:58 -0000 Author: jh Date: Wed Aug 17 15:22:58 2011 New Revision: 224945 URL: http://svn.freebsd.org/changeset/base/224945 Log: MFC r218411: - Use LINE_MAX from limits.h as the maximum line length instead of BUFSIZ. Use LINE_MAX * 2 as the buffer size (BSIZE). - Error out if we encounter a line longer than LINE_MAX. The previous behavior was to silently split long lines and produce corrupted output. PR: bin/151384 Modified: stable/8/usr.bin/rs/rs.c Directory Properties: stable/8/usr.bin/rs/ (props changed) Modified: stable/8/usr.bin/rs/rs.c ============================================================================== --- stable/8/usr.bin/rs/rs.c Wed Aug 17 15:19:25 2011 (r224944) +++ stable/8/usr.bin/rs/rs.c Wed Aug 17 15:22:58 2011 (r224945) @@ -52,6 +52,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -332,8 +333,8 @@ prepfile(void) warnx("%d is colwidths, nelem %d", colwidths[i], nelem);*/ } -#define BSIZE 2048 -char ibuf[BSIZE]; /* two screenfuls should do */ +#define BSIZE (LINE_MAX * 2) +char ibuf[BSIZE]; int getline(void) /* get line; maintain curline, curlen; manage storage */ @@ -354,7 +355,7 @@ getline(void) /* get line; maintain curl curline = ibuf; } } - if (!putlength && endblock - curline < BUFSIZ) { /* need storage */ + if (!putlength && endblock - curline < LINE_MAX + 1) { /* need storage */ /*ww = endblock-curline; tt += ww;*/ /*printf("#wasted %d total %d\n",ww,tt);*/ if (!(curline = (char *) malloc(BSIZE))) @@ -362,11 +363,16 @@ getline(void) /* get line; maintain curl endblock = curline + BSIZE; /*printf("#endb %d curline %d\n",endblock,curline);*/ } - for (p = curline, i = 1; i < BUFSIZ; *p++ = c, i++) - if ((c = getchar()) == EOF || c == '\n') + for (p = curline, i = 0;; *p++ = c, i++) { + if ((c = getchar()) == EOF) break; + if (i >= LINE_MAX) + errx(1, "maximum line length (%d) exceeded", LINE_MAX); + if (c == '\n') + break; + } *p = '\0'; - curlen = i - 1; + curlen = i; return(c); } From owner-svn-src-stable@FreeBSD.ORG Wed Aug 17 15:24:25 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 8EB15106566B; Wed, 17 Aug 2011 15:24:25 +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 7D8578FC19; Wed, 17 Aug 2011 15:24:25 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HFOPHs011167; Wed, 17 Aug 2011 15:24:25 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HFOPQL011165; Wed, 17 Aug 2011 15:24:25 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201108171524.p7HFOPQL011165@svn.freebsd.org> From: Jaakko Heinonen Date: Wed, 17 Aug 2011 15:24: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: r224946 - stable/8/usr.bin/rs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 15:24:25 -0000 Author: jh Date: Wed Aug 17 15:24:25 2011 New Revision: 224946 URL: http://svn.freebsd.org/changeset/base/224946 Log: MFC r219038: Document the input line length limit. Modified: stable/8/usr.bin/rs/rs.1 Directory Properties: stable/8/usr.bin/rs/ (props changed) Modified: stable/8/usr.bin/rs/rs.1 ============================================================================== --- stable/8/usr.bin/rs/rs.1 Wed Aug 17 15:22:58 2011 (r224945) +++ stable/8/usr.bin/rs/rs.1 Wed Aug 17 15:24:25 2011 (r224946) @@ -32,7 +32,7 @@ .\" @(#)rs.1 8.2 (Berkeley) 12/30/93 .\" $FreeBSD$ .\" -.Dd July 30, 2004 +.Dd February 25, 2011 .Dt RS 1 .Os .Sh NAME @@ -241,4 +241,9 @@ Re-ordering of columns is not yet possib There are too many options. .It Multibyte characters are not recognized. +.It +Lines longer than +.Dv LINE_MAX +(2048) bytes are not processed and result in immediate termination of +.Nm . .El From owner-svn-src-stable@FreeBSD.ORG Wed Aug 17 17:04:43 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D9812106566C; Wed, 17 Aug 2011 17:04:43 +0000 (UTC) (envelope-from gavin@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id C7CA08FC13; Wed, 17 Aug 2011 17:04:43 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HH4hVN014730; Wed, 17 Aug 2011 17:04:43 GMT (envelope-from gavin@svn.freebsd.org) Received: (from gavin@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HH4hb2014727; Wed, 17 Aug 2011 17:04:43 GMT (envelope-from gavin@svn.freebsd.org) Message-Id: <201108171704.p7HH4hb2014727@svn.freebsd.org> From: Gavin Atkinson Date: Wed, 17 Aug 2011 17:04:43 +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: r224948 - stable/8/sys/dev/ichwd X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 17:04:44 -0000 Author: gavin Date: Wed Aug 17 17:04:43 2011 New Revision: 224948 URL: http://svn.freebsd.org/changeset/base/224948 Log: Merge r211908 from head (originally by jfv): Add Intel Cougar Point PCH LPC Controller Device IDs for watchdog support. Also add additional Intel Ibex Peak (5 Series/3400 Series) PCH IDs. PR: kern/159800 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) Modified: stable/8/sys/dev/ichwd/ichwd.c ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.c Wed Aug 17 15:45:40 2011 (r224947) +++ stable/8/sys/dev/ichwd/ichwd.c Wed Aug 17 17:04:43 2011 (r224948) @@ -110,7 +110,53 @@ 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_PCH, "Intel PCH watchdog timer", 10 }, + { DEVICEID_PCHM, "Intel PCH watchdog timer", 10 }, + { DEVICEID_P55, "Intel P55 watchdog timer", 10 }, + { DEVICEID_PM55, "Intel PM55 watchdog timer", 10 }, { DEVICEID_H55, "Intel H55 watchdog timer", 10 }, + { DEVICEID_QM57, "Intel QM57 watchdog timer", 10 }, + { DEVICEID_H57, "Intel H57 watchdog timer", 10 }, + { DEVICEID_HM55, "Intel HM55 watchdog timer", 10 }, + { DEVICEID_Q57, "Intel Q57 watchdog timer", 10 }, + { DEVICEID_HM57, "Intel HM57 watchdog timer", 10 }, + { DEVICEID_PCHMSFF, "Intel PCHMSFF watchdog timer", 10 }, + { DEVICEID_QS57, "Intel QS57 watchdog timer", 10 }, + { DEVICEID_3400, "Intel 3400 watchdog timer", 10 }, + { DEVICEID_3420, "Intel 3420 watchdog timer", 10 }, + { DEVICEID_3450, "Intel 3450 watchdog timer", 10 }, + { DEVICEID_CPT0, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT1, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT2, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT3, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT4, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT5, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT6, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT7, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT8, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT9, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT10, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT11, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT12, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT13, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT14, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT15, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT16, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT17, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT18, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT19, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT20, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT21, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT22, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT23, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT23, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT25, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT26, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT27, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT28, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT29, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT30, "Intel Cougar Point watchdog timer", 10 }, + { DEVICEID_CPT31, "Intel Cougar Point watchdog timer", 10 }, { DEVICEID_PATSBURG_LPC1, "Intel Patsburg watchdog timer", 10 }, { DEVICEID_PATSBURG_LPC2, "Intel Patsburg watchdog timer", 10 }, { DEVICEID_PPT0, "Intel Panther Point watchdog timer", 10 }, Modified: stable/8/sys/dev/ichwd/ichwd.h ============================================================================== --- stable/8/sys/dev/ichwd/ichwd.h Wed Aug 17 15:45:40 2011 (r224947) +++ stable/8/sys/dev/ichwd/ichwd.h Wed Aug 17 17:04:43 2011 (r224948) @@ -65,6 +65,38 @@ struct ichwd_softc { }; #define VENDORID_INTEL 0x8086 +#define DEVICEID_CPT0 0x1c40 +#define DEVICEID_CPT1 0x1c41 +#define DEVICEID_CPT2 0x1c42 +#define DEVICEID_CPT3 0x1c43 +#define DEVICEID_CPT4 0x1c44 +#define DEVICEID_CPT5 0x1c45 +#define DEVICEID_CPT6 0x1c46 +#define DEVICEID_CPT7 0x1c47 +#define DEVICEID_CPT8 0x1c48 +#define DEVICEID_CPT9 0x1c49 +#define DEVICEID_CPT10 0x1c4a +#define DEVICEID_CPT11 0x1c4b +#define DEVICEID_CPT12 0x1c4c +#define DEVICEID_CPT13 0x1c4d +#define DEVICEID_CPT14 0x1c4e +#define DEVICEID_CPT15 0x1c4f +#define DEVICEID_CPT16 0x1c50 +#define DEVICEID_CPT17 0x1c51 +#define DEVICEID_CPT18 0x1c52 +#define DEVICEID_CPT19 0x1c53 +#define DEVICEID_CPT20 0x1c54 +#define DEVICEID_CPT21 0x1c55 +#define DEVICEID_CPT22 0x1c56 +#define DEVICEID_CPT23 0x1c57 +#define DEVICEID_CPT24 0x1c58 +#define DEVICEID_CPT25 0x1c59 +#define DEVICEID_CPT26 0x1c5a +#define DEVICEID_CPT27 0x1c5b +#define DEVICEID_CPT28 0x1c5c +#define DEVICEID_CPT29 0x1c5d +#define DEVICEID_CPT30 0x1c5e +#define DEVICEID_CPT31 0x1c5f #define DEVICEID_PATSBURG_LPC1 0x1d40 #define DEVICEID_PATSBURG_LPC2 0x1d41 #define DEVICEID_PPT0 0x1e40 @@ -136,7 +168,21 @@ struct ichwd_softc { #define DEVICEID_ICH10D 0x3a1a #define DEVICEID_ICH10DO 0x3a14 #define DEVICEID_ICH10R 0x3a16 +#define DEVICEID_PCH 0x3b00 +#define DEVICEID_PCHM 0x3b01 +#define DEVICEID_P55 0x3b02 +#define DEVICEID_PM55 0x3b03 #define DEVICEID_H55 0x3b06 +#define DEVICEID_QM57 0x3b07 +#define DEVICEID_H57 0x3b08 +#define DEVICEID_HM55 0x3b09 +#define DEVICEID_Q57 0x3b0a +#define DEVICEID_HM57 0x3b0b +#define DEVICEID_PCHMSFF 0x3b0d +#define DEVICEID_QS57 0x3b0f +#define DEVICEID_3400 0x3b12 +#define DEVICEID_3420 0x3b14 +#define DEVICEID_3450 0x3b16 /* ICH LPC Interface Bridge Registers (ICH5 and older) */ #define ICH_GEN_STA 0xd4 From owner-svn-src-stable@FreeBSD.ORG Wed Aug 17 20:44:00 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3FBAA1065670; Wed, 17 Aug 2011 20:44:00 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 262898FC16; Wed, 17 Aug 2011 20:44:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HKi09P022297; Wed, 17 Aug 2011 20:44:00 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HKi0Nh022294; Wed, 17 Aug 2011 20:44:00 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201108172044.p7HKi0Nh022294@svn.freebsd.org> From: Rick Macklem Date: Wed, 17 Aug 2011 20:44:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224950 - stable/8/sys/nfsclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 20:44:00 -0000 Author: rmacklem Date: Wed Aug 17 20:43:59 2011 New Revision: 224950 URL: http://svn.freebsd.org/changeset/base/224950 Log: MFC: r224604 Fix a LOR in the NFS client which could cause a deadlock. This was reported to the mailing list freebsd-net@freebsd.org on July 21, 2011 under the subject "LOR with nfsclient sillyrename". The LOR occurred when nfs_inactive() called vrele(sp->s_dvp) while holding the vnode lock on the file in s_dvp. This patch modifies the client so that it performs the vrele(sp->s_dvp) as a separate task to avoid the LOR. This fix was discussed with jhb@ and kib@, who both proposed variations of it. Modified: stable/8/sys/nfsclient/nfs_node.c stable/8/sys/nfsclient/nfsnode.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) Modified: stable/8/sys/nfsclient/nfs_node.c ============================================================================== --- stable/8/sys/nfsclient/nfs_node.c Wed Aug 17 19:43:41 2011 (r224949) +++ stable/8/sys/nfsclient/nfs_node.c Wed Aug 17 20:43:59 2011 (r224950) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -59,6 +60,8 @@ __FBSDID("$FreeBSD$"); static uma_zone_t nfsnode_zone; +static void nfs_freesillyrename(void *arg, __unused int pending); + #define TRUE 1 #define FALSE 0 @@ -185,6 +188,20 @@ nfs_nget(struct mount *mntp, nfsfh_t *fh return (0); } +/* + * Do the vrele(sp->s_dvp) as a separate task in order to avoid a + * deadlock because of a LOR when vrele() locks the directory vnode. + */ +static void +nfs_freesillyrename(void *arg, __unused int pending) +{ + struct sillyrename *sp; + + sp = arg; + vrele(sp->s_dvp); + free(sp, M_NFSREQ); +} + int nfs_inactive(struct vop_inactive_args *ap) { @@ -207,8 +224,8 @@ nfs_inactive(struct vop_inactive_args *a */ (sp->s_removeit)(sp); crfree(sp->s_cred); - vrele(sp->s_dvp); - free((caddr_t)sp, M_NFSREQ); + TASK_INIT(&sp->s_task, 0, nfs_freesillyrename, sp); + taskqueue_enqueue(taskqueue_thread, &sp->s_task); mtx_lock(&np->n_mtx); } np->n_flag &= NMODIFIED; Modified: stable/8/sys/nfsclient/nfsnode.h ============================================================================== --- stable/8/sys/nfsclient/nfsnode.h Wed Aug 17 19:43:41 2011 (r224949) +++ stable/8/sys/nfsclient/nfsnode.h Wed Aug 17 20:43:59 2011 (r224950) @@ -36,6 +36,7 @@ #ifndef _NFSCLIENT_NFSNODE_H_ #define _NFSCLIENT_NFSNODE_H_ +#include #if !defined(_NFSCLIENT_NFS_H_) && !defined(_KERNEL) #include #endif @@ -45,6 +46,7 @@ * can be removed by nfs_inactive() */ struct sillyrename { + struct task s_task; struct ucred *s_cred; struct vnode *s_dvp; int (*s_removeit)(struct sillyrename *sp); From owner-svn-src-stable@FreeBSD.ORG Wed Aug 17 20:55:57 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 2E828106566C; Wed, 17 Aug 2011 20:55:57 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 15C708FC14; Wed, 17 Aug 2011 20:55:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7HKtu4R022697; Wed, 17 Aug 2011 20:55:56 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7HKtuSC022694; Wed, 17 Aug 2011 20:55:56 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201108172055.p7HKtuSC022694@svn.freebsd.org> From: Rick Macklem Date: Wed, 17 Aug 2011 20:55:56 +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: r224951 - stable/8/sys/fs/nfsclient X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Aug 2011 20:55:57 -0000 Author: rmacklem Date: Wed Aug 17 20:55:56 2011 New Revision: 224951 URL: http://svn.freebsd.org/changeset/base/224951 Log: MFC: r224606 Fix a LOR in the NFS client which could cause a deadlock. This was reported to the mailing list freebsd-net@freebsd.org on July 21, 2011 under the subject "LOR with nfsclient sillyrename". The LOR occurred when nfs_inactive() called vrele(sp->s_dvp) while holding the vnode lock on the file in s_dvp. This patch modifies the client so that it performs the vrele(sp->s_dvp) as a separate task to avoid the LOR. This fix was discussed with jhb@ and kib@, who both proposed variations of it. Modified: stable/8/sys/fs/nfsclient/nfs_clnode.c stable/8/sys/fs/nfsclient/nfsnode.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) Modified: stable/8/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- stable/8/sys/fs/nfsclient/nfs_clnode.c Wed Aug 17 20:43:59 2011 (r224950) +++ stable/8/sys/fs/nfsclient/nfs_clnode.c Wed Aug 17 20:55:56 2011 (r224951) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -62,6 +63,8 @@ MALLOC_DECLARE(M_NEWNFSREQ); uma_zone_t newnfsnode_zone; +static void nfs_freesillyrename(void *arg, __unused int pending); + void ncl_nhinit(void) { @@ -183,6 +186,20 @@ ncl_nget(struct mount *mntp, u_int8_t *f return (0); } +/* + * Do the vrele(sp->s_dvp) as a separate task in order to avoid a + * deadlock because of a LOR when vrele() locks the directory vnode. + */ +static void +nfs_freesillyrename(void *arg, __unused int pending) +{ + struct sillyrename *sp; + + sp = arg; + vrele(sp->s_dvp); + free(sp, M_NEWNFSREQ); +} + int ncl_inactive(struct vop_inactive_args *ap) { @@ -217,8 +234,8 @@ ncl_inactive(struct vop_inactive_args *a */ ncl_removeit(sp, vp); crfree(sp->s_cred); - vrele(sp->s_dvp); - FREE((caddr_t)sp, M_NEWNFSREQ); + TASK_INIT(&sp->s_task, 0, nfs_freesillyrename, sp); + taskqueue_enqueue(taskqueue_thread, &sp->s_task); mtx_lock(&np->n_mtx); } np->n_flag &= NMODIFIED; Modified: stable/8/sys/fs/nfsclient/nfsnode.h ============================================================================== --- stable/8/sys/fs/nfsclient/nfsnode.h Wed Aug 17 20:43:59 2011 (r224950) +++ stable/8/sys/fs/nfsclient/nfsnode.h Wed Aug 17 20:55:56 2011 (r224951) @@ -35,11 +35,14 @@ #ifndef _NFSCLIENT_NFSNODE_H_ #define _NFSCLIENT_NFSNODE_H_ +#include + /* * Silly rename structure that hangs off the nfsnode until the name * can be removed by nfs_inactive() */ struct sillyrename { + struct task s_task; struct ucred *s_cred; struct vnode *s_dvp; long s_namlen; From owner-svn-src-stable@FreeBSD.ORG Thu Aug 18 00:05:09 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A71281065676; Thu, 18 Aug 2011 00:05:09 +0000 (UTC) (envelope-from zack@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 9669A8FC13; Thu, 18 Aug 2011 00:05:09 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7I059aa028463; Thu, 18 Aug 2011 00:05:09 GMT (envelope-from zack@svn.freebsd.org) Received: (from zack@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7I059rB028461; Thu, 18 Aug 2011 00:05:09 GMT (envelope-from zack@svn.freebsd.org) Message-Id: <201108180005.p7I059rB028461@svn.freebsd.org> From: Zack Kirsch Date: Thu, 18 Aug 2011 00:05:09 +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: r224953 - stable/8/sys/fs/nfsserver X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 00:05:09 -0000 Author: zack Date: Thu Aug 18 00:05:09 2011 New Revision: 224953 URL: http://svn.freebsd.org/changeset/base/224953 Log: MFC r224637: Fix an NFS server issue where it was not correctly setting the eof flag when a READ had hit the end of the file. Also, clean up some cruft in the code. Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.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) Modified: stable/8/sys/fs/nfsserver/nfs_nfsdserv.c ============================================================================== --- stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Wed Aug 17 23:59:55 2011 (r224952) +++ stable/8/sys/fs/nfsserver/nfs_nfsdserv.c Thu Aug 18 00:05:09 2011 (r224953) @@ -620,7 +620,7 @@ nfsrvd_read(struct nfsrv_descript *nd, _ vnode_t vp, NFSPROC_T *p, struct nfsexstuff *exp) { u_int32_t *tl; - int error = 0, cnt, len, getret = 1, reqlen, eof = 0; + int error = 0, cnt, getret = 1, reqlen, eof = 0; mbuf_t m2, m3; struct nfsvattr nva; off_t off = 0x0; @@ -714,11 +714,11 @@ nfsrvd_read(struct nfsrv_descript *nd, _ eof = 1; } else if (reqlen == 0) cnt = 0; - else if ((off + reqlen) > nva.na_size) + else if ((off + reqlen) >= nva.na_size) { cnt = nva.na_size - off; - else + eof = 1; + } else cnt = reqlen; - len = NFSM_RNDUP(cnt); m3 = NULL; if (cnt > 0) { nd->nd_repstat = nfsvno_read(vp, off, cnt, nd->nd_cred, p, @@ -748,7 +748,7 @@ nfsrvd_read(struct nfsrv_descript *nd, _ *tl++ = txdr_unsigned(cnt); } else NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - if (len < reqlen || eof) + if (eof) *tl++ = newnfs_true; else *tl++ = newnfs_false; From owner-svn-src-stable@FreeBSD.ORG Thu Aug 18 07:34:11 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C14251065675; Thu, 18 Aug 2011 07:34:11 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AFCFD8FC1E; Thu, 18 Aug 2011 07:34:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7I7YBSb042385; Thu, 18 Aug 2011 07:34:11 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7I7YBVu042383; Thu, 18 Aug 2011 07:34:11 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201108180734.p7I7YBVu042383@svn.freebsd.org> From: Martin Matuska Date: Thu, 18 Aug 2011 07:34:11 +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: r224959 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 07:34:11 -0000 Author: mm Date: Thu Aug 18 07:34:11 2011 New Revision: 224959 URL: http://svn.freebsd.org/changeset/base/224959 Log: MFC r224605: Fix panic in zfs_read() if IO_SYNC flag supplied by checking for zfsvfs->z_log before calling zil_commit(). [1] Do not call zfs_read() from zfs_getextattr() with the IO_SYNC flag. Submitted by: Alexander Zagrebin [1] Reviewed by: pjd Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_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) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Aug 18 04:44:41 2011 (r224958) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Thu Aug 18 07:34:11 2011 (r224959) @@ -618,7 +618,8 @@ zfs_read(vnode_t *vp, uio_t *uio, int io /* * If we're in FRSYNC mode, sync out this znode before reading it. */ - if (ioflag & FRSYNC || zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS) + if (zfsvfs->z_log && + (ioflag & FRSYNC || zfsvfs->z_os->os_sync == ZFS_SYNC_ALWAYS)) zil_commit(zfsvfs->z_log, zp->z_id); /* @@ -6345,7 +6346,7 @@ vop_getextattr { if (error == 0) *ap->a_size = (size_t)va.va_size; } else if (ap->a_uio != NULL) - error = VOP_READ(vp, ap->a_uio, IO_UNIT | IO_SYNC, ap->a_cred); + error = VOP_READ(vp, ap->a_uio, IO_UNIT, ap->a_cred); VOP_UNLOCK(vp, 0); vn_close(vp, flags, ap->a_cred, td); From owner-svn-src-stable@FreeBSD.ORG Thu Aug 18 08:25:27 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 74159106566B; Thu, 18 Aug 2011 08:25:27 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 620098FC08; Thu, 18 Aug 2011 08:25:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7I8PRpi045286; Thu, 18 Aug 2011 08:25:27 GMT (envelope-from hselasky@svn.freebsd.org) Received: (from hselasky@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7I8PRv6045281; Thu, 18 Aug 2011 08:25:27 GMT (envelope-from hselasky@svn.freebsd.org) Message-Id: <201108180825.p7I8PRv6045281@svn.freebsd.org> From: Hans Petter Selasky Date: Thu, 18 Aug 2011 08:25:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r224960 - stable/8/sys/dev/usb X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 18 Aug 2011 08:25:27 -0000 Author: hselasky Date: Thu Aug 18 08:25:27 2011 New Revision: 224960 URL: http://svn.freebsd.org/changeset/base/224960 Log: MFC r224777: Use synchronous device destruction instead of asynchronous. Modified: stable/8/sys/dev/usb/usb_dev.c stable/8/sys/dev/usb/usb_device.c stable/8/sys/dev/usb/usb_device.h stable/8/sys/dev/usb/usbdi.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) Modified: stable/8/sys/dev/usb/usb_dev.c ============================================================================== --- stable/8/sys/dev/usb/usb_dev.c Thu Aug 18 07:34:11 2011 (r224959) +++ stable/8/sys/dev/usb/usb_dev.c Thu Aug 18 08:25:27 2011 (r224960) @@ -1648,7 +1648,6 @@ usb_fifo_attach(struct usb_device *udev, struct usb_fifo *f_rx; char devname[32]; uint8_t n; - struct usb_fs_privdata* pd; f_sc->fp[USB_FIFO_TX] = NULL; f_sc->fp[USB_FIFO_RX] = NULL; @@ -1746,22 +1745,10 @@ usb_fifo_attach(struct usb_device *udev, usb_alloc_symlink(devname); } - /* - * Initialize device private data - this is used to find the - * actual USB device itself. - */ - pd = malloc(sizeof(struct usb_fs_privdata), M_USBDEV, M_WAITOK | M_ZERO); - pd->bus_index = device_get_unit(udev->bus->bdev); - pd->dev_index = udev->device_index; - pd->ep_addr = -1; /* not an endpoint */ - pd->fifo_index = f_tx->fifo_index & f_rx->fifo_index; - pd->mode = FREAD|FWRITE; - - /* Now, create the device itself */ - f_sc->dev = make_dev(&usb_devsw, 0, uid, gid, mode, - "%s", devname); - /* XXX setting si_drv1 and creating the device is not atomic! */ - f_sc->dev->si_drv1 = pd; + /* Create the device */ + f_sc->dev = usb_make_dev(udev, devname, -1, + f_tx->fifo_index & f_rx->fifo_index, + FREAD|FWRITE, uid, gid, mode); } DPRINTFN(2, "attached %p/%p\n", f_tx, f_rx); @@ -1814,12 +1801,6 @@ usb_fifo_free_buffer(struct usb_fifo *f) bzero(&f->used_q, sizeof(f->used_q)); } -static void -usb_fifo_cleanup(void* ptr) -{ - free(ptr, M_USBDEV); -} - void usb_fifo_detach(struct usb_fifo_sc *f_sc) { @@ -1832,11 +1813,9 @@ usb_fifo_detach(struct usb_fifo_sc *f_sc f_sc->fp[USB_FIFO_TX] = NULL; f_sc->fp[USB_FIFO_RX] = NULL; - if (f_sc->dev != NULL) { - destroy_dev_sched_cb(f_sc->dev, - usb_fifo_cleanup, f_sc->dev->si_drv1); - f_sc->dev = NULL; - } + usb_destroy_dev(f_sc->dev); + + f_sc->dev = NULL; DPRINTFN(2, "detached %p\n", f_sc); } Modified: stable/8/sys/dev/usb/usb_device.c ============================================================================== --- stable/8/sys/dev/usb/usb_device.c Thu Aug 18 07:34:11 2011 (r224959) +++ stable/8/sys/dev/usb/usb_device.c Thu Aug 18 08:25:27 2011 (r224960) @@ -102,10 +102,8 @@ static void usb_notify_addq(const char * #endif #if USB_HAVE_UGEN static void usb_fifo_free_wrap(struct usb_device *, uint8_t, uint8_t); -static struct cdev *usb_make_dev(struct usb_device *, int, int); static void usb_cdev_create(struct usb_device *); static void usb_cdev_free(struct usb_device *); -static void usb_cdev_cleanup(void *); #endif /* This variable is global to allow easy access to it: */ @@ -1626,10 +1624,12 @@ usb_alloc_device(device_t parent_dev, st LIST_INIT(&udev->pd_list); /* Create the control endpoint device */ - udev->ctrl_dev = usb_make_dev(udev, 0, FREAD|FWRITE); + udev->ctrl_dev = usb_make_dev(udev, NULL, 0, 0, + FREAD|FWRITE, UID_ROOT, GID_OPERATOR, 0600); /* Create a link from /dev/ugenX.X to the default endpoint */ - make_dev_alias(udev->ctrl_dev, "%s", udev->ugen_name); + if (udev->ctrl_dev != NULL) + make_dev_alias(udev->ctrl_dev->cdev, "%s", udev->ugen_name); #endif /* Initialise device */ if (bus->methods->device_init != NULL) { @@ -1884,11 +1884,12 @@ done: } #if USB_HAVE_UGEN -static struct cdev * -usb_make_dev(struct usb_device *udev, int ep, int mode) +struct usb_fs_privdata * +usb_make_dev(struct usb_device *udev, const char *devname, int ep, + int fi, int rwmode, uid_t uid, gid_t gid, int mode) { struct usb_fs_privdata* pd; - char devname[20]; + char buffer[32]; /* Store information to locate ourselves again later */ pd = malloc(sizeof(struct usb_fs_privdata), M_USBDEV, @@ -1896,16 +1897,39 @@ usb_make_dev(struct usb_device *udev, in pd->bus_index = device_get_unit(udev->bus->bdev); pd->dev_index = udev->device_index; pd->ep_addr = ep; - pd->mode = mode; + pd->fifo_index = fi; + pd->mode = rwmode; /* Now, create the device itself */ - snprintf(devname, sizeof(devname), "%u.%u.%u", - pd->bus_index, pd->dev_index, pd->ep_addr); - pd->cdev = make_dev(&usb_devsw, 0, UID_ROOT, - GID_OPERATOR, 0600, USB_DEVICE_DIR "/%s", devname); + if (devname == NULL) { + devname = buffer; + snprintf(buffer, sizeof(buffer), USB_DEVICE_DIR "/%u.%u.%u", + pd->bus_index, pd->dev_index, pd->ep_addr); + } + + pd->cdev = make_dev(&usb_devsw, 0, uid, gid, mode, "%s", devname); + + if (pd->cdev == NULL) { + DPRINTFN(0, "Failed to create device %s\n", devname); + free(pd, M_USBDEV); + return (NULL); + } + + /* XXX setting si_drv1 and creating the device is not atomic! */ pd->cdev->si_drv1 = pd; - return (pd->cdev); + return (pd); +} + +void +usb_destroy_dev(struct usb_fs_privdata *pd) +{ + if (pd == NULL) + return; + + destroy_dev(pd->cdev); + + free(pd, M_USBDEV); } static void @@ -1915,7 +1939,6 @@ usb_cdev_create(struct usb_device *udev) struct usb_endpoint_descriptor *ed; struct usb_descriptor *desc; struct usb_fs_privdata* pd; - struct cdev *dev; int inmode, outmode, inmask, outmask, mode; uint8_t ep; @@ -1957,14 +1980,16 @@ usb_cdev_create(struct usb_device *udev) /* Create all available endpoints except EP0 */ for (ep = 1; ep < 16; ep++) { - mode = inmask & (1 << ep) ? inmode : 0; - mode |= outmask & (1 << ep) ? outmode : 0; + mode = (inmask & (1 << ep)) ? inmode : 0; + mode |= (outmask & (1 << ep)) ? outmode : 0; if (mode == 0) continue; /* no IN or OUT endpoint */ - dev = usb_make_dev(udev, ep, mode); - pd = dev->si_drv1; - LIST_INSERT_HEAD(&udev->pd_list, pd, pd_next); + pd = usb_make_dev(udev, NULL, ep, 0, + mode, UID_ROOT, GID_OPERATOR, 0600); + + if (pd != NULL) + LIST_INSERT_HEAD(&udev->pd_list, pd, pd_next); } } @@ -1972,25 +1997,16 @@ static void usb_cdev_free(struct usb_device *udev) { struct usb_fs_privdata* pd; - struct cdev* pcdev; DPRINTFN(2, "Freeing device nodes\n"); while ((pd = LIST_FIRST(&udev->pd_list)) != NULL) { KASSERT(pd->cdev->si_drv1 == pd, ("privdata corrupt")); - pcdev = pd->cdev; - pd->cdev = NULL; LIST_REMOVE(pd, pd_next); - if (pcdev != NULL) - destroy_dev_sched_cb(pcdev, usb_cdev_cleanup, pd); - } -} -static void -usb_cdev_cleanup(void* arg) -{ - free(arg, M_USBDEV); + usb_destroy_dev(pd); + } } #endif @@ -2046,8 +2062,7 @@ usb_free_device(struct usb_device *udev, } mtx_unlock(&usb_ref_lock); - destroy_dev_sched_cb(udev->ctrl_dev, usb_cdev_cleanup, - udev->ctrl_dev->si_drv1); + usb_destroy_dev(udev->ctrl_dev); #endif if (udev->flags.usb_mode == USB_MODE_DEVICE) { Modified: stable/8/sys/dev/usb/usb_device.h ============================================================================== --- stable/8/sys/dev/usb/usb_device.h Thu Aug 18 07:34:11 2011 (r224959) +++ stable/8/sys/dev/usb/usb_device.h Thu Aug 18 08:25:27 2011 (r224960) @@ -29,6 +29,7 @@ struct usb_symlink; /* UGEN */ struct usb_device; /* linux compat */ +struct usb_fs_privdata; #define USB_CTRL_XFER_MAX 2 @@ -135,7 +136,7 @@ struct usb_device { #if USB_HAVE_UGEN struct usb_fifo *fifo[USB_FIFO_MAX]; struct usb_symlink *ugen_symlink; /* our generic symlink */ - struct cdev *ctrl_dev; /* Control Endpoint 0 device node */ + struct usb_fs_privdata *ctrl_dev; /* Control Endpoint 0 device node */ LIST_HEAD(,usb_fs_privdata) pd_list; char ugen_name[20]; /* name of ugenX.X device */ #endif @@ -202,6 +203,11 @@ struct usb_device *usb_alloc_device(devi struct usb_device *parent_hub, uint8_t depth, uint8_t port_index, uint8_t port_no, enum usb_dev_speed speed, enum usb_hc_mode mode); +#if USB_HAVE_UGEN +struct usb_fs_privdata *usb_make_dev(struct usb_device *, const char *, + int, int, int, uid_t, gid_t, int); +void usb_destroy_dev(struct usb_fs_privdata *); +#endif usb_error_t usb_probe_and_attach(struct usb_device *udev, uint8_t iface_index); void usb_detach_device(struct usb_device *, uint8_t, uint8_t); Modified: stable/8/sys/dev/usb/usbdi.h ============================================================================== --- stable/8/sys/dev/usb/usbdi.h Thu Aug 18 07:34:11 2011 (r224959) +++ stable/8/sys/dev/usb/usbdi.h Thu Aug 18 08:25:27 2011 (r224960) @@ -37,6 +37,7 @@ struct usb_page_search; struct usb_process; struct usb_proc_msg; struct usb_mbuf; +struct usb_fs_privdata; struct mbuf; typedef enum { /* keep in sync with usb_errstr_table */ @@ -449,7 +450,7 @@ struct usb_fifo_methods { struct usb_fifo_sc { struct usb_fifo *fp[2]; - struct cdev* dev; + struct usb_fs_privdata *dev; }; const char *usbd_errstr(usb_error_t error); From owner-svn-src-stable@FreeBSD.ORG Fri Aug 19 01:11:07 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3C3C6106564A; Fri, 19 Aug 2011 01:11:07 +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 22AED8FC08; Fri, 19 Aug 2011 01:11:07 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7J1B7CG081004; Fri, 19 Aug 2011 01:11:07 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7J1B7Gx081002; Fri, 19 Aug 2011 01:11:07 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201108190111.p7J1B7Gx081002@svn.freebsd.org> From: Xin LI Date: Fri, 19 Aug 2011 01:11:07 +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: r224991 - stable/8/sys/dev/arcmsr X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 01:11:07 -0000 Author: delphij Date: Fri Aug 19 01:11:06 2011 New Revision: 224991 URL: http://svn.freebsd.org/changeset/base/224991 Log: MFC r224905: Update arcmsr(4) to 1.20.00.22 to solve recursive acquisition of buffer mutex, which would lead to a deadlock. Many thanks to Areca for their continued support of FreeBSD. Submitted by: Ching Huang Tested by: Willem Jan Withagen Modified: stable/8/sys/dev/arcmsr/arcmsr.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) Modified: stable/8/sys/dev/arcmsr/arcmsr.c ============================================================================== --- stable/8/sys/dev/arcmsr/arcmsr.c Fri Aug 19 00:44:37 2011 (r224990) +++ stable/8/sys/dev/arcmsr/arcmsr.c Fri Aug 19 01:11:06 2011 (r224991) @@ -68,6 +68,7 @@ ** 1.20.00.21 02/08/2011 Ching Huang Implement I/O request timeout ** 02/14/2011 Ching Huang Modified pktRequestCount ** 1.20.00.21 03/03/2011 Ching Huang if a command timeout, then wait its ccb back before free it +** 1.20.00.22 07/04/2011 Ching Huang Fixed multiple MTX panic ****************************************************************************************** * $FreeBSD$ */ @@ -150,7 +151,7 @@ #define arcmsr_callout_init(a) callout_init(a); #endif -#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.21 2010-03-03" +#define ARCMSR_DRIVER_VERSION "Driver Version 1.20.00.22 2011-07-04" #include #define SRB_SIZE ((sizeof(struct CommandControlBlock)+0x1f) & 0xffe0) #define ARCMSR_SRBS_POOL_SIZE (SRB_SIZE * ARCMSR_MAX_FREESRB_NUM) @@ -1293,11 +1294,15 @@ static void arcmsr_stop_adapter_bgrb(str static void arcmsr_poll(struct cam_sim * psim) { struct AdapterControlBlock *acb; + int mutex; acb = (struct AdapterControlBlock *)cam_sim_softc(psim); - ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); + mutex = mtx_owned(&acb->qbuffer_lock); + if( mutex == 0 ) + ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); arcmsr_interrupt(acb); - ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); + if( mutex == 0 ) + ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); return; } /* @@ -2089,8 +2094,11 @@ struct CommandControlBlock * arcmsr_get_ { struct CommandControlBlock *srb=NULL; u_int32_t workingsrb_startindex, workingsrb_doneindex; + int mutex; - ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); + mutex = mtx_owned(&acb->qbuffer_lock); + if( mutex == 0 ) + ARCMSR_LOCK_ACQUIRE(&acb->qbuffer_lock); workingsrb_doneindex=acb->workingsrb_doneindex; workingsrb_startindex=acb->workingsrb_startindex; srb=acb->srbworkingQ[workingsrb_startindex]; @@ -2101,7 +2109,8 @@ struct CommandControlBlock * arcmsr_get_ } else { srb=NULL; } - ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); + if( mutex == 0 ) + ARCMSR_LOCK_RELEASE(&acb->qbuffer_lock); return(srb); } /* From owner-svn-src-stable@FreeBSD.ORG Fri Aug 19 09:06:00 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E10FD106570B; Fri, 19 Aug 2011 09:06:00 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id CFB798FC20; Fri, 19 Aug 2011 09:06:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7J960Ff095611; Fri, 19 Aug 2011 09:06:00 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7J960T9095609; Fri, 19 Aug 2011 09:06:00 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <201108190906.p7J960T9095609@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Fri, 19 Aug 2011 09:06:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225001 - stable/8/sys/netipsec X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 09:06:01 -0000 Author: vanhu Date: Fri Aug 19 09:06:00 2011 New Revision: 225001 URL: http://svn.freebsd.org/changeset/base/225001 Log: MFC: Release SP's refcount in key_get_spdbyid(). PR: 156676 Submitted by: Tobias Brunner (tobias@strongswan.org) Modified: stable/8/sys/netipsec/key.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netipsec/key.c ============================================================================== --- stable/8/sys/netipsec/key.c Fri Aug 19 09:01:34 2011 (r225000) +++ stable/8/sys/netipsec/key.c Fri Aug 19 09:06:00 2011 (r225001) @@ -2292,6 +2292,7 @@ key_spdget(so, m, mhp) } n = key_setdumpsp(sp, SADB_X_SPDGET, 0, mhp->msg->sadb_msg_pid); + KEY_FREESP(&sp); if (n != NULL) { m_freem(m); return key_sendup_mbuf(so, n, KEY_SENDUP_ONE); From owner-svn-src-stable@FreeBSD.ORG Fri Aug 19 12:08:15 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 7D5FB1065670; Fri, 19 Aug 2011 12:08:15 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6C6858FC13; Fri, 19 Aug 2011 12:08:15 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JC8Fd6002992; Fri, 19 Aug 2011 12:08:15 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JC8Fj9002990; Fri, 19 Aug 2011 12:08:15 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201108191208.p7JC8Fj9002990@svn.freebsd.org> From: Takahashi Yoshihiro Date: Fri, 19 Aug 2011 12:08: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: r225005 - in stable/8/release: . picobsd/floppy.tree/sbin X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 12:08:15 -0000 Author: nyan Date: Fri Aug 19 12:08:15 2011 New Revision: 225005 URL: http://svn.freebsd.org/changeset/base/225005 Log: MFC: revision 224780 Allow to build a release for stable/[78] on a current box and vise versa. Modified: stable/8/release/Makefile Directory Properties: stable/8/release/ (props changed) stable/8/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/8/release/picobsd/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/dhclient-script (props changed) stable/8/release/picobsd/qemu/ (props changed) stable/8/release/picobsd/tinyware/login/ (props changed) stable/8/release/powerpc/ (props changed) Modified: stable/8/release/Makefile ============================================================================== --- stable/8/release/Makefile Fri Aug 19 11:58:05 2011 (r225004) +++ stable/8/release/Makefile Fri Aug 19 12:08:15 2011 (r225005) @@ -583,7 +583,11 @@ release rerelease: echo "fi" >> ${_MK} echo "cd /usr/src/release" >> ${_MK} echo "make obj" >> ${_MK} - echo "make \$${_RELTARGET}" >> ${_MK} + echo "if [ -f Makefile.sysinstall ]; then" >> ${_MK} + echo " make -f Makefile.sysinstall \$${_RELTARGET}" >> ${_MK} + echo "else" >> ${_MK} + echo " make \$${_RELTARGET}" >> ${_MK} + echo "fi" >> ${_MK} echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK} chmod 755 ${_MK} .if defined(NOPORTS) From owner-svn-src-stable@FreeBSD.ORG Fri Aug 19 12:08:54 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C7B24106564A; Fri, 19 Aug 2011 12:08:54 +0000 (UTC) (envelope-from nyan@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B73848FC0C; Fri, 19 Aug 2011 12:08:54 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JC8sF0003048; Fri, 19 Aug 2011 12:08:54 GMT (envelope-from nyan@svn.freebsd.org) Received: (from nyan@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JC8sMQ003046; Fri, 19 Aug 2011 12:08:54 GMT (envelope-from nyan@svn.freebsd.org) Message-Id: <201108191208.p7JC8sMQ003046@svn.freebsd.org> From: Takahashi Yoshihiro Date: Fri, 19 Aug 2011 12:08:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225006 - stable/7/release X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 12:08:54 -0000 Author: nyan Date: Fri Aug 19 12:08:54 2011 New Revision: 225006 URL: http://svn.freebsd.org/changeset/base/225006 Log: MFC: revision 224780 Allow to build a release for stable/[78] on a current box and vise versa. Modified: stable/7/release/Makefile Directory Properties: stable/7/release/ (props changed) stable/7/release/doc/ (props changed) stable/7/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/7/release/picobsd/tinyware/login/ (props changed) Modified: stable/7/release/Makefile ============================================================================== --- stable/7/release/Makefile Fri Aug 19 12:08:15 2011 (r225005) +++ stable/7/release/Makefile Fri Aug 19 12:08:54 2011 (r225006) @@ -584,7 +584,11 @@ release rerelease: echo "fi" >> ${_MK} echo "cd /usr/src/release" >> ${_MK} echo "make obj" >> ${_MK} - echo "make \$${_RELTARGET}" >> ${_MK} + echo "if [ -f Makefile.sysinstall ]; then" >> ${_MK} + echo " make -f Makefile.sysinstall \$${_RELTARGET}" >> ${_MK} + echo "else" >> ${_MK} + echo " make \$${_RELTARGET}" >> ${_MK} + echo "fi" >> ${_MK} echo "echo \">>> make ${.TARGET} for ${TARGET} finished on \`LC_ALL=C TZ=GMT date\`\"" >> ${_MK} chmod 755 ${_MK} .if defined(NOPORTS) From owner-svn-src-stable@FreeBSD.ORG Fri Aug 19 13:41:00 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 668931065672; Fri, 19 Aug 2011 13:41:00 +0000 (UTC) (envelope-from vanhu@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 55B2D8FC21; Fri, 19 Aug 2011 13:41:00 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7JDf09w005973; Fri, 19 Aug 2011 13:41:00 GMT (envelope-from vanhu@svn.freebsd.org) Received: (from vanhu@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7JDf0ph005971; Fri, 19 Aug 2011 13:41:00 GMT (envelope-from vanhu@svn.freebsd.org) Message-Id: <201108191341.p7JDf0ph005971@svn.freebsd.org> From: VANHULLEBUS Yvan Date: Fri, 19 Aug 2011 13:41:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225011 - stable/8/sys/netipsec X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Aug 2011 13:41:00 -0000 Author: vanhu Date: Fri Aug 19 13:41:00 2011 New Revision: 225011 URL: http://svn.freebsd.org/changeset/base/225011 Log: MFC: fixed two race conditions when inserting/removing SAs via PFKey, which can both lead to a kernel panic when adding/removing quickly a lot of SAs. Obtained from: NETASQ Modified: stable/8/sys/netipsec/key.c Directory Properties: stable/8/sys/ (props changed) Modified: stable/8/sys/netipsec/key.c ============================================================================== --- stable/8/sys/netipsec/key.c Fri Aug 19 13:34:05 2011 (r225010) +++ stable/8/sys/netipsec/key.c Fri Aug 19 13:41:00 2011 (r225011) @@ -2866,9 +2866,10 @@ key_newsav(m, mhp, sah, errp, where, tag sa_initref(newsav); newsav->state = SADB_SASTATE_LARVAL; - /* XXX locking??? */ + SAHTREE_LOCK(); LIST_INSERT_TAIL(&sah->savtree[SADB_SASTATE_LARVAL], newsav, secasvar, chain); + SAHTREE_UNLOCK(); done: KEYDEBUG(KEYDEBUG_IPSEC_STAMP, printf("DP %s from %s:%u return SP:%p\n", __func__, @@ -5712,8 +5713,8 @@ key_delete(so, m, mhp) } key_sa_chgstate(sav, SADB_SASTATE_DEAD); - SAHTREE_UNLOCK(); KEY_FREESAV(&sav); + SAHTREE_UNLOCK(); { struct mbuf *n; From owner-svn-src-stable@FreeBSD.ORG Sat Aug 20 07:43:11 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 1B13E106566C; Sat, 20 Aug 2011 07:43:11 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 00C7D8FC1C; Sat, 20 Aug 2011 07:43:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7K7hA4n039488; Sat, 20 Aug 2011 07:43:10 GMT (envelope-from mm@svn.freebsd.org) Received: (from mm@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7K7hAaG039485; Sat, 20 Aug 2011 07:43:10 GMT (envelope-from mm@svn.freebsd.org) Message-Id: <201108200743.p7K7hAaG039485@svn.freebsd.org> From: Martin Matuska Date: Sat, 20 Aug 2011 07:43: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: r225022 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 07:43:11 -0000 Author: mm Date: Sat Aug 20 07:43:10 2011 New Revision: 225022 URL: http://svn.freebsd.org/changeset/base/225022 Log: MFC r224814, r224855: MFC r224814 [1]: Fix race between dmu_objset_prefetch() invoked from zfs_ioc_dataset_list_next() and dsl_dir_destroy_check() indirectly invoked from dmu_recv_existing_end() via dsl_dataset_destroy() by not prefetching temporary clones, as these count as always inconsistent. In addition, do not prefetch hidden datasets at all as we are not going to process these later. Filed as Illumos Bug #1346 MFC r224855: zfs_ioctl.c: improve code readability in zfs_ioc_dataset_list_next() zvol.c: fix calling of dmu_objset_prefetch() in zvol_create_minors() by passing full instead of relative dataset name and prefetching all visible datasets to be processed later instead of just the pool name PR: kern/157728 [1] Tested by: Borja Marcos [1], mm Reviewed by: pjd Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.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) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Aug 20 06:08:31 2011 (r225021) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Aug 20 07:43:10 2011 (r225022) @@ -1963,8 +1963,10 @@ top: uint64_t cookie = 0; int len = sizeof (zc->zc_name) - (p - zc->zc_name); - while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) - (void) dmu_objset_prefetch(zc->zc_name, NULL); + while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) { + if (!dataset_name_hidden(zc->zc_name)) + (void) dmu_objset_prefetch(zc->zc_name, NULL); + } } do { Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Aug 20 06:08:31 2011 (r225021) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c Sat Aug 20 07:43:10 2011 (r225022) @@ -2200,11 +2200,11 @@ zvol_create_minors(const char *name) p = osname + strlen(osname); len = MAXPATHLEN - (p - osname); - if (strchr(name, '/') == NULL) { - /* Prefetch only for pool name. */ - cookie = 0; - while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) - (void) dmu_objset_prefetch(p, NULL); + /* Prefetch the datasets. */ + cookie = 0; + while (dmu_dir_list_next(os, len, p, NULL, &cookie) == 0) { + if (!dataset_name_hidden(osname)) + (void) dmu_objset_prefetch(osname, NULL); } cookie = 0; From owner-svn-src-stable@FreeBSD.ORG Sat Aug 20 11:44:49 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 05F2F106564A; Sat, 20 Aug 2011 11:44:49 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E7D338FC08; Sat, 20 Aug 2011 11:44:48 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KBimT4050307; Sat, 20 Aug 2011 11:44:48 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KBim1e050305; Sat, 20 Aug 2011 11:44:48 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201108201144.p7KBim1e050305@svn.freebsd.org> From: Andriy Gapon Date: Sat, 20 Aug 2011 11:44: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: r225026 - in stable/8/release: doc/en_US.ISO8859-1/hardware picobsd/floppy.tree/sbin X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 11:44:49 -0000 Author: avg Date: Sat Aug 20 11:44:48 2011 New Revision: 225026 URL: http://svn.freebsd.org/changeset/base/225026 Log: MFC r224529: fix a typo/tautology in the release documentation Modified: stable/8/release/doc/en_US.ISO8859-1/hardware/article.sgml Directory Properties: stable/8/release/ (props changed) stable/8/release/doc/en_US.ISO8859-1/hardware/ (props changed) stable/8/release/picobsd/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/ (props changed) stable/8/release/picobsd/floppy.tree/sbin/dhclient-script (props changed) stable/8/release/picobsd/qemu/ (props changed) stable/8/release/picobsd/tinyware/login/ (props changed) stable/8/release/powerpc/ (props changed) Modified: stable/8/release/doc/en_US.ISO8859-1/hardware/article.sgml ============================================================================== --- stable/8/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Aug 20 10:44:13 2011 (r225025) +++ stable/8/release/doc/en_US.ISO8859-1/hardware/article.sgml Sat Aug 20 11:44:48 2011 (r225026) @@ -195,7 +195,7 @@ resources between logical processors within the same CPU. Because this naive scheduling can result in suboptimal performance, under certain circumstances it may be useful to - disable the logical processors with the the + disable the logical processors with the machdep.hlt_logical_cpus sysctl variable. It is also possible to halt any CPU in the idle loop with the machdep.hlt_cpus sysctl variable. The From owner-svn-src-stable@FreeBSD.ORG Sat Aug 20 11:47:11 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 86129106564A; Sat, 20 Aug 2011 11:47:11 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 74D2C8FC08; Sat, 20 Aug 2011 11:47:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KBlBDZ050434; Sat, 20 Aug 2011 11:47:11 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KBlBJC050432; Sat, 20 Aug 2011 11:47:11 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201108201147.p7KBlBJC050432@svn.freebsd.org> From: Andriy Gapon Date: Sat, 20 Aug 2011 11:47:11 +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: r225027 - stable/8/lib/libproc X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 11:47:11 -0000 Author: avg Date: Sat Aug 20 11:47:11 2011 New Revision: 225027 URL: http://svn.freebsd.org/changeset/base/225027 Log: MFC r224632: fix a serious bug in libproc's proc_attach PR: bin/158431 Modified: stable/8/lib/libproc/proc_create.c Directory Properties: stable/8/lib/libproc/ (props changed) Modified: stable/8/lib/libproc/proc_create.c ============================================================================== --- stable/8/lib/libproc/proc_create.c Sat Aug 20 11:44:48 2011 (r225026) +++ stable/8/lib/libproc/proc_create.c Sat Aug 20 11:47:11 2011 (r225027) @@ -79,12 +79,11 @@ proc_attach(pid_t pid, int flags, struct else phdl->status = PS_STOP; +out: if (error) proc_free(phdl); else *pphdl = phdl; -out: - proc_free(phdl); return (error); } From owner-svn-src-stable@FreeBSD.ORG Sat Aug 20 11:50:02 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 93821106564A; Sat, 20 Aug 2011 11:50:02 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 6F6618FC0A; Sat, 20 Aug 2011 11:50:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KBo20E050571; Sat, 20 Aug 2011 11:50:02 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KBo2n6050570; Sat, 20 Aug 2011 11:50:02 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201108201150.p7KBo2n6050570@svn.freebsd.org> From: Andriy Gapon Date: Sat, 20 Aug 2011 11:50: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: r225028 - stable/8/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 11:50:02 -0000 Author: avg Date: Sat Aug 20 11:50:02 2011 New Revision: 225028 URL: http://svn.freebsd.org/changeset/base/225028 Log: MFC r224527: smp_rendezvous: master cpu should wait until all slaves are fully done Modified: stable/8/sys/kern/subr_smp.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) Modified: stable/8/sys/kern/subr_smp.c ============================================================================== --- stable/8/sys/kern/subr_smp.c Sat Aug 20 11:47:11 2011 (r225027) +++ stable/8/sys/kern/subr_smp.c Sat Aug 20 11:50:02 2011 (r225028) @@ -110,8 +110,7 @@ static void (*volatile smp_rv_setup_func static void (*volatile smp_rv_action_func)(void *arg); static void (*volatile smp_rv_teardown_func)(void *arg); static void *volatile smp_rv_func_arg; -static volatile int smp_rv_waiters[3]; -static volatile int smp_rv_generation; +static volatile int smp_rv_waiters[4]; /* * Shared mutex to restrict busywaits between smp_rendezvous() and @@ -345,7 +344,6 @@ smp_rendezvous_action(void) void (*local_setup_func)(void*); void (*local_action_func)(void*); void (*local_teardown_func)(void*); - int generation; #ifdef INVARIANTS int owepreempt; #endif @@ -360,7 +358,6 @@ smp_rendezvous_action(void) local_setup_func = smp_rv_setup_func; local_action_func = smp_rv_action_func; local_teardown_func = smp_rv_teardown_func; - generation = smp_rv_generation; /* * Use a nested critical section to prevent any preemptions @@ -406,32 +403,28 @@ smp_rendezvous_action(void) if (local_action_func != NULL) local_action_func(local_func_arg); - /* - * Signal that the main action has been completed. If a - * full exit rendezvous is requested, then all CPUs will - * wait here until all CPUs have finished the main action. - * - * Note that the write by the last CPU to finish the action - * may become visible to different CPUs at different times. - * As a result, the CPU that initiated the rendezvous may - * exit the rendezvous and drop the lock allowing another - * rendezvous to be initiated on the same CPU or a different - * CPU. In that case the exit sentinel may be cleared before - * all CPUs have noticed causing those CPUs to hang forever. - * Workaround this by using a generation count to notice when - * this race occurs and to exit the rendezvous in that case. - */ - MPASS(generation == smp_rv_generation); - atomic_add_int(&smp_rv_waiters[2], 1); if (local_teardown_func != smp_no_rendevous_barrier) { - while (smp_rv_waiters[2] < smp_rv_ncpus && - generation == smp_rv_generation) + /* + * Signal that the main action has been completed. If a + * full exit rendezvous is requested, then all CPUs will + * wait here until all CPUs have finished the main action. + */ + atomic_add_int(&smp_rv_waiters[2], 1); + while (smp_rv_waiters[2] < smp_rv_ncpus) cpu_spinwait(); if (local_teardown_func != NULL) local_teardown_func(local_func_arg); } + /* + * Signal that the rendezvous is fully completed by this CPU. + * This means that no member of smp_rv_* pseudo-structure will be + * accessed by this target CPU after this point; in particular, + * memory pointed by smp_rv_func_arg. + */ + atomic_add_int(&smp_rv_waiters[3], 1); + td->td_critnest--; KASSERT(owepreempt == td->td_owepreempt, ("rendezvous action changed td_owepreempt")); @@ -465,8 +458,6 @@ smp_rendezvous_cpus(cpumask_t map, mtx_lock_spin(&smp_ipi_mtx); - atomic_add_acq_int(&smp_rv_generation, 1); - /* Pass rendezvous parameters via global variables. */ smp_rv_ncpus = ncpus; smp_rv_setup_func = setup_func; @@ -475,6 +466,7 @@ smp_rendezvous_cpus(cpumask_t map, smp_rv_func_arg = arg; smp_rv_waiters[1] = 0; smp_rv_waiters[2] = 0; + smp_rv_waiters[3] = 0; atomic_store_rel_int(&smp_rv_waiters[0], 0); /* @@ -488,13 +480,13 @@ smp_rendezvous_cpus(cpumask_t map, smp_rendezvous_action(); /* - * If the caller did not request an exit barrier to be enforced - * on each CPU, ensure that this CPU waits for all the other - * CPUs to finish the rendezvous. + * Ensure that the master CPU waits for all the other + * CPUs to finish the rendezvous, so that smp_rv_* + * pseudo-structure and the arg are guaranteed to not + * be in use. */ - if (teardown_func == smp_no_rendevous_barrier) - while (atomic_load_acq_int(&smp_rv_waiters[2]) < ncpus) - cpu_spinwait(); + while (atomic_load_acq_int(&smp_rv_waiters[3]) < ncpus) + cpu_spinwait(); mtx_unlock_spin(&smp_ipi_mtx); } From owner-svn-src-stable@FreeBSD.ORG Sat Aug 20 12:08:53 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BEBB51065670; Sat, 20 Aug 2011 12:08:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id A33578FC0C; Sat, 20 Aug 2011 12:08:53 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KC8rJh051237; Sat, 20 Aug 2011 12:08:53 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KC8rMZ051235; Sat, 20 Aug 2011 12:08:53 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201108201208.p7KC8rMZ051235@svn.freebsd.org> From: Andriy Gapon Date: Sat, 20 Aug 2011 12:08:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225029 - stable/7/sys/kern X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 12:08:53 -0000 Author: avg Date: Sat Aug 20 12:08:53 2011 New Revision: 225029 URL: http://svn.freebsd.org/changeset/base/225029 Log: MFC r224527: smp_rendezvous: master cpu should wait until all slaves are fully done Modified: stable/7/sys/kern/subr_smp.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/kern/subr_smp.c ============================================================================== --- stable/7/sys/kern/subr_smp.c Sat Aug 20 11:50:02 2011 (r225028) +++ stable/7/sys/kern/subr_smp.c Sat Aug 20 12:08:53 2011 (r225029) @@ -112,8 +112,7 @@ static void (*volatile smp_rv_setup_func static void (*volatile smp_rv_action_func)(void *arg); static void (*volatile smp_rv_teardown_func)(void *arg); static void * volatile smp_rv_func_arg; -static volatile int smp_rv_waiters[3]; -static volatile int smp_rv_generation; +static volatile int smp_rv_waiters[4]; /* * Shared mutex to restrict busywaits between smp_rendezvous() and @@ -308,7 +307,6 @@ smp_rendezvous_action(void) void (*local_setup_func)(void*); void (*local_action_func)(void*); void (*local_teardown_func)(void*); - int generation; #ifdef INVARIANTS int owepreempt; #endif @@ -323,7 +321,6 @@ smp_rendezvous_action(void) local_setup_func = smp_rv_setup_func; local_action_func = smp_rv_action_func; local_teardown_func = smp_rv_teardown_func; - generation = smp_rv_generation; /* * Use a nested critical section to prevent any preemptions @@ -369,32 +366,28 @@ smp_rendezvous_action(void) if (local_action_func != NULL) local_action_func(local_func_arg); - /* - * Signal that the main action has been completed. If a - * full exit rendezvous is requested, then all CPUs will - * wait here until all CPUs have finished the main action. - * - * Note that the write by the last CPU to finish the action - * may become visible to different CPUs at different times. - * As a result, the CPU that initiated the rendezvous may - * exit the rendezvous and drop the lock allowing another - * rendezvous to be initiated on the same CPU or a different - * CPU. In that case the exit sentinel may be cleared before - * all CPUs have noticed causing those CPUs to hang forever. - * Workaround this by using a generation count to notice when - * this race occurs and to exit the rendezvous in that case. - */ - MPASS(generation == smp_rv_generation); - atomic_add_int(&smp_rv_waiters[2], 1); if (local_teardown_func != smp_no_rendevous_barrier) { - while (smp_rv_waiters[2] < smp_rv_ncpus && - generation == smp_rv_generation) + /* + * Signal that the main action has been completed. If a + * full exit rendezvous is requested, then all CPUs will + * wait here until all CPUs have finished the main action. + */ + atomic_add_int(&smp_rv_waiters[2], 1); + while (smp_rv_waiters[2] < smp_rv_ncpus) cpu_spinwait(); if (local_teardown_func != NULL) local_teardown_func(local_func_arg); } + /* + * Signal that the rendezvous is fully completed by this CPU. + * This means that no member of smp_rv_* pseudo-structure will be + * accessed by this target CPU after this point; in particular, + * memory pointed by smp_rv_func_arg. + */ + atomic_add_int(&smp_rv_waiters[3], 1); + td->td_critnest--; KASSERT(owepreempt == td->td_owepreempt, ("rendezvous action changed td_owepreempt")); @@ -427,8 +420,6 @@ smp_rendezvous_cpus(cpumask_t map, mtx_lock_spin(&smp_ipi_mtx); - atomic_add_acq_int(&smp_rv_generation, 1); - /* Pass rendezvous parameters via global variables. */ smp_rv_ncpus = ncpus; smp_rv_setup_func = setup_func; @@ -437,6 +428,7 @@ smp_rendezvous_cpus(cpumask_t map, smp_rv_func_arg = arg; smp_rv_waiters[1] = 0; smp_rv_waiters[2] = 0; + smp_rv_waiters[3] = 0; atomic_store_rel_int(&smp_rv_waiters[0], 0); /* @@ -450,13 +442,13 @@ smp_rendezvous_cpus(cpumask_t map, smp_rendezvous_action(); /* - * If the caller did not request an exit barrier to be enforced - * on each CPU, ensure that this CPU waits for all the other - * CPUs to finish the rendezvous. + * Ensure that the master CPU waits for all the other + * CPUs to finish the rendezvous, so that smp_rv_* + * pseudo-structure and the arg are guaranteed to not + * be in use. */ - if (teardown_func == smp_no_rendevous_barrier) - while (atomic_load_acq_int(&smp_rv_waiters[2]) < ncpus) - cpu_spinwait(); + while (atomic_load_acq_int(&smp_rv_waiters[3]) < ncpus) + cpu_spinwait(); mtx_unlock_spin(&smp_ipi_mtx); } From owner-svn-src-stable@FreeBSD.ORG Sat Aug 20 15:21:02 2011 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id E8EB71065670; Sat, 20 Aug 2011 15:21:02 +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 D7CF38FC0A; Sat, 20 Aug 2011 15:21:02 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id p7KFL2eY057469; Sat, 20 Aug 2011 15:21:02 GMT (envelope-from jh@svn.freebsd.org) Received: (from jh@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id p7KFL2AF057467; Sat, 20 Aug 2011 15:21:02 GMT (envelope-from jh@svn.freebsd.org) Message-Id: <201108201521.p7KFL2AF057467@svn.freebsd.org> From: Jaakko Heinonen Date: Sat, 20 Aug 2011 15:21:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-7@freebsd.org X-SVN-Group: stable-7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r225039 - stable/7/sys/fs/devfs X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Aug 2011 15:21:03 -0000 Author: jh Date: Sat Aug 20 15:21:02 2011 New Revision: 225039 URL: http://svn.freebsd.org/changeset/base/225039 Log: MFC r208717: Don't try to call cdevsw d_close() method when devfs_close() is called because of insmntque1() failure. Modified: stable/7/sys/fs/devfs/devfs_vnops.c Directory Properties: stable/7/sys/ (props changed) stable/7/sys/cddl/contrib/opensolaris/ (props changed) stable/7/sys/contrib/dev/acpica/ (props changed) stable/7/sys/contrib/pf/ (props changed) Modified: stable/7/sys/fs/devfs/devfs_vnops.c ============================================================================== --- stable/7/sys/fs/devfs/devfs_vnops.c Sat Aug 20 15:12:53 2011 (r225038) +++ stable/7/sys/fs/devfs/devfs_vnops.c Sat Aug 20 15:21:02 2011 (r225039) @@ -396,6 +396,13 @@ devfs_close(struct vop_close_args *ap) int vp_locked, error; /* + * XXX: Don't call d_close() if we were called because of + * XXX: insmntque1() failure. + */ + if (vp->v_data == NULL) + return (0); + + /* * Hack: a tty device that is a controlling terminal * has a reference from the session structure. * We cannot easily tell that a character device is