From owner-svn-src-projects@freebsd.org Sun Apr 24 16:05:10 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 46114B19F58 for ; Sun, 24 Apr 2016 16:05:10 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 18ADF1D31; Sun, 24 Apr 2016 16:05:10 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3OG59BA067992; Sun, 24 Apr 2016 16:05:09 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3OG59cK067991; Sun, 24 Apr 2016 16:05:09 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201604241605.u3OG59cK067991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 24 Apr 2016 16:05:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r298544 - projects/vnet/sys/net X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2016 16:05:10 -0000 Author: bz Date: Sun Apr 24 16:05:09 2016 New Revision: 298544 URL: https://svnweb.freebsd.org/changeset/base/298544 Log: Move if_disc(4) to SI_SUB_INIT_IF. Modified: projects/vnet/sys/net/if_disc.c Modified: projects/vnet/sys/net/if_disc.c ============================================================================== --- projects/vnet/sys/net/if_disc.c Sun Apr 24 15:56:05 2016 (r298543) +++ projects/vnet/sys/net/if_disc.c Sun Apr 24 16:05:09 2016 (r298544) @@ -146,7 +146,7 @@ vnet_disc_uninit(const void *unused __un if_clone_detach(V_disc_cloner); } -VNET_SYSUNINIT(vnet_disc_uninit, SI_SUB_PSEUDO, SI_ORDER_ANY, +VNET_SYSUNINIT(vnet_disc_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, vnet_disc_uninit, NULL); static int From owner-svn-src-projects@freebsd.org Sun Apr 24 16:07:51 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7FC84B19F93 for ; Sun, 24 Apr 2016 16:07:51 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4347E1E43; Sun, 24 Apr 2016 16:07:51 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3OG7oWN068154; Sun, 24 Apr 2016 16:07:50 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3OG7oio068153; Sun, 24 Apr 2016 16:07:50 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201604241607.u3OG7oio068153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 24 Apr 2016 16:07:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r298545 - projects/vnet/sys/net X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2016 16:07:51 -0000 Author: bz Date: Sun Apr 24 16:07:50 2016 New Revision: 298545 URL: https://svnweb.freebsd.org/changeset/base/298545 Log: Move counters to SI_SUB_INIT_IF; cannot free them before all protcols and interfaces are gone as otherwise we will try to update them and modified freed memory. Sponsored by: The FreeBSD Foundation Modified: projects/vnet/sys/net/vnet.h Modified: projects/vnet/sys/net/vnet.h ============================================================================== --- projects/vnet/sys/net/vnet.h Sun Apr 24 16:05:09 2016 (r298544) +++ projects/vnet/sys/net/vnet.h Sun Apr 24 16:07:50 2016 (r298545) @@ -111,8 +111,8 @@ vnet_##name##_init(const void *unused) \ { \ VNET_PCPUSTAT_ALLOC(name, M_WAITOK); \ } \ -VNET_SYSINIT(vnet_ ## name ## _init, SI_SUB_PROTO_IFATTACHDOMAIN, \ - SI_ORDER_ANY, vnet_ ## name ## _init, NULL) +VNET_SYSINIT(vnet_ ## name ## _init, SI_SUB_INIT_IF, \ + SI_ORDER_FIRST, vnet_ ## name ## _init, NULL) #define VNET_PCPUSTAT_SYSUNINIT(name) \ static void \ @@ -120,8 +120,8 @@ vnet_##name##_uninit(const void *unused) { \ VNET_PCPUSTAT_FREE(name); \ } \ -VNET_SYSUNINIT(vnet_ ## name ## _uninit, SI_SUB_PROTO_IFATTACHDOMAIN, \ - SI_ORDER_ANY, vnet_ ## name ## _uninit, NULL) +VNET_SYSUNINIT(vnet_ ## name ## _uninit, SI_SUB_INIT_IF, \ + SI_ORDER_FIRST, vnet_ ## name ## _uninit, NULL) #ifdef SYSCTL_OID #define SYSCTL_VNET_PCPUSTAT(parent, nbr, name, type, array, desc) \ From owner-svn-src-projects@freebsd.org Sun Apr 24 16:33:27 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22AECB1B67D for ; Sun, 24 Apr 2016 16:33:27 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E23441F90; Sun, 24 Apr 2016 16:33:26 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3OGXQCV077334; Sun, 24 Apr 2016 16:33:26 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3OGXQAY077333; Sun, 24 Apr 2016 16:33:26 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201604241633.u3OGXQAY077333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 24 Apr 2016 16:33:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r298546 - projects/vnet/sys/net X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2016 16:33:27 -0000 Author: bz Date: Sun Apr 24 16:33:25 2016 New Revision: 298546 URL: https://svnweb.freebsd.org/changeset/base/298546 Log: Update the sysuninit subsystem before calling into the function handler so we always know at which stage we are running. Sponsored by: The FreeBSD Foundation Modified: projects/vnet/sys/net/vnet.c Modified: projects/vnet/sys/net/vnet.c ============================================================================== --- projects/vnet/sys/net/vnet.c Sun Apr 24 16:07:50 2016 (r298545) +++ projects/vnet/sys/net/vnet.c Sun Apr 24 16:33:25 2016 (r298546) @@ -582,8 +582,8 @@ vnet_sysuninit(void) VNET_SYSINIT_RLOCK(); TAILQ_FOREACH_REVERSE(vs, &vnet_destructors, vnet_sysuninit_head, link) { - vs->func(vs->arg); curvnet->vnet_state = vs->subsystem; + vs->func(vs->arg); } VNET_SYSINIT_RUNLOCK(); } From owner-svn-src-projects@freebsd.org Sun Apr 24 16:36:34 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2846AB1B6CB for ; Sun, 24 Apr 2016 16:36:34 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 03F1A10C7; Sun, 24 Apr 2016 16:36:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3OGaXSn077512; Sun, 24 Apr 2016 16:36:33 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3OGaX8w077511; Sun, 24 Apr 2016 16:36:33 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201604241636.u3OGaX8w077511@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 24 Apr 2016 16:36:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r298547 - projects/vnet/sys/net X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2016 16:36:34 -0000 Author: bz Date: Sun Apr 24 16:36:33 2016 New Revision: 298547 URL: https://svnweb.freebsd.org/changeset/base/298547 Log: Remove the "shutdown" argument again to if_detach_internal(). Using the sysuninit state we do not need this anymore and this simplifies the logic. Make sure we always call the dom_ifdetach handler, aas this is the only place this can happen. Sponsored by: The FreeBSD Foundation Modified: projects/vnet/sys/net/if.c Modified: projects/vnet/sys/net/if.c ============================================================================== --- projects/vnet/sys/net/if.c Sun Apr 24 16:33:25 2016 (r298546) +++ projects/vnet/sys/net/if.c Sun Apr 24 16:36:33 2016 (r298547) @@ -174,9 +174,9 @@ static int if_getgroup(struct ifgroupreq static int if_getgroupmembers(struct ifgroupreq *); static void if_delgroups(struct ifnet *); static void if_attach_internal(struct ifnet *, int, struct if_clone *); -static int if_detach_internal(struct ifnet *, int, int, struct if_clone **); +static int if_detach_internal(struct ifnet *, int, struct if_clone **); #ifdef VIMAGE -static void if_vmove(struct ifnet *, struct vnet *, int); +static void if_vmove(struct ifnet *, struct vnet *); #endif #ifdef INET6 @@ -397,7 +397,7 @@ vnet_if_return(const void *unused __unus /* Return all inherited interfaces to their parent vnets. */ TAILQ_FOREACH_SAFE(ifp, &V_ifnet, if_link, nifp) { if (ifp->if_home_vnet != ifp->if_vnet) - if_vmove(ifp, ifp->if_home_vnet, 1); + if_vmove(ifp, ifp->if_home_vnet); } } VNET_SYSUNINIT(vnet_if_return, SI_SUB_INIT_IF, SI_ORDER_ANY, @@ -904,7 +904,7 @@ if_detach(struct ifnet *ifp) { CURVNET_SET_QUIET(ifp->if_vnet); - if_detach_internal(ifp, 0, 0, NULL); + if_detach_internal(ifp, 0, NULL); CURVNET_RESTORE(); } @@ -919,15 +919,16 @@ if_detach(struct ifnet *ifp) * the cloned interfaces are destoyed as first thing of teardown. */ static int -if_detach_internal(struct ifnet *ifp, int vmove, int shutdown, - struct if_clone **ifcp) +if_detach_internal(struct ifnet *ifp, int vmove, struct if_clone **ifcp) { struct ifaddr *ifa; int i; struct domain *dp; struct ifnet *iter; - int found = 0; + int found = 0, shutdown; + shutdown = (ifp->if_vnet->vnet_state > SI_SUB_VNET && + ifp->if_vnet->vnet_state < SI_SUB_VNET_DONE) ? 1 : 0; IFNET_WLOCK(); TAILQ_FOREACH(iter, &V_ifnet, if_link) if (iter == ifp) { @@ -956,23 +957,51 @@ if_detach_internal(struct ifnet *ifp, in #endif } - /* The one thing we have to do. */ - if_delgroups(ifp); + /* + * At this point we know the interface still was on the ifnet list + * and we removed it so we are in a stable state. + */ /* - * Remove/wait for pending events. + * In any case (destroy or vmove) detach us from the groups + * and remove/wait for pending events on the taskq. + * XXX-BZ in theory an interface could still enqueue a taskq change? */ - taskqueue_drain(taskqueue_swi, &ifp->if_linktask); + if_delgroups(ifp); - if (!vmove && !shutdown && - ifp->if_vnet->vnet_state <= SI_SUB_PSEUDO_DONE) - return (ENOENT); + taskqueue_drain(taskqueue_swi, &ifp->if_linktask); - /* Check if this is a cloned interface or not. */ + /* + * Check if this is a cloned interface or not. Must do even if + * shutting down as a if_vmove_reclaim() would move the ifp and + * the if_clone_addgroup() will have a corrupted string overwise + * from a gibberish pointer. + */ if (vmove && ifcp != NULL) *ifcp = if_clone_findifc(ifp); /* + * On VNET shutdown abort here as the stack teardown will do all + * the work top-down for us. + */ + if (shutdown) { + /* + * In case of a vmove we are done here without error. + * If we would signal an error it would lead to the same + * abort as if we did not find the ifnet anymore. + * if_detach() calls us in void context and does not care + * about an early abort notification, so life is splendid :) + */ + goto finish_vnet_shutdown; + } + + /* + * At this point we are not tearing down a VNET and are either + * going to destroy or vmove the interface and have to cleanup + * accordingly. + */ + + /* * Remove routes and flush queues. */ if_down(ifp); @@ -986,7 +1015,7 @@ if_detach_internal(struct ifnet *ifp, in if_purgeaddrs(ifp); #ifdef INET - in_ifdetach(ifp, !shutdown); + in_ifdetach(ifp, 1); #endif #ifdef INET6 @@ -996,10 +1025,9 @@ if_detach_internal(struct ifnet *ifp, in * routes are expected to be removed by the IPv6-specific kernel API. * Otherwise, the kernel will detect some inconsistency and bark it. */ - in6_ifdetach(ifp, !shutdown); + in6_ifdetach(ifp, 1); #endif - if (!shutdown) - if_purgemaddrs(ifp); + if_purgemaddrs(ifp); /* Announce that the interface is gone. */ rt_ifannouncemsg(ifp, IFAN_DEPARTURE); @@ -1029,9 +1057,9 @@ if_detach_internal(struct ifnet *ifp, in } } - if (!shutdown) - rt_flushifroutes(ifp); + rt_flushifroutes(ifp); +finish_vnet_shutdown: /* * We cannot hold the lock over dom_ifdetach calls as they might * sleep, for example trying to drain a callout, thus open up the @@ -1059,7 +1087,7 @@ if_detach_internal(struct ifnet *ifp, in * and finally find an unused if_xname for the target vnet. */ static void -if_vmove(struct ifnet *ifp, struct vnet *new_vnet, int shutdown) +if_vmove(struct ifnet *ifp, struct vnet *new_vnet) { struct if_clone *ifc; int rc; @@ -1077,7 +1105,7 @@ if_vmove(struct ifnet *ifp, struct vnet * mark as dead etc. so that the ifnet can be reattached later. * If we cannot find it, we lost the race to someone else. */ - rc = if_detach_internal(ifp, 1, shutdown, &ifc); + rc = if_detach_internal(ifp, 1, &ifc); if (rc != 0) return; @@ -1152,7 +1180,7 @@ if_vmove_loan(struct thread *td, struct } /* Move the interface into the child jail/vnet. */ - if_vmove(ifp, pr->pr_vnet, 0); + if_vmove(ifp, pr->pr_vnet); /* Report the new if_xname back to the userland. */ sprintf(ifname, "%s", ifp->if_xname); @@ -1195,7 +1223,7 @@ if_vmove_reclaim(struct thread *td, char } /* Get interface back from child jail/vnet. */ - if_vmove(ifp, vnet_dst, 0); + if_vmove(ifp, vnet_dst); CURVNET_RESTORE(); /* Report the new if_xname back to the userland. */ From owner-svn-src-projects@freebsd.org Sun Apr 24 16:41:56 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F438B1B8DF for ; Sun, 24 Apr 2016 16:41:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 039EE1441; Sun, 24 Apr 2016 16:41:55 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3OGft0Y080369; Sun, 24 Apr 2016 16:41:55 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3OGfsG5080361; Sun, 24 Apr 2016 16:41:54 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201604241641.u3OGfsG5080361@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sun, 24 Apr 2016 16:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r298548 - in projects/vnet/sys: net netinet netinet6 X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2016 16:41:56 -0000 Author: bz Date: Sun Apr 24 16:41:54 2016 New Revision: 298548 URL: https://svnweb.freebsd.org/changeset/base/298548 Log: Virtualise the netisr registration in order to do a per-vnet de-registration to prevent further packets for a specific protocol (IP, ARP, IPv6) to come up from ether_demux(). We currently have not better "plug-and-play" hook in place at that level but should think about that in some distant future (e.g., to one day be able to load ip, or ipv6). Note: this commit will be reverted soon. It turns out that while the idea is good, and basically works, it can possibly lead to deadlocks. Sponsored by: The FreeBSD Foundation Modified: projects/vnet/sys/net/if_epair.c projects/vnet/sys/net/if_ethersubr.c projects/vnet/sys/net/netisr.c projects/vnet/sys/net/rtsock.c projects/vnet/sys/netinet/if_ether.c projects/vnet/sys/netinet/igmp.c projects/vnet/sys/netinet/ip_input.c projects/vnet/sys/netinet6/ip6_input.c Modified: projects/vnet/sys/net/if_epair.c ============================================================================== --- projects/vnet/sys/net/if_epair.c Sun Apr 24 16:36:33 2016 (r298547) +++ projects/vnet/sys/net/if_epair.c Sun Apr 24 16:41:54 2016 (r298548) @@ -959,6 +959,7 @@ vnet_epair_init(const void *unused __unu V_epair_cloner = if_clone_advanced(epairname, 0, epair_clone_match, epair_clone_create, epair_clone_destroy); + netisr_register(&epair_nh); } VNET_SYSINIT(vnet_epair_init, SI_SUB_PSEUDO, SI_ORDER_ANY, vnet_epair_init, NULL); @@ -967,6 +968,7 @@ static void vnet_epair_uninit(const void *unused __unused) { + netisr_unregister(&epair_nh); if_clone_detach(V_epair_cloner); } VNET_SYSUNINIT(vnet_epair_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, @@ -984,12 +986,10 @@ epair_modevent(module_t mod, int type, v epair_nh.nh_qlimit = 42 * ifqmaxlen; /* 42 shall be the number. */ if (TUNABLE_INT_FETCH("net.link.epair.netisr_maxqlen", &qlimit)) epair_nh.nh_qlimit = qlimit; - netisr_register(&epair_nh); if (bootverbose) printf("%s initialized.\n", epairname); break; case MOD_UNLOAD: - netisr_unregister(&epair_nh); epair_dpcpu_detach(); if (bootverbose) printf("%s unloaded.\n", epairname); @@ -1006,5 +1006,5 @@ static moduledata_t epair_mod = { 0 }; -DECLARE_MODULE(if_epair, epair_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); +DECLARE_MODULE(if_epair, epair_mod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE); MODULE_VERSION(if_epair, 1); Modified: projects/vnet/sys/net/if_ethersubr.c ============================================================================== --- projects/vnet/sys/net/if_ethersubr.c Sun Apr 24 16:36:33 2016 (r298547) +++ projects/vnet/sys/net/if_ethersubr.c Sun Apr 24 16:41:54 2016 (r298548) @@ -654,14 +654,6 @@ static struct netisr_handler ether_nh = }; static void -ether_init(__unused void *arg) -{ - - netisr_register(ðer_nh); -} -SYSINIT(ether, SI_SUB_INIT_IF, SI_ORDER_ANY, ether_init, NULL); - -static void vnet_ether_init(__unused void *arg) { int i; @@ -672,12 +664,13 @@ vnet_ether_init(__unused void *arg) if ((i = pfil_head_register(&V_link_pfil_hook)) != 0) printf("%s: WARNING: unable to register pfil link hook, " "error %d\n", __func__, i); + netisr_register(ðer_nh); } VNET_SYSINIT(vnet_ether_init, SI_SUB_PROTO_IF, SI_ORDER_ANY, vnet_ether_init, NULL); static void -vnet_ether_destroy(__unused void *arg) +vnet_ether_pfil_destroy(__unused void *arg) { int i; @@ -685,10 +678,17 @@ vnet_ether_destroy(__unused void *arg) printf("%s: WARNING: unable to unregister pfil link hook, " "error %d\n", __func__, i); } -VNET_SYSUNINIT(vnet_ether_uninit, SI_SUB_PROTO_PFIL, SI_ORDER_ANY, - vnet_ether_destroy, NULL); +VNET_SYSUNINIT(vnet_ether_pfil_uninit, SI_SUB_PROTO_PFIL, SI_ORDER_ANY, + vnet_ether_pfil_destroy, NULL); +static void +vnet_ether_destroy(__unused void *arg) +{ + netisr_unregister(ðer_nh); +} +VNET_SYSUNINIT(vnet_ether_uninit, SI_SUB_PROTO_IF, SI_ORDER_ANY, + vnet_ether_destroy, NULL); static void ether_input(struct ifnet *ifp, struct mbuf *m) @@ -710,7 +710,9 @@ ether_input(struct ifnet *ifp, struct mb * so assert it is correct here. */ KASSERT(m->m_pkthdr.rcvif == ifp, ("%s: ifnet mismatch", __func__)); + CURVNET_SET_QUIET(ifp->if_vnet); netisr_dispatch(NETISR_ETHER, m); + CURVNET_RESTORE(); m = mn; } } Modified: projects/vnet/sys/net/netisr.c ============================================================================== --- projects/vnet/sys/net/netisr.c Sun Apr 24 16:36:33 2016 (r298547) +++ projects/vnet/sys/net/netisr.c Sun Apr 24 16:41:54 2016 (r298548) @@ -208,7 +208,8 @@ SYSCTL_UINT(_net_isr, OID_AUTO, maxprot, * The netisr_proto array describes all registered protocols, indexed by * protocol number. See netisr_internal.h for more details. */ -static struct netisr_proto netisr_proto[NETISR_MAXPROT]; +static VNET_DEFINE(struct netisr_proto, netisr_proto[NETISR_MAXPROT]); +#define V_netisr_proto VNET(netisr_proto) /* * Per-CPU workstream data. See netisr_internal.h for more details. @@ -396,31 +397,31 @@ netisr_register(const struct netisr_hand * Test that no existing registration exists for this protocol. */ NETISR_WLOCK(); - KASSERT(netisr_proto[proto].np_name == NULL, + KASSERT(V_netisr_proto[proto].np_name == NULL, ("%s(%u, %s): name present", __func__, proto, name)); - KASSERT(netisr_proto[proto].np_handler == NULL, + KASSERT(V_netisr_proto[proto].np_handler == NULL, ("%s(%u, %s): handler present", __func__, proto, name)); - netisr_proto[proto].np_name = name; - netisr_proto[proto].np_handler = nhp->nh_handler; - netisr_proto[proto].np_m2flow = nhp->nh_m2flow; - netisr_proto[proto].np_m2cpuid = nhp->nh_m2cpuid; - netisr_proto[proto].np_drainedcpu = nhp->nh_drainedcpu; + V_netisr_proto[proto].np_name = name; + V_netisr_proto[proto].np_handler = nhp->nh_handler; + V_netisr_proto[proto].np_m2flow = nhp->nh_m2flow; + V_netisr_proto[proto].np_m2cpuid = nhp->nh_m2cpuid; + V_netisr_proto[proto].np_drainedcpu = nhp->nh_drainedcpu; if (nhp->nh_qlimit == 0) - netisr_proto[proto].np_qlimit = netisr_defaultqlimit; + V_netisr_proto[proto].np_qlimit = netisr_defaultqlimit; else if (nhp->nh_qlimit > netisr_maxqlimit) { printf("%s: %s requested queue limit %u capped to " "net.isr.maxqlimit %u\n", __func__, name, nhp->nh_qlimit, netisr_maxqlimit); - netisr_proto[proto].np_qlimit = netisr_maxqlimit; + V_netisr_proto[proto].np_qlimit = netisr_maxqlimit; } else - netisr_proto[proto].np_qlimit = nhp->nh_qlimit; - netisr_proto[proto].np_policy = nhp->nh_policy; - netisr_proto[proto].np_dispatch = nhp->nh_dispatch; + V_netisr_proto[proto].np_qlimit = nhp->nh_qlimit; + V_netisr_proto[proto].np_policy = nhp->nh_policy; + V_netisr_proto[proto].np_dispatch = nhp->nh_dispatch; CPU_FOREACH(i) { npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; bzero(npwp, sizeof(*npwp)); - npwp->nw_qlimit = netisr_proto[proto].np_qlimit; + npwp->nw_qlimit = V_netisr_proto[proto].np_qlimit; } NETISR_WUNLOCK(); } @@ -445,7 +446,7 @@ netisr_clearqdrops(const struct netisr_h ("%s(%u): protocol too big for %s", __func__, proto, name)); NETISR_WLOCK(); - KASSERT(netisr_proto[proto].np_handler != NULL, + KASSERT(V_netisr_proto[proto].np_handler != NULL, ("%s(%u): protocol not registered for %s", __func__, proto, name)); @@ -478,7 +479,7 @@ netisr_getqdrops(const struct netisr_han ("%s(%u): protocol too big for %s", __func__, proto, name)); NETISR_RLOCK(&tracker); - KASSERT(netisr_proto[proto].np_handler != NULL, + KASSERT(V_netisr_proto[proto].np_handler != NULL, ("%s(%u): protocol not registered for %s", __func__, proto, name)); @@ -509,10 +510,10 @@ netisr_getqlimit(const struct netisr_han ("%s(%u): protocol too big for %s", __func__, proto, name)); NETISR_RLOCK(&tracker); - KASSERT(netisr_proto[proto].np_handler != NULL, + KASSERT(V_netisr_proto[proto].np_handler != NULL, ("%s(%u): protocol not registered for %s", __func__, proto, name)); - *qlimitp = netisr_proto[proto].np_qlimit; + *qlimitp = V_netisr_proto[proto].np_qlimit; NETISR_RUNLOCK(&tracker); } @@ -541,11 +542,11 @@ netisr_setqlimit(const struct netisr_han ("%s(%u): protocol too big for %s", __func__, proto, name)); NETISR_WLOCK(); - KASSERT(netisr_proto[proto].np_handler != NULL, + KASSERT(V_netisr_proto[proto].np_handler != NULL, ("%s(%u): protocol not registered for %s", __func__, proto, name)); - netisr_proto[proto].np_qlimit = qlimit; + V_netisr_proto[proto].np_qlimit = qlimit; CPU_FOREACH(i) { npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; npwp->nw_qlimit = qlimit; @@ -600,16 +601,16 @@ netisr_unregister(const struct netisr_ha ("%s(%u): protocol too big for %s", __func__, proto, name)); NETISR_WLOCK(); - KASSERT(netisr_proto[proto].np_handler != NULL, + KASSERT(V_netisr_proto[proto].np_handler != NULL, ("%s(%u): protocol not registered for %s", __func__, proto, name)); - netisr_proto[proto].np_name = NULL; - netisr_proto[proto].np_handler = NULL; - netisr_proto[proto].np_m2flow = NULL; - netisr_proto[proto].np_m2cpuid = NULL; - netisr_proto[proto].np_qlimit = 0; - netisr_proto[proto].np_policy = 0; + V_netisr_proto[proto].np_name = NULL; + V_netisr_proto[proto].np_handler = NULL; + V_netisr_proto[proto].np_m2flow = NULL; + V_netisr_proto[proto].np_m2cpuid = NULL; + V_netisr_proto[proto].np_qlimit = 0; + V_netisr_proto[proto].np_policy = 0; CPU_FOREACH(i) { npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; netisr_drain_proto(npwp); @@ -763,13 +764,16 @@ netisr_process_workstream_proto(struct n VNET_ASSERT(m->m_pkthdr.rcvif != NULL, ("%s:%d rcvif == NULL: m=%p", __func__, __LINE__, m)); CURVNET_SET(m->m_pkthdr.rcvif->if_vnet); - netisr_proto[proto].np_handler(m); + V_netisr_proto[proto].np_handler(m); CURVNET_RESTORE(); } KASSERT(local_npw.nw_len == 0, ("%s(%u): len %u", __func__, proto, local_npw.nw_len)); - if (netisr_proto[proto].np_drainedcpu) - netisr_proto[proto].np_drainedcpu(nwsp->nws_cpu); + /* We can just use the one from the default VNET. */ + CURVNET_SET_QUIET(vnet0); + if (V_netisr_proto[proto].np_drainedcpu) + V_netisr_proto[proto].np_drainedcpu(nwsp->nws_cpu); + CURVNET_RESTORE(); NWS_LOCK(nwsp); npwp->nw_handled += handled; return (handled); @@ -905,10 +909,12 @@ netisr_queue_src(u_int proto, uintptr_t #ifdef NETISR_LOCKING NETISR_RLOCK(&tracker); #endif - KASSERT(netisr_proto[proto].np_handler != NULL, - ("%s: invalid proto %u", __func__, proto)); + if (V_netisr_proto[proto].np_handler == NULL) { + m_freem(m); + return (ENOPROTOOPT); + } - m = netisr_select_cpuid(&netisr_proto[proto], NETISR_DISPATCH_DEFERRED, + m = netisr_select_cpuid(&V_netisr_proto[proto], NETISR_DISPATCH_DEFERRED, source, m, &cpuid); if (m != NULL) { KASSERT(!CPU_ABSENT(cpuid), ("%s: CPU %u absent", __func__, @@ -950,9 +956,11 @@ netisr_dispatch_src(u_int proto, uintptr #ifdef NETISR_LOCKING NETISR_RLOCK(&tracker); #endif - npp = &netisr_proto[proto]; - KASSERT(npp->np_handler != NULL, ("%s: invalid proto %u", __func__, - proto)); + npp = &V_netisr_proto[proto]; + if (npp->np_handler == NULL) { + m_freem(m); + return (ENOPROTOOPT); + } dispatch_policy = netisr_get_dispatch(npp); if (dispatch_policy == NETISR_DISPATCH_DEFERRED) @@ -970,7 +978,7 @@ netisr_dispatch_src(u_int proto, uintptr npwp = &nwsp->nws_work[proto]; npwp->nw_dispatched++; npwp->nw_handled++; - netisr_proto[proto].np_handler(m); + V_netisr_proto[proto].np_handler(m); error = 0; goto out_unlock; } @@ -984,7 +992,7 @@ netisr_dispatch_src(u_int proto, uintptr * already running. */ sched_pin(); - m = netisr_select_cpuid(&netisr_proto[proto], NETISR_DISPATCH_HYBRID, + m = netisr_select_cpuid(&V_netisr_proto[proto], NETISR_DISPATCH_HYBRID, source, m, &cpuid); if (m == NULL) { error = ENOBUFS; @@ -1021,7 +1029,7 @@ netisr_dispatch_src(u_int proto, uintptr */ nwsp->nws_flags |= NWS_DISPATCHING; NWS_UNLOCK(nwsp); - netisr_proto[proto].np_handler(m); + V_netisr_proto[proto].np_handler(m); NWS_LOCK(nwsp); nwsp->nws_flags &= ~NWS_DISPATCHING; npwp->nw_handled++; @@ -1194,7 +1202,7 @@ sysctl_netisr_proto(SYSCTL_HANDLER_ARGS) counter = 0; NETISR_RLOCK(&tracker); for (proto = 0; proto < NETISR_MAXPROT; proto++) { - npp = &netisr_proto[proto]; + npp = &V_netisr_proto[proto]; if (npp->np_name == NULL) continue; snpp = &snp_array[counter]; @@ -1303,7 +1311,7 @@ sysctl_netisr_work(SYSCTL_HANDLER_ARGS) continue; NWS_LOCK(nwsp); for (proto = 0; proto < NETISR_MAXPROT; proto++) { - npp = &netisr_proto[proto]; + npp = &V_netisr_proto[proto]; if (npp->np_name == NULL) continue; nwp = &nwsp->nws_work[proto]; @@ -1352,7 +1360,7 @@ DB_SHOW_COMMAND(netisr, db_show_netisr) continue; first = 1; for (proto = 0; proto < NETISR_MAXPROT; proto++) { - if (netisr_proto[proto].np_handler == NULL) + if (V_netisr_proto[proto].np_handler == NULL) continue; nwp = &nwsp->nws_work[proto]; if (first) { @@ -1362,7 +1370,7 @@ DB_SHOW_COMMAND(netisr, db_show_netisr) db_printf("%3s ", ""); db_printf( "%6s %5d %5d %5d %8ju %8ju %8ju %8ju\n", - netisr_proto[proto].np_name, nwp->nw_len, + V_netisr_proto[proto].np_name, nwp->nw_len, nwp->nw_watermark, nwp->nw_qlimit, nwp->nw_dispatched, nwp->nw_hybrid_dispatched, nwp->nw_qdrops, nwp->nw_queued); Modified: projects/vnet/sys/net/rtsock.c ============================================================================== --- projects/vnet/sys/net/rtsock.c Sun Apr 24 16:36:33 2016 (r298547) +++ projects/vnet/sys/net/rtsock.c Sun Apr 24 16:41:54 2016 (r298548) @@ -197,10 +197,27 @@ rts_init(void) if (TUNABLE_INT_FETCH("net.route.netisr_maxqlen", &tmp)) rtsock_nh.nh_qlimit = tmp; - netisr_register(&rtsock_nh); } SYSINIT(rtsock, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rts_init, 0); +static void +vnet_rts_init(void) +{ + + netisr_register(&rtsock_nh); +} +VNET_SYSINIT(vnet_rtsock, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, + vnet_rts_init, 0); + +static void +vnet_rts_uninit(void) +{ + + netisr_unregister(&rtsock_nh); +} +VNET_SYSUNINIT(vnet_rts_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, + vnet_rts_uninit, 0); + static int raw_input_rts_cb(struct mbuf *m, struct sockproto *proto, struct sockaddr *src, struct rawcb *rp) Modified: projects/vnet/sys/netinet/if_ether.c ============================================================================== --- projects/vnet/sys/netinet/if_ether.c Sun Apr 24 16:36:33 2016 (r298547) +++ projects/vnet/sys/netinet/if_ether.c Sun Apr 24 16:41:54 2016 (r298548) @@ -143,7 +143,6 @@ SYSCTL_INT(_net_link_ether_inet, OID_AUT } while (0) -static void arp_init(void); static void arpintr(struct mbuf *); static void arptimer(void *); #ifdef INET @@ -1327,7 +1326,7 @@ arp_iflladdr(void *arg __unused, struct } static void -arp_init(void) +vnet_arp_init(void) { netisr_register(&arp_nh); @@ -1335,4 +1334,20 @@ arp_init(void) iflladdr_tag = EVENTHANDLER_REGISTER(iflladdr_event, arp_iflladdr, NULL, EVENTHANDLER_PRI_ANY); } -SYSINIT(arp, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND, arp_init, 0); +VNET_SYSINIT(vnet_arp_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND, + vnet_arp_init, 0); + +#ifdef VIMAGE +/* + * We have to unregister ARP along with IP otherwise we risk doing INADDR_HASH + * lookups after destroying the hash. Ideally this would go on SI_ORDER_3.5. + */ +static void +vnet_arp_destroy(__unused void *arg) +{ + + netisr_unregister(&arp_nh); +} +VNET_SYSUNINIT(vnet_arp_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, + vnet_arp_destroy, NULL); +#endif Modified: projects/vnet/sys/netinet/igmp.c ============================================================================== --- projects/vnet/sys/netinet/igmp.c Sun Apr 24 16:36:33 2016 (r298547) +++ projects/vnet/sys/netinet/igmp.c Sun Apr 24 16:41:54 2016 (r298548) @@ -3592,6 +3592,15 @@ igmp_rec_type_to_str(const int type) } #endif +static void +vnet_igmp_init(const void *unused __unused) +{ + + netisr_register(&igmp_nh); +} +VNET_SYSINIT(vnet_igmp_init, SI_SUB_PROTO_MC, SI_ORDER_ANY, + vnet_igmp_init, NULL); + #ifdef VIMAGE static void vnet_igmp_uninit(const void *unused __unused) @@ -3599,6 +3608,8 @@ vnet_igmp_uninit(const void *unused __un /* This can happen when we shutdown the entire network stack. */ CTR1(KTR_IGMPV3, "%s: tearing down", __func__); + + netisr_unregister(&igmp_nh); } VNET_SYSUNINIT(vnet_igmp_uninit, SI_SUB_PROTO_MC, SI_ORDER_ANY, vnet_igmp_uninit, NULL); @@ -3644,11 +3655,9 @@ igmp_modevent(module_t mod, int type, vo CTR1(KTR_IGMPV3, "%s: initializing", __func__); IGMP_LOCK_INIT(); m_raopt = igmp_ra_alloc(); - netisr_register(&igmp_nh); break; case MOD_UNLOAD: CTR1(KTR_IGMPV3, "%s: tearing down", __func__); - netisr_unregister(&igmp_nh); m_free(m_raopt); m_raopt = NULL; IGMP_LOCK_DESTROY(); @@ -3664,4 +3673,4 @@ static moduledata_t igmp_mod = { igmp_modevent, 0 }; -DECLARE_MODULE(igmp, igmp_mod, SI_SUB_PROTO_MC, SI_ORDER_ANY); +DECLARE_MODULE(igmp, igmp_mod, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE); Modified: projects/vnet/sys/netinet/ip_input.c ============================================================================== --- projects/vnet/sys/netinet/ip_input.c Sun Apr 24 16:36:33 2016 (r298547) +++ projects/vnet/sys/netinet/ip_input.c Sun Apr 24 16:41:54 2016 (r298548) @@ -332,7 +332,7 @@ ip_init(void) /* Skip initialization of globals for non-default instances. */ if (!IS_DEFAULT_VNET(curvnet)) - return; + goto out; pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); if (pr == NULL) @@ -354,6 +354,7 @@ ip_init(void) ip_protox[pr->pr_protocol] = pr - inetsw; } +out: netisr_register(&ip_nh); #ifdef RSS netisr_register(&ip_direct_nh); @@ -367,6 +368,11 @@ ip_destroy(void *unused __unused) struct ifnet *ifp; int error; +#ifdef RSS + netisr_unregister(&ip_direct_nh); +#endif + netisr_unregister(&ip_nh); + if ((error = pfil_head_unregister(&V_inet_pfil_hook)) != 0) printf("%s: WARNING: unable to unregister pfil hook, " "error %d\n", __func__, error); Modified: projects/vnet/sys/netinet6/ip6_input.c ============================================================================== --- projects/vnet/sys/netinet6/ip6_input.c Sun Apr 24 16:36:33 2016 (r298547) +++ projects/vnet/sys/netinet6/ip6_input.c Sun Apr 24 16:41:54 2016 (r298548) @@ -219,7 +219,7 @@ ip6_init(void) /* Skip global initialization stuff for non-default instances. */ if (!IS_DEFAULT_VNET(curvnet)) - return; + goto out; pr = pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); if (pr == NULL) @@ -241,6 +241,7 @@ ip6_init(void) ip6_protox[pr->pr_protocol] = pr - inet6sw; } +out: netisr_register(&ip6_nh); #ifdef RSS netisr_register(&ip6_direct_nh); @@ -313,6 +314,11 @@ ip6_destroy(void *unused __unused) struct ifnet *ifp; int error; +#ifdef RSS + netisr_unregister(&ip6_direct_nh); +#endif + netisr_unregister(&ip6_nh); + if ((error = pfil_head_unregister(&V_inet6_pfil_hook)) != 0) printf("%s: WARNING: unable to unregister pfil hook, " "error %d\n", __func__, error); From owner-svn-src-projects@freebsd.org Mon Apr 25 09:20:45 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E153EB12EBF for ; Mon, 25 Apr 2016 09:20:45 +0000 (UTC) (envelope-from zec@fer.hr) Received: from mail.fer.hr (mail.fer.hr [161.53.72.233]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (Client CN "mail.fer.hr", Issuer "TERENA SSL CA 3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 210DD17D3; Mon, 25 Apr 2016 09:20:41 +0000 (UTC) (envelope-from zec@fer.hr) Received: from x23 (161.53.63.210) by MAIL.fer.hr (161.53.72.233) with Microsoft SMTP Server (TLS) id 14.3.279.2; Mon, 25 Apr 2016 11:20:31 +0200 Date: Mon, 25 Apr 2016 11:21:02 +0200 From: Marko Zec To: "Bjoern A. Zeeb" CC: , Subject: Re: svn commit: r298548 - in projects/vnet/sys: net netinet netinet6 Message-ID: <20160425112102.1f3a8876@x23> In-Reply-To: <201604241641.u3OGfsG5080361@repo.freebsd.org> References: <201604241641.u3OGfsG5080361@repo.freebsd.org> X-Mailer: Claws Mail 3.13.2 (GTK+ 2.24.29; amd64-portbld-freebsd10.1) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [161.53.63.210] X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 25 Apr 2016 09:20:46 -0000 On Sun, 24 Apr 2016 16:41:54 +0000 "Bjoern A. Zeeb" wrote: > Author: bz > Date: Sun Apr 24 16:41:54 2016 > New Revision: 298548 > URL: https://svnweb.freebsd.org/changeset/base/298548 > > Log: > Virtualise the netisr registration in order to do a per-vnet > de-registration to prevent further packets for a specific protocol > (IP, ARP, IPv6) to come up from ether_demux(). There's still a single PCPU mbuf queue per protocol, so if a vnet referenced by a queued mbuf disappears before netisr processing takes place, all we gain here is that we'll panic earlier due to referencing freed memory in netisr_dispatch(), instead of panicing later, in ether_demux(). This patch introduces redundant (per-vnet) copies of handler fuction pointers, along with several extra per-packet checks whether those function pointers are NULL or not. If the goal was to reduce the possibility for the race described above, wouldn't it be simpler to add a single "dying" flag to a vnet, and prevent any further netisr queuing of mbufs once the flag was set?, In both cases, we'd need to walk all PCPU netisr queues and prune any stale mbufs referencing a dying vnet, before we could let the vnet go. Or am I missing something here? > We currently have not better "plug-and-play" hook in place at that > level but should think about that in some distant future (e.g., > to one day be able to load ip, or ipv6). > > Note: this commit will be reverted soon. It turns out that while > the idea is good, and basically works, it can possibly lead to > deadlocks. > > Sponsored by: The FreeBSD Foundation > > Modified: > projects/vnet/sys/net/if_epair.c > projects/vnet/sys/net/if_ethersubr.c > projects/vnet/sys/net/netisr.c > projects/vnet/sys/net/rtsock.c > projects/vnet/sys/netinet/if_ether.c > projects/vnet/sys/netinet/igmp.c > projects/vnet/sys/netinet/ip_input.c > projects/vnet/sys/netinet6/ip6_input.c > > Modified: projects/vnet/sys/net/if_epair.c > ============================================================================== > --- projects/vnet/sys/net/if_epair.c Sun Apr 24 16:36:33 > 2016 (r298547) +++ projects/vnet/sys/net/if_epair.c Sun > Apr 24 16:41:54 2016 (r298548) @@ -959,6 +959,7 @@ > vnet_epair_init(const void *unused __unu > V_epair_cloner = if_clone_advanced(epairname, 0, > epair_clone_match, epair_clone_create, > epair_clone_destroy); > + netisr_register(&epair_nh); > } > VNET_SYSINIT(vnet_epair_init, SI_SUB_PSEUDO, SI_ORDER_ANY, > vnet_epair_init, NULL); > @@ -967,6 +968,7 @@ static void > vnet_epair_uninit(const void *unused __unused) > { > > + netisr_unregister(&epair_nh); > if_clone_detach(V_epair_cloner); > } > VNET_SYSUNINIT(vnet_epair_uninit, SI_SUB_INIT_IF, SI_ORDER_ANY, > @@ -984,12 +986,10 @@ epair_modevent(module_t mod, int type, v > epair_nh.nh_qlimit = 42 * ifqmaxlen; /* 42 shall be > the number. */ if (TUNABLE_INT_FETCH("net.link.epair.netisr_maxqlen", > &qlimit)) epair_nh.nh_qlimit = qlimit; > - netisr_register(&epair_nh); > if (bootverbose) > printf("%s initialized.\n", epairname); > break; > case MOD_UNLOAD: > - netisr_unregister(&epair_nh); > epair_dpcpu_detach(); > if (bootverbose) > printf("%s unloaded.\n", epairname); > @@ -1006,5 +1006,5 @@ static moduledata_t epair_mod = { > 0 > }; > > -DECLARE_MODULE(if_epair, epair_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); > +DECLARE_MODULE(if_epair, epair_mod, SI_SUB_PSEUDO, SI_ORDER_MIDDLE); > MODULE_VERSION(if_epair, 1); > > Modified: projects/vnet/sys/net/if_ethersubr.c > ============================================================================== > --- projects/vnet/sys/net/if_ethersubr.c Sun Apr 24 16:36:33 > 2016 (r298547) +++ projects/vnet/sys/net/if_ethersubr.c > Sun Apr 24 16:41:54 2016 (r298548) @@ -654,14 +654,6 @@ static > struct netisr_handler ether_nh = }; > > static void > -ether_init(__unused void *arg) > -{ > - > - netisr_register(ðer_nh); > -} > -SYSINIT(ether, SI_SUB_INIT_IF, SI_ORDER_ANY, ether_init, NULL); > - > -static void > vnet_ether_init(__unused void *arg) > { > int i; > @@ -672,12 +664,13 @@ vnet_ether_init(__unused void *arg) > if ((i = pfil_head_register(&V_link_pfil_hook)) != 0) > printf("%s: WARNING: unable to register pfil link > hook, " "error %d\n", __func__, i); > + netisr_register(ðer_nh); > } > VNET_SYSINIT(vnet_ether_init, SI_SUB_PROTO_IF, SI_ORDER_ANY, > vnet_ether_init, NULL); > > static void > -vnet_ether_destroy(__unused void *arg) > +vnet_ether_pfil_destroy(__unused void *arg) > { > int i; > > @@ -685,10 +678,17 @@ vnet_ether_destroy(__unused void *arg) > printf("%s: WARNING: unable to unregister pfil link > hook, " "error %d\n", __func__, i); > } > -VNET_SYSUNINIT(vnet_ether_uninit, SI_SUB_PROTO_PFIL, SI_ORDER_ANY, > - vnet_ether_destroy, NULL); > +VNET_SYSUNINIT(vnet_ether_pfil_uninit, SI_SUB_PROTO_PFIL, > SI_ORDER_ANY, > + vnet_ether_pfil_destroy, NULL); > > +static void > +vnet_ether_destroy(__unused void *arg) > +{ > > + netisr_unregister(ðer_nh); > +} > +VNET_SYSUNINIT(vnet_ether_uninit, SI_SUB_PROTO_IF, SI_ORDER_ANY, > + vnet_ether_destroy, NULL); > > static void > ether_input(struct ifnet *ifp, struct mbuf *m) > @@ -710,7 +710,9 @@ ether_input(struct ifnet *ifp, struct mb > * so assert it is correct here. > */ > KASSERT(m->m_pkthdr.rcvif == ifp, ("%s: ifnet > mismatch", __func__)); > + CURVNET_SET_QUIET(ifp->if_vnet); > netisr_dispatch(NETISR_ETHER, m); > + CURVNET_RESTORE(); > m = mn; > } > } > > Modified: projects/vnet/sys/net/netisr.c > ============================================================================== > --- projects/vnet/sys/net/netisr.c Sun Apr 24 16:36:33 > 2016 (r298547) +++ projects/vnet/sys/net/netisr.c Sun > Apr 24 16:41:54 2016 (r298548) @@ -208,7 +208,8 @@ > SYSCTL_UINT(_net_isr, OID_AUTO, maxprot, > * The netisr_proto array describes all registered protocols, > indexed by > * protocol number. See netisr_internal.h for more details. > */ > -static struct netisr_proto netisr_proto[NETISR_MAXPROT]; > +static VNET_DEFINE(struct netisr_proto, > netisr_proto[NETISR_MAXPROT]); +#define > V_netisr_proto VNET(netisr_proto) > /* > * Per-CPU workstream data. See netisr_internal.h for more details. > @@ -396,31 +397,31 @@ netisr_register(const struct netisr_hand > * Test that no existing registration exists for this > protocol. */ > NETISR_WLOCK(); > - KASSERT(netisr_proto[proto].np_name == NULL, > + KASSERT(V_netisr_proto[proto].np_name == NULL, > ("%s(%u, %s): name present", __func__, proto, name)); > - KASSERT(netisr_proto[proto].np_handler == NULL, > + KASSERT(V_netisr_proto[proto].np_handler == NULL, > ("%s(%u, %s): handler present", __func__, proto, name)); > > - netisr_proto[proto].np_name = name; > - netisr_proto[proto].np_handler = nhp->nh_handler; > - netisr_proto[proto].np_m2flow = nhp->nh_m2flow; > - netisr_proto[proto].np_m2cpuid = nhp->nh_m2cpuid; > - netisr_proto[proto].np_drainedcpu = nhp->nh_drainedcpu; > + V_netisr_proto[proto].np_name = name; > + V_netisr_proto[proto].np_handler = nhp->nh_handler; > + V_netisr_proto[proto].np_m2flow = nhp->nh_m2flow; > + V_netisr_proto[proto].np_m2cpuid = nhp->nh_m2cpuid; > + V_netisr_proto[proto].np_drainedcpu = nhp->nh_drainedcpu; > if (nhp->nh_qlimit == 0) > - netisr_proto[proto].np_qlimit = netisr_defaultqlimit; > + V_netisr_proto[proto].np_qlimit = > netisr_defaultqlimit; else if (nhp->nh_qlimit > netisr_maxqlimit) { > printf("%s: %s requested queue limit %u capped to " > "net.isr.maxqlimit %u\n", __func__, name, > nhp->nh_qlimit, netisr_maxqlimit); > - netisr_proto[proto].np_qlimit = netisr_maxqlimit; > + V_netisr_proto[proto].np_qlimit = netisr_maxqlimit; > } else > - netisr_proto[proto].np_qlimit = nhp->nh_qlimit; > - netisr_proto[proto].np_policy = nhp->nh_policy; > - netisr_proto[proto].np_dispatch = nhp->nh_dispatch; > + V_netisr_proto[proto].np_qlimit = nhp->nh_qlimit; > + V_netisr_proto[proto].np_policy = nhp->nh_policy; > + V_netisr_proto[proto].np_dispatch = nhp->nh_dispatch; > CPU_FOREACH(i) { > npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; > bzero(npwp, sizeof(*npwp)); > - npwp->nw_qlimit = netisr_proto[proto].np_qlimit; > + npwp->nw_qlimit = V_netisr_proto[proto].np_qlimit; > } > NETISR_WUNLOCK(); > } > @@ -445,7 +446,7 @@ netisr_clearqdrops(const struct netisr_h > ("%s(%u): protocol too big for %s", __func__, proto, > name)); > NETISR_WLOCK(); > - KASSERT(netisr_proto[proto].np_handler != NULL, > + KASSERT(V_netisr_proto[proto].np_handler != NULL, > ("%s(%u): protocol not registered for %s", __func__, > proto, name)); > > @@ -478,7 +479,7 @@ netisr_getqdrops(const struct netisr_han > ("%s(%u): protocol too big for %s", __func__, proto, > name)); > NETISR_RLOCK(&tracker); > - KASSERT(netisr_proto[proto].np_handler != NULL, > + KASSERT(V_netisr_proto[proto].np_handler != NULL, > ("%s(%u): protocol not registered for %s", __func__, > proto, name)); > > @@ -509,10 +510,10 @@ netisr_getqlimit(const struct netisr_han > ("%s(%u): protocol too big for %s", __func__, proto, > name)); > NETISR_RLOCK(&tracker); > - KASSERT(netisr_proto[proto].np_handler != NULL, > + KASSERT(V_netisr_proto[proto].np_handler != NULL, > ("%s(%u): protocol not registered for %s", __func__, > proto, name)); > - *qlimitp = netisr_proto[proto].np_qlimit; > + *qlimitp = V_netisr_proto[proto].np_qlimit; > NETISR_RUNLOCK(&tracker); > } > > @@ -541,11 +542,11 @@ netisr_setqlimit(const struct netisr_han > ("%s(%u): protocol too big for %s", __func__, proto, > name)); > NETISR_WLOCK(); > - KASSERT(netisr_proto[proto].np_handler != NULL, > + KASSERT(V_netisr_proto[proto].np_handler != NULL, > ("%s(%u): protocol not registered for %s", __func__, > proto, name)); > > - netisr_proto[proto].np_qlimit = qlimit; > + V_netisr_proto[proto].np_qlimit = qlimit; > CPU_FOREACH(i) { > npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; > npwp->nw_qlimit = qlimit; > @@ -600,16 +601,16 @@ netisr_unregister(const struct netisr_ha > ("%s(%u): protocol too big for %s", __func__, proto, > name)); > NETISR_WLOCK(); > - KASSERT(netisr_proto[proto].np_handler != NULL, > + KASSERT(V_netisr_proto[proto].np_handler != NULL, > ("%s(%u): protocol not registered for %s", __func__, > proto, name)); > > - netisr_proto[proto].np_name = NULL; > - netisr_proto[proto].np_handler = NULL; > - netisr_proto[proto].np_m2flow = NULL; > - netisr_proto[proto].np_m2cpuid = NULL; > - netisr_proto[proto].np_qlimit = 0; > - netisr_proto[proto].np_policy = 0; > + V_netisr_proto[proto].np_name = NULL; > + V_netisr_proto[proto].np_handler = NULL; > + V_netisr_proto[proto].np_m2flow = NULL; > + V_netisr_proto[proto].np_m2cpuid = NULL; > + V_netisr_proto[proto].np_qlimit = 0; > + V_netisr_proto[proto].np_policy = 0; > CPU_FOREACH(i) { > npwp = &(DPCPU_ID_PTR(i, nws))->nws_work[proto]; > netisr_drain_proto(npwp); > @@ -763,13 +764,16 @@ netisr_process_workstream_proto(struct n > VNET_ASSERT(m->m_pkthdr.rcvif != NULL, > ("%s:%d rcvif == NULL: m=%p", __func__, > __LINE__, m)); CURVNET_SET(m->m_pkthdr.rcvif->if_vnet); > - netisr_proto[proto].np_handler(m); > + V_netisr_proto[proto].np_handler(m); > CURVNET_RESTORE(); > } > KASSERT(local_npw.nw_len == 0, > ("%s(%u): len %u", __func__, proto, local_npw.nw_len)); > - if (netisr_proto[proto].np_drainedcpu) > - netisr_proto[proto].np_drainedcpu(nwsp->nws_cpu); > + /* We can just use the one from the default VNET. */ > + CURVNET_SET_QUIET(vnet0); > + if (V_netisr_proto[proto].np_drainedcpu) > + V_netisr_proto[proto].np_drainedcpu(nwsp->nws_cpu); > + CURVNET_RESTORE(); > NWS_LOCK(nwsp); > npwp->nw_handled += handled; > return (handled); > @@ -905,10 +909,12 @@ netisr_queue_src(u_int proto, uintptr_t > #ifdef NETISR_LOCKING > NETISR_RLOCK(&tracker); > #endif > - KASSERT(netisr_proto[proto].np_handler != NULL, > - ("%s: invalid proto %u", __func__, proto)); > + if (V_netisr_proto[proto].np_handler == NULL) { > + m_freem(m); > + return (ENOPROTOOPT); > + } > > - m = netisr_select_cpuid(&netisr_proto[proto], > NETISR_DISPATCH_DEFERRED, > + m = netisr_select_cpuid(&V_netisr_proto[proto], > NETISR_DISPATCH_DEFERRED, source, m, &cpuid); > if (m != NULL) { > KASSERT(!CPU_ABSENT(cpuid), ("%s: CPU %u absent", > __func__, @@ -950,9 +956,11 @@ netisr_dispatch_src(u_int proto, > uintptr #ifdef NETISR_LOCKING > NETISR_RLOCK(&tracker); > #endif > - npp = &netisr_proto[proto]; > - KASSERT(npp->np_handler != NULL, ("%s: invalid proto %u", > __func__, > - proto)); > + npp = &V_netisr_proto[proto]; > + if (npp->np_handler == NULL) { > + m_freem(m); > + return (ENOPROTOOPT); > + } > > dispatch_policy = netisr_get_dispatch(npp); > if (dispatch_policy == NETISR_DISPATCH_DEFERRED) > @@ -970,7 +978,7 @@ netisr_dispatch_src(u_int proto, uintptr > npwp = &nwsp->nws_work[proto]; > npwp->nw_dispatched++; > npwp->nw_handled++; > - netisr_proto[proto].np_handler(m); > + V_netisr_proto[proto].np_handler(m); > error = 0; > goto out_unlock; > } > @@ -984,7 +992,7 @@ netisr_dispatch_src(u_int proto, uintptr > * already running. > */ > sched_pin(); > - m = netisr_select_cpuid(&netisr_proto[proto], > NETISR_DISPATCH_HYBRID, > + m = netisr_select_cpuid(&V_netisr_proto[proto], > NETISR_DISPATCH_HYBRID, source, m, &cpuid); > if (m == NULL) { > error = ENOBUFS; > @@ -1021,7 +1029,7 @@ netisr_dispatch_src(u_int proto, uintptr > */ > nwsp->nws_flags |= NWS_DISPATCHING; > NWS_UNLOCK(nwsp); > - netisr_proto[proto].np_handler(m); > + V_netisr_proto[proto].np_handler(m); > NWS_LOCK(nwsp); > nwsp->nws_flags &= ~NWS_DISPATCHING; > npwp->nw_handled++; > @@ -1194,7 +1202,7 @@ sysctl_netisr_proto(SYSCTL_HANDLER_ARGS) > counter = 0; > NETISR_RLOCK(&tracker); > for (proto = 0; proto < NETISR_MAXPROT; proto++) { > - npp = &netisr_proto[proto]; > + npp = &V_netisr_proto[proto]; > if (npp->np_name == NULL) > continue; > snpp = &snp_array[counter]; > @@ -1303,7 +1311,7 @@ sysctl_netisr_work(SYSCTL_HANDLER_ARGS) > continue; > NWS_LOCK(nwsp); > for (proto = 0; proto < NETISR_MAXPROT; proto++) { > - npp = &netisr_proto[proto]; > + npp = &V_netisr_proto[proto]; > if (npp->np_name == NULL) > continue; > nwp = &nwsp->nws_work[proto]; > @@ -1352,7 +1360,7 @@ DB_SHOW_COMMAND(netisr, db_show_netisr) > continue; > first = 1; > for (proto = 0; proto < NETISR_MAXPROT; proto++) { > - if (netisr_proto[proto].np_handler == NULL) > + if (V_netisr_proto[proto].np_handler == NULL) > continue; > nwp = &nwsp->nws_work[proto]; > if (first) { > @@ -1362,7 +1370,7 @@ DB_SHOW_COMMAND(netisr, db_show_netisr) > db_printf("%3s ", ""); > db_printf( > "%6s %5d %5d %5d %8ju %8ju %8ju %8ju\n", > - netisr_proto[proto].np_name, nwp->nw_len, > + V_netisr_proto[proto].np_name, > nwp->nw_len, nwp->nw_watermark, nwp->nw_qlimit, > nwp->nw_dispatched, > nwp->nw_hybrid_dispatched, nwp->nw_qdrops, nwp->nw_queued); > > Modified: projects/vnet/sys/net/rtsock.c > ============================================================================== > --- projects/vnet/sys/net/rtsock.c Sun Apr 24 16:36:33 > 2016 (r298547) +++ projects/vnet/sys/net/rtsock.c Sun > Apr 24 16:41:54 2016 (r298548) @@ -197,10 +197,27 @@ > rts_init(void) > if (TUNABLE_INT_FETCH("net.route.netisr_maxqlen", &tmp)) > rtsock_nh.nh_qlimit = tmp; > - netisr_register(&rtsock_nh); > } > SYSINIT(rtsock, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, rts_init, 0); > > +static void > +vnet_rts_init(void) > +{ > + > + netisr_register(&rtsock_nh); > +} > +VNET_SYSINIT(vnet_rtsock, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, > + vnet_rts_init, 0); > + > +static void > +vnet_rts_uninit(void) > +{ > + > + netisr_unregister(&rtsock_nh); > +} > +VNET_SYSUNINIT(vnet_rts_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, > + vnet_rts_uninit, 0); > + > static int > raw_input_rts_cb(struct mbuf *m, struct sockproto *proto, struct > sockaddr *src, struct rawcb *rp) > > Modified: projects/vnet/sys/netinet/if_ether.c > ============================================================================== > --- projects/vnet/sys/netinet/if_ether.c Sun Apr 24 16:36:33 > 2016 (r298547) +++ projects/vnet/sys/netinet/if_ether.c > Sun Apr 24 16:41:54 2016 (r298548) @@ -143,7 +143,6 @@ > SYSCTL_INT(_net_link_ether_inet, OID_AUT } while (0) > > > -static void arp_init(void); > static void arpintr(struct mbuf *); > static void arptimer(void *); > #ifdef INET > @@ -1327,7 +1326,7 @@ arp_iflladdr(void *arg __unused, struct > } > > static void > -arp_init(void) > +vnet_arp_init(void) > { > > netisr_register(&arp_nh); > @@ -1335,4 +1334,20 @@ arp_init(void) > iflladdr_tag = EVENTHANDLER_REGISTER(iflladdr_event, > arp_iflladdr, NULL, EVENTHANDLER_PRI_ANY); > } > -SYSINIT(arp, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND, arp_init, 0); > +VNET_SYSINIT(vnet_arp_init, SI_SUB_PROTO_DOMAIN, SI_ORDER_SECOND, > + vnet_arp_init, 0); > + > +#ifdef VIMAGE > +/* > + * We have to unregister ARP along with IP otherwise we risk doing > INADDR_HASH > + * lookups after destroying the hash. Ideally this would go on > SI_ORDER_3.5. > + */ > +static void > +vnet_arp_destroy(__unused void *arg) > +{ > + > + netisr_unregister(&arp_nh); > +} > +VNET_SYSUNINIT(vnet_arp_uninit, SI_SUB_PROTO_DOMAIN, SI_ORDER_THIRD, > + vnet_arp_destroy, NULL); > +#endif > > Modified: projects/vnet/sys/netinet/igmp.c > ============================================================================== > --- projects/vnet/sys/netinet/igmp.c Sun Apr 24 16:36:33 > 2016 (r298547) +++ projects/vnet/sys/netinet/igmp.c Sun > Apr 24 16:41:54 2016 (r298548) @@ -3592,6 +3592,15 @@ > igmp_rec_type_to_str(const int type) } > #endif > > +static void > +vnet_igmp_init(const void *unused __unused) > +{ > + > + netisr_register(&igmp_nh); > +} > +VNET_SYSINIT(vnet_igmp_init, SI_SUB_PROTO_MC, SI_ORDER_ANY, > + vnet_igmp_init, NULL); > + > #ifdef VIMAGE > static void > vnet_igmp_uninit(const void *unused __unused) > @@ -3599,6 +3608,8 @@ vnet_igmp_uninit(const void *unused __un > > /* This can happen when we shutdown the entire network > stack. */ CTR1(KTR_IGMPV3, "%s: tearing down", __func__); > + > + netisr_unregister(&igmp_nh); > } > VNET_SYSUNINIT(vnet_igmp_uninit, SI_SUB_PROTO_MC, SI_ORDER_ANY, > vnet_igmp_uninit, NULL); > @@ -3644,11 +3655,9 @@ igmp_modevent(module_t mod, int type, vo > CTR1(KTR_IGMPV3, "%s: initializing", __func__); > IGMP_LOCK_INIT(); > m_raopt = igmp_ra_alloc(); > - netisr_register(&igmp_nh); > break; > case MOD_UNLOAD: > CTR1(KTR_IGMPV3, "%s: tearing down", __func__); > - netisr_unregister(&igmp_nh); > m_free(m_raopt); > m_raopt = NULL; > IGMP_LOCK_DESTROY(); > @@ -3664,4 +3673,4 @@ static moduledata_t igmp_mod = { > igmp_modevent, > 0 > }; > -DECLARE_MODULE(igmp, igmp_mod, SI_SUB_PROTO_MC, SI_ORDER_ANY); > +DECLARE_MODULE(igmp, igmp_mod, SI_SUB_PROTO_MC, SI_ORDER_MIDDLE); > > Modified: projects/vnet/sys/netinet/ip_input.c > ============================================================================== > --- projects/vnet/sys/netinet/ip_input.c Sun Apr 24 16:36:33 > 2016 (r298547) +++ projects/vnet/sys/netinet/ip_input.c > Sun Apr 24 16:41:54 2016 (r298548) @@ -332,7 +332,7 @@ > ip_init(void) > /* Skip initialization of globals for non-default instances. > */ if (!IS_DEFAULT_VNET(curvnet)) > - return; > + goto out; > > pr = pffindproto(PF_INET, IPPROTO_RAW, SOCK_RAW); > if (pr == NULL) > @@ -354,6 +354,7 @@ ip_init(void) > ip_protox[pr->pr_protocol] = pr - > inetsw; } > > +out: > netisr_register(&ip_nh); > #ifdef RSS > netisr_register(&ip_direct_nh); > @@ -367,6 +368,11 @@ ip_destroy(void *unused __unused) > struct ifnet *ifp; > int error; > > +#ifdef RSS > + netisr_unregister(&ip_direct_nh); > +#endif > + netisr_unregister(&ip_nh); > + > if ((error = pfil_head_unregister(&V_inet_pfil_hook)) != 0) > printf("%s: WARNING: unable to unregister pfil hook, > " "error %d\n", __func__, error); > > Modified: projects/vnet/sys/netinet6/ip6_input.c > ============================================================================== > --- projects/vnet/sys/netinet6/ip6_input.c Sun Apr 24 16:36:33 > 2016 (r298547) +++ > projects/vnet/sys/netinet6/ip6_input.c Sun Apr 24 16:41:54 > 2016 (r298548) @@ -219,7 +219,7 @@ ip6_init(void) > /* Skip global initialization stuff for non-default > instances. */ if (!IS_DEFAULT_VNET(curvnet)) > - return; > + goto out; > > pr = pffindproto(PF_INET6, IPPROTO_RAW, SOCK_RAW); > if (pr == NULL) > @@ -241,6 +241,7 @@ ip6_init(void) > ip6_protox[pr->pr_protocol] = pr - > inet6sw; } > > +out: > netisr_register(&ip6_nh); > #ifdef RSS > netisr_register(&ip6_direct_nh); > @@ -313,6 +314,11 @@ ip6_destroy(void *unused __unused) > struct ifnet *ifp; > int error; > > +#ifdef RSS > + netisr_unregister(&ip6_direct_nh); > +#endif > + netisr_unregister(&ip6_nh); > + > if ((error = pfil_head_unregister(&V_inet6_pfil_hook)) != 0) > printf("%s: WARNING: unable to unregister pfil hook, > " "error %d\n", __func__, error); > From owner-svn-src-projects@freebsd.org Wed Apr 27 15:27:24 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53A08B1ED8C for ; Wed, 27 Apr 2016 15:27:24 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2497319B2; Wed, 27 Apr 2016 15:27:24 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3RFRNgr082192; Wed, 27 Apr 2016 15:27:23 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3RFRNh3082189; Wed, 27 Apr 2016 15:27:23 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201604271527.u3RFRNh3082189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 27 Apr 2016 15:27:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r298701 - in projects/zfsd/head: cddl/sbin/zfsd share/mk X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 15:27:24 -0000 Author: asomers Date: Wed Apr 27 15:27:23 2016 New Revision: 298701 URL: https://svnweb.freebsd.org/changeset/base/298701 Log: Replace LDADD with LIBADD and NO_MAN with MK_MAN Sponsored by: Spectra Logic Corp Modified: projects/zfsd/head/cddl/sbin/zfsd/Makefile.common projects/zfsd/head/share/mk/src.libnames.mk Modified: projects/zfsd/head/cddl/sbin/zfsd/Makefile.common ============================================================================== --- projects/zfsd/head/cddl/sbin/zfsd/Makefile.common Wed Apr 27 15:25:18 2016 (r298700) +++ projects/zfsd/head/cddl/sbin/zfsd/Makefile.common Wed Apr 27 15:27:23 2016 (r298701) @@ -10,7 +10,7 @@ SRCS= callout.cc \ zpool_list.cc \ zfsd_main.cc -NO_MAN= YES +MK_MAN= no WARNS?= 3 @@ -36,7 +36,7 @@ CFLAGS= -g -DNEED_SOLARIS_BOOLEAN ${INCF DPADD= ${LIBDEVDCTL} ${LIBZFS} ${LIBZFS_CORE} ${LIBUTIL} ${LIBGEOM} \ ${LIBBSDXML} ${LIBSBUF} ${LIBNVPAIR} ${LIBUUTIL} -LDADD= -ldevdctl -lzfs -lzfs_core -lutil -lgeom -lbsdxml -lsbuf -lnvpair -luutil +LIBADD= devdctl zfs zfs_core util geom bsdxml sbuf nvpair uutil cscope: find ${.CURDIR} -type f -a \( -name "*.[ch]" -o -name "*.cc" \) \ Modified: projects/zfsd/head/share/mk/src.libnames.mk ============================================================================== --- projects/zfsd/head/share/mk/src.libnames.mk Wed Apr 27 15:25:18 2016 (r298700) +++ projects/zfsd/head/share/mk/src.libnames.mk Wed Apr 27 15:27:23 2016 (r298701) @@ -82,6 +82,7 @@ _LIBRARIES= \ cuse \ cxxrt \ devctl \ + devdctl \ devinfo \ devstat \ dialog \ From owner-svn-src-projects@freebsd.org Wed Apr 27 15:38:58 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CFCAB1E182 for ; Wed, 27 Apr 2016 15:38:58 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6192A1254; Wed, 27 Apr 2016 15:38:58 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3RFcvgW085396; Wed, 27 Apr 2016 15:38:57 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3RFcvNa085390; Wed, 27 Apr 2016 15:38:57 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201604271538.u3RFcvNa085390@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 27 Apr 2016 15:38:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r298704 - in projects/zfsd/head: cddl/sbin/zfsd lib/libdevdctl lib/libdevdctl/tests X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 15:38:58 -0000 Author: asomers Date: Wed Apr 27 15:38:56 2016 New Revision: 298704 URL: https://svnweb.freebsd.org/changeset/base/298704 Log: Make zfsd(8) listen to GEOM::physpath events zfsd should use a newly arrived device for autoreplace by physical path operations, even if that device's physical path isn't known when zfsd first becomes aware of the device. Background: When a new device arrives, devfs emits a CREATE event to devctl(4). In parallel, enc(4) assigns a physical path to it, then geom(4) emits a GEOM::physpath event. It's possible that zfsd will see the CREATE event before the physical path has been assigned. Previously, we would ignore such a device. Now, zfsd(8) will listen to the GEOM::physpath event so it can use the device for autoreplace-by-physical-path actions. lib/libdevctl/event.cc: lib/libdevctl/event.h: lib/libdevctl/tests/libdevctl_unittest.cc Provide GeomEvent objects. Move DevfsEvent::{Devname,IsDiskDev,PhysicalPath,DevPath} into the base Event class. Only DevName needs to be specialized in the derived classes. cddl/sbin/zfsd/zfsd.cc cddl/sbin/zfsd/zfsd_event.cc cddl/sbin/zfsd/zfsd_event.h Listen for GEOM::physpath events. When one arrives, ReEvaluate any matching caseFiles. Sponsored by: Spectra Logic Corp Modified: projects/zfsd/head/cddl/sbin/zfsd/zfsd.cc projects/zfsd/head/cddl/sbin/zfsd/zfsd_event.cc projects/zfsd/head/cddl/sbin/zfsd/zfsd_event.h projects/zfsd/head/lib/libdevdctl/event.cc projects/zfsd/head/lib/libdevdctl/event.h projects/zfsd/head/lib/libdevdctl/tests/libdevdctl_unittest.cc Modified: projects/zfsd/head/cddl/sbin/zfsd/zfsd.cc ============================================================================== --- projects/zfsd/head/cddl/sbin/zfsd/zfsd.cc Wed Apr 27 15:35:05 2016 (r298703) +++ projects/zfsd/head/cddl/sbin/zfsd/zfsd.cc Wed Apr 27 15:38:56 2016 (r298704) @@ -99,6 +99,7 @@ bool ZfsDaemon::s_systemRescanRequ EventFactory::Record ZfsDaemon::s_registryEntries[] = { { Event::NOTIFY, "DEVFS", &DevfsEvent::Builder }, + { Event::NOTIFY, "GEOM", &GeomEvent::Builder }, { Event::NOTIFY, "ZFS", &ZfsEvent::Builder } }; Modified: projects/zfsd/head/cddl/sbin/zfsd/zfsd_event.cc ============================================================================== --- projects/zfsd/head/cddl/sbin/zfsd/zfsd_event.cc Wed Apr 27 15:35:05 2016 (r298703) +++ projects/zfsd/head/cddl/sbin/zfsd/zfsd_event.cc Wed Apr 27 15:38:56 2016 (r298704) @@ -226,6 +226,79 @@ DevfsEvent::DevfsEvent(const DevfsEvent { } +/*-------------------------------- GeomEvent --------------------------------*/ + +//- GeomEvent Static Public Methods ------------------------------------------- +Event * +GeomEvent::Builder(Event::Type type, + NVPairMap &nvPairs, + const string &eventString) +{ + return (new GeomEvent(type, nvPairs, eventString)); +} + +//- GeomEvent Virtual Public Methods ------------------------------------------ +Event * +GeomEvent::DeepCopy() const +{ + return (new GeomEvent(*this)); +} + +bool +GeomEvent::Process() const +{ + /* + * We are only concerned with physical path changes, because those can + * be used to satisfy autoreplace operations + */ + if (Value("type") != "GEOM::physpath" || !IsDiskDev()) + return (false); + + /* Log the event since it is of interest. */ + Log(LOG_INFO); + + string devPath; + if (!DevPath(devPath)) + return (false); + + string physPath; + bool havePhysPath(PhysicalPath(physPath)); + + string devName; + DevName(devName); + + if (havePhysPath) { + /* + * TODO: attempt to resolve events using every casefile + * that matches this physpath + */ + CaseFile *caseFile(CaseFile::Find(physPath)); + if (caseFile != NULL) { + syslog(LOG_INFO, + "Found CaseFile(%s:%s:%s) - ReEvaluating\n", + caseFile->PoolGUIDString().c_str(), + caseFile->VdevGUIDString().c_str(), + zpool_state_to_name(caseFile->VdevState(), + VDEV_AUX_NONE)); + caseFile->ReEvaluate(devPath, physPath, /*vdev*/NULL); + } + } + return (false); +} + +//- GeomEvent Protected Methods ----------------------------------------------- +GeomEvent::GeomEvent(Event::Type type, NVPairMap &nvpairs, + const string &eventString) + : DevdCtl::GeomEvent(type, nvpairs, eventString) +{ +} + +GeomEvent::GeomEvent(const GeomEvent &src) + : DevdCtl::GeomEvent::GeomEvent(src) +{ +} + + /*--------------------------------- ZfsEvent ---------------------------------*/ //- ZfsEvent Static Public Methods --------------------------------------------- DevdCtl::Event * Modified: projects/zfsd/head/cddl/sbin/zfsd/zfsd_event.h ============================================================================== --- projects/zfsd/head/cddl/sbin/zfsd/zfsd_event.h Wed Apr 27 15:35:05 2016 (r298703) +++ projects/zfsd/head/cddl/sbin/zfsd/zfsd_event.h Wed Apr 27 15:38:56 2016 (r298704) @@ -149,4 +149,20 @@ protected: static VdevCallback_t TryDetach; }; +class GeomEvent : public DevdCtl::GeomEvent +{ +public: + static BuildMethod Builder; + + virtual DevdCtl::Event *DeepCopy() const; + + virtual bool Process() const; + +protected: + /** DeepCopy Constructor. */ + GeomEvent(const GeomEvent &src); + + /** Constructor */ + GeomEvent(Type, DevdCtl::NVPairMap &, const string &); +}; #endif /*_ZFSD_EVENT_H_ */ Modified: projects/zfsd/head/lib/libdevdctl/event.cc ============================================================================== --- projects/zfsd/head/lib/libdevdctl/event.cc Wed Apr 27 15:35:05 2016 (r298703) +++ projects/zfsd/head/lib/libdevdctl/event.cc Wed Apr 27 15:38:56 2016 (r298704) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011, 2012, 2013 Spectra Logic Corporation + * Copyright (c) 2011, 2012, 2013, 2016 Spectra Logic Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -69,7 +69,9 @@ __FBSDID("$FreeBSD$"); #define NUM_ELEMENTS(x) (sizeof(x) / sizeof(*x)) /*============================ Namespace Control =============================*/ +using std::begin; using std::cout; +using std::end; using std::endl; using std::string; using std::stringstream; @@ -123,6 +125,50 @@ Event::CreateEvent(const EventFactory &f return (factory.Build(type, nvpairs, eventString)); } +bool +Event::DevName(std::string &name) const +{ + return (false); +} + +/* TODO: simplify this function with C++-11 methods */ +bool +Event::IsDiskDev() const +{ + static const char *diskDevNames[] = + { + "da", + "ada" + }; + const char **dName; + string devName; + + if (! DevName(devName)) + return false; + + size_t find_start = devName.rfind('/'); + if (find_start == string::npos) { + find_start = 0; + } else { + /* Just after the last '/'. */ + find_start++; + } + + for (dName = begin(diskDevNames); dName <= end(diskDevNames); dName++) { + + size_t loc(devName.find(*dName, find_start)); + if (loc == find_start) { + size_t prefixLen(strlen(*dName)); + + if (devName.length() - find_start >= prefixLen + && isdigit(devName[find_start + prefixLen])) + return (true); + } + } + + return (false); +} + const char * Event::TypeToString(Event::Type type) { @@ -228,6 +274,48 @@ Event::GetTimestamp() const return (tv_timestamp); } +bool +Event::DevPath(std::string &path) const +{ + string devName; + + if (!DevName(devName)) + return (false); + + string devPath(_PATH_DEV + devName); + int devFd(open(devPath.c_str(), O_RDONLY)); + if (devFd == -1) + return (false); + + /* Normalize the device name in case the DEVFS event is for a link. */ + devName = fdevname(devFd); + path = _PATH_DEV + devName; + + close(devFd); + + return (true); +} + +bool +Event::PhysicalPath(std::string &path) const +{ + string devPath; + + if (!DevPath(devPath)) + return (false); + + int devFd(open(devPath.c_str(), O_RDONLY)); + if (devFd == -1) + return (false); + + char physPath[MAXPATHLEN]; + physPath[0] = '\0'; + bool result(ioctl(devFd, DIOCGPHYSPATH, physPath) == 0); + close(devFd); + if (result) + path = physPath; + return (result); +} //- Event Protected Methods ---------------------------------------------------- Event::Event(Type type, NVPairMap &map, const string &eventString) @@ -366,41 +454,6 @@ DevfsEvent::Builder(Event::Type type, NV //- DevfsEvent Static Protected Methods ---------------------------------------- bool -DevfsEvent::IsDiskDev(const string &devName) -{ - static const char *diskDevNames[] = - { - "da", - "ada" - }; - - const char **diskName(diskDevNames); - const char **lastDiskName(diskDevNames - + NUM_ELEMENTS(diskDevNames) - 1); - size_t find_start = devName.rfind('/'); - if (find_start == string::npos) { - find_start = 0; - } else { - /* Just after the last '/'. */ - find_start++; - } - - for (; diskName <= lastDiskName; diskName++) { - - size_t loc(devName.find(*diskName, find_start)); - if (loc == find_start) { - size_t prefixLen(strlen(*diskName)); - - if (devName.length() - find_start >= prefixLen - && isdigit(devName[find_start + prefixLen])) - return (true); - } - } - - return (false); -} - -bool DevfsEvent::IsWholeDev(const string &devName) { string::const_iterator i(devName.begin()); @@ -442,14 +495,6 @@ DevfsEvent::Process() const //- DevfsEvent Public Methods -------------------------------------------------- bool -DevfsEvent::IsDiskDev() const -{ - string devName; - - return (DevName(devName) && IsDiskDev(devName)); -} - -bool DevfsEvent::IsWholeDev() const { string devName; @@ -467,58 +512,53 @@ DevfsEvent::DevName(std::string &name) c return (!name.empty()); } -bool -DevfsEvent::DevPath(std::string &path) const +//- DevfsEvent Protected Methods ----------------------------------------------- +DevfsEvent::DevfsEvent(Event::Type type, NVPairMap &nvpairs, + const string &eventString) + : Event(type, nvpairs, eventString) { - string devName; - - if (!DevName(devName)) - return (false); - - string devPath(_PATH_DEV + devName); - int devFd(open(devPath.c_str(), O_RDONLY)); - if (devFd == -1) - return (false); +} - /* Normalize the device name in case the DEVFS event is for a link. */ - devName = fdevname(devFd); - path = _PATH_DEV + devName; +DevfsEvent::DevfsEvent(const DevfsEvent &src) + : Event(src) +{ +} - close(devFd); +/*--------------------------------- GeomEvent --------------------------------*/ +//- GeomEvent Static Public Methods -------------------------------------------- +Event * +GeomEvent::Builder(Event::Type type, NVPairMap &nvpairs, + const string &eventString) +{ + return (new GeomEvent(type, nvpairs, eventString)); +} - return (true); +//- GeomEvent Virtual Public Methods ------------------------------------------- +Event * +GeomEvent::DeepCopy() const +{ + return (new GeomEvent(*this)); } bool -DevfsEvent::PhysicalPath(std::string &path) const +GeomEvent::DevName(std::string &name) const { - string devPath; - - if (!DevPath(devPath)) - return (false); - - int devFd(open(devPath.c_str(), O_RDONLY)); - if (devFd == -1) - return (false); - - char physPath[MAXPATHLEN]; - physPath[0] = '\0'; - bool result(ioctl(devFd, DIOCGPHYSPATH, physPath) == 0); - close(devFd); - if (result) - path = physPath; - return (result); + name = Value("devname"); + return (!name.empty()); } -//- DevfsEvent Protected Methods ----------------------------------------------- -DevfsEvent::DevfsEvent(Event::Type type, NVPairMap &nvpairs, - const string &eventString) - : Event(type, nvpairs, eventString) + +//- GeomEvent Protected Methods ------------------------------------------------ +GeomEvent::GeomEvent(Event::Type type, NVPairMap &nvpairs, + const string &eventString) + : Event(type, nvpairs, eventString), + m_devname(Value("devname")) { } -DevfsEvent::DevfsEvent(const DevfsEvent &src) - : Event(src) +GeomEvent::GeomEvent(const GeomEvent &src) + : Event(src), + m_devname(src.m_devname) { } @@ -538,6 +578,12 @@ ZfsEvent::DeepCopy() const return (new ZfsEvent(*this)); } +bool +ZfsEvent::DevName(std::string &name) const +{ + return (false); +} + //- ZfsEvent Protected Methods ------------------------------------------------- ZfsEvent::ZfsEvent(Event::Type type, NVPairMap &nvpairs, const string &eventString) Modified: projects/zfsd/head/lib/libdevdctl/event.h ============================================================================== --- projects/zfsd/head/lib/libdevdctl/event.h Wed Apr 27 15:35:05 2016 (r298703) +++ projects/zfsd/head/lib/libdevdctl/event.h Wed Apr 27 15:38:56 2016 (r298704) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2011, 2012, 2013 Spectra Logic Corporation + * Copyright (c) 2011, 2012, 2013, 2016 Spectra Logic Corporation * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -101,6 +101,36 @@ public: const std::string &eventString); /** + * Returns the devname, if any, associated with the event + * + * \param name Devname, returned by reference + * \return True iff the event contained a devname + */ + virtual bool DevName(std::string &name) const; + + /** + * Returns the absolute pathname of the device associated with this + * event. + * + * \param name Devname, returned by reference + * \return True iff the event contained a devname + */ + bool DevPath(std::string &path) const; + + /** + * Returns true iff this event refers to a disk device + */ + bool IsDiskDev() const; + + /** Returns the physical path of the device, if any + * + * \param path Physical path, returned by reference + * \return True iff the event contains a device with a physical + * path + */ + bool PhysicalPath(std::string &path) const; + + /** * Provide a user friendly string representation of an * event type. * @@ -298,22 +328,11 @@ public: */ virtual bool Process() const; - bool IsDiskDev() const; bool IsWholeDev() const; - bool DevName(std::string &name) const; - bool DevPath(std::string &path) const; - bool PhysicalPath(std::string &path) const; + virtual bool DevName(std::string &name) const; protected: /** - * Determine if the given device name references a potential - * disk device. - * - * \param devName The device name to test. - */ - static bool IsDiskDev(const std::string &devName); - - /** * Given the device name of a disk, determine if the device * represents the whole device, not just a partition. * @@ -331,6 +350,29 @@ protected: DevfsEvent(Type, NVPairMap &, const std::string &); }; +/*--------------------------------- GeomEvent --------------------------------*/ +class GeomEvent : public Event +{ +public: + /** Specialized Event object factory for GEOM events. */ + static BuildMethod Builder; + + virtual Event *DeepCopy() const; + + virtual bool DevName(std::string &name) const; + + const std::string &DeviceName() const; + +protected: + /** Constructor */ + GeomEvent(Type, NVPairMap &, const std::string &); + + /** Deep copy constructor. */ + GeomEvent(const GeomEvent &src); + + std::string m_devname; +}; + /*--------------------------------- ZfsEvent ---------------------------------*/ class ZfsEvent : public Event { @@ -340,6 +382,8 @@ public: virtual Event *DeepCopy() const; + virtual bool DevName(std::string &name) const; + const std::string &PoolName() const; Guid PoolGUID() const; Guid VdevGUID() const; Modified: projects/zfsd/head/lib/libdevdctl/tests/libdevdctl_unittest.cc ============================================================================== --- projects/zfsd/head/lib/libdevdctl/tests/libdevdctl_unittest.cc Wed Apr 27 15:35:05 2016 (r298703) +++ projects/zfsd/head/lib/libdevdctl/tests/libdevdctl_unittest.cc Wed Apr 27 15:38:56 2016 (r298704) @@ -44,13 +44,21 @@ using namespace DevdCtl; using namespace std; using namespace testing; -#define NUM_ELEMENTS(x) (sizeof(x) / sizeof(*x)) +#define REGISTRY_SIZE 2 -class IsDiskDevTest : public TestWithParam >{ +struct DevNameTestParams +{ + const char* evs; + bool is_disk; + const char* devname; +}; + +class DevNameTest : public TestWithParam{ protected: virtual void SetUp() { m_factory = new EventFactory(); + m_factory->UpdateRegistry(s_registry, REGISTRY_SIZE); } virtual void TearDown() @@ -61,53 +69,68 @@ protected: EventFactory *m_factory; Event *m_ev; - static EventFactory::Record s_registry[]; + static EventFactory::Record s_registry[REGISTRY_SIZE]; }; -DevdCtl::EventFactory::Record IsDiskDevTest::s_registry[] = { - { Event::NOTIFY, "DEVFS", &DevfsEvent::Builder } +DevdCtl::EventFactory::Record DevNameTest::s_registry[REGISTRY_SIZE] = { + { Event::NOTIFY, "DEVFS", &DevfsEvent::Builder }, + { Event::NOTIFY, "GEOM", &GeomEvent::Builder } }; -TEST_P(IsDiskDevTest, TestIsDiskDev) { - pair param = GetParam(); - DevfsEvent *devfs_ev; +TEST_P(DevNameTest, TestDevname) { + std::string devname; + DevNameTestParams param = GetParam(); + + string evString(param.evs); + m_ev = Event::CreateEvent(*m_factory, evString); + m_ev->DevName(devname); + EXPECT_STREQ(param.devname, devname.c_str()); +} + +TEST_P(DevNameTest, TestIsDiskDev) { + DevNameTestParams param = GetParam(); - m_factory->UpdateRegistry(s_registry, NUM_ELEMENTS(s_registry)); - string evString(param.second); + string evString(param.evs); m_ev = Event::CreateEvent(*m_factory, evString); - devfs_ev = dynamic_cast(m_ev); - ASSERT_NE(nullptr, devfs_ev); - EXPECT_EQ(param.first, devfs_ev->IsDiskDev()); + EXPECT_EQ(param.is_disk, m_ev->IsDiskDev()); } -INSTANTIATE_TEST_CASE_P(IsDiskDevTestInstantiation, IsDiskDevTest, Values( - pair(true, - "!system=DEVFS subsystem=CDEV type=CREATE cdev=da6\n"), - pair(false, - "!system=DEVFS subsystem=CDEV type=CREATE cdev=cuau0\n"), - pair(true, - "!system=DEVFS subsystem=CDEV type=CREATE cdev=ada6\n"), - pair(true, - "!system=DEVFS subsystem=CDEV type=CREATE cdev=da6p1\n"), - pair(true, - "!system=DEVFS subsystem=CDEV type=CREATE cdev=ada6p1\n"), - pair(true, - "!system=DEVFS subsystem=CDEV type=CREATE cdev=da6s0p1\n"), - pair(true, - "!system=DEVFS subsystem=CDEV type=CREATE cdev=ada6s0p1\n"), +/* TODO: clean this up using C++-11 uniform initializers */ +INSTANTIATE_TEST_CASE_P(IsDiskDevTestInstantiation, DevNameTest, Values( + (DevNameTestParams){ + .evs = "!system=DEVFS subsystem=CDEV type=CREATE cdev=da6\n", + .is_disk = true, .devname = "da6"}, + (DevNameTestParams){.is_disk = false, .devname = "cuau0", + .evs = "!system=DEVFS subsystem=CDEV type=CREATE cdev=cuau0\n"}, + (DevNameTestParams){.is_disk = true, .devname = "ada6", + .evs = "!system=DEVFS subsystem=CDEV type=CREATE cdev=ada6\n"}, + (DevNameTestParams){.is_disk = true, .devname = "da6p1", + .evs = "!system=DEVFS subsystem=CDEV type=CREATE cdev=da6p1\n"}, + (DevNameTestParams){.is_disk = true, .devname = "ada6p1", + .evs = "!system=DEVFS subsystem=CDEV type=CREATE cdev=ada6p1\n"}, + (DevNameTestParams){.is_disk = true, .devname = "da6s0p1", + .evs = "!system=DEVFS subsystem=CDEV type=CREATE cdev=da6s0p1\n"}, + (DevNameTestParams){.is_disk = true, .devname = "ada6s0p1", + .evs = "!system=DEVFS subsystem=CDEV type=CREATE cdev=ada6s0p1\n"}, /* * Test physical path nodes. These are currently all set to false since * physical path nodes are implemented with symlinks, and most CAM and * ZFS operations can't use symlinked device nodes */ /* A SpectraBSD-style physical path node*/ - pair(false, - "!system=DEVFS subsystem=CDEV type=CREATE cdev=enc@50030480019f53fd/elmtype@array_device/slot@18/da\n"), - pair(false, - "!system=DEVFS subsystem=CDEV type=CREATE cdev=enc@50030480019f53fd/elmtype@array_device/slot@18/pass\n"), + (DevNameTestParams){.is_disk = false, .devname = "enc@50030480019f53fd/elmtype@array_device/slot@18/da", + .evs = "!system=DEVFS subsystem=CDEV type=CREATE cdev=enc@50030480019f53fd/elmtype@array_device/slot@18/da\n"}, + (DevNameTestParams){.is_disk = false, .devname = "enc@50030480019f53fd/elmtype@array_device/slot@18/pass", + .evs = "!system=DEVFS subsystem=CDEV type=CREATE cdev=enc@50030480019f53fd/elmtype@array_device/slot@18/pass\n"}, /* A FreeBSD-style physical path node */ - pair(true, - "!system=DEVFS subsystem=CDEV type=CREATE cdev=enc@n50030480019f53fd/type@0/slot@18/elmdesc@ArrayDevice18/da6\n"), - pair(false, - "!system=DEVFS subsystem=CDEV type=CREATE cdev=enc@n50030480019f53fd/type@0/slot@18/elmdesc@ArrayDevice18/pass6\n")); + (DevNameTestParams){.is_disk = true, .devname = "enc@n50030480019f53fd/type@0/slot@18/elmdesc@ArrayDevice18/da6", + .evs = "!system=DEVFS subsystem=CDEV type=CREATE cdev=enc@n50030480019f53fd/type@0/slot@18/elmdesc@ArrayDevice18/da6\n"}, + (DevNameTestParams){.is_disk = false, .devname = "enc@n50030480019f53fd/type@0/slot@18/elmdesc@ArrayDevice18/pass6", + .evs = "!system=DEVFS subsystem=CDEV type=CREATE cdev=enc@n50030480019f53fd/type@0/slot@18/elmdesc@ArrayDevice18/pass6\n"}, + + /* + * Test some GEOM events + */ + (DevNameTestParams){.is_disk = true, .devname = "da5", + .evs = "!system=GEOM subsystem=disk type=GEOM::physpath devname=da5\n"}) ); From owner-svn-src-projects@freebsd.org Wed Apr 27 16:14:05 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23F9CB1EAAC for ; Wed, 27 Apr 2016 16:14:05 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x241.google.com (mail-wm0-x241.google.com [IPv6:2a00:1450:400c:c09::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C07781D92; Wed, 27 Apr 2016 16:14:04 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x241.google.com with SMTP id e201so14597923wme.2; Wed, 27 Apr 2016 09:14:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=qYwbKew+AF5rssJk73pzSbH/4NPcWeD9qUovMQ72kJc=; b=UQgZEYIgl49+GXCEp1SehMmV8AQTfwMPc70K9yPBCFwyPtcRNc9efy6LQZJJHSi0Hr eoRis9FFBH2kkaOk9vtirF45FPfsYDZzpKHpXuQNFRKFZIu+IW9mkmJp3sJsGedNeOCb SD49WIRZ3ltRWvOGovru4eNTwrckGDYjsqlVdllvoruAogTZ+wMf8hKlQqvWX4gYDBFt ba2f7LTKAHlQkINjE+miRooSc4sp8Ws/jeNSQVpKP5b9UKCV3lUwEBSIG5pT90hueVRE IP6LeHwJvyYh9b2b3Eury0ozLpj/yPF3K/KRnCDR5XdIYPlh2F1l1btjptO0AiQnWruI Ga0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=qYwbKew+AF5rssJk73pzSbH/4NPcWeD9qUovMQ72kJc=; b=Ui2oAID6CG55lF1UzBL3OM1wheHRP2kK+K++8zs4aKxO5F+r3VeQTs+wQqT0nwvS7/ Wz6Ci/Pr9OA512r4P4WM4N9MGFlW4mfrA3TGzMqasyzATOwE9BweBHCuUTFLy5MXHQ6Y 084SxpmQB3kCHWGd02KUOPyJiK5zM5L2rrS3l/aG+U5l65qf3mV10WXoBs6YESLQ/mQ9 NkfM+zTAc4i2+eaB3VH3qhK184iRAWYGYu4jpFckouzhsrfyG5SweS4ZmiWRfFMqiP9g 0eFUK8/6m4CcTHHHV2ifi04MWYVXuJATmZL2GJSGJaxty3IDUcosZs4HKDEkmtcDC2lg SKlQ== X-Gm-Message-State: AOPr4FXE44DKtkaImhOvCx985pHexxV7LHroaPYDDfmlLuCA20UDT4Rpxxfn49JgisCVZQ== X-Received: by 10.194.58.138 with SMTP id r10mr10078783wjq.153.1461773643212; Wed, 27 Apr 2016 09:14:03 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id r10sm4839915wjf.2.2016.04.27.09.14.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Apr 2016 09:14:02 -0700 (PDT) Sender: Baptiste Daroussin Date: Wed, 27 Apr 2016 18:13:59 +0200 From: Baptiste Daroussin To: Alan Somers Cc: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: Re: svn commit: r298701 - in projects/zfsd/head: cddl/sbin/zfsd share/mk Message-ID: <20160427161359.GP26116@ivaldir.etoilebsd.net> References: <201604271527.u3RFRNh3082189@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="5/6IVfYouxg+lu1D" Content-Disposition: inline In-Reply-To: <201604271527.u3RFRNh3082189@repo.freebsd.org> User-Agent: Mutt/1.6.0 (2016-04-01) X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 16:14:05 -0000 --5/6IVfYouxg+lu1D Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 27, 2016 at 03:27:23PM +0000, Alan Somers wrote: > Author: asomers > Date: Wed Apr 27 15:27:23 2016 > New Revision: 298701 > URL: https://svnweb.freebsd.org/changeset/base/298701 >=20 > Log: > Replace LDADD with LIBADD and NO_MAN with MK_MAN > =20 > Sponsored by: Spectra Logic Corp >=20 > Modified: > projects/zfsd/head/cddl/sbin/zfsd/Makefile.common > projects/zfsd/head/share/mk/src.libnames.mk >=20 > Modified: projects/zfsd/head/cddl/sbin/zfsd/Makefile.common > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- projects/zfsd/head/cddl/sbin/zfsd/Makefile.common Wed Apr 27 15:25:18= 2016 (r298700) > +++ projects/zfsd/head/cddl/sbin/zfsd/Makefile.common Wed Apr 27 15:27:23= 2016 (r298701) > @@ -10,7 +10,7 @@ SRCS=3D callout.cc \ > zpool_list.cc \ > zfsd_main.cc > =20 > -NO_MAN=3D YES > +MK_MAN=3D no This is supposed to be: MAN=3D with no value assigned and not MK_MAN Best regards, Bapt --5/6IVfYouxg+lu1D Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXIOVHAAoJEGOJi9zxtz5ajkgP/iX0SANS0UqX+7UjjOS/Y095 9UNnFKZwDu+XlSZMqgk/EYRUSSALTzg5yyFLnN8qT6qcufQapY1W99mSwZboVL5f 4JxBPkizSO2+9SXZuGWU9kmfMTVGE4uS/P4dEH745Vn8s1+Yx8M/7Pv0A/cd1uq2 kwBj9i0F4vaUbbbj6+w6s4OO1fT/6MJWxoQiEskn2ypFLl7uh3kZmzkintEyFHFQ 5wh+UJSv80JGvTkI9HJdGqUQ3x9RkAOgNQej8zvwG440mrCcT8lsBVtfvUZifCXG Ua3dHIqXTzlI2pl7xpnCeXbNbrvEyWMWyEk3Adbj/6JaJNe7TsxsJbAvXhQv59UE gAvfjQou1fSlEzYE1KGtSM0qlmraa/e2Kx52KrThfTvw5lnGc9fkt8uvaHWdt43a ioMMeYrHh+YxEecQ88OUsheaUpBHCFpopE+v+Sbevr2ZrVmh9WXCJKWgGKXPhAFq o9Iv0//JUnQPxBObxD2DBsBbagESNEAkG/jImtPeGqSiIMD/sGKKv0lgKt4WsLpy OqNclf2lBh3fsLeUdUl63a115Aj3DqTcFzP40JYaS50csg597/TnYRiuApM/HvBU 4suLmiMne3dPlvttQxYXMIupz2gI0GfrY3c5u6b51PB1ymoHbEGNVmLnn2xth9AT wwoHnLn611cp36Bbljai =X69C -----END PGP SIGNATURE----- --5/6IVfYouxg+lu1D-- From owner-svn-src-projects@freebsd.org Wed Apr 27 16:20:20 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BE6BDB1EDAC for ; Wed, 27 Apr 2016 16:20:20 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi0-x233.google.com (mail-oi0-x233.google.com [IPv6:2607:f8b0:4003:c06::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 841F512DC; Wed, 27 Apr 2016 16:20:20 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi0-x233.google.com with SMTP id k142so54529805oib.1; Wed, 27 Apr 2016 09:20:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=F+yKyI0KkdNY78LcZn2o1SF3CWbQm3pcpH+3r+f2+Uk=; b=sfILTwlkxHlQOz9dkw0WulfyxRHahU5Ho3MwIWQWXq2xLOgHxlbnkG32KMzIozVPys wD0WPDzoMnCNs7ZTE8ie6tmTOjfCH6+5KY5rpOO7+j+xW5994kXK07t4L5Dd3afbQDXA p8m+fQ0CxKholEocwceKzOPWY9n/Qk+SqwY+H8t5MjmySizHIC8JJhg4CGUq6oxYqml0 P52ame7bKKeA5qjd0AexyO7B2g8xmA3ErpZDJ/41EbM58hx21v16Nw2IwFKv39Wqzp5C QzucvYWGeD4MDByiVJPeUI17xz5Gzx7t7vHHEA5PaY/apJyM8AHvR3Z6B9+cGDfoKmsJ bJyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=F+yKyI0KkdNY78LcZn2o1SF3CWbQm3pcpH+3r+f2+Uk=; b=iC07OxiD90QROsNwOF/x/P8nZiHeYeCo+gSscdEnc8/ZRAKbKYwZrx3cUKo2+mA/lr sKv7KUQ2FUKecYcMMvjPgqSOvU60Enfp8yyhSQ9FS4o1TeRcKcHgPpFBjEnbg1SRtqOr OSc7txlRlCAkpASqdnqFmF4NZEV1qdNEmcXDSYOuYBDE02GS0bUl8URJT4chyRrK0c3r qJNUDJB5o+YwI8zmAIMyOrRQWTSnx8lDwudpLPBfWQJuR6br1nhPygHzeql1QvfbHlvC cNQHOWWLaH3oqXt+u5MJ+MhaYcuRYs2SXbqT4T7H15Q1/ngQzHqt0mgovjnVE6CBsJuQ LrBA== X-Gm-Message-State: AOPr4FXggWqKvvkG1dotgaYgI/aepsnOIWkFR+l6IjxYtC757BaVGgPDT6kGPMnZyhy2Vtr47+RJjt9K8gOW8A== MIME-Version: 1.0 X-Received: by 10.157.38.40 with SMTP id a37mr4381387otb.152.1461774019949; Wed, 27 Apr 2016 09:20:19 -0700 (PDT) Sender: asomers@gmail.com Received: by 10.202.64.138 with HTTP; Wed, 27 Apr 2016 09:20:19 -0700 (PDT) In-Reply-To: <20160427161359.GP26116@ivaldir.etoilebsd.net> References: <201604271527.u3RFRNh3082189@repo.freebsd.org> <20160427161359.GP26116@ivaldir.etoilebsd.net> Date: Wed, 27 Apr 2016 10:20:19 -0600 X-Google-Sender-Auth: tVvWPKv9KooRPin0gNv1aEPvG4w Message-ID: Subject: Re: svn commit: r298701 - in projects/zfsd/head: cddl/sbin/zfsd share/mk From: Alan Somers To: Baptiste Daroussin Cc: "src-committers@freebsd.org" , svn-src-projects@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 16:20:20 -0000 On Wed, Apr 27, 2016 at 10:13 AM, Baptiste Daroussin wrote: > On Wed, Apr 27, 2016 at 03:27:23PM +0000, Alan Somers wrote: > > Author: asomers > > Date: Wed Apr 27 15:27:23 2016 > > New Revision: 298701 > > URL: https://svnweb.freebsd.org/changeset/base/298701 > > > > Log: > > Replace LDADD with LIBADD and NO_MAN with MK_MAN > > > > Sponsored by: Spectra Logic Corp > > > > Modified: > > projects/zfsd/head/cddl/sbin/zfsd/Makefile.common > > projects/zfsd/head/share/mk/src.libnames.mk > > > > Modified: projects/zfsd/head/cddl/sbin/zfsd/Makefile.common > > > ============================================================================== > > --- projects/zfsd/head/cddl/sbin/zfsd/Makefile.common Wed Apr 27 > 15:25:18 2016 (r298700) > > +++ projects/zfsd/head/cddl/sbin/zfsd/Makefile.common Wed Apr 27 > 15:27:23 2016 (r298701) > > @@ -10,7 +10,7 @@ SRCS= callout.cc \ > > zpool_list.cc \ > > zfsd_main.cc > > > > -NO_MAN= YES > > +MK_MAN= no > > This is supposed to be: > MAN= > > with no value assigned and not MK_MAN > > Best regards, > Bapt > Ok, I'll change it. Is that a recent change? When it was still NO_MAN, make printed an error advising me to use "MK_MAN=no". From owner-svn-src-projects@freebsd.org Wed Apr 27 16:26:16 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3FBB6B1E00A for ; Wed, 27 Apr 2016 16:26:16 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DBD3619F3; Wed, 27 Apr 2016 16:26:15 +0000 (UTC) (envelope-from baptiste.daroussin@gmail.com) Received: by mail-wm0-x243.google.com with SMTP id e201so14696612wme.2; Wed, 27 Apr 2016 09:26:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=wkk3V3dlax4dCCwWbqTxS/la3MiZo/7AqoEAUtQEKFQ=; b=0yWa4QFNVZ5vm68zkHu/0NqFkkbRxJ2zIGqqCa6pJvw/1YECloevEjrf9iYpzx/Y8s k5vmld6OYDw/0jntYCNe18KAEjFaSrTsDyLV+bhgbbKA1AkRaRHyA3KR1qC6ajDwYhjN R1wFTIqKoSWCe4gsceXnksRR0PcApyGJ7Ps4hF2+DAS62G1IsKr3sXy5Sd9G9p0l/uD9 BuGyR3TeHNqVJoL485YHnbgxDMY4uiZXuoBvMHfD8Eqk+EM9zpJf7b9lmtT6rt4zd7q/ DOwhzGdXGC3EQ0JLZyUcBEO3wD3/8SMhFIOpzzCIQUsqRw0DNnficuOlvsrqx9QsM//K k00Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=wkk3V3dlax4dCCwWbqTxS/la3MiZo/7AqoEAUtQEKFQ=; b=cDOX4ri5fMy6IKvkRmWWepco7tM5JSbWKMu+/uBmlPrKG4YI7ULlH/NCPfg/FI2oOy u7jnb+LQA4CsLTPmLkYZtsBzpGHfFgnX/8OSohR4oef/dn+uSdtu/htK0F+v7+QV8M4I LLRjZ5NH+GuBaxrw7Fl+Fs4vNeVwdQqehcW4+H86apUz7hEDwIVwY+1bKm9m4JXBJe/l TA1wxmGs1vujPCCMYrfMrpB9xlcwV+q8Y7paCjHM2nNqY7BGsrZR2+VYJVtWaVps/lVe jIkKsVDSWJpmcR+7nJh+i4HhLlcwoeJArPkL0NcYli11xQUM+pEyz3H/mN3/XsUeuvSe bR+Q== X-Gm-Message-State: AOPr4FXwOQkxZtwl+eD6MwqmsVgRnsusAqd5DSDgArdAtdMhdG/jtGfrqWWaruB87Ffuhw== X-Received: by 10.28.144.20 with SMTP id s20mr11544520wmd.12.1461774374466; Wed, 27 Apr 2016 09:26:14 -0700 (PDT) Received: from ivaldir.etoilebsd.net ([2001:41d0:8:db4c::1]) by smtp.gmail.com with ESMTPSA id f135sm9297120wmf.22.2016.04.27.09.26.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Apr 2016 09:26:13 -0700 (PDT) Sender: Baptiste Daroussin Date: Wed, 27 Apr 2016 18:26:12 +0200 From: Baptiste Daroussin To: Alan Somers Cc: "src-committers@freebsd.org" , svn-src-projects@freebsd.org Subject: Re: svn commit: r298701 - in projects/zfsd/head: cddl/sbin/zfsd share/mk Message-ID: <20160427162611.GQ26116@ivaldir.etoilebsd.net> References: <201604271527.u3RFRNh3082189@repo.freebsd.org> <20160427161359.GP26116@ivaldir.etoilebsd.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="UJEqbsikIZBgizPR" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0 (2016-04-01) X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 16:26:16 -0000 --UJEqbsikIZBgizPR Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 27, 2016 at 10:20:19AM -0600, Alan Somers wrote: > On Wed, Apr 27, 2016 at 10:13 AM, Baptiste Daroussin > wrote: >=20 > > On Wed, Apr 27, 2016 at 03:27:23PM +0000, Alan Somers wrote: > > > Author: asomers > > > Date: Wed Apr 27 15:27:23 2016 > > > New Revision: 298701 > > > URL: https://svnweb.freebsd.org/changeset/base/298701 > > > > > > Log: > > > Replace LDADD with LIBADD and NO_MAN with MK_MAN > > > > > > Sponsored by: Spectra Logic Corp > > > > > > Modified: > > > projects/zfsd/head/cddl/sbin/zfsd/Makefile.common > > > projects/zfsd/head/share/mk/src.libnames.mk > > > > > > Modified: projects/zfsd/head/cddl/sbin/zfsd/Makefile.common > > > > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D > > > --- projects/zfsd/head/cddl/sbin/zfsd/Makefile.common Wed Apr 27 > > 15:25:18 2016 (r298700) > > > +++ projects/zfsd/head/cddl/sbin/zfsd/Makefile.common Wed Apr 27 > > 15:27:23 2016 (r298701) > > > @@ -10,7 +10,7 @@ SRCS=3D callout.cc \ > > > zpool_list.cc \ > > > zfsd_main.cc > > > > > > -NO_MAN=3D YES > > > +MK_MAN=3D no > > > > This is supposed to be: > > MAN=3D > > > > with no value assigned and not MK_MAN > > > > Best regards, > > Bapt > > >=20 > Ok, I'll change it. Is that a recent change? When it was still NO_MAN, > make printed an error advising me to use "MK_MAN=3Dno". I do not remember when this change happened but iirc it was long ago (I do = not also remember about the advice). All I know is there are 334 MAN=3D and only 3 MK_MAN=3Dno. Others might kno= w better (Warner?) Best regards, Bapt --UJEqbsikIZBgizPR Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXIOgjAAoJEGOJi9zxtz5azsYP/jB2dl71sIu/8jALgmc7MGqL x6gax0T4L+THJ/zdVcCpcAGB3tkfovnamMZiOicvobt7KtnXPSlEmtD75yVw80Qt jR7TcbvEuKuss6C3sFztFGvXxxojzSV5WP7kXXyt+MPgc6Fkt88+WpNPZAC6jR3h CmRIJxb00JWHuvFnfTOhlPGKw5ljWVPezfu/uPhvUKEIoRrDTgoWr81kZbThU7Dz pM/D1AwMOoD1yCqo+KgFiBFSbBKmuWsapVAs7oLvoVlGRth9aZ7HFJ9JHwvGrHu0 M08NRLNop8iixeWSPCNqTPW06cC61L67HZX3j3runyvXbDc8f0vz9c8NjxM2WaIQ 0XPrSnLhGhNsAUo19AqMVeZ1Zu3j4W6kYu0r80RbVwe6c4h4AXq1sR5K9Ao6EeOd QebovRQMJtUmNT+K0tmPV6EJBQCxbXKg6cAHl735VDZfjfY5+M9ZW7VWYwqcTEtw wJfKHGXpBooUNzWGyLtKuVrey4mtHdw2wopHEZ6+CaRcOzqqlbxEP75nhhYQxZDZ +QCONUI6J8tcCKg6KBacZOizf6oB/qWQ4ioHW9CMToncXDPrxHHJ71BrK4OmAeDU q/sguph9f27d7XcEixmnB1HS1ToINgNH9fR2uXa15ykvlN2yXq120LHwB7ytQh1a KiB/v6EOuUcWjVTl76Uz =Npl9 -----END PGP SIGNATURE----- --UJEqbsikIZBgizPR-- From owner-svn-src-projects@freebsd.org Wed Apr 27 16:55:43 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DA5E7B1EA01 for ; Wed, 27 Apr 2016 16:55:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-ig0-x234.google.com (mail-ig0-x234.google.com [IPv6:2607:f8b0:4001:c05::234]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6EA01A1F for ; Wed, 27 Apr 2016 16:55:43 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-ig0-x234.google.com with SMTP id bi2so133852596igb.0 for ; Wed, 27 Apr 2016 09:55:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc; bh=014EeENY2me/qFzfkddDJOfJfDVf12g0AgfnrXRnuq8=; b=qsMrbqVbH8xa/qGI/rZj9o/4D48tVD8Mz5Mw0alBT04JhQMAkh6/rn1drVg/u0v0cJ EOyIai4HIlJ4KNZyAFt4ZeCH4Qpfu2EDh0bCNXG5SZM8fKQrnHx+XOvrmewBZeRjcELM nCvQWHVgnaR7FeOsBejtDHzP54/7/GIZeQKGtT4DTUw6mNd17xPb4cg7c8KBwV8dlXKF YLzbFw83zF0Zb0G8ge/5b/iDnAwLSMGPs5+TVnZvAvT3DaSU1gCqbEu9FgwYtsrNG3Ci GoxrsHIYX7ppgGex2ZCpbwT7GrTdRk/Xhde982tfs6f80iRboDBdtpdtXpt6JGZl1/1K nI3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:sender:in-reply-to:references:date :message-id:subject:from:to:cc; bh=014EeENY2me/qFzfkddDJOfJfDVf12g0AgfnrXRnuq8=; b=YZGQWVO3YQDVTNQ5ZrdmnYrsPHsKKioa8ufrrPDQJPfJBRwGV3jkNyKo/e0Uu1VOcH 2RNqh3Hn3SDdM7Pb1LAX1LdCU9vqpIvXsPaoZp5OYtorgbWPM0YbZXj7F7ELBUAo2C/2 CSUrx+8NIRe/hE2ybJ15LErpdbi6rMFlRYM9SC1rMqRhihYY9r9X7BsugdpXapU7cans 4SmDiJEjHaBFDR8DIxGCdbwLgbIWxwzWKrbXywqJ5rXrnGy8S03upLBkRjduzSBUOGlw kth20FHqHMwppPdM4Yai2q46GDo8LLPBLFXWUAi8fXGsTq/rwAWqZRmCiZTM5SD0bC9i Pr8w== X-Gm-Message-State: AOPr4FWVwWXHzBLKNa+1ykQqWrc1pwZgxQam2oLyOJh/mciWFNJ3xYkY28StknEyAnVkeu0tGagRx0jLcF4Pdw== MIME-Version: 1.0 X-Received: by 10.50.32.102 with SMTP id h6mr24968268igi.16.1461776142831; Wed, 27 Apr 2016 09:55:42 -0700 (PDT) Sender: wlosh@bsdimp.com Received: by 10.79.104.197 with HTTP; Wed, 27 Apr 2016 09:55:42 -0700 (PDT) X-Originating-IP: [69.53.245.25] In-Reply-To: <20160427162611.GQ26116@ivaldir.etoilebsd.net> References: <201604271527.u3RFRNh3082189@repo.freebsd.org> <20160427161359.GP26116@ivaldir.etoilebsd.net> <20160427162611.GQ26116@ivaldir.etoilebsd.net> Date: Wed, 27 Apr 2016 12:55:42 -0400 X-Google-Sender-Auth: 8PnMpAo9ckN1uVSDELSrQ8DNmpI Message-ID: Subject: Re: svn commit: r298701 - in projects/zfsd/head: cddl/sbin/zfsd share/mk From: Warner Losh To: Baptiste Daroussin Cc: Alan Somers , "src-committers@freebsd.org" , svn-src-projects@freebsd.org Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 16:55:43 -0000 On Wed, Apr 27, 2016 at 12:26 PM, Baptiste Daroussin wrote: > On Wed, Apr 27, 2016 at 10:20:19AM -0600, Alan Somers wrote: > > On Wed, Apr 27, 2016 at 10:13 AM, Baptiste Daroussin > > wrote: > > > > > On Wed, Apr 27, 2016 at 03:27:23PM +0000, Alan Somers wrote: > > > > Author: asomers > > > > Date: Wed Apr 27 15:27:23 2016 > > > > New Revision: 298701 > > > > URL: https://svnweb.freebsd.org/changeset/base/298701 > > > > > > > > Log: > > > > Replace LDADD with LIBADD and NO_MAN with MK_MAN > > > > > > > > Sponsored by: Spectra Logic Corp > > > > > > > > Modified: > > > > projects/zfsd/head/cddl/sbin/zfsd/Makefile.common > > > > projects/zfsd/head/share/mk/src.libnames.mk > > > > > > > > Modified: projects/zfsd/head/cddl/sbin/zfsd/Makefile.common > > > > > > > > ============================================================================== > > > > --- projects/zfsd/head/cddl/sbin/zfsd/Makefile.common Wed Apr 27 > > > 15:25:18 2016 (r298700) > > > > +++ projects/zfsd/head/cddl/sbin/zfsd/Makefile.common Wed Apr 27 > > > 15:27:23 2016 (r298701) > > > > @@ -10,7 +10,7 @@ SRCS= callout.cc \ > > > > zpool_list.cc \ > > > > zfsd_main.cc > > > > > > > > -NO_MAN= YES > > > > +MK_MAN= no > > > > > > This is supposed to be: > > > MAN= > > > > > > with no value assigned and not MK_MAN > > > > > > Best regards, > > > Bapt > > > > > > > Ok, I'll change it. Is that a recent change? When it was still NO_MAN, > > make printed an error advising me to use "MK_MAN=no". > > I do not remember when this change happened but iirc it was long ago (I do > not > also remember about the advice). > > All I know is there are 334 MAN= and only 3 MK_MAN=no. Others might know > better > (Warner?) > There should be zero MK_MAN=no. That's always an error to set in a Makefile in the tree (though we set it for some phaes in Makefile.inc1 during buildworld). We transitioned from NO_MAN=yes to MAN= when we reworked where the man pages were installed. This was in r74806 when ru@ changed the list of man pages. If MAN was empty no man pages are installed. This was only 15 years ago... The reason for the change was that you can't easily change a default so we eliminated all the NO options that were user visible into MK options. But MK options are supposed to only be set by WITHOUT_ and WITH_ options and never directly by Makefile or by user action (though we've relaxed it a bit for buildworld things in Makefile.inc1). Warner From owner-svn-src-projects@freebsd.org Wed Apr 27 19:45:15 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DD9CDB1FCC2 for ; Wed, 27 Apr 2016 19:45:15 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-lf0-x229.google.com (mail-lf0-x229.google.com [IPv6:2a00:1450:4010:c07::229]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 65E931839; Wed, 27 Apr 2016 19:45:15 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-lf0-x229.google.com with SMTP id y84so61677859lfc.0; Wed, 27 Apr 2016 12:45:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=wU+NF4v3x5Wr+rV3oIMMsxplBNDGFmth5iakeRTvJcc=; b=W1QoA+TGQT7OzUwugOR4wvExmTG6Wdp5dOjrbGEvvlH56HtamQaOHoAg30qlDRYbNL 7S2Yljs+c0+ScsyPC73L45+namPc3xAAKcbYN7Pkiy8qr+LY0SqYxoQUMpb/QMy0kFNv kW9DxmRtXI+8ldyMlVYwpKuiJ5U0Nf7wl0ahPwrNw8URQshdZgUuhDrkafyKmhEIRhSc WMHN/mYe50dY19XI1Ticm2DvC0o2reovUcDo6lduY/+QoRwWOzaLJPP9/g59420KY2Qu QY1HU8IRUsFoG9UZsLOxlhoXAzP5oTXfoKU5qukaKhq5WZzHcXwG7rdU/H2VUhglXCSe mxsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=wU+NF4v3x5Wr+rV3oIMMsxplBNDGFmth5iakeRTvJcc=; b=TNi5mQH5bJgdFoljO7xp2mYZ1y1U+2HsSonrW/iSkJRM2PvRK6RZ03BCVaKWLoKYXT naazeywe22uOXDWDbkj4Sh/QJ0b3jaoYLJBT0f9cSBFpbM3XXamlgmTYzs+aCSW4RQM9 lli8WWZuV7KG6fmLz3IseO6maJPJy4hyez9ZvAbWsg8rHmvX8+gp6SmjCxtGdhlOBy11 1Tc+/t75eB5ovDJIgGDJfz5BqddyzXpBMdReDNkMqcY1/j0Bh7w1WddljhRAv/oqzvD1 dP7AsrOcSmMUl2Mi2VogJYn2ri6fjyPML/Gx+45T+1K+W7fhK46M12ICNi2nQeSpRVrd mcfw== X-Gm-Message-State: AOPr4FXVg5E/4CS2y+zNpltLtuNH5wq+ClGDGWIPVg+o7JOrvl9fquGey/ALpk3Basn77aoTuDGQpAs1Tu8o4g== MIME-Version: 1.0 X-Received: by 10.25.153.69 with SMTP id b66mr4398655lfe.138.1461786313680; Wed, 27 Apr 2016 12:45:13 -0700 (PDT) Received: by 10.112.175.8 with HTTP; Wed, 27 Apr 2016 12:45:13 -0700 (PDT) In-Reply-To: References: <201604271527.u3RFRNh3082189@repo.freebsd.org> <20160427161359.GP26116@ivaldir.etoilebsd.net> Date: Wed, 27 Apr 2016 12:45:13 -0700 Message-ID: Subject: Re: svn commit: r298701 - in projects/zfsd/head: cddl/sbin/zfsd share/mk From: Ngie Cooper To: Alan Somers Cc: Baptiste Daroussin , "src-committers@freebsd.org" , "svn-src-projects@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 19:45:16 -0000 On Wed, Apr 27, 2016 at 9:20 AM, Alan Somers wrote: ... > Ok, I'll change it. Is that a recent change? When it was still NO_MAN, > make printed an error advising me to use "MK_MAN=no". - MK_MAN=no/NO_MAN is for turning off manpage support. - MAN= is for explicitly declaring that no manpages are included in the subdirectory. MAN= has been present for a number of years, but only became important in FreeBSD 11.x because of the NO_MAN= deprecation, soon to be removal in 12 according to imp@. I added the snippet below to a commonly used Makefile at $work. Thanks, -Ngie # See share/mk/bsd.mkopts.mk@r276556 note about deprecating NO_foo in FreeBSD 12 .ifdef NO_MAN .error "${.CURDIR}: NO_MAN has been deprecated in future revisions of FreeBSD; please use MAN= instead" .endif From owner-svn-src-projects@freebsd.org Wed Apr 27 20:09:03 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B527FB1E354 for ; Wed, 27 Apr 2016 20:09:03 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 86F6A1693; Wed, 27 Apr 2016 20:09:03 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3RK92bW095440; Wed, 27 Apr 2016 20:09:02 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3RK92Cx095439; Wed, 27 Apr 2016 20:09:02 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201604272009.u3RK92Cx095439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 27 Apr 2016 20:09:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r298718 - projects/zfsd/head/cddl/sbin/zfsd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 20:09:03 -0000 Author: asomers Date: Wed Apr 27 20:09:02 2016 New Revision: 298718 URL: https://svnweb.freebsd.org/changeset/base/298718 Log: s/MK_MAN=no/MAN= Reported by: bapt, et al Sponsored by: Spectra Logic Corp Modified: projects/zfsd/head/cddl/sbin/zfsd/Makefile.common Modified: projects/zfsd/head/cddl/sbin/zfsd/Makefile.common ============================================================================== --- projects/zfsd/head/cddl/sbin/zfsd/Makefile.common Wed Apr 27 19:54:56 2016 (r298717) +++ projects/zfsd/head/cddl/sbin/zfsd/Makefile.common Wed Apr 27 20:09:02 2016 (r298718) @@ -10,7 +10,7 @@ SRCS= callout.cc \ zpool_list.cc \ zfsd_main.cc -MK_MAN= no +MAN= WARNS?= 3 From owner-svn-src-projects@freebsd.org Wed Apr 27 20:12:17 2016 Return-Path: Delivered-To: svn-src-projects@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 688D1B1E466 for ; Wed, 27 Apr 2016 20:12:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 37FEC1A21; Wed, 27 Apr 2016 20:12:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u3RKCGaC098206; Wed, 27 Apr 2016 20:12:16 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id u3RKCGhf098205; Wed, 27 Apr 2016 20:12:16 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201604272012.u3RKCGhf098205@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 27 Apr 2016 20:12:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: svn commit: r298719 - projects/zfsd/head/cddl/sbin/zfsd X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 27 Apr 2016 20:12:17 -0000 Author: asomers Date: Wed Apr 27 20:12:16 2016 New Revision: 298719 URL: https://svnweb.freebsd.org/changeset/base/298719 Log: zfsd should attempt to activate a hotspare whenever a vdev becomes UNAVAIL. This is rare, but sometimes happens when you would expect the REMOVED state instead. I think it happens if vdev_reopen fails before vdev_geom_orphan gets called. Sponsored by: Spectra Logic Corp Modified: projects/zfsd/head/cddl/sbin/zfsd/case_file.cc Modified: projects/zfsd/head/cddl/sbin/zfsd/case_file.cc ============================================================================== --- projects/zfsd/head/cddl/sbin/zfsd/case_file.cc Wed Apr 27 20:09:02 2016 (r298718) +++ projects/zfsd/head/cddl/sbin/zfsd/case_file.cc Wed Apr 27 20:12:16 2016 (r298719) @@ -442,11 +442,12 @@ CaseFile::ReEvaluate(const ZfsEvent &eve } else if (event.Value("class") == "resource.fs.zfs.statechange") { RefreshVdevState(); /* - * If this vdev is DEGRADED or FAULTED, try to activate a - * hotspare. Otherwise, ignore the event + * If this vdev is DEGRADED, FAULTED, or UNAVAIL, try to + * activate a hotspare. Otherwise, ignore the event */ if (VdevState() == VDEV_STATE_FAULTED || - VdevState() == VDEV_STATE_DEGRADED) + VdevState() == VDEV_STATE_DEGRADED || + VdevState() == VDEV_STATE_CANT_OPEN) (void) ActivateSpare(); consumed = true; }