From owner-svn-src-stable@FreeBSD.ORG Sun Sep 8 11:35:57 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7CA48FC4; Sun, 8 Sep 2013 11:35:57 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5003E294F; Sun, 8 Sep 2013 11:35:57 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r88BZvhh017065; Sun, 8 Sep 2013 11:35:57 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r88BZu4d017063; Sun, 8 Sep 2013 11:35:56 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201309081135.r88BZu4d017063@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Sun, 8 Sep 2013 11:35:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255388 - stable/9/usr.sbin/rtadvd X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Sep 2013 11:35:57 -0000 Author: des Date: Sun Sep 8 11:35:56 2013 New Revision: 255388 URL: http://svnweb.freebsd.org/changeset/base/255388 Log: MFH (r254684, r254955): fix segfault on reload. MFH (r255156): silence an error message on non-IPv6 interfaces. Modified: stable/9/usr.sbin/rtadvd/config.c stable/9/usr.sbin/rtadvd/if.c Directory Properties: stable/9/usr.sbin/rtadvd/ (props changed) Modified: stable/9/usr.sbin/rtadvd/config.c ============================================================================== --- stable/9/usr.sbin/rtadvd/config.c Sun Sep 8 11:21:08 2013 (r255387) +++ stable/9/usr.sbin/rtadvd/config.c Sun Sep 8 11:35:56 2013 (r255388) @@ -296,10 +296,8 @@ rm_rainfo(struct rainfo *rai) if (rai->rai_ra_data != NULL) free(rai->rai_ra_data); - while ((pfx = TAILQ_FIRST(&rai->rai_prefix)) != NULL) { - TAILQ_REMOVE(&rai->rai_prefix, pfx, pfx_next); - free(pfx); - } + while ((pfx = TAILQ_FIRST(&rai->rai_prefix)) != NULL) + delete_prefix(pfx); while ((sol = TAILQ_FIRST(&rai->rai_soliciter)) != NULL) { TAILQ_REMOVE(&rai->rai_soliciter, sol, sol_next); free(sol); @@ -1123,9 +1121,9 @@ add_prefix(struct rainfo *rai, struct in pfx->pfx_onlinkflg = ipr->ipr_raf_onlink; pfx->pfx_autoconfflg = ipr->ipr_raf_auto; pfx->pfx_origin = PREFIX_FROM_DYNAMIC; + pfx->pfx_rainfo = rai; TAILQ_INSERT_TAIL(&rai->rai_prefix, pfx, pfx_next); - pfx->pfx_rainfo = rai; syslog(LOG_DEBUG, "<%s> new prefix %s/%d was added on %s", __func__, Modified: stable/9/usr.sbin/rtadvd/if.c ============================================================================== --- stable/9/usr.sbin/rtadvd/if.c Sun Sep 8 11:21:08 2013 (r255387) +++ stable/9/usr.sbin/rtadvd/if.c Sun Sep 8 11:35:56 2013 (r255388) @@ -394,8 +394,8 @@ update_ifinfo_nd_flags(struct ifinfo *if error = ioctl(s, SIOCGIFINFO_IN6, (caddr_t)&nd); if (error) { close(s); - syslog(LOG_ERR, - "<%s> ioctl() failed.", __func__); + if (errno != EPFNOSUPPORT) + syslog(LOG_ERR, "<%s> ioctl() failed.", __func__); return (1); } ifi->ifi_nd_flags = nd.ndi.flags; From owner-svn-src-stable@FreeBSD.ORG Sun Sep 8 17:28:11 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id A26CD7C4; Sun, 8 Sep 2013 17:28:11 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8F83D2806; Sun, 8 Sep 2013 17:28:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r88HSBOb032243; Sun, 8 Sep 2013 17:28:11 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r88HSBYq032242; Sun, 8 Sep 2013 17:28:11 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201309081728.r88HSBYq032242@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Sun, 8 Sep 2013 17:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255394 - stable/9/etc/mtree X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Sep 2013 17:28:11 -0000 Author: des Date: Sun Sep 8 17:28:11 2013 New Revision: 255394 URL: http://svnweb.freebsd.org/changeset/base/255394 Log: MFH (r255243): create /var/authpf with correct ownership and permissions. Modified: stable/9/etc/mtree/BSD.var.dist Directory Properties: stable/9/etc/mtree/ (props changed) Modified: stable/9/etc/mtree/BSD.var.dist ============================================================================== --- stable/9/etc/mtree/BSD.var.dist Sun Sep 8 16:56:17 2013 (r255393) +++ stable/9/etc/mtree/BSD.var.dist Sun Sep 8 17:28:11 2013 (r255394) @@ -23,6 +23,8 @@ remote uname=auditdistd gname=wheel mode=0700 .. .. + authpf uname=root gname=authpf mode=0770 + .. /set gname=wheel backups .. From owner-svn-src-stable@FreeBSD.ORG Sun Sep 8 17:47:16 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id ECD1ABBA; Sun, 8 Sep 2013 17:47:15 +0000 (UTC) (envelope-from trociny@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D791828C2; Sun, 8 Sep 2013 17:47:15 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r88HlFci043785; Sun, 8 Sep 2013 17:47:15 GMT (envelope-from trociny@svn.freebsd.org) Received: (from trociny@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r88HlF5X043771; Sun, 8 Sep 2013 17:47:15 GMT (envelope-from trociny@svn.freebsd.org) Message-Id: <201309081747.r88HlF5X043771@svn.freebsd.org> From: Mikolaj Golub Date: Sun, 8 Sep 2013 17:47:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255395 - stable/9/sys/netpfil/ipfw X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 08 Sep 2013 17:47:16 -0000 Author: trociny Date: Sun Sep 8 17:47:14 2013 New Revision: 255395 URL: http://svnweb.freebsd.org/changeset/base/255395 Log: MFC r254776: Make ipfw nat init/unint work correctly for VIMAGE: * Do per vnet instance cleanup (previously it was only for vnet0 on module unload, and led to libalias leaks and possible panics due to stale pointer dereferences). * Instead of protecting ipfw hooks registering/deregistering by only vnet0 lock (which does not prevent pointers access from another vnets), introduce per vnet ipfw_nat_loaded variable. The variable is set after hooks are registered and unset before they are deregistered. * Devirtualize ifaddr_event_tag as we run only one event handler for all vnets. * It is supposed that ifaddr_change event handler is called in the interface vnet context, so add an assertion. Reviewed by: zec Modified: stable/9/sys/netpfil/ipfw/ip_fw2.c stable/9/sys/netpfil/ipfw/ip_fw_nat.c stable/9/sys/netpfil/ipfw/ip_fw_private.h Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/netpfil/ipfw/ip_fw2.c ============================================================================== --- stable/9/sys/netpfil/ipfw/ip_fw2.c Sun Sep 8 17:28:11 2013 (r255394) +++ stable/9/sys/netpfil/ipfw/ip_fw2.c Sun Sep 8 17:47:14 2013 (r255395) @@ -142,6 +142,8 @@ VNET_DEFINE(int, verbose_limit); /* layer3_chain contains the list of rules for layer 3 */ VNET_DEFINE(struct ip_fw_chain, layer3_chain); +VNET_DEFINE(int, ipfw_nat_ready) = 0; + ipfw_nat_t *ipfw_nat_ptr = NULL; struct cfg_nat *(*lookup_nat_ptr)(struct nat_list *, int); ipfw_nat_cfg_t *ipfw_nat_cfg_ptr; Modified: stable/9/sys/netpfil/ipfw/ip_fw_nat.c ============================================================================== --- stable/9/sys/netpfil/ipfw/ip_fw_nat.c Sun Sep 8 17:28:11 2013 (r255394) +++ stable/9/sys/netpfil/ipfw/ip_fw_nat.c Sun Sep 8 17:47:14 2013 (r255395) @@ -53,8 +53,7 @@ __FBSDID("$FreeBSD$"); #include /* XXX for in_cksum */ -static VNET_DEFINE(eventhandler_tag, ifaddr_event_tag); -#define V_ifaddr_event_tag VNET(ifaddr_event_tag) +static eventhandler_tag ifaddr_event_tag; static void ifaddr_change(void *arg __unused, struct ifnet *ifp) @@ -63,6 +62,8 @@ ifaddr_change(void *arg __unused, struct struct ifaddr *ifa; struct ip_fw_chain *chain; + KASSERT(curvnet == ifp->if_vnet, + ("curvnet(%p) differs from iface vnet(%p)", curvnet, ifp->if_vnet)); chain = &V_layer3_chain; IPFW_WLOCK(chain); /* Check every nat entry... */ @@ -590,11 +591,38 @@ ipfw_nat_get_log(struct sockopt *sopt) return(0); } +static int +vnet_ipfw_nat_init(const void *arg __unused) +{ + + V_ipfw_nat_ready = 1; + return (0); +} + +static int +vnet_ipfw_nat_uninit(const void *arg __unused) +{ + struct cfg_nat *ptr, *ptr_temp; + struct ip_fw_chain *chain; + + chain = &V_layer3_chain; + IPFW_WLOCK(chain); + LIST_FOREACH_SAFE(ptr, &chain->nat, _next, ptr_temp) { + LIST_REMOVE(ptr, _next); + del_redir_spool_cfg(ptr, &ptr->redir_chain); + LibAliasUninit(ptr->lib); + free(ptr, M_IPFW); + } + flush_nat_ptrs(chain, -1 /* flush all */); + V_ipfw_nat_ready = 0; + IPFW_WUNLOCK(chain); + return (0); +} + static void ipfw_nat_init(void) { - IPFW_WLOCK(&V_layer3_chain); /* init ipfw hooks */ ipfw_nat_ptr = ipfw_nat; lookup_nat_ptr = lookup_nat; @@ -602,28 +630,16 @@ ipfw_nat_init(void) ipfw_nat_del_ptr = ipfw_nat_del; ipfw_nat_get_cfg_ptr = ipfw_nat_get_cfg; ipfw_nat_get_log_ptr = ipfw_nat_get_log; - IPFW_WUNLOCK(&V_layer3_chain); - V_ifaddr_event_tag = EVENTHANDLER_REGISTER( - ifaddr_event, ifaddr_change, + + ifaddr_event_tag = EVENTHANDLER_REGISTER(ifaddr_event, ifaddr_change, NULL, EVENTHANDLER_PRI_ANY); } static void ipfw_nat_destroy(void) { - struct cfg_nat *ptr, *ptr_temp; - struct ip_fw_chain *chain; - chain = &V_layer3_chain; - IPFW_WLOCK(chain); - LIST_FOREACH_SAFE(ptr, &chain->nat, _next, ptr_temp) { - LIST_REMOVE(ptr, _next); - del_redir_spool_cfg(ptr, &ptr->redir_chain); - LibAliasUninit(ptr->lib); - free(ptr, M_IPFW); - } - EVENTHANDLER_DEREGISTER(ifaddr_event, V_ifaddr_event_tag); - flush_nat_ptrs(chain, -1 /* flush all */); + EVENTHANDLER_DEREGISTER(ifaddr_event, ifaddr_event_tag); /* deregister ipfw_nat */ ipfw_nat_ptr = NULL; lookup_nat_ptr = NULL; @@ -631,7 +647,6 @@ ipfw_nat_destroy(void) ipfw_nat_del_ptr = NULL; ipfw_nat_get_cfg_ptr = NULL; ipfw_nat_get_log_ptr = NULL; - IPFW_WUNLOCK(chain); } static int @@ -641,11 +656,9 @@ ipfw_nat_modevent(module_t mod, int type switch (type) { case MOD_LOAD: - ipfw_nat_init(); break; case MOD_UNLOAD: - ipfw_nat_destroy(); break; default: @@ -661,8 +674,25 @@ static moduledata_t ipfw_nat_mod = { 0 }; -DECLARE_MODULE(ipfw_nat, ipfw_nat_mod, SI_SUB_PROTO_IFATTACHDOMAIN, SI_ORDER_ANY); +/* Define startup order. */ +#define IPFW_NAT_SI_SUB_FIREWALL SI_SUB_PROTO_IFATTACHDOMAIN +#define IPFW_NAT_MODEVENT_ORDER (SI_ORDER_ANY - 255) +#define IPFW_NAT_MODULE_ORDER (IPFW_NAT_MODEVENT_ORDER + 1) +#define IPFW_NAT_VNET_ORDER (IPFW_NAT_MODEVENT_ORDER + 2) + +DECLARE_MODULE(ipfw_nat, ipfw_nat_mod, IPFW_NAT_SI_SUB_FIREWALL, SI_ORDER_ANY); MODULE_DEPEND(ipfw_nat, libalias, 1, 1, 1); MODULE_DEPEND(ipfw_nat, ipfw, 2, 2, 2); MODULE_VERSION(ipfw_nat, 1); + +SYSINIT(ipfw_nat_init, IPFW_NAT_SI_SUB_FIREWALL, IPFW_NAT_MODULE_ORDER, + ipfw_nat_init, NULL); +VNET_SYSINIT(vnet_ipfw_nat_init, IPFW_NAT_SI_SUB_FIREWALL, IPFW_NAT_VNET_ORDER, + vnet_ipfw_nat_init, NULL); + +SYSUNINIT(ipfw_nat_destroy, IPFW_NAT_SI_SUB_FIREWALL, IPFW_NAT_MODULE_ORDER, + ipfw_nat_destroy, NULL); +VNET_SYSUNINIT(vnet_ipfw_nat_uninit, IPFW_NAT_SI_SUB_FIREWALL, + IPFW_NAT_VNET_ORDER, vnet_ipfw_nat_uninit, NULL); + /* end of file */ Modified: stable/9/sys/netpfil/ipfw/ip_fw_private.h ============================================================================== --- stable/9/sys/netpfil/ipfw/ip_fw_private.h Sun Sep 8 17:28:11 2013 (r255394) +++ stable/9/sys/netpfil/ipfw/ip_fw_private.h Sun Sep 8 17:47:14 2013 (r255395) @@ -329,9 +329,11 @@ extern struct cfg_nat *(*lookup_nat_ptr) typedef int ipfw_nat_t(struct ip_fw_args *, struct cfg_nat *, struct mbuf *); typedef int ipfw_nat_cfg_t(struct sockopt *); -extern ipfw_nat_t *ipfw_nat_ptr; -#define IPFW_NAT_LOADED (ipfw_nat_ptr != NULL) +VNET_DECLARE(int, ipfw_nat_ready); +#define V_ipfw_nat_ready VNET(ipfw_nat_ready) +#define IPFW_NAT_LOADED (V_ipfw_nat_ready) +extern ipfw_nat_t *ipfw_nat_ptr; extern ipfw_nat_cfg_t *ipfw_nat_cfg_ptr; extern ipfw_nat_cfg_t *ipfw_nat_del_ptr; extern ipfw_nat_cfg_t *ipfw_nat_get_cfg_ptr; From owner-svn-src-stable@FreeBSD.ORG Mon Sep 9 15:38:52 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2625693D; Mon, 9 Sep 2013 15:38:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 124242EE4; Mon, 9 Sep 2013 15:38:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r89Fcpwv022454; Mon, 9 Sep 2013 15:38:51 GMT (envelope-from jhb@svn.freebsd.org) Received: (from jhb@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r89FcpG4022453; Mon, 9 Sep 2013 15:38:51 GMT (envelope-from jhb@svn.freebsd.org) Message-Id: <201309091538.r89FcpG4022453@svn.freebsd.org> From: John Baldwin Date: Mon, 9 Sep 2013 15:38:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255423 - stable/8/lib/libpam/modules/pam_ssh X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Sep 2013 15:38:52 -0000 Author: jhb Date: Mon Sep 9 15:38:51 2013 New Revision: 255423 URL: http://svnweb.freebsd.org/changeset/base/255423 Log: MFC 236106: Passing NULL as a key casues a segfault when loading SSH 1 keys. Use an empty string instead. Modified: stable/8/lib/libpam/modules/pam_ssh/pam_ssh.c Directory Properties: stable/8/lib/libpam/ (props changed) Modified: stable/8/lib/libpam/modules/pam_ssh/pam_ssh.c ============================================================================== --- stable/8/lib/libpam/modules/pam_ssh/pam_ssh.c Mon Sep 9 13:56:58 2013 (r255422) +++ stable/8/lib/libpam/modules/pam_ssh/pam_ssh.c Mon Sep 9 15:38:51 2013 (r255423) @@ -110,7 +110,7 @@ pam_ssh_load_key(const char *dir, const * with an empty passphrase, and if the key is not encrypted, * accept only an empty passphrase. */ - key = key_load_private(fn, NULL, &comment); + key = key_load_private(fn, "", &comment); if (key != NULL && !(*passphrase == '\0' && nullok)) { key_free(key); return (NULL); From owner-svn-src-stable@FreeBSD.ORG Mon Sep 9 21:00:04 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BAEE6229; Mon, 9 Sep 2013 21:00:04 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A7C3F23CC; Mon, 9 Sep 2013 21:00:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r89L04Fc015224; Mon, 9 Sep 2013 21:00:04 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r89L04KC015216; Mon, 9 Sep 2013 21:00:04 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201309092100.r89L04KC015216@svn.freebsd.org> From: Sean Bruno Date: Mon, 9 Sep 2013 21:00:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255429 - stable/9/usr.sbin/mfiutil X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Sep 2013 21:00:04 -0000 Author: sbruno Date: Mon Sep 9 21:00:03 2013 New Revision: 255429 URL: http://svnweb.freebsd.org/changeset/base/255429 Log: MFC r254906 -- add SYSPD (real jbod) support to mfiutil Add support to reconfigure a drive as SYSPD (real JBOD in LSI terminology). Adds command "mfiutil syspd " to change a drive to SYSPD. Drive will then be scanned/reported immediately as /dev/mfisyspdX by the host. "mfiutil good " clears SYSPD mode, remove /dev/mfisyspdX and sets disk into UNCONFIGURED mode. Tested on Dell H310 SAS/SATA RAID controller. Modified: stable/9/usr.sbin/mfiutil/mfi_drive.c stable/9/usr.sbin/mfiutil/mfiutil.8 stable/9/usr.sbin/mfiutil/mfiutil.c Directory Properties: stable/9/usr.sbin/mfiutil/ (props changed) Modified: stable/9/usr.sbin/mfiutil/mfi_drive.c ============================================================================== --- stable/9/usr.sbin/mfiutil/mfi_drive.c Mon Sep 9 20:36:28 2013 (r255428) +++ stable/9/usr.sbin/mfiutil/mfi_drive.c Mon Sep 9 21:00:03 2013 (r255429) @@ -474,6 +474,20 @@ rebuild_drive(int ac, char **av) MFI_COMMAND(top, rebuild, rebuild_drive); static int +syspd_drive(int ac, char **av) +{ + + if (ac != 2) { + warnx("syspd: %s", ac > 2 ? "extra arguments" : + "drive required"); + return (EINVAL); + } + + return (drive_set_state(av[1], MFI_PD_STATE_SYSTEM)); +} +MFI_COMMAND(top, syspd, syspd_drive); + +static int start_rebuild(int ac, char **av) { struct mfi_pd_info info; Modified: stable/9/usr.sbin/mfiutil/mfiutil.8 ============================================================================== --- stable/9/usr.sbin/mfiutil/mfiutil.8 Mon Sep 9 20:36:28 2013 (r255428) +++ stable/9/usr.sbin/mfiutil/mfiutil.8 Mon Sep 9 21:00:03 2013 (r255429) @@ -91,6 +91,9 @@ .Cm rebuild Ar drive .Nm .Op Fl u Ar unit +.Cm syspd Ar drive +.Nm +.Op Fl u Ar unit .Cm drive progress Ar drive .Nm .Op Fl u Ar unit @@ -372,6 +375,11 @@ Mark a failed that is still part of an array as a good drive suitable for a rebuild. The firmware should kick off an array rebuild on its own if a failed drive is marked as a rebuild drive. +.It Cm syspd Ar drive +Present the drive to the host operating system as a disk SYSPD block device in +the format /dev/mfisyspdX. Clear this flag with +.Cm good +.Ar drive .It Cm drive progress Ar drive Report the current progress and estimated completion time of drive operations such as rebuilds or patrol reads. @@ -679,6 +687,10 @@ Add the drive in slot 2 in the main chas .Pp .Dl Nm Cm add s2 mfid0 .Pp +Reconfigure a disk as a SYSPD block device with no RAID +.Pp +.Dl Nm Cm syspd 0 +.Pp Configure the adapter to run periodic patrol reads once a week with the first patrol read starting in 5 minutes: .Pp Modified: stable/9/usr.sbin/mfiutil/mfiutil.c ============================================================================== --- stable/9/usr.sbin/mfiutil/mfiutil.c Mon Sep 9 20:36:28 2013 (r255428) +++ stable/9/usr.sbin/mfiutil/mfiutil.c Mon Sep 9 21:00:03 2013 (r255429) @@ -66,8 +66,9 @@ usage(void) fprintf(stderr, " show patrol - display patrol read status\n"); fprintf(stderr, " show progress - display status of active operations\n"); fprintf(stderr, " fail - fail a physical drive\n"); - fprintf(stderr, " good - mark a bad physical drive as good\n"); + fprintf(stderr, " good - set a failed/SYSPD drive as UNCONFIGURED\n"); fprintf(stderr, " rebuild - mark failed drive ready for rebuild\n"); + fprintf(stderr, " syspd - set drive into use as SYSPD JBOD\n"); fprintf(stderr, " drive progress - display status of active operations\n"); fprintf(stderr, " drive clear - clear a drive with all 0x00\n"); fprintf(stderr, " start rebuild \n"); @@ -103,7 +104,7 @@ static int version(int ac __unused, char **av __unused) { - printf("mfiutil version 1.0.14"); + printf("mfiutil version 1.0.15"); #ifdef DEBUG printf(" (DEBUG)"); #endif From owner-svn-src-stable@FreeBSD.ORG Mon Sep 9 21:05:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6F2FE562; Mon, 9 Sep 2013 21:05:02 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5BC41243F; Mon, 9 Sep 2013 21:05:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r89L520F019677; Mon, 9 Sep 2013 21:05:02 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r89L51uo019649; Mon, 9 Sep 2013 21:05:01 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201309092105.r89L51uo019649@svn.freebsd.org> From: Sean Bruno Date: Mon, 9 Sep 2013 21:05:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255430 - stable/8/usr.sbin/mfiutil X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Sep 2013 21:05:02 -0000 Author: sbruno Date: Mon Sep 9 21:05:01 2013 New Revision: 255430 URL: http://svnweb.freebsd.org/changeset/base/255430 Log: MFC r254906 -- add SYSPD (real jbod) support to mfiutil Add support to reconfigure a drive as SYSPD (real JBOD in LSI terminology). Adds command "mfiutil syspd " to change a drive to SYSPD. Drive will then be scanned/reported immediately as /dev/mfisyspdX by the host. "mfiutil good " clears SYSPD mode, remove /dev/mfisyspdX and sets disk into UNCONFIGURED mode. Tested on Dell H310 SAS/SATA RAID controller. Modified: stable/8/usr.sbin/mfiutil/mfi_drive.c stable/8/usr.sbin/mfiutil/mfiutil.8 stable/8/usr.sbin/mfiutil/mfiutil.c Directory Properties: stable/8/usr.sbin/mfiutil/ (props changed) Modified: stable/8/usr.sbin/mfiutil/mfi_drive.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfi_drive.c Mon Sep 9 21:00:03 2013 (r255429) +++ stable/8/usr.sbin/mfiutil/mfi_drive.c Mon Sep 9 21:05:01 2013 (r255430) @@ -474,6 +474,20 @@ rebuild_drive(int ac, char **av) MFI_COMMAND(top, rebuild, rebuild_drive); static int +syspd_drive(int ac, char **av) +{ + + if (ac != 2) { + warnx("syspd: %s", ac > 2 ? "extra arguments" : + "drive required"); + return (EINVAL); + } + + return (drive_set_state(av[1], MFI_PD_STATE_SYSTEM)); +} +MFI_COMMAND(top, syspd, syspd_drive); + +static int start_rebuild(int ac, char **av) { struct mfi_pd_info info; Modified: stable/8/usr.sbin/mfiutil/mfiutil.8 ============================================================================== --- stable/8/usr.sbin/mfiutil/mfiutil.8 Mon Sep 9 21:00:03 2013 (r255429) +++ stable/8/usr.sbin/mfiutil/mfiutil.8 Mon Sep 9 21:05:01 2013 (r255430) @@ -88,6 +88,9 @@ .Cm rebuild Ar drive .Nm .Op Fl u Ar unit +.Cm syspd Ar drive +.Nm +.Op Fl u Ar unit .Cm drive progress Ar drive .Nm .Op Fl u Ar unit @@ -352,6 +355,11 @@ Mark a failed that is still part of an array as a good drive suitable for a rebuild. The firmware should kick off an array rebuild on its own if a failed drive is marked as a rebuild drive. +.It Cm syspd Ar drive +Present the drive to the host operating system as a disk SYSPD block device in +the format /dev/mfisyspdX. Clear this flag with +.Cm good +.Ar drive .It Cm drive progress Ar drive Report the current progress and estimated completion time of drive operations such as rebuilds or patrol reads. @@ -630,6 +638,10 @@ Add the drive in slot 2 in the main chas .Pp .Dl Nm Cm add s2 mfid0 .Pp +Reconfigure a disk as a SYSPD block device with no RAID +.Pp +.Dl Nm Cm syspd 0 +.Pp Configure the adapter to run periodic patrol reads once a week with the first patrol read starting in 5 minutes: .Pp Modified: stable/8/usr.sbin/mfiutil/mfiutil.c ============================================================================== --- stable/8/usr.sbin/mfiutil/mfiutil.c Mon Sep 9 21:00:03 2013 (r255429) +++ stable/8/usr.sbin/mfiutil/mfiutil.c Mon Sep 9 21:05:01 2013 (r255430) @@ -65,8 +65,9 @@ usage(void) fprintf(stderr, " show patrol - display patrol read status\n"); fprintf(stderr, " show progress - display status of active operations\n"); fprintf(stderr, " fail - fail a physical drive\n"); - fprintf(stderr, " good - mark a bad physical drive as good\n"); + fprintf(stderr, " good - set a failed/SYSPD drive as UNCONFIGURED\n"); fprintf(stderr, " rebuild - mark failed drive ready for rebuild\n"); + fprintf(stderr, " syspd - set drive into use as SYSPD JBOD\n"); fprintf(stderr, " drive progress - display status of active operations\n"); fprintf(stderr, " drive clear - clear a drive with all 0x00\n"); fprintf(stderr, " start rebuild \n"); @@ -97,7 +98,7 @@ static int version(int ac __unused, char **av __unused) { - printf("mfiutil version 1.0.14"); + printf("mfiutil version 1.0.15"); #ifdef DEBUG printf(" (DEBUG)"); #endif From owner-svn-src-stable@FreeBSD.ORG Mon Sep 9 21:25:35 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 00155FBF; Mon, 9 Sep 2013 21:25:34 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C764E2570; Mon, 9 Sep 2013 21:25:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r89LPYJ3032138; Mon, 9 Sep 2013 21:25:34 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r89LPYtP032136; Mon, 9 Sep 2013 21:25:34 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201309092125.r89LPYtP032136@svn.freebsd.org> From: Sean Bruno Date: Mon, 9 Sep 2013 21:25:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255432 - in stable/9: share/man/man4 sys/dev/ciss X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Sep 2013 21:25:35 -0000 Author: sbruno Date: Mon Sep 9 21:25:34 2013 New Revision: 255432 URL: http://svnweb.freebsd.org/changeset/base/255432 Log: MFC r253980 - new pciids for ciss(4) support Modified: stable/9/share/man/man4/ciss.4 stable/9/sys/dev/ciss/ciss.c Directory Properties: stable/9/share/man/man4/ (props changed) stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/share/man/man4/ciss.4 ============================================================================== --- stable/9/share/man/man4/ciss.4 Mon Sep 9 21:18:16 2013 (r255431) +++ stable/9/share/man/man4/ciss.4 Mon Sep 9 21:25:34 2013 (r255432) @@ -125,6 +125,8 @@ HP Smart Array P220i .It HP Smart Array P222 .It +HP Smart Array P230i +.It HP Smart Array P400 .It HP Smart Array P400i @@ -141,14 +143,30 @@ HP Smart Array P420i .It HP Smart Array P421 .It +HP Smart Array P430 +.It +HP Smart Array P430i +.It +HP Smart Array P431 +.It +HP Smart Array P530 +.It +HP Smart Array P531 +.It HP Smart Array P600 .It HP Smart Array P721m .It +HP Smart Array P731m +.It HP Smart Array P800 .It HP Smart Array P812 .It +HP Smart Array P830 +.It +HP Smart Array P830i +.It HP Modular Smart Array 20 (MSA20) .It HP Modular Smart Array 500 (MSA500) Modified: stable/9/sys/dev/ciss/ciss.c ============================================================================== --- stable/9/sys/dev/ciss/ciss.c Mon Sep 9 21:18:16 2013 (r255431) +++ stable/9/sys/dev/ciss/ciss.c Mon Sep 9 21:25:34 2013 (r255432) @@ -338,6 +338,15 @@ static struct { 0x103C, 0x3354, CISS_BOARD_SA5, "HP Smart Array P420i" }, { 0x103C, 0x3355, CISS_BOARD_SA5, "HP Smart Array P220i" }, { 0x103C, 0x3356, CISS_BOARD_SA5, "HP Smart Array P721m" }, + { 0x103C, 0x1920, CISS_BOARD_SA5, "HP Smart Array P430i" }, + { 0x103C, 0x1921, CISS_BOARD_SA5, "HP Smart Array P830i" }, + { 0x103C, 0x1922, CISS_BOARD_SA5, "HP Smart Array P430" }, + { 0x103C, 0x1923, CISS_BOARD_SA5, "HP Smart Array P431" }, + { 0x103C, 0x1924, CISS_BOARD_SA5, "HP Smart Array P830" }, + { 0x103C, 0x1926, CISS_BOARD_SA5, "HP Smart Array P731m" }, + { 0x103C, 0x1928, CISS_BOARD_SA5, "HP Smart Array P230i" }, + { 0x103C, 0x1929, CISS_BOARD_SA5, "HP Smart Array P530" }, + { 0x103C, 0x192A, CISS_BOARD_SA5, "HP Smart Array P531" }, { 0, 0, 0, NULL } }; From owner-svn-src-stable@FreeBSD.ORG Mon Sep 9 21:26:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 55ABB185; Mon, 9 Sep 2013 21:26:19 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 290B4257A; Mon, 9 Sep 2013 21:26:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r89LQJV5032392; Mon, 9 Sep 2013 21:26:19 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r89LQIdm032390; Mon, 9 Sep 2013 21:26:18 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201309092126.r89LQIdm032390@svn.freebsd.org> From: Sean Bruno Date: Mon, 9 Sep 2013 21:26:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255433 - in stable/8: share/man/man4 sys/dev/ciss X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Sep 2013 21:26:19 -0000 Author: sbruno Date: Mon Sep 9 21:26:18 2013 New Revision: 255433 URL: http://svnweb.freebsd.org/changeset/base/255433 Log: MFC r253980 -- add new pciids for ciss(4) Modified: stable/8/share/man/man4/ciss.4 stable/8/sys/dev/ciss/ciss.c Directory Properties: stable/8/share/man/man4/ (props changed) stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/ciss/ (props changed) Modified: stable/8/share/man/man4/ciss.4 ============================================================================== --- stable/8/share/man/man4/ciss.4 Mon Sep 9 21:25:34 2013 (r255432) +++ stable/8/share/man/man4/ciss.4 Mon Sep 9 21:26:18 2013 (r255433) @@ -125,6 +125,8 @@ HP Smart Array P220i .It HP Smart Array P222 .It +HP Smart Array P230i +.It HP Smart Array P400 .It HP Smart Array P400i @@ -141,14 +143,30 @@ HP Smart Array P420i .It HP Smart Array P421 .It +HP Smart Array P430 +.It +HP Smart Array P430i +.It +HP Smart Array P431 +.It +HP Smart Array P530 +.It +HP Smart Array P531 +.It HP Smart Array P600 .It HP Smart Array P721m .It +HP Smart Array P731m +.It HP Smart Array P800 .It HP Smart Array P812 .It +HP Smart Array P830 +.It +HP Smart Array P830i +.It HP Modular Smart Array 20 (MSA20) .It HP Modular Smart Array 500 (MSA500) Modified: stable/8/sys/dev/ciss/ciss.c ============================================================================== --- stable/8/sys/dev/ciss/ciss.c Mon Sep 9 21:25:34 2013 (r255432) +++ stable/8/sys/dev/ciss/ciss.c Mon Sep 9 21:26:18 2013 (r255433) @@ -337,6 +337,15 @@ static struct { 0x103C, 0x3354, CISS_BOARD_SA5, "HP Smart Array P420i" }, { 0x103C, 0x3355, CISS_BOARD_SA5, "HP Smart Array P220i" }, { 0x103C, 0x3356, CISS_BOARD_SA5, "HP Smart Array P721m" }, + { 0x103C, 0x1920, CISS_BOARD_SA5, "HP Smart Array P430i" }, + { 0x103C, 0x1921, CISS_BOARD_SA5, "HP Smart Array P830i" }, + { 0x103C, 0x1922, CISS_BOARD_SA5, "HP Smart Array P430" }, + { 0x103C, 0x1923, CISS_BOARD_SA5, "HP Smart Array P431" }, + { 0x103C, 0x1924, CISS_BOARD_SA5, "HP Smart Array P830" }, + { 0x103C, 0x1926, CISS_BOARD_SA5, "HP Smart Array P731m" }, + { 0x103C, 0x1928, CISS_BOARD_SA5, "HP Smart Array P230i" }, + { 0x103C, 0x1929, CISS_BOARD_SA5, "HP Smart Array P530" }, + { 0x103C, 0x192A, CISS_BOARD_SA5, "HP Smart Array P531" }, { 0, 0, 0, NULL } }; From owner-svn-src-stable@FreeBSD.ORG Tue Sep 10 00:40:22 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8C8DCE52; Tue, 10 Sep 2013 00:40:22 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 7AC992E80; Tue, 10 Sep 2013 00:40:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8A0eM0U052137; Tue, 10 Sep 2013 00:40:22 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8A0eMI5052136; Tue, 10 Sep 2013 00:40:22 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201309100040.r8A0eMI5052136@svn.freebsd.org> From: Xin LI Date: Tue, 10 Sep 2013 00:40:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255435 - stable/9/sys/dev/hpt27xx X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Sep 2013 00:40:22 -0000 Author: delphij Date: Tue Sep 10 00:40:21 2013 New Revision: 255435 URL: http://svnweb.freebsd.org/changeset/base/255435 Log: MFC r255320: Return BUS_PROBE_DEFAULT instead of BUS_PROBE_SPECIFIC. This change is a 9.2-RELEASE candidate. Modified: stable/9/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/hpt27xx/hpt27xx_osm_bsd.c ============================================================================== --- stable/9/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Mon Sep 9 21:40:07 2013 (r255434) +++ stable/9/sys/dev/hpt27xx/hpt27xx_osm_bsd.c Tue Sep 10 00:40:21 2013 (r255435) @@ -52,7 +52,7 @@ static int hpt_probe(device_t dev) memset(hba, 0, sizeof(HBA)); hba->ext_type = EXT_TYPE_HBA; hba->ldm_adapter.him = him; - return 0; + return (BUS_PROBE_DEFAULT); } } } From owner-svn-src-stable@FreeBSD.ORG Tue Sep 10 10:07:23 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 15D2BE27; Tue, 10 Sep 2013 10:07:23 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E6B462A39; Tue, 10 Sep 2013 10:07:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8AA7MKN097289; Tue, 10 Sep 2013 10:07:22 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8AA7LWJ097283; Tue, 10 Sep 2013 10:07:21 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201309101007.r8AA7LWJ097283@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Tue, 10 Sep 2013 10:07:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255443 - in stable/9/sys: fs/nullfs kern net netinet6 netnatm X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Sep 2013 10:07:23 -0000 Author: des Date: Tue Sep 10 10:07:21 2013 New Revision: 255443 URL: http://svnweb.freebsd.org/changeset/base/255443 Log: Fix the length calculation for the final block of a sendfile(2) transmission which could be tricked into rounding up to the nearest page size, leaking up to a page of kernel memory. [13:11] In IPv6 and NetATM, stop SIOCSIFADDR, SIOCSIFBRDADDR, SIOCSIFDSTADDR and SIOCSIFNETMASK at the socket layer rather than pass them on to the link layer without validation or credential checks. [SA-13:12] Prevent cross-mount hardlinks between different nullfs mounts of the same underlying filesystem. [SA-13:13] Security: CVE-2013-5666 Security: FreeBSD-SA-13:11.sendfile Security: CVE-2013-5691 Security: FreeBSD-SA-13:12.ifioctl Security: CVE-2013-5710 Security: FreeBSD-SA-13:13.nullfs Approved by: so Modified: stable/9/sys/fs/nullfs/null_vnops.c stable/9/sys/kern/uipc_syscalls.c stable/9/sys/net/if.c stable/9/sys/netinet6/in6.c stable/9/sys/netnatm/natm.c Modified: stable/9/sys/fs/nullfs/null_vnops.c ============================================================================== --- stable/9/sys/fs/nullfs/null_vnops.c Tue Sep 10 10:05:59 2013 (r255442) +++ stable/9/sys/fs/nullfs/null_vnops.c Tue Sep 10 10:07:21 2013 (r255443) @@ -858,6 +858,15 @@ null_vptocnp(struct vop_vptocnp_args *ap return (error); } +static int +null_link(struct vop_link_args *ap) +{ + + if (ap->a_tdvp->v_mount != ap->a_vp->v_mount) + return (EXDEV); + return (null_bypass((struct vop_generic_args *)ap)); +} + /* * Global vfs data structures */ @@ -871,6 +880,7 @@ struct vop_vector null_vnodeops = { .vop_getwritemount = null_getwritemount, .vop_inactive = null_inactive, .vop_islocked = vop_stdislocked, + .vop_link = null_link, .vop_lock1 = null_lock, .vop_lookup = null_lookup, .vop_open = null_open, Modified: stable/9/sys/kern/uipc_syscalls.c ============================================================================== --- stable/9/sys/kern/uipc_syscalls.c Tue Sep 10 10:05:59 2013 (r255442) +++ stable/9/sys/kern/uipc_syscalls.c Tue Sep 10 10:07:21 2013 (r255443) @@ -2126,11 +2126,10 @@ retry_space: * or the passed in nbytes. */ pgoff = (vm_offset_t)(off & PAGE_MASK); - if (uap->nbytes) - rem = (uap->nbytes - fsbytes - loopbytes); - else - rem = va.va_size - - uap->offset - fsbytes - loopbytes; + rem = va.va_size - uap->offset; + if (uap->nbytes != 0) + rem = omin(rem, uap->nbytes); + rem -= fsbytes + loopbytes; xfsize = omin(PAGE_SIZE - pgoff, rem); xfsize = omin(space - loopbytes, xfsize); if (xfsize <= 0) { Modified: stable/9/sys/net/if.c ============================================================================== --- stable/9/sys/net/if.c Tue Sep 10 10:05:59 2013 (r255442) +++ stable/9/sys/net/if.c Tue Sep 10 10:07:21 2013 (r255443) @@ -2555,11 +2555,23 @@ ifioctl(struct socket *so, u_long cmd, c CURVNET_RESTORE(); return (EOPNOTSUPP); } + + /* + * Pass the request on to the socket control method, and if the + * latter returns EOPNOTSUPP, directly to the interface. + * + * Make an exception for the legacy SIOCSIF* requests. Drivers + * trust SIOCSIFADDR et al to come from an already privileged + * layer, and do not perform any credentials checks or input + * validation. + */ #ifndef COMPAT_43 error = ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd, data, ifp, td)); - if (error == EOPNOTSUPP && ifp != NULL && ifp->if_ioctl != NULL) + if (error == EOPNOTSUPP && ifp != NULL && ifp->if_ioctl != NULL && + cmd != SIOCSIFADDR && cmd != SIOCSIFBRDADDR && + cmd != SIOCSIFDSTADDR && cmd != SIOCSIFNETMASK) error = (*ifp->if_ioctl)(ifp, cmd, data); #else { @@ -2603,7 +2615,9 @@ ifioctl(struct socket *so, u_long cmd, c data, ifp, td)); if (error == EOPNOTSUPP && ifp != NULL && - ifp->if_ioctl != NULL) + ifp->if_ioctl != NULL && + cmd != SIOCSIFADDR && cmd != SIOCSIFBRDADDR && + cmd != SIOCSIFDSTADDR && cmd != SIOCSIFNETMASK) error = (*ifp->if_ioctl)(ifp, cmd, data); switch (ocmd) { Modified: stable/9/sys/netinet6/in6.c ============================================================================== --- stable/9/sys/netinet6/in6.c Tue Sep 10 10:05:59 2013 (r255442) +++ stable/9/sys/netinet6/in6.c Tue Sep 10 10:07:21 2013 (r255443) @@ -422,6 +422,18 @@ in6_control(struct socket *so, u_long cm case SIOCGIFSTAT_ICMP6: sa6 = &ifr->ifr_addr; break; + case SIOCSIFADDR: + case SIOCSIFBRDADDR: + case SIOCSIFDSTADDR: + case SIOCSIFNETMASK: + /* + * Although we should pass any non-INET6 ioctl requests + * down to driver, we filter some legacy INET requests. + * Drivers trust SIOCSIFADDR et al to come from an already + * privileged layer, and do not perform any credentials + * checks or input validation. + */ + return (EINVAL); default: sa6 = NULL; break; Modified: stable/9/sys/netnatm/natm.c ============================================================================== --- stable/9/sys/netnatm/natm.c Tue Sep 10 10:05:59 2013 (r255442) +++ stable/9/sys/netnatm/natm.c Tue Sep 10 10:07:21 2013 (r255443) @@ -339,6 +339,21 @@ natm_usr_control(struct socket *so, u_lo npcb = (struct natmpcb *)so->so_pcb; KASSERT(npcb != NULL, ("natm_usr_control: npcb == NULL")); + switch (cmd) { + case SIOCSIFADDR: + case SIOCSIFBRDADDR: + case SIOCSIFDSTADDR: + case SIOCSIFNETMASK: + /* + * Although we should pass any non-ATM ioctl requests + * down to driver, we filter some legacy INET requests. + * Drivers trust SIOCSIFADDR et al to come from an already + * privileged layer, and do not perform any credentials + * checks or input validation. + */ + return (EINVAL); + } + if (ifp == NULL || ifp->if_ioctl == NULL) return (EOPNOTSUPP); return ((*ifp->if_ioctl)(ifp, cmd, arg)); From owner-svn-src-stable@FreeBSD.ORG Tue Sep 10 10:12:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8FB7E1FA; Tue, 10 Sep 2013 10:12:10 +0000 (UTC) (envelope-from des@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 6CC492AAE; Tue, 10 Sep 2013 10:12:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8AACAwx001297; Tue, 10 Sep 2013 10:12:10 GMT (envelope-from des@svn.freebsd.org) Received: (from des@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8AAC9hY001288; Tue, 10 Sep 2013 10:12:09 GMT (envelope-from des@svn.freebsd.org) Message-Id: <201309101012.r8AAC9hY001288@svn.freebsd.org> From: Dag-Erling Smørgrav Date: Tue, 10 Sep 2013 10:12:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255445 - in stable/8/sys: fs/nullfs net netinet6 netnatm X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 10 Sep 2013 10:12:10 -0000 Author: des Date: Tue Sep 10 10:12:09 2013 New Revision: 255445 URL: http://svnweb.freebsd.org/changeset/base/255445 Log: In IPv6 and NetATM, stop SIOCSIFADDR, SIOCSIFBRDADDR, SIOCSIFDSTADDR and SIOCSIFNETMASK at the socket layer rather than pass them on to the link layer without validation or credential checks. [SA-13:12] Prevent cross-mount hardlinks between different nullfs mounts of the same underlying filesystem. [SA-13:13] Security: CVE-2013-5691 Security: FreeBSD-SA-13:12.ifioctl Security: CVE-2013-5710 Security: FreeBSD-SA-13:13.nullfs Approved by: so Modified: stable/8/sys/fs/nullfs/null_vnops.c stable/8/sys/net/if.c stable/8/sys/netinet6/in6.c stable/8/sys/netnatm/natm.c Modified: stable/8/sys/fs/nullfs/null_vnops.c ============================================================================== --- stable/8/sys/fs/nullfs/null_vnops.c Tue Sep 10 10:08:20 2013 (r255444) +++ stable/8/sys/fs/nullfs/null_vnops.c Tue Sep 10 10:12:09 2013 (r255445) @@ -816,6 +816,15 @@ null_vptocnp(struct vop_vptocnp_args *ap return (error); } +static int +null_link(struct vop_link_args *ap) +{ + + if (ap->a_tdvp->v_mount != ap->a_vp->v_mount) + return (EXDEV); + return (null_bypass((struct vop_generic_args *)ap)); +} + /* * Global vfs data structures */ @@ -828,6 +837,7 @@ struct vop_vector null_vnodeops = { .vop_getwritemount = null_getwritemount, .vop_inactive = null_inactive, .vop_islocked = vop_stdislocked, + .vop_link = null_link, .vop_lock1 = null_lock, .vop_lookup = null_lookup, .vop_open = null_open, Modified: stable/8/sys/net/if.c ============================================================================== --- stable/8/sys/net/if.c Tue Sep 10 10:08:20 2013 (r255444) +++ stable/8/sys/net/if.c Tue Sep 10 10:12:09 2013 (r255445) @@ -2603,11 +2603,23 @@ ifioctl(struct socket *so, u_long cmd, c CURVNET_RESTORE(); return (EOPNOTSUPP); } + + /* + * Pass the request on to the socket control method, and if the + * latter returns EOPNOTSUPP, directly to the interface. + * + * Make an exception for the legacy SIOCSIF* requests. Drivers + * trust SIOCSIFADDR et al to come from an already privileged + * layer, and do not perform any credentials checks or input + * validation. + */ #ifndef COMPAT_43 error = ((*so->so_proto->pr_usrreqs->pru_control)(so, cmd, data, ifp, td)); - if (error == EOPNOTSUPP && ifp != NULL && ifp->if_ioctl != NULL) + if (error == EOPNOTSUPP && ifp != NULL && ifp->if_ioctl != NULL && + cmd != SIOCSIFADDR && cmd != SIOCSIFBRDADDR && + cmd != SIOCSIFDSTADDR && cmd != SIOCSIFNETMASK) error = (*ifp->if_ioctl)(ifp, cmd, data); #else { @@ -2651,7 +2663,9 @@ ifioctl(struct socket *so, u_long cmd, c data, ifp, td)); if (error == EOPNOTSUPP && ifp != NULL && - ifp->if_ioctl != NULL) + ifp->if_ioctl != NULL && + cmd != SIOCSIFADDR && cmd != SIOCSIFBRDADDR && + cmd != SIOCSIFDSTADDR && cmd != SIOCSIFNETMASK) error = (*ifp->if_ioctl)(ifp, cmd, data); switch (ocmd) { Modified: stable/8/sys/netinet6/in6.c ============================================================================== --- stable/8/sys/netinet6/in6.c Tue Sep 10 10:08:20 2013 (r255444) +++ stable/8/sys/netinet6/in6.c Tue Sep 10 10:12:09 2013 (r255445) @@ -344,6 +344,18 @@ in6_control(struct socket *so, u_long cm case SIOCGIFSTAT_ICMP6: sa6 = &ifr->ifr_addr; break; + case SIOCSIFADDR: + case SIOCSIFBRDADDR: + case SIOCSIFDSTADDR: + case SIOCSIFNETMASK: + /* + * Although we should pass any non-INET6 ioctl requests + * down to driver, we filter some legacy INET requests. + * Drivers trust SIOCSIFADDR et al to come from an already + * privileged layer, and do not perform any credentials + * checks or input validation. + */ + return (EINVAL); default: sa6 = NULL; break; Modified: stable/8/sys/netnatm/natm.c ============================================================================== --- stable/8/sys/netnatm/natm.c Tue Sep 10 10:08:20 2013 (r255444) +++ stable/8/sys/netnatm/natm.c Tue Sep 10 10:12:09 2013 (r255445) @@ -339,6 +339,21 @@ natm_usr_control(struct socket *so, u_lo npcb = (struct natmpcb *)so->so_pcb; KASSERT(npcb != NULL, ("natm_usr_control: npcb == NULL")); + switch (cmd) { + case SIOCSIFADDR: + case SIOCSIFBRDADDR: + case SIOCSIFDSTADDR: + case SIOCSIFNETMASK: + /* + * Although we should pass any non-ATM ioctl requests + * down to driver, we filter some legacy INET requests. + * Drivers trust SIOCSIFADDR et al to come from an already + * privileged layer, and do not perform any credentials + * checks or input validation. + */ + return (EINVAL); + } + if (ifp == NULL || ifp->if_ioctl == NULL) return (EOPNOTSUPP); return ((*ifp->if_ioctl)(ifp, cmd, arg)); From owner-svn-src-stable@FreeBSD.ORG Wed Sep 11 07:24:48 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 16793CFC; Wed, 11 Sep 2013 07:24:48 +0000 (UTC) (envelope-from dteske@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E9BEC29FF; Wed, 11 Sep 2013 07:24:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8B7Olku037600; Wed, 11 Sep 2013 07:24:47 GMT (envelope-from dteske@svn.freebsd.org) Received: (from dteske@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8B7OkdJ037593; Wed, 11 Sep 2013 07:24:46 GMT (envelope-from dteske@svn.freebsd.org) Message-Id: <201309110724.r8B7OkdJ037593@svn.freebsd.org> From: Devin Teske Date: Wed, 11 Sep 2013 07:24:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255470 - in stable/8/sys: net netinet netinet6 X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Sep 2013 07:24:48 -0000 Author: dteske Date: Wed Sep 11 07:24:46 2013 New Revision: 255470 URL: http://svnweb.freebsd.org/changeset/base/255470 Log: Merge from stable/9 SVN r250927: MFC: r249628, r249742 - recover missing arp_ifinit() call. - plug static llentry leak (ipv4 & ipv6 were affected). PR: kern/172985 Also merge from stable/9 SVN r240313: Merge r238990 (manually resolving absence of r237263): Fix races between in_lltable_prefix_free(), lla_lookup(), llentry_free() and arptimer(): o Use callout_init_rw() for lle timeout, this allows us safely disestablish them. - This allows us to simplify the arptimer() and make it race safe. o Consistently use ifp->if_afdata_lock to lock access to linked lists in the lle hashes. o Introduce new lle flag LLE_LINKED, which marks an entry that is attached to the hash. - Use LLE_LINKED to avoid double unlinking via consequent calls to llentry_free(). - Mark lle with LLE_DELETED via |= operation istead of =, so that other flags won't be lost. o Make LLE_ADDREF(), LLE_REMREF() and LLE_FREE_LOCKED() more consistent and provide more informative KASSERTs. The patch is a collaborative work of all submitters and myself. PR: kern/165863 Submitted by: zont, rstone Submitted by: Eric van Gyzen Modified: stable/8/sys/net/if_llatbl.c stable/8/sys/net/if_llatbl.h stable/8/sys/net/if_var.h stable/8/sys/net/if_vlan.c stable/8/sys/netinet/if_ether.c stable/8/sys/netinet/in.c stable/8/sys/netinet6/in6.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/net/ (props changed) stable/8/sys/netinet/ (props changed) stable/8/sys/netinet6/ (props changed) Modified: stable/8/sys/net/if_llatbl.c ============================================================================== --- stable/8/sys/net/if_llatbl.c Wed Sep 11 07:11:14 2013 (r255469) +++ stable/8/sys/net/if_llatbl.c Wed Sep 11 07:24:46 2013 (r255470) @@ -109,10 +109,19 @@ llentry_free(struct llentry *lle) size_t pkts_dropped; struct mbuf *next; - pkts_dropped = 0; + IF_AFDATA_WLOCK_ASSERT(lle->lle_tbl->llt_ifp); LLE_WLOCK_ASSERT(lle); + + /* XXX: guard against race with other llentry_free(). */ + if (!(lle->la_flags & LLE_LINKED)) { + LLE_FREE_LOCKED(lle); + return (0); + } + LIST_REMOVE(lle, lle_next); + lle->la_flags &= ~(LLE_VALID | LLE_LINKED); + pkts_dropped = 0; while ((lle->la_numheld > 0) && (lle->la_hold != NULL)) { next = lle->la_hold->m_nextpkt; m_freem(lle->la_hold); @@ -125,7 +134,6 @@ llentry_free(struct llentry *lle) ("%s: la_numheld %d > 0, pkts_droped %zd", __func__, lle->la_numheld, pkts_dropped)); - lle->la_flags &= ~LLE_VALID; LLE_FREE_LOCKED(lle); return (pkts_dropped); @@ -185,17 +193,16 @@ lltable_free(struct lltable *llt) SLIST_REMOVE(&V_lltables, llt, lltable, llt_link); LLTABLE_WUNLOCK(); - for (i=0; i < LLTBL_HASHTBL_SIZE; i++) { + IF_AFDATA_WLOCK(llt->llt_ifp); + for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { - int canceled; - - canceled = callout_drain(&lle->la_timer); LLE_WLOCK(lle); - if (canceled) + if (callout_stop(&lle->la_timer)) LLE_REMREF(lle); llentry_free(lle); } } + IF_AFDATA_WUNLOCK(llt->llt_ifp); free(llt, M_LLTABLE); } Modified: stable/8/sys/net/if_llatbl.h ============================================================================== --- stable/8/sys/net/if_llatbl.h Wed Sep 11 07:11:14 2013 (r255469) +++ stable/8/sys/net/if_llatbl.h Wed Sep 11 07:24:46 2013 (r255470) @@ -97,26 +97,28 @@ struct llentry { #define LLE_ADDREF(lle) do { \ LLE_WLOCK_ASSERT(lle); \ KASSERT((lle)->lle_refcnt >= 0, \ - ("negative refcnt %d", (lle)->lle_refcnt)); \ + ("negative refcnt %d on lle %p", \ + (lle)->lle_refcnt, (lle))); \ (lle)->lle_refcnt++; \ } while (0) #define LLE_REMREF(lle) do { \ LLE_WLOCK_ASSERT(lle); \ - KASSERT((lle)->lle_refcnt > 1, \ - ("bogus refcnt %d", (lle)->lle_refcnt)); \ + KASSERT((lle)->lle_refcnt > 0, \ + ("bogus refcnt %d on lle %p", \ + (lle)->lle_refcnt, (lle))); \ (lle)->lle_refcnt--; \ } while (0) #define LLE_FREE_LOCKED(lle) do { \ - if ((lle)->lle_refcnt <= 1) \ + if ((lle)->lle_refcnt == 1) \ (lle)->lle_tbl->llt_free((lle)->lle_tbl, (lle));\ else { \ - (lle)->lle_refcnt--; \ + LLE_REMREF(lle); \ LLE_WUNLOCK(lle); \ } \ /* guard against invalid refs */ \ - lle = NULL; \ + (lle) = NULL; \ } while (0) #define LLE_FREE(lle) do { \ @@ -167,9 +169,10 @@ MALLOC_DECLARE(M_LLTABLE); #define LLE_VALID 0x0008 /* ll_addr is valid */ #define LLE_PROXY 0x0010 /* proxy entry ??? */ #define LLE_PUB 0x0020 /* publish entry ??? */ +#define LLE_LINKED 0x0040 /* linked to lookup structure */ +#define LLE_EXCLUSIVE 0x2000 /* return lle xlocked */ #define LLE_DELETE 0x4000 /* delete on a lookup - match LLE_IFADDR */ #define LLE_CREATE 0x8000 /* create on a lookup miss */ -#define LLE_EXCLUSIVE 0x2000 /* return lle xlocked */ #define LLATBL_HASH(key, mask) \ (((((((key >> 8) ^ key) >> 8) ^ key) >> 8) ^ key) & mask) Modified: stable/8/sys/net/if_var.h ============================================================================== --- stable/8/sys/net/if_var.h Wed Sep 11 07:11:14 2013 (r255469) +++ stable/8/sys/net/if_var.h Wed Sep 11 07:24:46 2013 (r255470) @@ -406,6 +406,8 @@ EVENTHANDLER_DECLARE(group_change_event, #define IF_AFDATA_DESTROY(ifp) rw_destroy(&(ifp)->if_afdata_lock) #define IF_AFDATA_LOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_LOCKED) +#define IF_AFDATA_RLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_RLOCKED) +#define IF_AFDATA_WLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_WLOCKED) #define IF_AFDATA_UNLOCK_ASSERT(ifp) rw_assert(&(ifp)->if_afdata_lock, RA_UNLOCKED) int if_handoff(struct ifqueue *ifq, struct mbuf *m, struct ifnet *ifp, Modified: stable/8/sys/net/if_vlan.c ============================================================================== --- stable/8/sys/net/if_vlan.c Wed Sep 11 07:11:14 2013 (r255469) +++ stable/8/sys/net/if_vlan.c Wed Sep 11 07:24:46 2013 (r255470) @@ -41,6 +41,7 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_inet.h" #include "opt_vlan.h" #include @@ -65,6 +66,11 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef INET +#include +#include +#endif + #define VLANNAME "vlan" #define VLAN_DEF_HWIDTH 4 #define VLAN_IFFLAGS (IFF_BROADCAST | IFF_MULTICAST) Modified: stable/8/sys/netinet/if_ether.c ============================================================================== --- stable/8/sys/netinet/if_ether.c Wed Sep 11 07:11:14 2013 (r255469) +++ stable/8/sys/netinet/if_ether.c Wed Sep 11 07:24:46 2013 (r255470) @@ -167,38 +167,30 @@ arp_ifscrub(struct ifnet *ifp, uint32_t static void arptimer(void *arg) { + struct llentry *lle = (struct llentry *)arg; struct ifnet *ifp; - struct llentry *lle; - int pkts_dropped; + size_t pkts_dropped; + + if (lle->la_flags & LLE_STATIC) { + LLE_WUNLOCK(lle); + return; + } - KASSERT(arg != NULL, ("%s: arg NULL", __func__)); - lle = (struct llentry *)arg; ifp = lle->lle_tbl->llt_ifp; CURVNET_SET(ifp->if_vnet); + + callout_stop(&lle->la_timer); + + /* XXX: LOR avoidance. We still have ref on lle. */ + LLE_WUNLOCK(lle); IF_AFDATA_LOCK(ifp); LLE_WLOCK(lle); - if (lle->la_flags & LLE_STATIC) - LLE_WUNLOCK(lle); - else { - if (!callout_pending(&lle->la_timer) && - callout_active(&lle->la_timer)) { - callout_stop(&lle->la_timer); - LLE_REMREF(lle); - pkts_dropped = llentry_free(lle); - ARPSTAT_ADD(dropped, pkts_dropped); - ARPSTAT_INC(timeouts); - } else { -#ifdef DIAGNOSTIC - struct sockaddr *l3addr = L3_ADDR(lle); - log(LOG_INFO, - "arptimer issue: %p, IPv4 address: \"%s\"\n", lle, - inet_ntoa( - ((const struct sockaddr_in *)l3addr)->sin_addr)); -#endif - LLE_WUNLOCK(lle); - } - } + + LLE_REMREF(lle); + pkts_dropped = llentry_free(lle); IF_AFDATA_UNLOCK(ifp); + ARPSTAT_ADD(dropped, pkts_dropped); + ARPSTAT_INC(timeouts); CURVNET_RESTORE(); } Modified: stable/8/sys/netinet/in.c ============================================================================== --- stable/8/sys/netinet/in.c Wed Sep 11 07:11:14 2013 (r255469) +++ stable/8/sys/netinet/in.c Wed Sep 11 07:24:46 2013 (r255470) @@ -1350,7 +1350,6 @@ in_lltable_new(const struct sockaddr *l3 if (lle == NULL) /* NB: caller generates msg */ return NULL; - callout_init(&lle->base.la_timer, CALLOUT_MPSAFE); /* * For IPv4 this will trigger "arpresolve" to generate * an ARP request. @@ -1359,7 +1358,10 @@ in_lltable_new(const struct sockaddr *l3 lle->l3_addr4 = *(const struct sockaddr_in *)l3addr; lle->base.lle_refcnt = 1; LLE_LOCK_INIT(&lle->base); - return &lle->base; + callout_init_rw(&lle->base.la_timer, &lle->base.lle_lock, + CALLOUT_RETURNUNLOCKED); + + return (&lle->base); } /* @@ -1392,7 +1394,8 @@ in_lltable_prefix_free(struct lltable *l register int i; size_t pkts_dropped; - for (i=0; i < LLTBL_HASHTBL_SIZE; i++) { + IF_AFDATA_WLOCK(llt->llt_ifp); + for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { /* @@ -1402,17 +1405,15 @@ in_lltable_prefix_free(struct lltable *l if (IN_ARE_MASKED_ADDR_EQUAL((struct sockaddr_in *)L3_ADDR(lle), pfx, msk) && ((flags & LLE_STATIC) || !(lle->la_flags & LLE_STATIC))) { - int canceled; - - canceled = callout_drain(&lle->la_timer); LLE_WLOCK(lle); - if (canceled) + if (callout_stop(&lle->la_timer)) LLE_REMREF(lle); pkts_dropped = llentry_free(lle); ARPSTAT_ADD(dropped, pkts_dropped); } } } + IF_AFDATA_WUNLOCK(llt->llt_ifp); } @@ -1545,15 +1546,20 @@ in_lltable_lookup(struct lltable *llt, u lle->lle_tbl = llt; lle->lle_head = lleh; + lle->la_flags |= LLE_LINKED; LIST_INSERT_HEAD(lleh, lle, lle_next); } else if (flags & LLE_DELETE) { if (!(lle->la_flags & LLE_IFADDR) || (flags & LLE_IFADDR)) { LLE_WLOCK(lle); - lle->la_flags = LLE_DELETED; - LLE_WUNLOCK(lle); + lle->la_flags |= LLE_DELETED; #ifdef DIAGNOSTIC - log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); + log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); #endif + if ((lle->la_flags & + (LLE_STATIC | LLE_IFADDR)) == LLE_STATIC) + llentry_free(lle); + else + LLE_WUNLOCK(lle); } lle = (void *)-1; Modified: stable/8/sys/netinet6/in6.c ============================================================================== --- stable/8/sys/netinet6/in6.c Wed Sep 11 07:11:14 2013 (r255469) +++ stable/8/sys/netinet6/in6.c Wed Sep 11 07:24:46 2013 (r255470) @@ -1377,10 +1377,10 @@ in6_purgeaddr(struct ifaddr *ifa) nd6_dad_stop(ifa); /* Remove local address entry from lltable. */ - IF_AFDATA_LOCK(ifp); - lla_lookup(LLTABLE6(ifp), (LLE_DELETE | LLE_IFADDR), - (struct sockaddr *)&ia->ia_addr); - IF_AFDATA_UNLOCK(ifp); + memcpy(&addr, &ia->ia_addr, sizeof(ia->ia_addr)); + memcpy(&mask, &ia->ia_prefixmask, sizeof(ia->ia_prefixmask)); + lltable_prefix_free(AF_INET6, (struct sockaddr *)&addr, + (struct sockaddr *)&mask, LLE_STATIC); /* * initialize for rtmsg generation @@ -1393,8 +1393,6 @@ in6_purgeaddr(struct ifaddr *ifa) /* */ bzero(&rt0, sizeof(rt0)); rt0.rt_gateway = (struct sockaddr *)&gateway; - memcpy(&mask, &ia->ia_prefixmask, sizeof(ia->ia_prefixmask)); - memcpy(&addr, &ia->ia_addr, sizeof(ia->ia_addr)); rt_mask(&rt0) = (struct sockaddr *)&mask; rt_key(&rt0) = (struct sockaddr *)&addr; rt0.rt_flags = RTF_HOST | RTF_STATIC; @@ -2392,23 +2390,22 @@ in6_lltable_prefix_free(struct lltable * * (flags & LLE_STATIC) means deleting all entries * including static ND6 entries */ - for (i=0; i < LLTBL_HASHTBL_SIZE; i++) { + IF_AFDATA_WLOCK(llt->llt_ifp); + for (i = 0; i < LLTBL_HASHTBL_SIZE; i++) { LIST_FOREACH_SAFE(lle, &llt->lle_head[i], lle_next, next) { if (IN6_ARE_MASKED_ADDR_EQUAL( - &((struct sockaddr_in6 *)L3_ADDR(lle))->sin6_addr, - &pfx->sin6_addr, - &msk->sin6_addr) && - ((flags & LLE_STATIC) || !(lle->la_flags & LLE_STATIC))) { - int canceled; - - canceled = callout_drain(&lle->la_timer); + &satosin6(L3_ADDR(lle))->sin6_addr, + &pfx->sin6_addr, &msk->sin6_addr) && + ((flags & LLE_STATIC) || + !(lle->la_flags & LLE_STATIC))) { LLE_WLOCK(lle); - if (canceled) + if (callout_stop(&lle->la_timer)) LLE_REMREF(lle); llentry_free(lle); } } } + IF_AFDATA_WUNLOCK(llt->llt_ifp); } static int @@ -2500,15 +2497,20 @@ in6_lltable_lookup(struct lltable *llt, lle->lle_tbl = llt; lle->lle_head = lleh; + lle->la_flags |= LLE_LINKED; LIST_INSERT_HEAD(lleh, lle, lle_next); } else if (flags & LLE_DELETE) { if (!(lle->la_flags & LLE_IFADDR) || (flags & LLE_IFADDR)) { LLE_WLOCK(lle); - lle->la_flags = LLE_DELETED; - LLE_WUNLOCK(lle); + lle->la_flags |= LLE_DELETED; #ifdef DIAGNOSTIC - log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); -#endif + log(LOG_INFO, "ifaddr cache = %p is deleted\n", lle); +#endif + if ((lle->la_flags & + (LLE_STATIC | LLE_IFADDR)) == LLE_STATIC) + llentry_free(lle); + else + LLE_WUNLOCK(lle); } lle = (void *)-1; } From owner-svn-src-stable@FreeBSD.ORG Wed Sep 11 17:42:35 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DE9BECFD; Wed, 11 Sep 2013 17:42:35 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CAE1E2B7F; Wed, 11 Sep 2013 17:42:35 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8BHgZQS014506; Wed, 11 Sep 2013 17:42:35 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8BHgZax014505; Wed, 11 Sep 2013 17:42:35 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201309111742.r8BHgZax014505@svn.freebsd.org> From: Xin LI Date: Wed, 11 Sep 2013 17:42:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255476 - in stable: 8/usr.sbin/mergemaster 9/usr.sbin/mergemaster X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Sep 2013 17:42:36 -0000 Author: delphij Date: Wed Sep 11 17:42:35 2013 New Revision: 255476 URL: http://svnweb.freebsd.org/changeset/base/255476 Log: MFC r255428: Pass -n (do not emit comments) when saving mtree information for future mergemaster(8) runs. Modified: stable/9/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/9/usr.sbin/mergemaster/ (props changed) Changes in other areas also in this revision: Modified: stable/8/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/8/usr.sbin/mergemaster/ (props changed) Modified: stable/9/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/9/usr.sbin/mergemaster/mergemaster.sh Wed Sep 11 17:31:22 2013 (r255475) +++ stable/9/usr.sbin/mergemaster/mergemaster.sh Wed Sep 11 17:42:35 2013 (r255476) @@ -707,7 +707,7 @@ case "${RERUN}" in # Build the mtree database in a temporary location. case "${PRE_WORLD}" in '') MTREENEW=`mktemp -t mergemaster.mtree` - mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null + mtree -nci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null ;; *) # We don't want to mess with the mtree database on a pre-world run or # when re-scanning a previously-built tree. From owner-svn-src-stable@FreeBSD.ORG Wed Sep 11 17:42:36 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3EC53CFE; Wed, 11 Sep 2013 17:42:36 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2A9862B80; Wed, 11 Sep 2013 17:42:36 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8BHgaf6014512; Wed, 11 Sep 2013 17:42:36 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8BHgaIR014511; Wed, 11 Sep 2013 17:42:36 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201309111742.r8BHgaIR014511@svn.freebsd.org> From: Xin LI Date: Wed, 11 Sep 2013 17:42:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255476 - in stable: 8/usr.sbin/mergemaster 9/usr.sbin/mergemaster X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Sep 2013 17:42:36 -0000 Author: delphij Date: Wed Sep 11 17:42:35 2013 New Revision: 255476 URL: http://svnweb.freebsd.org/changeset/base/255476 Log: MFC r255428: Pass -n (do not emit comments) when saving mtree information for future mergemaster(8) runs. Modified: stable/8/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/8/usr.sbin/mergemaster/ (props changed) Changes in other areas also in this revision: Modified: stable/9/usr.sbin/mergemaster/mergemaster.sh Directory Properties: stable/9/usr.sbin/mergemaster/ (props changed) Modified: stable/8/usr.sbin/mergemaster/mergemaster.sh ============================================================================== --- stable/8/usr.sbin/mergemaster/mergemaster.sh Wed Sep 11 17:31:22 2013 (r255475) +++ stable/8/usr.sbin/mergemaster/mergemaster.sh Wed Sep 11 17:42:35 2013 (r255476) @@ -710,7 +710,7 @@ case "${RERUN}" in # Build the mtree database in a temporary location. case "${PRE_WORLD}" in '') MTREENEW=`mktemp -t mergemaster.mtree` - mtree -ci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null + mtree -nci -p ${TEMPROOT} -k size,md5digest > ${MTREENEW} 2>/dev/null ;; *) # We don't want to mess with the mtree database on a pre-world run or # when re-scanning a previously-built tree. From owner-svn-src-stable@FreeBSD.ORG Wed Sep 11 19:20:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 17675C6D; Wed, 11 Sep 2013 19:20:54 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 045F521F8; Wed, 11 Sep 2013 19:20:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8BJKrQ6075163; Wed, 11 Sep 2013 19:20:53 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8BJKrWJ075162; Wed, 11 Sep 2013 19:20:53 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201309111920.r8BJKrWJ075162@svn.freebsd.org> From: Sean Bruno Date: Wed, 11 Sep 2013 19:20:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255479 - stable/9/sys/dev/mfi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Sep 2013 19:20:54 -0000 Author: sbruno Date: Wed Sep 11 19:20:53 2013 New Revision: 255479 URL: http://svnweb.freebsd.org/changeset/base/255479 Log: MFC r254330 -- allow users to run SYS_PD mode JBOD with a non-default MAXPHYS Modified: stable/9/sys/dev/mfi/mfi_syspd.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/mfi/mfi_syspd.c ============================================================================== --- stable/9/sys/dev/mfi/mfi_syspd.c Wed Sep 11 18:22:30 2013 (r255478) +++ stable/9/sys/dev/mfi/mfi_syspd.c Wed Sep 11 19:20:53 2013 (r255479) @@ -126,7 +126,8 @@ mfi_syspd_attach(device_t dev) sectors / (1024 * 1024 / secsize), sectors, sc->pd_id); sc->pd_disk = disk_alloc(); sc->pd_disk->d_drv1 = sc; - sc->pd_disk->d_maxsize = sc->pd_controller->mfi_max_io * secsize; + sc->pd_disk->d_maxsize = min(sc->pd_controller->mfi_max_io * secsize, + (sc->pd_controller->mfi_max_sge - 1) * PAGE_SIZE); sc->pd_disk->d_name = "mfisyspd"; sc->pd_disk->d_open = mfi_syspd_open; sc->pd_disk->d_close = mfi_syspd_close; From owner-svn-src-stable@FreeBSD.ORG Wed Sep 11 21:45:03 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 67188471; Wed, 11 Sep 2013 21:45:03 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 52C072ABF; Wed, 11 Sep 2013 21:45:03 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8BLj3m8064552; Wed, 11 Sep 2013 21:45:03 GMT (envelope-from sbruno@svn.freebsd.org) Received: (from sbruno@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8BLj30O064551; Wed, 11 Sep 2013 21:45:03 GMT (envelope-from sbruno@svn.freebsd.org) Message-Id: <201309112145.r8BLj30O064551@svn.freebsd.org> From: Sean Bruno Date: Wed, 11 Sep 2013 21:45:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255480 - stable/8/sys/dev/mfi X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 11 Sep 2013 21:45:03 -0000 Author: sbruno Date: Wed Sep 11 21:45:02 2013 New Revision: 255480 URL: http://svnweb.freebsd.org/changeset/base/255480 Log: MFC r254330 -- allow users to run SYS_PD mode JBOD with a non-default MAXPHYS Modified: stable/8/sys/dev/mfi/mfi_syspd.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/mfi/ (props changed) Modified: stable/8/sys/dev/mfi/mfi_syspd.c ============================================================================== --- stable/8/sys/dev/mfi/mfi_syspd.c Wed Sep 11 19:20:53 2013 (r255479) +++ stable/8/sys/dev/mfi/mfi_syspd.c Wed Sep 11 21:45:02 2013 (r255480) @@ -126,7 +126,8 @@ mfi_syspd_attach(device_t dev) sectors / (1024 * 1024 / secsize), sectors, sc->pd_id); sc->pd_disk = disk_alloc(); sc->pd_disk->d_drv1 = sc; - sc->pd_disk->d_maxsize = sc->pd_controller->mfi_max_io * secsize; + sc->pd_disk->d_maxsize = min(sc->pd_controller->mfi_max_io * secsize, + (sc->pd_controller->mfi_max_sge - 1) * PAGE_SIZE); sc->pd_disk->d_name = "mfisyspd"; sc->pd_disk->d_open = mfi_syspd_open; sc->pd_disk->d_close = mfi_syspd_close; From owner-svn-src-stable@FreeBSD.ORG Thu Sep 12 00:46:33 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id F33AF71E; Thu, 12 Sep 2013 00:46:32 +0000 (UTC) (envelope-from delphij@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E08D023BD; Thu, 12 Sep 2013 00:46:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8C0kWRR076978; Thu, 12 Sep 2013 00:46:32 GMT (envelope-from delphij@svn.freebsd.org) Received: (from delphij@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8C0kWDe076977; Thu, 12 Sep 2013 00:46:32 GMT (envelope-from delphij@svn.freebsd.org) Message-Id: <201309120046.r8C0kWDe076977@svn.freebsd.org> From: Xin LI Date: Thu, 12 Sep 2013 00:46:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255485 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Sep 2013 00:46:33 -0000 Author: delphij Date: Thu Sep 12 00:46:32 2013 New Revision: 255485 URL: http://svnweb.freebsd.org/changeset/base/255485 Log: MFC r255412: In r243868, the error message buffer errmsg have been changed from an on-stack array to a pointer and therefore sizeof(errmsg) would become 4 or 8 bytes depending on the architecture. Fix this by using ERRMSGL in place of sizeof(). Submitted by: J David Modified: stable/9/sys/kern/vfs_mountroot.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/vfs_mountroot.c ============================================================================== --- stable/9/sys/kern/vfs_mountroot.c Thu Sep 12 00:23:09 2013 (r255484) +++ stable/9/sys/kern/vfs_mountroot.c Thu Sep 12 00:46:32 2013 (r255485) @@ -710,7 +710,7 @@ parse_mount(char **conf) errmsg = malloc(ERRMSGL, M_TEMP, M_WAITOK | M_ZERO); if (vfs_byname(fs) == NULL) { - strlcpy(errmsg, "unknown file system", sizeof(errmsg)); + strlcpy(errmsg, "unknown file system", ERRMSGL); error = ENOENT; goto out; } From owner-svn-src-stable@FreeBSD.ORG Thu Sep 12 19:36:04 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9AB9653F; Thu, 12 Sep 2013 19:36:04 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 85FD720EA; Thu, 12 Sep 2013 19:36:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8CJa4Rl060100; Thu, 12 Sep 2013 19:36:04 GMT (envelope-from mckusick@svn.freebsd.org) Received: (from mckusick@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8CJa4Q6060099; Thu, 12 Sep 2013 19:36:04 GMT (envelope-from mckusick@svn.freebsd.org) Message-Id: <201309121936.r8CJa4Q6060099@svn.freebsd.org> From: Kirk McKusick Date: Thu, 12 Sep 2013 19:36:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255494 - stable/9/sys/ufs/ffs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Sep 2013 19:36:04 -0000 Author: mckusick Date: Thu Sep 12 19:36:04 2013 New Revision: 255494 URL: http://svnweb.freebsd.org/changeset/base/255494 Log: MFC of 254995: A performance problem was reported in PR kern/181226: I have 25TB Dell PERC 6 RAID5 array. When it becomes almost full (10-20GB free), processes which write data to it start eating 100% CPU and write speed drops below 1MB/sec (normally to gives 400MB/sec). The revision at which it first became apparent was http://svnweb.freebsd.org/changeset/base/249782. The offending change reserved an area in each cylinder group to store metadata. The new algorithm attempts to save this area for metadata and allows its use for non-metadata only after all the data areas have been exhausted. The size of the reserved area defaults to half of minfree, so the filesystem reports full before the data area can completely fill. However, in this report, the filesystem has had minfree reduced to 1% thus forcing the metadata area to be used for data. As the filesystem approached full, it had only metadata areas left to allocate. The result was that every block allocation had to scan summary data for 30,000 cylinder groups before falling back to searching up to 30,000 metadata areas. The fix is to give up on saving the metadata areas once the free space reserve drops below 2%. The effect of this change is to use the old algorithm of just accepting the first available block that we find. Since most filesystems use the default 5% minfree, this will have no effect on their operation. For those that want to push to the limit, they will get their crappy block placements quickly. Submitted by: Dmitry Sivachenko Fix Tested by: Dmitry Sivachenko PR: kern/181226 MFC of 254996: In looking at block layouts as part of fixing filesystem block allocations under low free-space conditions (-r254995), determine that old block-preference search order used before -r249782 worked a bit better. This change reverts to that block-preference search order. Modified: stable/9/sys/ufs/ffs/ffs_alloc.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/ufs/ffs/ffs_alloc.c ============================================================================== --- stable/9/sys/ufs/ffs/ffs_alloc.c Thu Sep 12 18:08:25 2013 (r255493) +++ stable/9/sys/ufs/ffs/ffs_alloc.c Thu Sep 12 19:36:04 2013 (r255494) @@ -516,7 +516,13 @@ ffs_reallocblks_ufs1(ap) ip = VTOI(vp); fs = ip->i_fs; ump = ip->i_ump; - if (fs->fs_contigsumsize <= 0) + /* + * If we are not tracking block clusters or if we have less than 2% + * free blocks left, then do not attempt to cluster. Running with + * less than 5% free block reserve is not recommended and those that + * choose to do so do not expect to have good file layout. + */ + if (fs->fs_contigsumsize <= 0 || freespace(fs, 2) < 0) return (ENOSPC); buflist = ap->a_buflist; len = buflist->bs_nchildren; @@ -736,7 +742,13 @@ ffs_reallocblks_ufs2(ap) ip = VTOI(vp); fs = ip->i_fs; ump = ip->i_ump; - if (fs->fs_contigsumsize <= 0) + /* + * If we are not tracking block clusters or if we have less than 2% + * free blocks left, then do not attempt to cluster. Running with + * less than 5% free block reserve is not recommended and those that + * choose to do so do not expect to have good file layout. + */ + if (fs->fs_contigsumsize <= 0 || freespace(fs, 2) < 0) return (ENOSPC); buflist = ap->a_buflist; len = buflist->bs_nchildren; @@ -1173,7 +1185,7 @@ ffs_dirpref(pip) if (fs->fs_contigdirs[cg] < maxcontigdirs) return ((ino_t)(fs->fs_ipg * cg)); } - for (cg = prefcg - 1; cg >= 0; cg--) + for (cg = 0; cg < prefcg; cg++) if (fs->fs_cs(fs, cg).cs_ndir < maxndir && fs->fs_cs(fs, cg).cs_nifree >= minifree && fs->fs_cs(fs, cg).cs_nbfree >= minbfree) { @@ -1186,7 +1198,7 @@ ffs_dirpref(pip) for (cg = prefcg; cg < fs->fs_ncg; cg++) if (fs->fs_cs(fs, cg).cs_nifree >= avgifree) return ((ino_t)(fs->fs_ipg * cg)); - for (cg = prefcg - 1; cg >= 0; cg--) + for (cg = 0; cg < prefcg; cg++) if (fs->fs_cs(fs, cg).cs_nifree >= avgifree) break; return ((ino_t)(fs->fs_ipg * cg)); From owner-svn-src-stable@FreeBSD.ORG Fri Sep 13 00:51:37 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E1E8C949; Fri, 13 Sep 2013 00:51:37 +0000 (UTC) (envelope-from cperciva@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CF1C32AA5; Fri, 13 Sep 2013 00:51:37 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8D0pbDT049664; Fri, 13 Sep 2013 00:51:37 GMT (envelope-from cperciva@svn.freebsd.org) Received: (from cperciva@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8D0pbbP049663; Fri, 13 Sep 2013 00:51:37 GMT (envelope-from cperciva@svn.freebsd.org) Message-Id: <201309130051.r8D0pbbP049663@svn.freebsd.org> From: Colin Percival Date: Fri, 13 Sep 2013 00:51:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255502 - stable/9/share/man/man4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 00:51:38 -0000 Author: cperciva Date: Fri Sep 13 00:51:37 2013 New Revision: 255502 URL: http://svnweb.freebsd.org/changeset/base/255502 Log: MFC r255459: Remove documentation describing functionality which geom(4) does not, in fact, provide. Modified: stable/9/share/man/man4/geom.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/geom.4 ============================================================================== --- stable/9/share/man/man4/geom.4 Thu Sep 12 22:06:12 2013 (r255501) +++ stable/9/share/man/man4/geom.4 Fri Sep 13 00:51:37 2013 (r255502) @@ -34,7 +34,7 @@ .\" .\" $FreeBSD$ .\" -.Dd May 25, 2006 +.Dd September 10, 2013 .Dt GEOM 4 .Os .Sh NAME @@ -319,24 +319,6 @@ only be done with their cooperation. Finally: the spoiling only happens when the write count goes from zero to non-zero and the retasting happens only when the write count goes from non-zero to zero. -.It Em INSERT/DELETE -are very special operations which allow a new geom -to be instantiated between a consumer and a provider attached to -each other and to remove it again. -.Pp -To understand the utility of this, imagine a provider -being mounted as a file system. -Between the DEVFS geom's consumer and its provider we insert -a mirror module which configures itself with one mirror -copy and consequently is transparent to the I/O requests -on the path. -We can now configure yet a mirror copy on the mirror geom, -request a synchronization, and finally drop the first mirror -copy. -We have now, in essence, moved a mounted file system from one -disk to another while it was being used. -At this point the mirror geom can be deleted from the path -again; it has served its purpose. .It Em CONFIGURE is the process where the administrator issues instructions for a particular class to instantiate itself. From owner-svn-src-stable@FreeBSD.ORG Fri Sep 13 06:07:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 95C55470; Fri, 13 Sep 2013 06:07:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 694022935; Fri, 13 Sep 2013 06:07:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8D67QUJ035598; Fri, 13 Sep 2013 06:07:26 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8D67PW7035597; Fri, 13 Sep 2013 06:07:25 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201309130607.r8D67PW7035597@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Sep 2013 06:07:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255507 - stable/9/sys/dev/cpuctl X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 06:07:26 -0000 Author: kib Date: Fri Sep 13 06:07:25 2013 New Revision: 255507 URL: http://svnweb.freebsd.org/changeset/base/255507 Log: MFC r255439: Call free() on the pointer returned from malloc(). Modified: stable/9/sys/dev/cpuctl/cpuctl.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/dev/ (props changed) Modified: stable/9/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/9/sys/dev/cpuctl/cpuctl.c Fri Sep 13 04:04:21 2013 (r255506) +++ stable/9/sys/dev/cpuctl/cpuctl.c Fri Sep 13 06:07:25 2013 (r255507) @@ -295,10 +295,10 @@ cpuctl_do_update(int cpu, cpuctl_update_ static int update_intel(int cpu, cpuctl_update_args_t *args, struct thread *td) { - void *ptr = NULL; + void *ptr; uint64_t rev0, rev1; uint32_t tmp[4]; - int is_bound = 0; + int is_bound; int oldcpu; int ret; @@ -312,10 +312,11 @@ update_intel(int cpu, cpuctl_update_args } /* - * 16 byte alignment required. + * 16 byte alignment required. Rely on the fact that + * malloc(9) always returns the pointer aligned at least on + * the size of the allocation. */ ptr = malloc(args->size + 16, M_CPUCTL, M_WAITOK); - ptr = (void *)(16 + ((intptr_t)ptr & ~0xf)); if (copyin(args->data, ptr, args->size) != 0) { DPRINTF("[cpuctl,%d]: copyin %p->%p of %zd bytes failed", __LINE__, args->data, ptr, args->size); @@ -408,10 +409,10 @@ fail: static int update_via(int cpu, cpuctl_update_args_t *args, struct thread *td) { - void *ptr = NULL; + void *ptr; uint64_t rev0, rev1, res; uint32_t tmp[4]; - int is_bound = 0; + int is_bound; int oldcpu; int ret; @@ -427,8 +428,7 @@ update_via(int cpu, cpuctl_update_args_t /* * 4 byte alignment required. */ - ptr = malloc(args->size + 16, M_CPUCTL, M_WAITOK); - ptr = (void *)(16 + ((intptr_t)ptr & ~0xf)); + ptr = malloc(args->size, M_CPUCTL, M_WAITOK); if (copyin(args->data, ptr, args->size) != 0) { DPRINTF("[cpuctl,%d]: copyin %p->%p of %zd bytes failed", __LINE__, args->data, ptr, args->size); From owner-svn-src-stable@FreeBSD.ORG Fri Sep 13 06:18:34 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1CFA48DA; Fri, 13 Sep 2013 06:18:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E445329C0; Fri, 13 Sep 2013 06:18:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8D6IXPj041906; Fri, 13 Sep 2013 06:18:33 GMT (envelope-from kib@svn.freebsd.org) Received: (from kib@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8D6IXvm041905; Fri, 13 Sep 2013 06:18:33 GMT (envelope-from kib@svn.freebsd.org) Message-Id: <201309130618.r8D6IXvm041905@svn.freebsd.org> From: Konstantin Belousov Date: Fri, 13 Sep 2013 06:18:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255508 - stable/8/sys/dev/cpuctl X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 06:18:34 -0000 Author: kib Date: Fri Sep 13 06:18:33 2013 New Revision: 255508 URL: http://svnweb.freebsd.org/changeset/base/255508 Log: MFC r255439: Call free() on the pointer returned from malloc(). Modified: stable/8/sys/dev/cpuctl/cpuctl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/dev/ (props changed) stable/8/sys/dev/cpuctl/ (props changed) Modified: stable/8/sys/dev/cpuctl/cpuctl.c ============================================================================== --- stable/8/sys/dev/cpuctl/cpuctl.c Fri Sep 13 06:07:25 2013 (r255507) +++ stable/8/sys/dev/cpuctl/cpuctl.c Fri Sep 13 06:18:33 2013 (r255508) @@ -295,10 +295,10 @@ cpuctl_do_update(int cpu, cpuctl_update_ static int update_intel(int cpu, cpuctl_update_args_t *args, struct thread *td) { - void *ptr = NULL; + void *ptr; uint64_t rev0, rev1; uint32_t tmp[4]; - int is_bound = 0; + int is_bound; int oldcpu; int ret; @@ -312,10 +312,11 @@ update_intel(int cpu, cpuctl_update_args } /* - * 16 byte alignment required. + * 16 byte alignment required. Rely on the fact that + * malloc(9) always returns the pointer aligned at least on + * the size of the allocation. */ ptr = malloc(args->size + 16, M_CPUCTL, M_WAITOK); - ptr = (void *)(16 + ((intptr_t)ptr & ~0xf)); if (copyin(args->data, ptr, args->size) != 0) { DPRINTF("[cpuctl,%d]: copyin %p->%p of %zd bytes failed", __LINE__, args->data, ptr, args->size); @@ -408,10 +409,10 @@ fail: static int update_via(int cpu, cpuctl_update_args_t *args, struct thread *td) { - void *ptr = NULL; + void *ptr; uint64_t rev0, rev1, res; uint32_t tmp[4]; - int is_bound = 0; + int is_bound; int oldcpu; int ret; @@ -427,8 +428,7 @@ update_via(int cpu, cpuctl_update_args_t /* * 4 byte alignment required. */ - ptr = malloc(args->size + 16, M_CPUCTL, M_WAITOK); - ptr = (void *)(16 + ((intptr_t)ptr & ~0xf)); + ptr = malloc(args->size, M_CPUCTL, M_WAITOK); if (copyin(args->data, ptr, args->size) != 0) { DPRINTF("[cpuctl,%d]: copyin %p->%p of %zd bytes failed", __LINE__, args->data, ptr, args->size); From owner-svn-src-stable@FreeBSD.ORG Fri Sep 13 11:57:53 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id F220DDD2; Fri, 13 Sep 2013 11:57:52 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id DF0532CBB; Fri, 13 Sep 2013 11:57:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8DBvqaE041692; Fri, 13 Sep 2013 11:57:52 GMT (envelope-from bdrewery@svn.freebsd.org) Received: (from bdrewery@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8DBvq01041691; Fri, 13 Sep 2013 11:57:52 GMT (envelope-from bdrewery@svn.freebsd.org) Message-Id: <201309131157.r8DBvq01041691@svn.freebsd.org> From: Bryan Drewery Date: Fri, 13 Sep 2013 11:57:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255514 - stable/9 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 11:57:53 -0000 Author: bdrewery (ports committer) Date: Fri Sep 13 11:57:52 2013 New Revision: 255514 URL: http://svnweb.freebsd.org/changeset/base/255514 Log: MFC r255048: - Fix LOCAL_MTREE so it properly handles multiple files and quotes its value into submakes PR: conf/179466 Submitted by: Garrett Cooper Sponsored by: EMC / Isilon Storage Division Modified: stable/9/Makefile.inc1 (contents, props changed) Directory Properties: stable/9/ (props changed) Modified: stable/9/Makefile.inc1 ============================================================================== --- stable/9/Makefile.inc1 Fri Sep 13 11:25:42 2013 (r255513) +++ stable/9/Makefile.inc1 Fri Sep 13 11:57:52 2013 (r255514) @@ -270,7 +270,7 @@ WMAKEENV= ${CROSSENV} \ PATH=${TMPPATH} # make hierarchy -HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE} +HMAKE= PATH=${TMPPATH} ${MAKE} LOCAL_MTREE=${LOCAL_MTREE:Q} .if defined(NO_ROOT) HMAKE+= PATH=${TMPPATH} METALOG=${METALOG} -DNO_ROOT .endif @@ -768,7 +768,7 @@ distributeworld installworld: installche cd ${.CURDIR}/etc; ${CROSSENV} PATH=${TMPPATH} ${MAKE} \ METALOG=${METALOG} ${IMAKE_INSTALL} ${IMAKE_MTREE} \ DISTBASE=/base DESTDIR=${DESTDIR}/${DISTDIR}/base \ - LOCAL_MTREE=${LOCAL_MTREE} distrib-dirs + LOCAL_MTREE=${LOCAL_MTREE:Q} distrib-dirs .endif ${_+_}cd ${.CURDIR}; ${IMAKE} re${.TARGET:S/world$//}; \ ${IMAKEENV} rm -rf ${INSTALLTMP} @@ -814,7 +814,7 @@ reinstall: @echo ">>> Making hierarchy" @echo "--------------------------------------------------------------" ${_+_}cd ${.CURDIR}; ${MAKE} -f Makefile.inc1 \ - LOCAL_MTREE=${LOCAL_MTREE} hierarchy + LOCAL_MTREE=${LOCAL_MTREE:Q} hierarchy @echo @echo "--------------------------------------------------------------" @echo ">>> Installing everything" From owner-svn-src-stable@FreeBSD.ORG Fri Sep 13 13:53:22 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 31EB2B37; Fri, 13 Sep 2013 13:53:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1E8592446; Fri, 13 Sep 2013 13:53:22 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8DDrL1b010686; Fri, 13 Sep 2013 13:53:21 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8DDrLeb010685; Fri, 13 Sep 2013 13:53:21 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201309131353.r8DDrLeb010685@svn.freebsd.org> From: Andriy Gapon Date: Fri, 13 Sep 2013 13:53:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255515 - stable/9/sys/cddl/dev/fbt X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 13:53:22 -0000 Author: avg Date: Fri Sep 13 13:53:21 2013 New Revision: 255515 URL: http://svnweb.freebsd.org/changeset/base/255515 Log: MFC r254713: fbt: drop a local write-only variable Modified: stable/9/sys/cddl/dev/fbt/fbt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cddl/dev/fbt/fbt.c ============================================================================== --- stable/9/sys/cddl/dev/fbt/fbt.c Fri Sep 13 11:57:52 2013 (r255514) +++ stable/9/sys/cddl/dev/fbt/fbt.c Fri Sep 13 13:53:21 2013 (r255515) @@ -574,7 +574,6 @@ static int fbt_ctfoff_init(modctl_t *lf, linker_ctf_t *lc) { const Elf_Sym *symp = lc->symtab;; - const char *name; const ctf_header_t *hp = (const ctf_header_t *) lc->ctftab; const uint8_t *ctfdata = lc->ctftab + sizeof(ctf_header_t); int i; @@ -606,11 +605,6 @@ fbt_ctfoff_init(modctl_t *lf, linker_ctf continue; } - if (symp->st_name < lc->strcnt) - name = lc->strtab + symp->st_name; - else - name = "(?)"; - switch (ELF_ST_TYPE(symp->st_info)) { case STT_OBJECT: if (objtoff >= hp->cth_funcoff || From owner-svn-src-stable@FreeBSD.ORG Fri Sep 13 13:53:48 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3975EC64; Fri, 13 Sep 2013 13:53:48 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 261DE244B; Fri, 13 Sep 2013 13:53:48 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8DDrmp3010915; Fri, 13 Sep 2013 13:53:48 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8DDrmdR010914; Fri, 13 Sep 2013 13:53:48 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201309131353.r8DDrmdR010914@svn.freebsd.org> From: Andriy Gapon Date: Fri, 13 Sep 2013 13:53:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255516 - stable/8/sys/cddl/dev/fbt X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 13:53:48 -0000 Author: avg Date: Fri Sep 13 13:53:47 2013 New Revision: 255516 URL: http://svnweb.freebsd.org/changeset/base/255516 Log: MFC r254713: fbt: drop a local write-only variable Modified: stable/8/sys/cddl/dev/fbt/fbt.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) Modified: stable/8/sys/cddl/dev/fbt/fbt.c ============================================================================== --- stable/8/sys/cddl/dev/fbt/fbt.c Fri Sep 13 13:53:21 2013 (r255515) +++ stable/8/sys/cddl/dev/fbt/fbt.c Fri Sep 13 13:53:47 2013 (r255516) @@ -574,7 +574,6 @@ static int fbt_ctfoff_init(modctl_t *lf, linker_ctf_t *lc) { const Elf_Sym *symp = lc->symtab;; - const char *name; const ctf_header_t *hp = (const ctf_header_t *) lc->ctftab; const uint8_t *ctfdata = lc->ctftab + sizeof(ctf_header_t); int i; @@ -606,11 +605,6 @@ fbt_ctfoff_init(modctl_t *lf, linker_ctf continue; } - if (symp->st_name < lc->strcnt) - name = lc->strtab + symp->st_name; - else - name = "(?)"; - switch (ELF_ST_TYPE(symp->st_info)) { case STT_OBJECT: if (objtoff >= hp->cth_funcoff || From owner-svn-src-stable@FreeBSD.ORG Fri Sep 13 14:03:40 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1D42B19B; Fri, 13 Sep 2013 14:03:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 05CC024DE; Fri, 13 Sep 2013 14:03:40 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8DE3dah017097; Fri, 13 Sep 2013 14:03:39 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8DE3ddx017094; Fri, 13 Sep 2013 14:03:39 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201309131403.r8DE3ddx017094@svn.freebsd.org> From: Andriy Gapon Date: Fri, 13 Sep 2013 14:03:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255517 - in stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 14:03:40 -0000 Author: avg Date: Fri Sep 13 14:03:39 2013 New Revision: 255517 URL: http://svnweb.freebsd.org/changeset/base/255517 Log: MFC r254445,254711: zfs: inline and remove zfs_vnode_lock Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Fri Sep 13 13:53:47 2013 (r255516) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Fri Sep 13 14:03:39 2013 (r255517) @@ -153,7 +153,6 @@ extern int zfs_set_version(zfsvfs_t *zfs extern int zfsvfs_create(const char *name, zfsvfs_t **zfvp); extern void zfsvfs_free(zfsvfs_t *zfsvfs); extern int zfs_check_global_label(const char *dsname, const char *hexsl); -extern int zfs_vnode_lock(vnode_t *vp, int flags); #ifdef _KERNEL extern void zfsvfs_update_fromname(const char *oldname, const char *newname); Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Sep 13 13:53:47 2013 (r255516) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Sep 13 14:03:39 2013 (r255517) @@ -1797,17 +1797,6 @@ zfs_statfs(vfs_t *vfsp, struct statfs *s return (0); } -int -zfs_vnode_lock(vnode_t *vp, int flags) -{ - int error; - - ASSERT(vp != NULL); - - error = vn_lock(vp, flags); - return (error); -} - static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp) { @@ -1824,7 +1813,7 @@ zfs_root(vfs_t *vfsp, int flags, vnode_t ZFS_EXIT(zfsvfs); if (error == 0) { - error = zfs_vnode_lock(*vpp, flags); + error = vn_lock(*vpp, flags); if (error == 0) (*vpp)->v_vflag |= VV_ROOT; } @@ -2083,7 +2072,7 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla *vpp = ZTOV(zp); ZFS_EXIT(zfsvfs); if (err == 0) - err = zfs_vnode_lock(*vpp, flags); + err = vn_lock(*vpp, flags); if (err != 0) *vpp = NULL; else @@ -2182,7 +2171,7 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int VN_HOLD(*vpp); } ZFS_EXIT(zfsvfs); - err = zfs_vnode_lock(*vpp, flags); + err = vn_lock(*vpp, flags); if (err != 0) *vpp = NULL; return (err); @@ -2209,7 +2198,7 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, int *vpp = ZTOV(zp); ZFS_EXIT(zfsvfs); - err = zfs_vnode_lock(*vpp, flags | LK_RETRY); + err = vn_lock(*vpp, flags | LK_RETRY); if (err == 0) vnode_create_vobject(*vpp, zp->z_size, curthread); else Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Sep 13 13:53:47 2013 (r255516) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Sep 13 14:03:39 2013 (r255517) @@ -1520,7 +1520,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode VOP_UNLOCK(dvp, 0); } ZFS_EXIT(zfsvfs); - error = zfs_vnode_lock(*vpp, cnp->cn_lkflags); + error = vn_lock(*vpp, cnp->cn_lkflags); if (cnp->cn_flags & ISDOTDOT) vn_lock(dvp, ltype | LK_RETRY); if (error != 0) { From owner-svn-src-stable@FreeBSD.ORG Fri Sep 13 14:07:33 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 4AA3E306; Fri, 13 Sep 2013 14:07:33 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 35FB724FE; Fri, 13 Sep 2013 14:07:33 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8DE7X31018448; Fri, 13 Sep 2013 14:07:33 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8DE7Wnv018442; Fri, 13 Sep 2013 14:07:32 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201309131407.r8DE7Wnv018442@svn.freebsd.org> From: Andriy Gapon Date: Fri, 13 Sep 2013 14:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255518 - in stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 14:07:33 -0000 Author: avg Date: Fri Sep 13 14:07:32 2013 New Revision: 255518 URL: http://svnweb.freebsd.org/changeset/base/255518 Log: MFC r254445,254711: zfs: inline and remove zfs_vnode_lock Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Fri Sep 13 14:03:39 2013 (r255517) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h Fri Sep 13 14:07:32 2013 (r255518) @@ -153,7 +153,6 @@ extern int zfs_set_version(zfsvfs_t *zfs extern int zfsvfs_create(const char *name, zfsvfs_t **zfvp); extern void zfsvfs_free(zfsvfs_t *zfsvfs); extern int zfs_check_global_label(const char *dsname, const char *hexsl); -extern int zfs_vnode_lock(vnode_t *vp, int flags); #ifdef _KERNEL extern void zfsvfs_update_fromname(const char *oldname, const char *newname); Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Sep 13 14:03:39 2013 (r255517) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Fri Sep 13 14:07:32 2013 (r255518) @@ -1793,17 +1793,6 @@ zfs_statfs(vfs_t *vfsp, struct statfs *s return (0); } -int -zfs_vnode_lock(vnode_t *vp, int flags) -{ - int error; - - ASSERT(vp != NULL); - - error = vn_lock(vp, flags); - return (error); -} - static int zfs_root(vfs_t *vfsp, int flags, vnode_t **vpp) { @@ -1820,7 +1809,7 @@ zfs_root(vfs_t *vfsp, int flags, vnode_t ZFS_EXIT(zfsvfs); if (error == 0) { - error = zfs_vnode_lock(*vpp, flags); + error = vn_lock(*vpp, flags); if (error == 0) (*vpp)->v_vflag |= VV_ROOT; } @@ -2079,7 +2068,7 @@ zfs_vget(vfs_t *vfsp, ino_t ino, int fla *vpp = ZTOV(zp); ZFS_EXIT(zfsvfs); if (err == 0) - err = zfs_vnode_lock(*vpp, flags); + err = vn_lock(*vpp, flags); if (err != 0) *vpp = NULL; return (err); @@ -2176,7 +2165,7 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vno VN_HOLD(*vpp); } ZFS_EXIT(zfsvfs); - err = zfs_vnode_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); + err = vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); if (err != 0) *vpp = NULL; return (err); @@ -2203,7 +2192,7 @@ zfs_fhtovp(vfs_t *vfsp, fid_t *fidp, vno *vpp = ZTOV(zp); ZFS_EXIT(zfsvfs); - err = zfs_vnode_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); + err = vn_lock(*vpp, LK_EXCLUSIVE | LK_RETRY); if (err == 0) vnode_create_vobject(*vpp, zp->z_size, curthread); else Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Sep 13 14:03:39 2013 (r255517) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c Fri Sep 13 14:07:32 2013 (r255518) @@ -1509,7 +1509,7 @@ zfs_lookup(vnode_t *dvp, char *nm, vnode VOP_UNLOCK(dvp, 0); } ZFS_EXIT(zfsvfs); - error = zfs_vnode_lock(*vpp, cnp->cn_lkflags); + error = vn_lock(*vpp, cnp->cn_lkflags); if (cnp->cn_flags & ISDOTDOT) vn_lock(dvp, ltype | LK_RETRY); if (error != 0) { From owner-svn-src-stable@FreeBSD.ORG Fri Sep 13 14:15:38 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C279F5E2; Fri, 13 Sep 2013 14:15:38 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AD5C0256E; Fri, 13 Sep 2013 14:15:38 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8DEFcio023978; Fri, 13 Sep 2013 14:15:38 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8DEFccp023977; Fri, 13 Sep 2013 14:15:38 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201309131415.r8DEFccp023977@svn.freebsd.org> From: Andriy Gapon Date: Fri, 13 Sep 2013 14:15:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255519 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 14:15:38 -0000 Author: avg Date: Fri Sep 13 14:15:38 2013 New Revision: 255519 URL: http://svnweb.freebsd.org/changeset/base/255519 Log: MFC r254714: zfs: do not reject any operations on a pool just because it's a boot pool Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Sep 13 14:07:32 2013 (r255518) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Sep 13 14:15:38 2013 (r255519) @@ -1828,6 +1828,7 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc) (void) nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_SPARES, &spares, &nspares); +#ifdef illumos /* * A root pool with concatenated devices is not supported. * Thus, can not add a device to a root pool. @@ -1843,6 +1844,7 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc) spa_close(spa, FTAG); return (SET_ERROR(EDOM)); } +#endif /* illumos */ if (error == 0) { error = spa_vdev_add(spa, config); From owner-svn-src-stable@FreeBSD.ORG Fri Sep 13 14:15:52 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E9AD370F; Fri, 13 Sep 2013 14:15:52 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D694B2571; Fri, 13 Sep 2013 14:15:52 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8DEFqEc024119; Fri, 13 Sep 2013 14:15:52 GMT (envelope-from avg@svn.freebsd.org) Received: (from avg@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8DEFqC5024118; Fri, 13 Sep 2013 14:15:52 GMT (envelope-from avg@svn.freebsd.org) Message-Id: <201309131415.r8DEFqC5024118@svn.freebsd.org> From: Andriy Gapon Date: Fri, 13 Sep 2013 14:15:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org Subject: svn commit: r255520 - stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 14:15:53 -0000 Author: avg Date: Fri Sep 13 14:15:52 2013 New Revision: 255520 URL: http://svnweb.freebsd.org/changeset/base/255520 Log: MFC r254714: zfs: do not reject any operations on a pool just because it's a boot pool Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/cddl/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Sep 13 14:15:38 2013 (r255519) +++ stable/8/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Fri Sep 13 14:15:52 2013 (r255520) @@ -1828,6 +1828,7 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc) (void) nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_SPARES, &spares, &nspares); +#ifdef illumos /* * A root pool with concatenated devices is not supported. * Thus, can not add a device to a root pool. @@ -1843,6 +1844,7 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc) spa_close(spa, FTAG); return (SET_ERROR(EDOM)); } +#endif /* illumos */ if (error == 0) { error = spa_vdev_add(spa, config); From owner-svn-src-stable@FreeBSD.ORG Fri Sep 13 20:56:42 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id CD838B09; Fri, 13 Sep 2013 20:56:42 +0000 (UTC) (envelope-from jilles@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B9187215B; Fri, 13 Sep 2013 20:56:42 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8DKugMG062402; Fri, 13 Sep 2013 20:56:42 GMT (envelope-from jilles@svn.freebsd.org) Received: (from jilles@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8DKugOM062401; Fri, 13 Sep 2013 20:56:42 GMT (envelope-from jilles@svn.freebsd.org) Message-Id: <201309132056.r8DKugOM062401@svn.freebsd.org> From: Jilles Tjoelker Date: Fri, 13 Sep 2013 20:56:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255529 - stable/9/usr.sbin/watch X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 20:56:42 -0000 Author: jilles Date: Fri Sep 13 20:56:42 2013 New Revision: 255529 URL: http://svnweb.freebsd.org/changeset/base/255529 Log: MFC r255261: watch: Do not mess up the tty modes on early error. Record the initial state earlier, so it is always safe to restore it. One way this happens is if watch(8) is started by a user that does not have access to /dev/snp. The result is "staircase effect" during later commands. PR: bin/153052 Modified: stable/9/usr.sbin/watch/watch.c Directory Properties: stable/9/usr.sbin/watch/ (props changed) Modified: stable/9/usr.sbin/watch/watch.c ============================================================================== --- stable/9/usr.sbin/watch/watch.c Fri Sep 13 19:55:40 2013 (r255528) +++ stable/9/usr.sbin/watch/watch.c Fri Sep 13 20:56:42 2013 (r255529) @@ -110,7 +110,6 @@ set_tty(void) { struct termios ntty; - tcgetattr(std_in, &otty); ntty = otty; ntty.c_lflag &= ~ICANON; /* disable canonical operation */ ntty.c_lflag &= ~ECHO; @@ -324,6 +323,8 @@ main(int ac, char *av[]) usage(); } + tcgetattr(std_in, &otty); + if (modfind("snp") == -1) if (kldload("snp") == -1 || modfind("snp") == -1) warn("snp module not available"); From owner-svn-src-stable@FreeBSD.ORG Fri Sep 13 23:10:54 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C96C7671; Fri, 13 Sep 2013 23:10:54 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A71F52FED; Fri, 13 Sep 2013 23:10:54 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8DNAs8u044549; Fri, 13 Sep 2013 23:10:54 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8DNArPb044542; Fri, 13 Sep 2013 23:10:53 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201309132310.r8DNArPb044542@svn.freebsd.org> From: Rick Macklem Date: Fri, 13 Sep 2013 23:10:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255532 - in stable/9/sys/fs: nfs nfsserver X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 13 Sep 2013 23:10:55 -0000 Author: rmacklem Date: Fri Sep 13 23:10:53 2013 New Revision: 255532 URL: http://svnweb.freebsd.org/changeset/base/255532 Log: MFC: r254337 Fix several performance related issues in the new NFS server's DRC for NFS over TCP. - Increase the size of the hash tables. - Create a separate mutex for each hash list of the TCP hash table. - Single thread the code that deletes stale cache entries. - Add a tunable called vfs.nfsd.tcphighwater, which can be increased to allow the cache to grow larger, avoiding the overhead of frequent scans to delete stale cache entries. (The default value will result in frequent scans to delete stale cache entries, analagous to what the pre-patched code does.) - Add a tunable called vfs.nfsd.cachetcp that can be used to disable DRC caching for NFS over TCP, since the old NFS server didn't DRC cache TCP. It also adjusts the size of nfsrc_floodlevel dynamically, so that it is always greater than vfs.nfsd.tcphighwater. For UDP the algorithm remains the same as the pre-patched code, but the tunable vfs.nfsd.udphighwater can be used to allow the cache to grow larger and reduce the overhead caused by frequent scans for stale entries. UDP also uses a larger hash table size than the pre-patched code. Modified: stable/9/sys/fs/nfs/nfsport.h stable/9/sys/fs/nfs/nfsrvcache.h stable/9/sys/fs/nfsserver/nfs_nfsdcache.c stable/9/sys/fs/nfsserver/nfs_nfsdport.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfs/nfsport.h ============================================================================== --- stable/9/sys/fs/nfs/nfsport.h Fri Sep 13 21:23:04 2013 (r255531) +++ stable/9/sys/fs/nfs/nfsport.h Fri Sep 13 23:10:53 2013 (r255532) @@ -541,11 +541,6 @@ void nfsrvd_rcv(struct socket *, void *, #define NFSREQSPINLOCK extern struct mtx nfs_req_mutex #define NFSLOCKREQ() mtx_lock(&nfs_req_mutex) #define NFSUNLOCKREQ() mtx_unlock(&nfs_req_mutex) -#define NFSCACHEMUTEX extern struct mtx nfs_cache_mutex -#define NFSCACHEMUTEXPTR (&nfs_cache_mutex) -#define NFSLOCKCACHE() mtx_lock(&nfs_cache_mutex) -#define NFSUNLOCKCACHE() mtx_unlock(&nfs_cache_mutex) -#define NFSCACHELOCKREQUIRED() mtx_assert(&nfs_cache_mutex, MA_OWNED) #define NFSSOCKMUTEX extern struct mtx nfs_slock_mutex #define NFSSOCKMUTEXPTR (&nfs_slock_mutex) #define NFSLOCKSOCK() mtx_lock(&nfs_slock_mutex) Modified: stable/9/sys/fs/nfs/nfsrvcache.h ============================================================================== --- stable/9/sys/fs/nfs/nfsrvcache.h Fri Sep 13 21:23:04 2013 (r255531) +++ stable/9/sys/fs/nfs/nfsrvcache.h Fri Sep 13 23:10:53 2013 (r255532) @@ -41,8 +41,9 @@ #define NFSRVCACHE_MAX_SIZE 2048 #define NFSRVCACHE_MIN_SIZE 64 -#define NFSRVCACHE_HASHSIZE 20 +#define NFSRVCACHE_HASHSIZE 500 +/* Cache table entry. */ struct nfsrvcache { LIST_ENTRY(nfsrvcache) rc_hash; /* Hash chain */ TAILQ_ENTRY(nfsrvcache) rc_lru; /* UDP lru chain */ @@ -104,4 +105,11 @@ struct nfsrvcache { LIST_HEAD(nfsrvhashhead, nfsrvcache); +/* The fine-grained locked cache hash table for TCP. */ +struct nfsrchash_bucket { + struct mtx mtx; + char lock_name[16]; + struct nfsrvhashhead tbl; +}; + #endif /* _NFS_NFSRVCACHE_H_ */ Modified: stable/9/sys/fs/nfsserver/nfs_nfsdcache.c ============================================================================== --- stable/9/sys/fs/nfsserver/nfs_nfsdcache.c Fri Sep 13 21:23:04 2013 (r255531) +++ stable/9/sys/fs/nfsserver/nfs_nfsdcache.c Fri Sep 13 23:10:53 2013 (r255532) @@ -160,15 +160,51 @@ __FBSDID("$FreeBSD$"); #include extern struct nfsstats newnfsstats; -NFSCACHEMUTEX; +extern struct mtx nfsrc_udpmtx; +extern struct nfsrchash_bucket nfsrchash_table[NFSRVCACHE_HASHSIZE]; int nfsrc_floodlevel = NFSRVCACHE_FLOODLEVEL, nfsrc_tcpsavedreplies = 0; #endif /* !APPLEKEXT */ -static int nfsrc_tcpnonidempotent = 1; -static int nfsrc_udphighwater = NFSRVCACHE_UDPHIGHWATER, nfsrc_udpcachesize = 0; +SYSCTL_DECL(_vfs_nfsd); + +static u_int nfsrc_tcphighwater = 0; +static int +sysctl_tcphighwater(SYSCTL_HANDLER_ARGS) +{ + int error, newhighwater; + + newhighwater = nfsrc_tcphighwater; + error = sysctl_handle_int(oidp, &newhighwater, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (newhighwater < 0) + return (EINVAL); + if (newhighwater >= nfsrc_floodlevel) + nfsrc_floodlevel = newhighwater + newhighwater / 5; + nfsrc_tcphighwater = newhighwater; + return (0); +} +SYSCTL_PROC(_vfs_nfsd, OID_AUTO, tcphighwater, CTLTYPE_UINT | CTLFLAG_RW, 0, + sizeof(nfsrc_tcphighwater), sysctl_tcphighwater, "IU", + "High water mark for TCP cache entries"); + +static u_int nfsrc_udphighwater = NFSRVCACHE_UDPHIGHWATER; +SYSCTL_UINT(_vfs_nfsd, OID_AUTO, udphighwater, CTLFLAG_RW, + &nfsrc_udphighwater, 0, + "High water mark for UDP cache entries"); +static u_int nfsrc_tcptimeout = NFSRVCACHE_TCPTIMEOUT; +SYSCTL_UINT(_vfs_nfsd, OID_AUTO, tcpcachetimeo, CTLFLAG_RW, + &nfsrc_tcptimeout, 0, + "Timeout for TCP entries in the DRC"); +static u_int nfsrc_tcpnonidempotent = 1; +SYSCTL_UINT(_vfs_nfsd, OID_AUTO, cachetcp, CTLFLAG_RW, + &nfsrc_tcpnonidempotent, 0, + "Enable the DRC for NFS over TCP"); + +static int nfsrc_udpcachesize = 0; static TAILQ_HEAD(, nfsrvcache) nfsrvudplru; -static struct nfsrvhashhead nfsrvhashtbl[NFSRVCACHE_HASHSIZE], - nfsrvudphashtbl[NFSRVCACHE_HASHSIZE]; +static struct nfsrvhashhead nfsrvudphashtbl[NFSRVCACHE_HASHSIZE]; + /* * and the reverse mapping from generic to Version 2 procedure numbers */ @@ -197,10 +233,11 @@ static int newnfsv2_procid[NFS_V3NPROCS] NFSV2PROC_NOOP, }; +#define nfsrc_hash(xid) (((xid) + ((xid) >> 24)) % NFSRVCACHE_HASHSIZE) #define NFSRCUDPHASH(xid) \ - (&nfsrvudphashtbl[((xid) + ((xid) >> 24)) % NFSRVCACHE_HASHSIZE]) + (&nfsrvudphashtbl[nfsrc_hash(xid)]) #define NFSRCHASH(xid) \ - (&nfsrvhashtbl[((xid) + ((xid) >> 24)) % NFSRVCACHE_HASHSIZE]) + (&nfsrchash_table[nfsrc_hash(xid)].tbl) #define TRUE 1 #define FALSE 0 #define NFSRVCACHE_CHECKLEN 100 @@ -251,6 +288,18 @@ static int nfsrc_getlenandcksum(mbuf_t m static void nfsrc_marksametcpconn(u_int64_t); /* + * Return the correct mutex for this cache entry. + */ +static __inline struct mtx * +nfsrc_cachemutex(struct nfsrvcache *rp) +{ + + if ((rp->rc_flag & RC_UDP) != 0) + return (&nfsrc_udpmtx); + return (&nfsrchash_table[nfsrc_hash(rp->rc_xid)].mtx); +} + +/* * Initialize the server request cache list */ APPLESTATIC void @@ -264,7 +313,7 @@ nfsrvd_initcache(void) inited = 1; for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { LIST_INIT(&nfsrvudphashtbl[i]); - LIST_INIT(&nfsrvhashtbl[i]); + LIST_INIT(&nfsrchash_table[i].tbl); } TAILQ_INIT(&nfsrvudplru); nfsrc_tcpsavedreplies = 0; @@ -325,10 +374,12 @@ nfsrc_getudp(struct nfsrv_descript *nd, struct sockaddr_in6 *saddr6; struct nfsrvhashhead *hp; int ret = 0; + struct mtx *mutex; + mutex = nfsrc_cachemutex(newrp); hp = NFSRCUDPHASH(newrp->rc_xid); loop: - NFSLOCKCACHE(); + mtx_lock(mutex); LIST_FOREACH(rp, hp, rc_hash) { if (newrp->rc_xid == rp->rc_xid && newrp->rc_proc == rp->rc_proc && @@ -336,8 +387,8 @@ loop: nfsaddr_match(NETFAMILY(rp), &rp->rc_haddr, nd->nd_nam)) { if ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - (void)mtx_sleep(rp, NFSCACHEMUTEXPTR, - (PZERO - 1) | PDROP, "nfsrc", 10 * hz); + (void)mtx_sleep(rp, mutex, (PZERO - 1) | PDROP, + "nfsrc", 10 * hz); goto loop; } if (rp->rc_flag == 0) @@ -347,14 +398,14 @@ loop: TAILQ_INSERT_TAIL(&nfsrvudplru, rp, rc_lru); if (rp->rc_flag & RC_INPROG) { newnfsstats.srvcache_inproghits++; - NFSUNLOCKCACHE(); + mtx_unlock(mutex); ret = RC_DROPIT; } else if (rp->rc_flag & RC_REPSTATUS) { /* * V2 only. */ newnfsstats.srvcache_nonidemdonehits++; - NFSUNLOCKCACHE(); + mtx_unlock(mutex); nfsrvd_rephead(nd); *(nd->nd_errp) = rp->rc_status; ret = RC_REPLY; @@ -362,7 +413,7 @@ loop: NFSRVCACHE_UDPTIMEOUT; } else if (rp->rc_flag & RC_REPMBUF) { newnfsstats.srvcache_nonidemdonehits++; - NFSUNLOCKCACHE(); + mtx_unlock(mutex); nd->nd_mreq = m_copym(rp->rc_reply, 0, M_COPYALL, M_WAIT); ret = RC_REPLY; @@ -377,7 +428,7 @@ loop: } } newnfsstats.srvcache_misses++; - newnfsstats.srvcache_size++; + atomic_add_int(&newnfsstats.srvcache_size, 1); nfsrc_udpcachesize++; newrp->rc_flag |= RC_INPROG; @@ -392,7 +443,7 @@ loop: } LIST_INSERT_HEAD(hp, newrp, rc_hash); TAILQ_INSERT_TAIL(&nfsrvudplru, newrp, rc_lru); - NFSUNLOCKCACHE(); + mtx_unlock(mutex); nd->nd_rp = newrp; ret = RC_DOIT; @@ -410,12 +461,14 @@ nfsrvd_updatecache(struct nfsrv_descript struct nfsrvcache *rp; struct nfsrvcache *retrp = NULL; mbuf_t m; + struct mtx *mutex; rp = nd->nd_rp; if (!rp) panic("nfsrvd_updatecache null rp"); nd->nd_rp = NULL; - NFSLOCKCACHE(); + mutex = nfsrc_cachemutex(rp); + mtx_lock(mutex); nfsrc_lock(rp); if (!(rp->rc_flag & RC_INPROG)) panic("nfsrvd_updatecache not inprog"); @@ -430,7 +483,7 @@ nfsrvd_updatecache(struct nfsrv_descript */ if (nd->nd_repstat == NFSERR_REPLYFROMCACHE) { newnfsstats.srvcache_nonidemdonehits++; - NFSUNLOCKCACHE(); + mtx_unlock(mutex); nd->nd_repstat = 0; if (nd->nd_mreq) mbuf_freem(nd->nd_mreq); @@ -438,7 +491,7 @@ nfsrvd_updatecache(struct nfsrv_descript panic("reply from cache"); nd->nd_mreq = m_copym(rp->rc_reply, 0, M_COPYALL, M_WAIT); - rp->rc_timestamp = NFSD_MONOSEC + NFSRVCACHE_TCPTIMEOUT; + rp->rc_timestamp = NFSD_MONOSEC + nfsrc_tcptimeout; nfsrc_unlock(rp); goto out; } @@ -463,29 +516,28 @@ nfsrvd_updatecache(struct nfsrv_descript nfsv2_repstat[newnfsv2_procid[nd->nd_procnum]]) { rp->rc_status = nd->nd_repstat; rp->rc_flag |= RC_REPSTATUS; - NFSUNLOCKCACHE(); + mtx_unlock(mutex); } else { if (!(rp->rc_flag & RC_UDP)) { - nfsrc_tcpsavedreplies++; + atomic_add_int(&nfsrc_tcpsavedreplies, 1); if (nfsrc_tcpsavedreplies > newnfsstats.srvcache_tcppeak) newnfsstats.srvcache_tcppeak = nfsrc_tcpsavedreplies; } - NFSUNLOCKCACHE(); + mtx_unlock(mutex); m = m_copym(nd->nd_mreq, 0, M_COPYALL, M_WAIT); - NFSLOCKCACHE(); + mtx_lock(mutex); rp->rc_reply = m; rp->rc_flag |= RC_REPMBUF; - NFSUNLOCKCACHE(); + mtx_unlock(mutex); } if (rp->rc_flag & RC_UDP) { rp->rc_timestamp = NFSD_MONOSEC + NFSRVCACHE_UDPTIMEOUT; nfsrc_unlock(rp); } else { - rp->rc_timestamp = NFSD_MONOSEC + - NFSRVCACHE_TCPTIMEOUT; + rp->rc_timestamp = NFSD_MONOSEC + nfsrc_tcptimeout; if (rp->rc_refcnt > 0) nfsrc_unlock(rp); else @@ -493,7 +545,7 @@ nfsrvd_updatecache(struct nfsrv_descript } } else { nfsrc_freecache(rp); - NFSUNLOCKCACHE(); + mtx_unlock(mutex); } out: @@ -509,14 +561,16 @@ out: APPLESTATIC void nfsrvd_delcache(struct nfsrvcache *rp) { + struct mtx *mutex; + mutex = nfsrc_cachemutex(rp); if (!(rp->rc_flag & RC_INPROG)) panic("nfsrvd_delcache not in prog"); - NFSLOCKCACHE(); + mtx_lock(mutex); rp->rc_flag &= ~RC_INPROG; if (rp->rc_refcnt == 0 && !(rp->rc_flag & RC_LOCKED)) nfsrc_freecache(rp); - NFSUNLOCKCACHE(); + mtx_unlock(mutex); } /* @@ -528,7 +582,9 @@ APPLESTATIC void nfsrvd_sentcache(struct nfsrvcache *rp, struct socket *so, int err) { tcp_seq tmp_seq; + struct mtx *mutex; + mutex = nfsrc_cachemutex(rp); if (!(rp->rc_flag & RC_LOCKED)) panic("nfsrvd_sentcache not locked"); if (!err) { @@ -537,10 +593,10 @@ nfsrvd_sentcache(struct nfsrvcache *rp, so->so_proto->pr_protocol != IPPROTO_TCP) panic("nfs sent cache"); if (nfsrv_getsockseqnum(so, &tmp_seq)) { - NFSLOCKCACHE(); + mtx_lock(mutex); rp->rc_tcpseq = tmp_seq; rp->rc_flag |= RC_TCPSEQ; - NFSUNLOCKCACHE(); + mtx_unlock(mutex); } } nfsrc_unlock(rp); @@ -559,11 +615,13 @@ nfsrc_gettcp(struct nfsrv_descript *nd, struct nfsrvcache *hitrp; struct nfsrvhashhead *hp, nfsrc_templist; int hit, ret = 0; + struct mtx *mutex; + mutex = nfsrc_cachemutex(newrp); hp = NFSRCHASH(newrp->rc_xid); newrp->rc_reqlen = nfsrc_getlenandcksum(nd->nd_mrep, &newrp->rc_cksum); tryagain: - NFSLOCKCACHE(); + mtx_lock(mutex); hit = 1; LIST_INIT(&nfsrc_templist); /* @@ -621,8 +679,8 @@ tryagain: rp = hitrp; if ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - (void)mtx_sleep(rp, NFSCACHEMUTEXPTR, - (PZERO - 1) | PDROP, "nfsrc", 10 * hz); + (void)mtx_sleep(rp, mutex, (PZERO - 1) | PDROP, + "nfsrc", 10 * hz); goto tryagain; } if (rp->rc_flag == 0) @@ -630,7 +688,7 @@ tryagain: rp->rc_flag |= RC_LOCKED; if (rp->rc_flag & RC_INPROG) { newnfsstats.srvcache_inproghits++; - NFSUNLOCKCACHE(); + mtx_unlock(mutex); if (newrp->rc_sockref == rp->rc_sockref) nfsrc_marksametcpconn(rp->rc_sockref); ret = RC_DROPIT; @@ -639,24 +697,22 @@ tryagain: * V2 only. */ newnfsstats.srvcache_nonidemdonehits++; - NFSUNLOCKCACHE(); + mtx_unlock(mutex); if (newrp->rc_sockref == rp->rc_sockref) nfsrc_marksametcpconn(rp->rc_sockref); ret = RC_REPLY; nfsrvd_rephead(nd); *(nd->nd_errp) = rp->rc_status; - rp->rc_timestamp = NFSD_MONOSEC + - NFSRVCACHE_TCPTIMEOUT; + rp->rc_timestamp = NFSD_MONOSEC + nfsrc_tcptimeout; } else if (rp->rc_flag & RC_REPMBUF) { newnfsstats.srvcache_nonidemdonehits++; - NFSUNLOCKCACHE(); + mtx_unlock(mutex); if (newrp->rc_sockref == rp->rc_sockref) nfsrc_marksametcpconn(rp->rc_sockref); ret = RC_REPLY; nd->nd_mreq = m_copym(rp->rc_reply, 0, M_COPYALL, M_WAIT); - rp->rc_timestamp = NFSD_MONOSEC + - NFSRVCACHE_TCPTIMEOUT; + rp->rc_timestamp = NFSD_MONOSEC + nfsrc_tcptimeout; } else { panic("nfs tcp cache1"); } @@ -665,7 +721,7 @@ tryagain: goto out; } newnfsstats.srvcache_misses++; - newnfsstats.srvcache_size++; + atomic_add_int(&newnfsstats.srvcache_size, 1); /* * For TCP, multiple entries for a key are allowed, so don't @@ -674,7 +730,7 @@ tryagain: newrp->rc_cachetime = NFSD_MONOSEC; newrp->rc_flag |= RC_INPROG; LIST_INSERT_HEAD(hp, newrp, rc_hash); - NFSUNLOCKCACHE(); + mtx_unlock(mutex); nd->nd_rp = newrp; ret = RC_DOIT; @@ -685,16 +741,17 @@ out: /* * Lock a cache entry. - * Also puts a mutex lock on the cache list. */ static void nfsrc_lock(struct nfsrvcache *rp) { - NFSCACHELOCKREQUIRED(); + struct mtx *mutex; + + mutex = nfsrc_cachemutex(rp); + mtx_assert(mutex, MA_OWNED); while ((rp->rc_flag & RC_LOCKED) != 0) { rp->rc_flag |= RC_WANTED; - (void)mtx_sleep(rp, NFSCACHEMUTEXPTR, PZERO - 1, - "nfsrc", 0); + (void)mtx_sleep(rp, mutex, PZERO - 1, "nfsrc", 0); } rp->rc_flag |= RC_LOCKED; } @@ -705,11 +762,13 @@ nfsrc_lock(struct nfsrvcache *rp) static void nfsrc_unlock(struct nfsrvcache *rp) { + struct mtx *mutex; - NFSLOCKCACHE(); + mutex = nfsrc_cachemutex(rp); + mtx_lock(mutex); rp->rc_flag &= ~RC_LOCKED; nfsrc_wanted(rp); - NFSUNLOCKCACHE(); + mtx_unlock(mutex); } /* @@ -732,7 +791,6 @@ static void nfsrc_freecache(struct nfsrvcache *rp) { - NFSCACHELOCKREQUIRED(); LIST_REMOVE(rp, rc_hash); if (rp->rc_flag & RC_UDP) { TAILQ_REMOVE(&nfsrvudplru, rp, rc_lru); @@ -742,10 +800,10 @@ nfsrc_freecache(struct nfsrvcache *rp) if (rp->rc_flag & RC_REPMBUF) { mbuf_freem(rp->rc_reply); if (!(rp->rc_flag & RC_UDP)) - nfsrc_tcpsavedreplies--; + atomic_add_int(&nfsrc_tcpsavedreplies, -1); } FREE((caddr_t)rp, M_NFSRVCACHE); - newnfsstats.srvcache_size--; + atomic_add_int(&newnfsstats.srvcache_size, -1); } /* @@ -757,20 +815,21 @@ nfsrvd_cleancache(void) struct nfsrvcache *rp, *nextrp; int i; - NFSLOCKCACHE(); for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { - LIST_FOREACH_SAFE(rp, &nfsrvhashtbl[i], rc_hash, nextrp) { + mtx_lock(&nfsrchash_table[i].mtx); + LIST_FOREACH_SAFE(rp, &nfsrchash_table[i].tbl, rc_hash, nextrp) nfsrc_freecache(rp); - } + mtx_unlock(&nfsrchash_table[i].mtx); } + mtx_lock(&nfsrc_udpmtx); for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { LIST_FOREACH_SAFE(rp, &nfsrvudphashtbl[i], rc_hash, nextrp) { nfsrc_freecache(rp); } } newnfsstats.srvcache_size = 0; + mtx_unlock(&nfsrc_udpmtx); nfsrc_tcpsavedreplies = 0; - NFSUNLOCKCACHE(); } /* @@ -780,28 +839,97 @@ static void nfsrc_trimcache(u_int64_t sockref, struct socket *so) { struct nfsrvcache *rp, *nextrp; - int i; + int i, j, k, time_histo[10]; + time_t thisstamp; + static time_t udp_lasttrim = 0, tcp_lasttrim = 0; + static int onethread = 0; - NFSLOCKCACHE(); - TAILQ_FOREACH_SAFE(rp, &nfsrvudplru, rc_lru, nextrp) { - if (!(rp->rc_flag & (RC_INPROG|RC_LOCKED|RC_WANTED)) - && rp->rc_refcnt == 0 - && ((rp->rc_flag & RC_REFCNT) || - NFSD_MONOSEC > rp->rc_timestamp || - nfsrc_udpcachesize > nfsrc_udphighwater)) - nfsrc_freecache(rp); - } - for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { - LIST_FOREACH_SAFE(rp, &nfsrvhashtbl[i], rc_hash, nextrp) { + if (atomic_cmpset_acq_int(&onethread, 0, 1) == 0) + return; + if (NFSD_MONOSEC != udp_lasttrim || + nfsrc_udpcachesize >= (nfsrc_udphighwater + + nfsrc_udphighwater / 2)) { + mtx_lock(&nfsrc_udpmtx); + udp_lasttrim = NFSD_MONOSEC; + TAILQ_FOREACH_SAFE(rp, &nfsrvudplru, rc_lru, nextrp) { if (!(rp->rc_flag & (RC_INPROG|RC_LOCKED|RC_WANTED)) && rp->rc_refcnt == 0 && ((rp->rc_flag & RC_REFCNT) || - NFSD_MONOSEC > rp->rc_timestamp || - nfsrc_activesocket(rp, sockref, so))) + udp_lasttrim > rp->rc_timestamp || + nfsrc_udpcachesize > nfsrc_udphighwater)) nfsrc_freecache(rp); } + mtx_unlock(&nfsrc_udpmtx); + } + if (NFSD_MONOSEC != tcp_lasttrim || + nfsrc_tcpsavedreplies >= nfsrc_tcphighwater) { + for (i = 0; i < 10; i++) + time_histo[i] = 0; + for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { + mtx_lock(&nfsrchash_table[i].mtx); + if (i == 0) + tcp_lasttrim = NFSD_MONOSEC; + LIST_FOREACH_SAFE(rp, &nfsrchash_table[i].tbl, rc_hash, + nextrp) { + if (!(rp->rc_flag & + (RC_INPROG|RC_LOCKED|RC_WANTED)) + && rp->rc_refcnt == 0) { + /* + * The timestamps range from roughly the + * present (tcp_lasttrim) to the present + * + nfsrc_tcptimeout. Generate a simple + * histogram of where the timeouts fall. + */ + j = rp->rc_timestamp - tcp_lasttrim; + if (j >= nfsrc_tcptimeout) + j = nfsrc_tcptimeout - 1; + if (j < 0) + j = 0; + j = (j * 10 / nfsrc_tcptimeout) % 10; + time_histo[j]++; + if ((rp->rc_flag & RC_REFCNT) || + tcp_lasttrim > rp->rc_timestamp || + nfsrc_activesocket(rp, sockref, so)) + nfsrc_freecache(rp); + } + } + mtx_unlock(&nfsrchash_table[i].mtx); + } + j = nfsrc_tcphighwater / 5; /* 20% of it */ + if (j > 0 && (nfsrc_tcpsavedreplies + j) > nfsrc_tcphighwater) { + /* + * Trim some more with a smaller timeout of as little + * as 20% of nfsrc_tcptimeout to try and get below + * 80% of the nfsrc_tcphighwater. + */ + k = 0; + for (i = 0; i < 8; i++) { + k += time_histo[i]; + if (k > j) + break; + } + k = nfsrc_tcptimeout * (i + 1) / 10; + if (k < 1) + k = 1; + thisstamp = tcp_lasttrim + k; + for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { + mtx_lock(&nfsrchash_table[i].mtx); + LIST_FOREACH_SAFE(rp, &nfsrchash_table[i].tbl, + rc_hash, nextrp) { + if (!(rp->rc_flag & + (RC_INPROG|RC_LOCKED|RC_WANTED)) + && rp->rc_refcnt == 0 + && ((rp->rc_flag & RC_REFCNT) || + thisstamp > rp->rc_timestamp || + nfsrc_activesocket(rp, sockref, + so))) + nfsrc_freecache(rp); + } + mtx_unlock(&nfsrchash_table[i].mtx); + } + } } - NFSUNLOCKCACHE(); + atomic_store_rel_int(&onethread, 0); } /* @@ -810,12 +938,14 @@ nfsrc_trimcache(u_int64_t sockref, struc APPLESTATIC void nfsrvd_refcache(struct nfsrvcache *rp) { + struct mtx *mutex; - NFSLOCKCACHE(); + mutex = nfsrc_cachemutex(rp); + mtx_lock(mutex); if (rp->rc_refcnt < 0) panic("nfs cache refcnt"); rp->rc_refcnt++; - NFSUNLOCKCACHE(); + mtx_unlock(mutex); } /* @@ -824,14 +954,16 @@ nfsrvd_refcache(struct nfsrvcache *rp) APPLESTATIC void nfsrvd_derefcache(struct nfsrvcache *rp) { + struct mtx *mutex; - NFSLOCKCACHE(); + mutex = nfsrc_cachemutex(rp); + mtx_lock(mutex); if (rp->rc_refcnt <= 0) panic("nfs cache derefcnt"); rp->rc_refcnt--; if (rp->rc_refcnt == 0 && !(rp->rc_flag & (RC_LOCKED | RC_INPROG))) nfsrc_freecache(rp); - NFSUNLOCKCACHE(); + mtx_unlock(mutex); } /* Modified: stable/9/sys/fs/nfsserver/nfs_nfsdport.c ============================================================================== --- stable/9/sys/fs/nfsserver/nfs_nfsdport.c Fri Sep 13 21:23:04 2013 (r255531) +++ stable/9/sys/fs/nfsserver/nfs_nfsdport.c Fri Sep 13 23:10:53 2013 (r255532) @@ -60,7 +60,8 @@ extern SVCPOOL *nfsrvd_pool; extern struct nfsv4lock nfsd_suspend_lock; struct vfsoptlist nfsv4root_opt, nfsv4root_newopt; NFSDLOCKMUTEX; -struct mtx nfs_cache_mutex; +struct nfsrchash_bucket nfsrchash_table[NFSRVCACHE_HASHSIZE]; +struct mtx nfsrc_udpmtx; struct mtx nfs_v4root_mutex; struct nfsrvfh nfs_rootfh, nfs_pubfh; int nfs_pubfhset = 0, nfs_rootfhset = 0; @@ -3291,7 +3292,7 @@ extern int (*nfsd_call_nfsd)(struct thre static int nfsd_modevent(module_t mod, int type, void *data) { - int error = 0; + int error = 0, i; static int loaded = 0; switch (type) { @@ -3299,7 +3300,14 @@ nfsd_modevent(module_t mod, int type, vo if (loaded) goto out; newnfs_portinit(); - mtx_init(&nfs_cache_mutex, "nfs_cache_mutex", NULL, MTX_DEF); + for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) { + snprintf(nfsrchash_table[i].lock_name, + sizeof(nfsrchash_table[i].lock_name), "nfsrc_tcp%d", + i); + mtx_init(&nfsrchash_table[i].mtx, + nfsrchash_table[i].lock_name, NULL, MTX_DEF); + } + mtx_init(&nfsrc_udpmtx, "nfs_udpcache_mutex", NULL, MTX_DEF); mtx_init(&nfs_v4root_mutex, "nfs_v4root_mutex", NULL, MTX_DEF); mtx_init(&nfsv4root_mnt.mnt_mtx, "struct mount mtx", NULL, MTX_DEF); @@ -3343,7 +3351,9 @@ nfsd_modevent(module_t mod, int type, vo svcpool_destroy(nfsrvd_pool); /* and get rid of the locks */ - mtx_destroy(&nfs_cache_mutex); + for (i = 0; i < NFSRVCACHE_HASHSIZE; i++) + mtx_destroy(&nfsrchash_table[i].mtx); + mtx_destroy(&nfsrc_udpmtx); mtx_destroy(&nfs_v4root_mutex); mtx_destroy(&nfsv4root_mnt.mnt_mtx); lockdestroy(&nfsv4root_mnt.mnt_explock); From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 08:22:58 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7AB9D8F4; Sat, 14 Sep 2013 08:22:58 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 65AAE28CB; Sat, 14 Sep 2013 08:22:58 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E8MwJd067844; Sat, 14 Sep 2013 08:22:58 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E8Mw46067843; Sat, 14 Sep 2013 08:22:58 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140822.r8E8Mw46067843@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 08:22:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255534 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 08:22:58 -0000 Author: mav Date: Sat Sep 14 08:22:57 2013 New Revision: 255534 URL: http://svnweb.freebsd.org/changeset/base/255534 Log: MFC r255119: Fix SES_ENABLE_PASSTHROUGH kernel option, unexpectedly broken during driver overhaul. Modified: stable/9/sys/cam/scsi/scsi_enc.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_enc.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_enc.c Sat Sep 14 06:43:09 2013 (r255533) +++ stable/9/sys/cam/scsi/scsi_enc.c Sat Sep 14 08:22:57 2013 (r255534) @@ -56,6 +56,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include + MALLOC_DEFINE(M_SCSIENC, "SCSI ENC", "SCSI ENC buffers"); /* Enclosure type independent driver */ @@ -719,12 +721,12 @@ enc_type(struct ccb_getdev *cgd) return (ENC_NONE); } -#ifdef ENC_ENABLE_PASSTHROUGH +#ifdef SES_ENABLE_PASSTHROUGH if ((iqd[6] & 0x40) && (iqd[2] & 0x7) >= 2) { /* * PassThrough Device. */ - return (ENC_ENC_PASSTHROUGH); + return (ENC_SES_PASSTHROUGH); } #endif From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 08:24:34 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B96AEA28; Sat, 14 Sep 2013 08:24:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A55EB28D2; Sat, 14 Sep 2013 08:24:34 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E8OYTc068224; Sat, 14 Sep 2013 08:24:34 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E8OYWl068223; Sat, 14 Sep 2013 08:24:34 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140824.r8E8OYWl068223@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 08:24:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255535 - stable/9/share/man/man4 X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 08:24:34 -0000 Author: mav Date: Sat Sep 14 08:24:34 2013 New Revision: 255535 URL: http://svnweb.freebsd.org/changeset/base/255535 Log: MFC r255534: Add more references. Modified: stable/9/share/man/man4/netgraph.4 Directory Properties: stable/9/share/man/man4/ (props changed) Modified: stable/9/share/man/man4/netgraph.4 ============================================================================== --- stable/9/share/man/man4/netgraph.4 Sat Sep 14 08:22:57 2013 (r255534) +++ stable/9/share/man/man4/netgraph.4 Sat Sep 14 08:24:34 2013 (r255535) @@ -1284,7 +1284,7 @@ link between two machines. There is a full multilink PPP implementation that runs in .Nm . The -.Pa net/mpd +.Pa net/mpd5 port can use these modules to make a very low latency high capacity PPP system. It also supports @@ -1423,6 +1423,7 @@ common networking problems, solved using .Xr ng_bridge 4 , .Xr ng_bt3c 4 , .Xr ng_btsocket 4 , +.Xr ng_car 4 , .Xr ng_cisco 4 , .Xr ng_device 4 , .Xr ng_echo 4 , @@ -1439,13 +1440,16 @@ common networking problems, solved using .Xr ng_hub 4 , .Xr ng_iface 4 , .Xr ng_ip_input 4 , +.Xr ng_ipfw 4 , .Xr ng_ksocket 4 , .Xr ng_l2cap 4 , .Xr ng_l2tp 4 , .Xr ng_lmi 4 , .Xr ng_mppc 4 , +.Xr ng_nat 4 , .Xr ng_netflow 4 , .Xr ng_one2many 4 , +.Xr ng_patch 4 , .Xr ng_ppp 4 , .Xr ng_pppoe 4 , .Xr ng_pptpgre 4 , From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 08:29:11 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9D9EFEF4; Sat, 14 Sep 2013 08:29:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 887D828F9; Sat, 14 Sep 2013 08:29:11 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E8TBQt070159; Sat, 14 Sep 2013 08:29:11 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E8TB4E070158; Sat, 14 Sep 2013 08:29:11 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140829.r8E8TB4E070158@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 08:29:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255536 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 08:29:11 -0000 Author: mav Date: Sat Sep 14 08:29:11 2013 New Revision: 255536 URL: http://svnweb.freebsd.org/changeset/base/255536 Log: MFC r253643: Following r222950, revert unintentional change cls -> class in argument name in r245264. Aside from non-uniformity, that again confused C++ compilers. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h Sat Sep 14 08:24:34 2013 (r255535) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h Sat Sep 14 08:29:11 2013 (r255536) @@ -172,7 +172,7 @@ extern void ddt_object_name(ddt_t *ddt, extern int ddt_object_walk(ddt_t *ddt, enum ddt_type type, enum ddt_class cls, uint64_t *walk, ddt_entry_t *dde); extern int ddt_object_count(ddt_t *ddt, enum ddt_type type, - enum ddt_class class, uint64_t *count); + enum ddt_class cls, uint64_t *count); extern int ddt_object_info(ddt_t *ddt, enum ddt_type type, enum ddt_class cls, dmu_object_info_t *); extern boolean_t ddt_object_exists(ddt_t *ddt, enum ddt_type type, From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 08:32:17 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E2424114; Sat, 14 Sep 2013 08:32:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id B4D76293C; Sat, 14 Sep 2013 08:32:17 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E8WHbN073623; Sat, 14 Sep 2013 08:32:17 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E8WHLa073622; Sat, 14 Sep 2013 08:32:17 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140832.r8E8WHLa073622@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 08:32:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255537 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 08:32:18 -0000 Author: mav Date: Sat Sep 14 08:32:17 2013 New Revision: 255537 URL: http://svnweb.freebsd.org/changeset/base/255537 Log: MFC r253806: Allow three IOCTLs to be used on suspended pool, restoring state that existed before IOCTL code refactoring merged change 4445fffb from illumos at r248571. This change allows `zpool clear` to be used again to recover suspended pool. It seems the only was supposed by the code to restore pool operation after reconnecting lost disks that were required for data completeness. There are still cases where `zpool clear` command can just safely stuck due to deadlocks inside ZFS kernel part, but probably that is better then having no chances to recover at all. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Sep 14 08:29:11 2013 (r255536) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Sep 14 08:32:17 2013 (r255537) @@ -5504,10 +5504,10 @@ zfs_ioctl_init(void) zfs_secpolicy_read, B_FALSE, POOL_CHECK_NONE); zfs_ioctl_register_pool(ZFS_IOC_ERROR_LOG, zfs_ioc_error_log, - zfs_secpolicy_inject, B_FALSE, POOL_CHECK_SUSPENDED); + zfs_secpolicy_inject, B_FALSE, POOL_CHECK_NONE); zfs_ioctl_register_pool(ZFS_IOC_DSOBJ_TO_DSNAME, zfs_ioc_dsobj_to_dsname, - zfs_secpolicy_diff, B_FALSE, POOL_CHECK_SUSPENDED); + zfs_secpolicy_diff, B_FALSE, POOL_CHECK_NONE); zfs_ioctl_register_pool(ZFS_IOC_POOL_GET_HISTORY, zfs_ioc_pool_get_history, zfs_secpolicy_config, B_FALSE, POOL_CHECK_SUSPENDED); @@ -5516,7 +5516,7 @@ zfs_ioctl_init(void) zfs_secpolicy_config, B_TRUE, POOL_CHECK_NONE); zfs_ioctl_register_pool(ZFS_IOC_CLEAR, zfs_ioc_clear, - zfs_secpolicy_config, B_TRUE, POOL_CHECK_SUSPENDED); + zfs_secpolicy_config, B_TRUE, POOL_CHECK_NONE); zfs_ioctl_register_pool(ZFS_IOC_POOL_REOPEN, zfs_ioc_pool_reopen, zfs_secpolicy_config, B_TRUE, POOL_CHECK_SUSPENDED); From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 08:33:59 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8098524C; Sat, 14 Sep 2013 08:33:59 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 5E5892946; Sat, 14 Sep 2013 08:33:59 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E8Xxuq073973; Sat, 14 Sep 2013 08:33:59 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E8Xxsq073971; Sat, 14 Sep 2013 08:33:59 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140833.r8E8Xxsq073971@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 08:33:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255538 - in stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs: . sys X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 08:33:59 -0000 Author: mav Date: Sat Sep 14 08:33:58 2013 New Revision: 255538 URL: http://svnweb.freebsd.org/changeset/base/255538 Log: MFC r253990: Make ZFS to use separate thread to handle SPA_ASYNC_REMOVE async events. Existing async thread is running only on successfull spa_sync() completion, that is impossible in case of pool loosing required (last) disk(s). That indefinite delay of SPA_ASYNC_REMOVE processing made ZFS to not close the lost disks, preventing GEOM/CAM from destroying devices and reusing names on later disk reattach. In earlier version of the patch I've tried to just run existing thread immediately, unrelated to spa_sync() completion, but that exposed number of situations where it could stuck due to locks held by stuck spa_sync(), that are required for other kinds of async events. Experiments with OpenIndiana snapshot confirmed that they also have this issue with lost disks reattach. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Sep 14 08:32:17 2013 (r255537) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Sep 14 08:33:58 2013 (r255538) @@ -5763,7 +5763,7 @@ spa_async_thread(void *arg) mutex_enter(&spa->spa_async_lock); tasks = spa->spa_async_tasks; - spa->spa_async_tasks = 0; + spa->spa_async_tasks &= SPA_ASYNC_REMOVE; mutex_exit(&spa->spa_async_lock); /* @@ -5789,19 +5789,6 @@ spa_async_thread(void *arg) } } - /* - * See if any devices need to be marked REMOVED. - */ - if (tasks & SPA_ASYNC_REMOVE) { - spa_vdev_state_enter(spa, SCL_NONE); - spa_async_remove(spa, spa->spa_root_vdev); - for (int i = 0; i < spa->spa_l2cache.sav_count; i++) - spa_async_remove(spa, spa->spa_l2cache.sav_vdevs[i]); - for (int i = 0; i < spa->spa_spares.sav_count; i++) - spa_async_remove(spa, spa->spa_spares.sav_vdevs[i]); - (void) spa_vdev_state_exit(spa, NULL, 0); - } - if ((tasks & SPA_ASYNC_AUTOEXPAND) && !spa_suspended(spa)) { spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER); spa_async_autoexpand(spa, spa->spa_root_vdev); @@ -5839,12 +5826,53 @@ spa_async_thread(void *arg) thread_exit(); } +static void +spa_async_thread_vd(void *arg) +{ + spa_t *spa = arg; + int tasks; + + ASSERT(spa->spa_sync_on); + + mutex_enter(&spa->spa_async_lock); + tasks = spa->spa_async_tasks; +retry: + spa->spa_async_tasks &= ~SPA_ASYNC_REMOVE; + mutex_exit(&spa->spa_async_lock); + + /* + * See if any devices need to be marked REMOVED. + */ + if (tasks & SPA_ASYNC_REMOVE) { + spa_vdev_state_enter(spa, SCL_NONE); + spa_async_remove(spa, spa->spa_root_vdev); + for (int i = 0; i < spa->spa_l2cache.sav_count; i++) + spa_async_remove(spa, spa->spa_l2cache.sav_vdevs[i]); + for (int i = 0; i < spa->spa_spares.sav_count; i++) + spa_async_remove(spa, spa->spa_spares.sav_vdevs[i]); + (void) spa_vdev_state_exit(spa, NULL, 0); + } + + /* + * Let the world know that we're done. + */ + mutex_enter(&spa->spa_async_lock); + tasks = spa->spa_async_tasks; + if ((tasks & SPA_ASYNC_REMOVE) != 0) + goto retry; + spa->spa_async_thread_vd = NULL; + cv_broadcast(&spa->spa_async_cv); + mutex_exit(&spa->spa_async_lock); + thread_exit(); +} + void spa_async_suspend(spa_t *spa) { mutex_enter(&spa->spa_async_lock); spa->spa_async_suspended++; - while (spa->spa_async_thread != NULL) + while (spa->spa_async_thread != NULL && + spa->spa_async_thread_vd != NULL) cv_wait(&spa->spa_async_cv, &spa->spa_async_lock); mutex_exit(&spa->spa_async_lock); } @@ -5865,7 +5893,8 @@ spa_async_tasks_pending(spa_t *spa) uint_t config_task; boolean_t config_task_suspended; - non_config_tasks = spa->spa_async_tasks & ~SPA_ASYNC_CONFIG_UPDATE; + non_config_tasks = spa->spa_async_tasks & ~(SPA_ASYNC_CONFIG_UPDATE | + SPA_ASYNC_REMOVE); config_task = spa->spa_async_tasks & SPA_ASYNC_CONFIG_UPDATE; if (spa->spa_ccw_fail_time == 0) { config_task_suspended = B_FALSE; @@ -5891,6 +5920,19 @@ spa_async_dispatch(spa_t *spa) mutex_exit(&spa->spa_async_lock); } +static void +spa_async_dispatch_vd(spa_t *spa) +{ + mutex_enter(&spa->spa_async_lock); + if ((spa->spa_async_tasks & SPA_ASYNC_REMOVE) != 0 && + !spa->spa_async_suspended && + spa->spa_async_thread_vd == NULL && + rootdir != NULL) + spa->spa_async_thread_vd = thread_create(NULL, 0, + spa_async_thread_vd, spa, 0, &p0, TS_RUN, maxclsyspri); + mutex_exit(&spa->spa_async_lock); +} + void spa_async_request(spa_t *spa, int task) { @@ -5898,6 +5940,7 @@ spa_async_request(spa_t *spa, int task) mutex_enter(&spa->spa_async_lock); spa->spa_async_tasks |= task; mutex_exit(&spa->spa_async_lock); + spa_async_dispatch_vd(spa); } /* @@ -6486,6 +6529,7 @@ spa_sync(spa_t *spa, uint64_t txg) * If any async tasks have been requested, kick them off. */ spa_async_dispatch(spa); + spa_async_dispatch_vd(spa); } /* Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Sat Sep 14 08:32:17 2013 (r255537) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h Sat Sep 14 08:33:58 2013 (r255538) @@ -169,6 +169,7 @@ struct spa { uint64_t spa_scan_pass_exam; /* examined bytes per pass */ kmutex_t spa_async_lock; /* protect async state */ kthread_t *spa_async_thread; /* thread doing async task */ + kthread_t *spa_async_thread_vd; /* thread doing vd async task */ int spa_async_suspended; /* async tasks suspended */ kcondvar_t spa_async_cv; /* wait for thread_exit() */ uint16_t spa_async_tasks; /* async task mask */ From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 08:35:21 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2C2AB379; Sat, 14 Sep 2013 08:35:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 172122949; Sat, 14 Sep 2013 08:35:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E8ZKmJ074518; Sat, 14 Sep 2013 08:35:20 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E8ZKDe074517; Sat, 14 Sep 2013 08:35:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140835.r8E8ZKDe074517@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 08:35:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255539 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 08:35:21 -0000 Author: mav Date: Sat Sep 14 08:35:20 2013 New Revision: 255539 URL: http://svnweb.freebsd.org/changeset/base/255539 Log: MFC r253991: Make `zpool clear` to reopen also reconnected cache and spare devices. Since `zpool status` reports about such kinds of errors, it is strange that they are not cleared by `zpool clear`. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Sat Sep 14 08:33:58 2013 (r255538) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Sat Sep 14 08:35:20 2013 (r255539) @@ -2379,6 +2379,14 @@ vdev_clear(spa_t *spa, vdev_t *vd) for (int c = 0; c < vd->vdev_children; c++) vdev_clear(spa, vd->vdev_child[c]); + if (vd == rvd) { + for (int c = 0; c < spa->spa_l2cache.sav_count; c++) + vdev_clear(spa, spa->spa_l2cache.sav_vdevs[c]); + + for (int c = 0; c < spa->spa_spares.sav_count; c++) + vdev_clear(spa, spa->spa_spares.sav_vdevs[c]); + } + /* * If we're in the FAULTED state or have experienced failed I/O, then * clear the persistent state and attempt to reopen the device. We From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 08:37:50 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 28B164CA; Sat, 14 Sep 2013 08:37:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id EFB52295A; Sat, 14 Sep 2013 08:37:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E8bneB075311; Sat, 14 Sep 2013 08:37:49 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E8bnaj075310; Sat, 14 Sep 2013 08:37:49 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140837.r8E8bnaj075310@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 08:37:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255540 - stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 08:37:50 -0000 Author: mav Date: Sat Sep 14 08:37:49 2013 New Revision: 255540 URL: http://svnweb.freebsd.org/changeset/base/255540 Log: MFC r253993: Block reporting of ZFS features for suspended pools. Before executing any subcommand, zpool tool fetches pools configuration from the kernel. Before features support was added, kernel was regenerating that configuration based on data always present in memory. Unfortunately, pool features list and activity counters are not such. They are stored in ZAP, that normally resides in ARC, but under heavy memory pressure may be swapped out. If pool is suspended at this point, there is no way to recover it back since any zpool command will stuck. This change has one predictable flaw: `zpool upgrade` always wish to upgrade suspended pools, but fortunately it can't do it due to the suspension. Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/cddl/contrib/opensolaris/ (props changed) Modified: stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Sep 14 08:35:20 2013 (r255539) +++ stable/9/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Sat Sep 14 08:37:49 2013 (r255540) @@ -3060,6 +3060,10 @@ spa_add_feature_stats(spa_t *spa, nvlist ASSERT(spa_config_held(spa, SCL_CONFIG, RW_READER)); VERIFY(nvlist_alloc(&features, NV_UNIQUE_NAME, KM_SLEEP) == 0); + /* We may be unable to read features if pool is suspended. */ + if (spa_suspended(spa)) + goto out; + if (spa->spa_feat_for_read_obj != 0) { for (zap_cursor_init(&zc, spa->spa_meta_objset, spa->spa_feat_for_read_obj); @@ -3086,6 +3090,7 @@ spa_add_feature_stats(spa_t *spa, nvlist zap_cursor_fini(&zc); } +out: VERIFY(nvlist_add_nvlist(config, ZPOOL_CONFIG_FEATURE_STATS, features) == 0); nvlist_free(features); From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 08:45:16 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 2F6C062E; Sat, 14 Sep 2013 08:45:16 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1BC41299D; Sat, 14 Sep 2013 08:45:16 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E8jFSg080232; Sat, 14 Sep 2013 08:45:15 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E8jFTq080231; Sat, 14 Sep 2013 08:45:15 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140845.r8E8jFTq080231@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 08:45:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255541 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 08:45:16 -0000 Author: mav Date: Sat Sep 14 08:45:15 2013 New Revision: 255541 URL: http://svnweb.freebsd.org/changeset/base/255541 Log: MFC r255363: Micro-optimize cpu_search(), allowing compiler to use more efficient inline ffsl() implementation, when it is available, instead of homegrown iteration. On dual-E5645 amd64 system (2x6x2 cores) under heavy I/O load that reduces time spent inside cpu_search() from 19% to 13%, while IOPS increased by 5%. Modified: stable/9/sys/kern/sched_ule.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/kern/sched_ule.c ============================================================================== --- stable/9/sys/kern/sched_ule.c Sat Sep 14 08:37:49 2013 (r255540) +++ stable/9/sys/kern/sched_ule.c Sat Sep 14 08:45:15 2013 (r255541) @@ -632,10 +632,14 @@ cpu_search(const struct cpu_group *cg, s } /* Iterate through the child CPU groups and then remaining CPUs. */ - for (i = cg->cg_children, cpu = mp_maxid; i >= 0; ) { + for (i = cg->cg_children, cpu = mp_maxid; ; ) { if (i == 0) { +#ifdef HAVE_INLINE_FFSL + cpu = CPU_FFS(&cpumask) - 1; +#else while (cpu >= 0 && !CPU_ISSET(cpu, &cpumask)) cpu--; +#endif if (cpu < 0) break; child = NULL; @@ -660,6 +664,7 @@ cpu_search(const struct cpu_group *cg, s break; } } else { /* Handle child CPU. */ + CPU_CLR(cpu, &cpumask); tdq = TDQ_CPU(cpu); load = tdq->tdq_load * 256; rndptr = DPCPU_PTR(randomval); @@ -707,8 +712,11 @@ cpu_search(const struct cpu_group *cg, s i--; if (i == 0 && CPU_EMPTY(&cpumask)) break; - } else + } +#ifndef HAVE_INLINE_FFSL + else cpu--; +#endif } return (total); } From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 08:55:49 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 6196CFF9; Sat, 14 Sep 2013 08:55:49 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3F2A42A15; Sat, 14 Sep 2013 08:55:49 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E8tnRE086854; Sat, 14 Sep 2013 08:55:49 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E8tmV0086850; Sat, 14 Sep 2013 08:55:48 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140855.r8E8tmV0086850@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 08:55:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255542 - in stable/9/sys/cam: . scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 08:55:49 -0000 Author: mav Date: Sat Sep 14 08:55:48 2013 New Revision: 255542 URL: http://svnweb.freebsd.org/changeset/base/255542 Log: MFC r252382 (by scottl), r252684 (by jkim): Introduce accessors for the ccb status word. Convert one (of many more) modules to use it, will convert the others once the appropriate shed color is selected by consensus. Modified: stable/9/sys/cam/cam_ccb.h stable/9/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_ccb.h ============================================================================== --- stable/9/sys/cam/cam_ccb.h Sat Sep 14 08:45:15 2013 (r255541) +++ stable/9/sys/cam/cam_ccb.h Sat Sep 14 08:55:48 2013 (r255542) @@ -1305,6 +1305,19 @@ cam_fill_smpio(struct ccb_smpio *smpio, smpio->smp_response_len = smp_response_len; } +static __inline void +cam_set_ccbstatus(union ccb *ccb, cam_status status) +{ + ccb->ccb_h.status &= ~CAM_STATUS_MASK; + ccb->ccb_h.status |= status; +} + +static __inline cam_status +cam_ccb_status(union ccb *ccb) +{ + return ((cam_status)(ccb->ccb_h.status & CAM_STATUS_MASK)); +} + void cam_calc_geometry(struct ccb_calc_geometry *ccg, int extended); __END_DECLS Modified: stable/9/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_xpt.c Sat Sep 14 08:45:15 2013 (r255541) +++ stable/9/sys/cam/scsi/scsi_xpt.c Sat Sep 14 08:55:48 2013 (r255542) @@ -975,7 +975,7 @@ proberequestdefaultnegotiation(struct ca cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_USER_SETTINGS; xpt_action((union ccb *)&cts); - if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) { return; } cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; @@ -997,7 +997,7 @@ proberequestbackoff(struct cam_periph *p cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb *)&cts); - if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) { if (bootverbose) { xpt_print(periph->path, "failed to get current device settings\n"); @@ -1076,7 +1076,7 @@ proberequestbackoff(struct cam_periph *p cts.ccb_h.func_code = XPT_SET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb *)&cts); - if ((cts.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) { break; } CAM_DEBUG(periph->path, CAM_DEBUG_PROBE, @@ -1106,7 +1106,7 @@ probedone(struct cam_periph *periph, uni switch (softc->action) { case PROBE_TUR: { - if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) { if (cam_periph_error(done_ccb, 0, SF_NO_PRINT, NULL) == ERESTART) @@ -1125,7 +1125,7 @@ probedone(struct cam_periph *periph, uni case PROBE_INQUIRY: case PROBE_FULL_INQUIRY: { - if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + if (cam_ccb_status(done_ccb) == CAM_REQ_CMP) { struct scsi_inquiry_data *inq_buf; u_int8_t periph_qual; @@ -1243,7 +1243,7 @@ probedone(struct cam_periph *periph, uni nlun = scsi_4btoul(lp->length) / 8; maxlun = (csio->dxfer_len / 8) - 1; - if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) { if (cam_periph_error(done_ccb, 0, done_ccb->ccb_h.target_lun > 0 ? SF_RETRY_UA|SF_QUIET_IR : SF_RETRY_UA, @@ -1354,7 +1354,7 @@ probedone(struct cam_periph *periph, uni csio = &done_ccb->csio; mode_hdr = (struct scsi_mode_header_6 *)csio->data_ptr; - if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + if (cam_ccb_status(done_ccb) == CAM_REQ_CMP) { struct scsi_control_page *page; u_int8_t *offset; @@ -1489,7 +1489,7 @@ probe_device_check: /* * Don't process the command as it was never sent */ - } else if ((csio->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP + } else if (cam_ccb_status(done_ccb) == CAM_REQ_CMP && (serial_buf->length > 0)) { have_serialnum = 1; @@ -1574,7 +1574,7 @@ probe_device_check: } case PROBE_TUR_FOR_NEGOTIATION: case PROBE_DV_EXIT: - if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) { cam_periph_error(done_ccb, 0, SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY, NULL); } @@ -1625,7 +1625,7 @@ probe_device_check: struct scsi_inquiry_data *nbuf; struct ccb_scsiio *csio; - if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (cam_ccb_status(done_ccb) != CAM_REQ_CMP) { cam_periph_error(done_ccb, 0, SF_NO_PRINT | SF_NO_RECOVERY | SF_NO_RETRY, NULL); } @@ -1980,7 +1980,7 @@ scsi_scan_bus(struct cam_periph *periph, oldpath = request_ccb->ccb_h.path; - status = request_ccb->ccb_h.status & CAM_STATUS_MASK; + status = cam_ccb_status(request_ccb); /* Reuse the same CCB to query if a device was really found */ scan_info = (scsi_scan_bus_info *)request_ccb->ccb_h.ppriv_ptr0; xpt_setup_ccb(&request_ccb->ccb_h, request_ccb->ccb_h.path, @@ -2663,7 +2663,7 @@ scsi_set_transfer_settings(struct ccb_tr cur_cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cur_cts.type = cts->type; xpt_action((union ccb *)&cur_cts); - if ((cur_cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { + if (cam_ccb_status((union ccb *)&cur_cts) != CAM_REQ_CMP) { return; } cur_scsi = &cur_cts.proto_specific.scsi; @@ -2947,7 +2947,7 @@ scsi_announce_periph(struct cam_periph * cts.ccb_h.func_code = XPT_GET_TRAN_SETTINGS; cts.type = CTS_TYPE_CURRENT_SETTINGS; xpt_action((union ccb*)&cts); - if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) + if (cam_ccb_status((union ccb *)&cts) != CAM_REQ_CMP) return; /* Ask the SIM for its base transfer speed */ xpt_setup_ccb(&cpi.ccb_h, path, CAM_PRIORITY_NORMAL); From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 08:58:29 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 30DD71D6; Sat, 14 Sep 2013 08:58:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1BB262A26; Sat, 14 Sep 2013 08:58:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E8wTfe087953; Sat, 14 Sep 2013 08:58:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E8wTRD087952; Sat, 14 Sep 2013 08:58:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140858.r8E8wTRD087952@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 08:58:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255543 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 08:58:29 -0000 Author: mav Date: Sat Sep 14 08:58:28 2013 New Revision: 255543 URL: http://svnweb.freebsd.org/changeset/base/255543 Log: MFC r253228, r253307 (by scottl): Refactor the various delete methods out of dastart(). Cleans up a bunch of style and adds more modularity and clarity. Modified: stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 08:55:48 2013 (r255542) +++ stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 08:58:28 2013 (r255543) @@ -145,6 +145,22 @@ typedef enum { DA_DELETE_MAX = DA_DELETE_ZERO } da_delete_methods; +typedef void da_delete_func_t (struct cam_periph *periph, union ccb *ccb, + struct bio *bp); +static da_delete_func_t da_delete_trim; +static da_delete_func_t da_delete_unmap; +static da_delete_func_t da_delete_ws; + +static const void * da_delete_functions[] = { + NULL, + NULL, + da_delete_trim, + da_delete_unmap, + da_delete_ws, + da_delete_ws, + da_delete_ws +}; + static const char *da_delete_method_names[] = { "NONE", "DISABLE", "ATA_TRIM", "UNMAP", "WS16", "WS10", "ZERO" }; static const char *da_delete_method_desc[] = @@ -199,6 +215,7 @@ struct da_softc { uint32_t unmap_max_lba; uint64_t ws_max_blks; da_delete_methods delete_method; + da_delete_func_t *delete_func; struct disk_params params; struct disk *disk; union ccb saved_ccb; @@ -1813,6 +1830,7 @@ dadeletemethodset(struct da_softc *softc softc->delete_method = delete_method; softc->disk->d_delmaxsize = dadeletemaxsize(softc, delete_method); + softc->delete_func = da_delete_functions[delete_method]; if (softc->delete_method > DA_DELETE_DISABLE) softc->disk->d_flags |= DISKFLAG_CANDELETE; @@ -2172,7 +2190,7 @@ skipstate: switch (softc->state) { case DA_STATE_NORMAL: { - struct bio *bp, *bp1; + struct bio *bp; uint8_t tag_code; /* Execute immediate CCB if waiting. */ @@ -2192,237 +2210,13 @@ skipstate: /* Run BIO_DELETE if not running yet. */ if (!softc->delete_running && (bp = bioq_first(&softc->delete_queue)) != NULL) { - uint64_t lba; - uint64_t count; /* forward compat with WS32 */ - - /* - * In each of the methods below, while its the caller's - * responsibility to ensure the request will fit into a - * single device request, we might have changed the delete - * method due to the device incorrectly advertising either - * its supported methods or limits. - * - * To prevent this causing further issues we validate the - * against the methods limits, and warn which would - * otherwise be unnecessary. - */ - - if (softc->delete_method == DA_DELETE_UNMAP) { - uint8_t *buf = softc->unmap_buf; - uint64_t lastlba = (uint64_t)-1; - uint32_t lastcount = 0, c; - uint64_t totalcount = 0; - uint32_t off, ranges = 0; - - /* - * Currently this doesn't take the UNMAP - * Granularity and Granularity Alignment - * fields into account. - * - * This could result in both unoptimal unmap - * requests as as well as UNMAP calls unmapping - * fewer LBA's than requested. - */ - - softc->delete_running = 1; - bzero(softc->unmap_buf, sizeof(softc->unmap_buf)); - bp1 = bp; - do { - bioq_remove(&softc->delete_queue, bp1); - if (bp1 != bp) - bioq_insert_tail(&softc->delete_run_queue, bp1); - lba = bp1->bio_pblkno; - count = bp1->bio_bcount / softc->params.secsize; - - /* Try to extend the previous range. */ - if (lba == lastlba) { - c = min(count, softc->unmap_max_lba - - lastcount); - lastcount += c; - off = ((ranges - 1) * UNMAP_RANGE_SIZE) + - UNMAP_HEAD_SIZE; - scsi_ulto4b(lastcount, &buf[off + 8]); - count -= c; - lba +=c; - totalcount += c; - } - - while (count > 0) { - c = min(count, softc->unmap_max_lba); - if (totalcount + c > softc->unmap_max_lba || - ranges >= softc->unmap_max_ranges) { - xpt_print(periph->path, - "%s issuing short delete %ld > %ld" - "|| %d >= %d", - da_delete_method_desc[softc->delete_method], - totalcount + c, softc->unmap_max_lba, - ranges, softc->unmap_max_ranges); - break; - } - off = (ranges * UNMAP_RANGE_SIZE) + - UNMAP_HEAD_SIZE; - scsi_u64to8b(lba, &buf[off + 0]); - scsi_ulto4b(c, &buf[off + 8]); - lba += c; - totalcount += c; - ranges++; - count -= c; - lastcount = c; - } - lastlba = lba; - bp1 = bioq_first(&softc->delete_queue); - if (bp1 == NULL || - ranges >= softc->unmap_max_ranges || - totalcount + bp1->bio_bcount / - softc->params.secsize > softc->unmap_max_lba) - break; - } while (1); - scsi_ulto2b(ranges * 16 + 6, &buf[0]); - scsi_ulto2b(ranges * 16, &buf[2]); - - scsi_unmap(&start_ccb->csio, - /*retries*/da_retry_count, - /*cbfcnp*/dadone, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*byte2*/0, - /*data_ptr*/ buf, - /*dxfer_len*/ ranges * 16 + 8, - /*sense_len*/SSD_FULL_SIZE, - da_default_timeout * 1000); - start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; - goto out; - } else if (softc->delete_method == DA_DELETE_ATA_TRIM) { - uint8_t *buf = softc->unmap_buf; - uint64_t lastlba = (uint64_t)-1; - uint32_t lastcount = 0, c, requestcount; - int ranges = 0, off, block_count; - - softc->delete_running = 1; - bzero(softc->unmap_buf, sizeof(softc->unmap_buf)); - bp1 = bp; - do { - bioq_remove(&softc->delete_queue, bp1); - if (bp1 != bp) - bioq_insert_tail(&softc->delete_run_queue, bp1); - lba = bp1->bio_pblkno; - count = bp1->bio_bcount / softc->params.secsize; - requestcount = count; - - /* Try to extend the previous range. */ - if (lba == lastlba) { - c = min(count, ATA_DSM_RANGE_MAX - lastcount); - lastcount += c; - off = (ranges - 1) * 8; - buf[off + 6] = lastcount & 0xff; - buf[off + 7] = (lastcount >> 8) & 0xff; - count -= c; - lba += c; - } - - while (count > 0) { - c = min(count, ATA_DSM_RANGE_MAX); - off = ranges * 8; - - buf[off + 0] = lba & 0xff; - buf[off + 1] = (lba >> 8) & 0xff; - buf[off + 2] = (lba >> 16) & 0xff; - buf[off + 3] = (lba >> 24) & 0xff; - buf[off + 4] = (lba >> 32) & 0xff; - buf[off + 5] = (lba >> 40) & 0xff; - buf[off + 6] = c & 0xff; - buf[off + 7] = (c >> 8) & 0xff; - lba += c; - ranges++; - count -= c; - lastcount = c; - if (count != 0 && ranges == softc->trim_max_ranges) { - xpt_print(periph->path, - "%s issuing short delete %ld > %ld", - da_delete_method_desc[softc->delete_method], - requestcount, - (softc->trim_max_ranges - ranges) * - ATA_DSM_RANGE_MAX); - break; - } - } - lastlba = lba; - bp1 = bioq_first(&softc->delete_queue); - if (bp1 == NULL || - bp1->bio_bcount / softc->params.secsize > - (softc->trim_max_ranges - ranges) * - ATA_DSM_RANGE_MAX) - break; - } while (1); - - block_count = (ranges + ATA_DSM_BLK_RANGES - 1) / - ATA_DSM_BLK_RANGES; - scsi_ata_trim(&start_ccb->csio, - /*retries*/da_retry_count, - /*cbfcnp*/dadone, - /*tag_action*/MSG_SIMPLE_Q_TAG, - block_count, - /*data_ptr*/buf, - /*dxfer_len*/block_count * ATA_DSM_BLK_SIZE, - /*sense_len*/SSD_FULL_SIZE, - da_default_timeout * 1000); - start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; + if (softc->delete_func != NULL) { + softc->delete_func(periph, start_ccb, bp); goto out; - } else if (softc->delete_method == DA_DELETE_ZERO || - softc->delete_method == DA_DELETE_WS10 || - softc->delete_method == DA_DELETE_WS16) { - /* - * We calculate ws_max_blks here based off d_delmaxsize instead - * of using softc->ws_max_blks as it is absolute max for the - * device not the protocol max which may well be lower - */ - uint64_t ws_max_blks; - ws_max_blks = softc->disk->d_delmaxsize / softc->params.secsize; - softc->delete_running = 1; - lba = bp->bio_pblkno; - count = 0; - bp1 = bp; - do { - bioq_remove(&softc->delete_queue, bp1); - if (bp1 != bp) - bioq_insert_tail(&softc->delete_run_queue, bp1); - count += bp1->bio_bcount / softc->params.secsize; - if (count > ws_max_blks) { - count = min(count, ws_max_blks); - xpt_print(periph->path, - "%s issuing short delete %ld > %ld", - da_delete_method_desc[softc->delete_method], - count, ws_max_blks); - break; - } - bp1 = bioq_first(&softc->delete_queue); - if (bp1 == NULL || - lba + count != bp1->bio_pblkno || - count + bp1->bio_bcount / - softc->params.secsize > ws_max_blks) - break; - } while (1); - - scsi_write_same(&start_ccb->csio, - /*retries*/da_retry_count, - /*cbfcnp*/dadone, - /*tag_action*/MSG_SIMPLE_Q_TAG, - /*byte2*/softc->delete_method == - DA_DELETE_ZERO ? 0 : SWS_UNMAP, - softc->delete_method == - DA_DELETE_WS16 ? 16 : 10, - /*lba*/lba, - /*block_count*/count, - /*data_ptr*/ __DECONST(void *, - zero_region), - /*dxfer_len*/ softc->params.secsize, - /*sense_len*/SSD_FULL_SIZE, - da_default_timeout * 1000); - start_ccb->ccb_h.ccb_state = DA_CCB_DELETE; - goto out; - } else { - bioq_flush(&softc->delete_queue, NULL, 0); - /* FALLTHROUGH */ - } + } else { + bioq_flush(&softc->delete_queue, NULL, 0); + /* FALLTHROUGH */ + } } /* Run regular command. */ @@ -2714,6 +2508,240 @@ out: } } +/* + * In each of the methods below, while its the caller's + * responsibility to ensure the request will fit into a + * single device request, we might have changed the delete + * method due to the device incorrectly advertising either + * its supported methods or limits. + * + * To prevent this causing further issues we validate the + * against the methods limits, and warn which would + * otherwise be unnecessary. + */ +static void +da_delete_unmap(struct cam_periph *periph, union ccb *ccb, struct bio *bp) +{ + struct da_softc *softc = (struct da_softc *)periph->softc;; + struct bio *bp1; + uint8_t *buf = softc->unmap_buf; + uint64_t lba, lastlba = (uint64_t)-1; + uint64_t totalcount = 0; + uint64_t count; + uint32_t lastcount = 0, c; + uint32_t off, ranges = 0; + + /* + * Currently this doesn't take the UNMAP + * Granularity and Granularity Alignment + * fields into account. + * + * This could result in both unoptimal unmap + * requests as as well as UNMAP calls unmapping + * fewer LBA's than requested. + */ + + softc->delete_running = 1; + bzero(softc->unmap_buf, sizeof(softc->unmap_buf)); + bp1 = bp; + do { + bioq_remove(&softc->delete_queue, bp1); + if (bp1 != bp) + bioq_insert_tail(&softc->delete_run_queue, bp1); + lba = bp1->bio_pblkno; + count = bp1->bio_bcount / softc->params.secsize; + + /* Try to extend the previous range. */ + if (lba == lastlba) { + c = min(count, softc->unmap_max_lba - lastcount); + lastcount += c; + off = ((ranges - 1) * UNMAP_RANGE_SIZE) + + UNMAP_HEAD_SIZE; + scsi_ulto4b(lastcount, &buf[off + 8]); + count -= c; + lba +=c; + totalcount += c; + } + + while (count > 0) { + c = min(count, softc->unmap_max_lba); + if (totalcount + c > softc->unmap_max_lba || + ranges >= softc->unmap_max_ranges) { + xpt_print(periph->path, + "%s issuing short delete %ld > %ld" + "|| %d >= %d", + da_delete_method_desc[softc->delete_method], + totalcount + c, softc->unmap_max_lba, + ranges, softc->unmap_max_ranges); + break; + } + off = (ranges * UNMAP_RANGE_SIZE) + UNMAP_HEAD_SIZE; + scsi_u64to8b(lba, &buf[off + 0]); + scsi_ulto4b(c, &buf[off + 8]); + lba += c; + totalcount += c; + ranges++; + count -= c; + lastcount = c; + } + lastlba = lba; + bp1 = bioq_first(&softc->delete_queue); + if (bp1 == NULL || ranges >= softc->unmap_max_ranges || + totalcount + bp1->bio_bcount / + softc->params.secsize > softc->unmap_max_lba) + break; + } while (1); + scsi_ulto2b(ranges * 16 + 6, &buf[0]); + scsi_ulto2b(ranges * 16, &buf[2]); + + scsi_unmap(&ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*byte2*/0, + /*data_ptr*/ buf, + /*dxfer_len*/ ranges * 16 + 8, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + ccb->ccb_h.ccb_state = DA_CCB_DELETE; +} + +static void +da_delete_trim(struct cam_periph *periph, union ccb *ccb, struct bio *bp) +{ + struct da_softc *softc = (struct da_softc *)periph->softc; + struct bio *bp1; + uint8_t *buf = softc->unmap_buf; + uint64_t lastlba = (uint64_t)-1; + uint64_t count; + uint64_t lba; + uint32_t lastcount = 0, c, requestcount; + int ranges = 0, off, block_count; + + softc->delete_running = 1; + bzero(softc->unmap_buf, sizeof(softc->unmap_buf)); + bp1 = bp; + do { + bioq_remove(&softc->delete_queue, bp1); + if (bp1 != bp) + bioq_insert_tail(&softc->delete_run_queue, bp1); + lba = bp1->bio_pblkno; + count = bp1->bio_bcount / softc->params.secsize; + requestcount = count; + + /* Try to extend the previous range. */ + if (lba == lastlba) { + c = min(count, ATA_DSM_RANGE_MAX - lastcount); + lastcount += c; + off = (ranges - 1) * 8; + buf[off + 6] = lastcount & 0xff; + buf[off + 7] = (lastcount >> 8) & 0xff; + count -= c; + lba += c; + } + + while (count > 0) { + c = min(count, ATA_DSM_RANGE_MAX); + off = ranges * 8; + + buf[off + 0] = lba & 0xff; + buf[off + 1] = (lba >> 8) & 0xff; + buf[off + 2] = (lba >> 16) & 0xff; + buf[off + 3] = (lba >> 24) & 0xff; + buf[off + 4] = (lba >> 32) & 0xff; + buf[off + 5] = (lba >> 40) & 0xff; + buf[off + 6] = c & 0xff; + buf[off + 7] = (c >> 8) & 0xff; + lba += c; + ranges++; + count -= c; + lastcount = c; + if (count != 0 && ranges == softc->trim_max_ranges) { + xpt_print(periph->path, + "%s issuing short delete %ld > %ld", + da_delete_method_desc[softc->delete_method], + requestcount, + (softc->trim_max_ranges - ranges) * + ATA_DSM_RANGE_MAX); + break; + } + } + lastlba = lba; + bp1 = bioq_first(&softc->delete_queue); + if (bp1 == NULL || bp1->bio_bcount / softc->params.secsize > + (softc->trim_max_ranges - ranges) * ATA_DSM_RANGE_MAX) + break; + } while (1); + + block_count = (ranges + ATA_DSM_BLK_RANGES - 1) / ATA_DSM_BLK_RANGES; + scsi_ata_trim(&ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + block_count, + /*data_ptr*/buf, + /*dxfer_len*/block_count * ATA_DSM_BLK_SIZE, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + ccb->ccb_h.ccb_state = DA_CCB_DELETE; +} + +/* + * We calculate ws_max_blks here based off d_delmaxsize instead + * of using softc->ws_max_blks as it is absolute max for the + * device not the protocol max which may well be lower + */ +static void +da_delete_ws(struct cam_periph *periph, union ccb *ccb, struct bio *bp) +{ + struct da_softc *softc; + struct bio *bp1; + uint64_t ws_max_blks; + uint64_t lba; + uint64_t count; /* forward compat with WS32 */ + + softc = (struct da_softc *)periph->softc; + ws_max_blks = softc->disk->d_delmaxsize / softc->params.secsize; + softc->delete_running = 1; + lba = bp->bio_pblkno; + count = 0; + bp1 = bp; + do { + bioq_remove(&softc->delete_queue, bp1); + if (bp1 != bp) + bioq_insert_tail(&softc->delete_run_queue, bp1); + count += bp1->bio_bcount / softc->params.secsize; + if (count > ws_max_blks) { + count = min(count, ws_max_blks); + xpt_print(periph->path, + "%s issuing short delete %ld > %ld", + da_delete_method_desc[softc->delete_method], + count, ws_max_blks); + break; + } + bp1 = bioq_first(&softc->delete_queue); + if (bp1 == NULL || lba + count != bp1->bio_pblkno || + count + bp1->bio_bcount / + softc->params.secsize > ws_max_blks) + break; + } while (1); + + scsi_write_same(&ccb->csio, + /*retries*/da_retry_count, + /*cbfcnp*/dadone, + /*tag_action*/MSG_SIMPLE_Q_TAG, + /*byte2*/softc->delete_method == + DA_DELETE_ZERO ? 0 : SWS_UNMAP, + softc->delete_method == DA_DELETE_WS16 ? 16 : 10, + /*lba*/lba, + /*block_count*/count, + /*data_ptr*/ __DECONST(void *, zero_region), + /*dxfer_len*/ softc->params.secsize, + /*sense_len*/SSD_FULL_SIZE, + da_default_timeout * 1000); + ccb->ccb_h.ccb_state = DA_CCB_DELETE; +} + static int cmd6workaround(union ccb *ccb) { From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:01:43 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 7D3B1688; Sat, 14 Sep 2013 09:01:43 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 698A92AAC; Sat, 14 Sep 2013 09:01:43 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E91hbG091607; Sat, 14 Sep 2013 09:01:43 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E91gtt091603; Sat, 14 Sep 2013 09:01:42 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140901.r8E91gtt091603@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:01:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255544 - in stable/9/sys/cam: . scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:01:43 -0000 Author: mav Date: Sat Sep 14 09:01:42 2013 New Revision: 255544 URL: http://svnweb.freebsd.org/changeset/base/255544 Log: MFC r253322, r253370: Improve handling of 0x3F/0x0E "Reported LUNs data has changed" and 0x25/0x00 "Logical unit not supported" errors. First initiates specific target rescan, second -- destroys specific LUN. That allows to automatically detect changes in list of device LUNs. This mechanism doesn't work when target is completely idle, but probably that is all what can be done without active polling. Modified: stable/9/sys/cam/cam_periph.c stable/9/sys/cam/scsi/scsi_all.c stable/9/sys/cam/scsi/scsi_all.h stable/9/sys/cam/scsi/scsi_xpt.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Sat Sep 14 08:58:28 2013 (r255543) +++ stable/9/sys/cam/cam_periph.c Sat Sep 14 09:01:42 2013 (r255544) @@ -75,7 +75,7 @@ static int camperiphscsistatuserror(uni int *openings, u_int32_t *relsim_flags, u_int32_t *timeout, - int *print, + u_int32_t *action, const char **action_string); static int camperiphscsisenseerror(union ccb *ccb, union ccb **orig_ccb, @@ -84,7 +84,7 @@ static int camperiphscsisenseerror(unio int *openings, u_int32_t *relsim_flags, u_int32_t *timeout, - int *print, + u_int32_t *action, const char **action_string); static int nperiph_drivers; @@ -1283,7 +1283,7 @@ static int camperiphscsistatuserror(union ccb *ccb, union ccb **orig_ccb, cam_flags camflags, u_int32_t sense_flags, int *openings, u_int32_t *relsim_flags, - u_int32_t *timeout, int *print, const char **action_string) + u_int32_t *timeout, u_int32_t *action, const char **action_string) { int error; @@ -1302,7 +1302,7 @@ camperiphscsistatuserror(union ccb *ccb, openings, relsim_flags, timeout, - print, + action, action_string); break; case SCSI_STATUS_QUEUE_FULL: @@ -1357,7 +1357,7 @@ camperiphscsistatuserror(union ccb *ccb, } *timeout = 0; error = ERESTART; - *print = 0; + *action &= ~SSQ_PRINT_SENSE; break; } /* FALLTHROUGH */ @@ -1389,7 +1389,7 @@ static int camperiphscsisenseerror(union ccb *ccb, union ccb **orig, cam_flags camflags, u_int32_t sense_flags, int *openings, u_int32_t *relsim_flags, - u_int32_t *timeout, int *print, const char **action_string) + u_int32_t *timeout, u_int32_t *action, const char **action_string) { struct cam_periph *periph; union ccb *orig_ccb = ccb; @@ -1412,7 +1412,7 @@ camperiphscsisenseerror(union ccb *ccb, * imperitive that we don't violate this assumption. */ error = ERESTART; - *print = 0; + *action &= ~SSQ_PRINT_SENSE; } else { scsi_sense_action err_action; struct ccb_getdev cgd; @@ -1584,7 +1584,7 @@ camperiphscsisenseerror(union ccb *ccb, } sense_error_done: - *print = ((err_action & SSQ_PRINT_SENSE) != 0); + *action = err_action; } return (error); } @@ -1598,32 +1598,32 @@ int cam_periph_error(union ccb *ccb, cam_flags camflags, u_int32_t sense_flags, union ccb *save_ccb) { - union ccb *orig_ccb; + struct cam_path *newpath; + union ccb *orig_ccb, *scan_ccb; struct cam_periph *periph; const char *action_string; cam_status status; - int frozen, error, openings, print, lost_device; - int error_code, sense_key, asc, ascq; - u_int32_t relsim_flags, timeout; + int frozen, error, openings; + u_int32_t action, relsim_flags, timeout; - print = 1; + action = SSQ_PRINT_SENSE; periph = xpt_path_periph(ccb->ccb_h.path); action_string = NULL; status = ccb->ccb_h.status; frozen = (status & CAM_DEV_QFRZN) != 0; status &= CAM_STATUS_MASK; - openings = relsim_flags = timeout = lost_device = 0; + openings = relsim_flags = timeout = 0; orig_ccb = ccb; switch (status) { case CAM_REQ_CMP: error = 0; - print = 0; + action &= ~SSQ_PRINT_SENSE; break; case CAM_SCSI_STATUS_ERROR: error = camperiphscsistatuserror(ccb, &orig_ccb, camflags, sense_flags, &openings, &relsim_flags, - &timeout, &print, &action_string); + &timeout, &action, &action_string); break; case CAM_AUTOSENSE_FAIL: error = EIO; /* we have to kill the command */ @@ -1654,8 +1654,7 @@ cam_periph_error(union ccb *ccb, cam_fla /* FALLTHROUGH */ case CAM_DEV_NOT_THERE: error = ENXIO; - print = 0; - lost_device = 1; + action = SSQ_LOST; break; case CAM_REQ_INVALID: case CAM_PATH_INVALID: @@ -1686,7 +1685,7 @@ cam_periph_error(union ccb *ccb, cam_fla action_string = "Retry was blocked"; } else { error = ERESTART; - print = 0; + action &= ~SSQ_PRINT_SENSE; } break; case CAM_RESRC_UNAVAIL: @@ -1725,12 +1724,12 @@ cam_periph_error(union ccb *ccb, cam_fla if ((sense_flags & SF_PRINT_ALWAYS) || CAM_DEBUGGED(ccb->ccb_h.path, CAM_DEBUG_INFO)) - print = 1; + action |= SSQ_PRINT_SENSE; else if (sense_flags & SF_NO_PRINT) - print = 0; - if (print) + action &= ~SSQ_PRINT_SENSE; + if ((action & SSQ_PRINT_SENSE) != 0) cam_error_print(orig_ccb, CAM_ESF_ALL, CAM_EPF_ALL); - if (error != 0 && print) { + if (error != 0 && (action & SSQ_PRINT_SENSE) != 0) { if (error != ERESTART) { if (action_string == NULL) action_string = "Unretryable error"; @@ -1742,8 +1741,7 @@ cam_periph_error(union ccb *ccb, cam_fla xpt_print(ccb->ccb_h.path, "Retrying command\n"); } - if (lost_device) { - struct cam_path *newpath; + if ((action & SSQ_LOST) != 0) { lun_id_t lun_id; /* @@ -1752,10 +1750,10 @@ cam_periph_error(union ccb *ccb, cam_fla * then we only get rid of the device(s) specified by the * path in the original CCB. */ - if (status == CAM_DEV_NOT_THERE) - lun_id = xpt_path_lun_id(ccb->ccb_h.path); - else + if (status == CAM_SEL_TIMEOUT) lun_id = CAM_LUN_WILDCARD; + else + lun_id = xpt_path_lun_id(ccb->ccb_h.path); /* Should we do more if we can't create the path?? */ if (xpt_create_path(&newpath, periph, @@ -1770,12 +1768,29 @@ cam_periph_error(union ccb *ccb, cam_fla xpt_async(AC_LOST_DEVICE, newpath, NULL); xpt_free_path(newpath); } + } /* Broadcast UNIT ATTENTIONs to all periphs. */ - } else if (scsi_extract_sense_ccb(ccb, - &error_code, &sense_key, &asc, &ascq) && - sense_key == SSD_KEY_UNIT_ATTENTION) { + if ((action & SSQ_UA) != 0) xpt_async(AC_UNIT_ATTENTION, orig_ccb->ccb_h.path, orig_ccb); + + /* Rescan target on "Reported LUNs data has changed" */ + if ((action & SSQ_RESCAN) != 0) { + if (xpt_create_path(&newpath, NULL, + xpt_path_path_id(ccb->ccb_h.path), + xpt_path_target_id(ccb->ccb_h.path), + CAM_LUN_WILDCARD) == CAM_REQ_CMP) { + + scan_ccb = xpt_alloc_ccb_nowait(); + if (scan_ccb != NULL) { + scan_ccb->ccb_h.path = newpath; + scan_ccb->ccb_h.func_code = XPT_SCAN_TGT; + scan_ccb->crcn.flags = 0; + xpt_rescan(scan_ccb); + } else + xpt_print(newpath, + "Can't allocate CCB to rescan target\n"); + } } /* Attempt a retry */ Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Sat Sep 14 08:58:28 2013 (r255543) +++ stable/9/sys/cam/scsi/scsi_all.c Sat Sep 14 09:01:42 2013 (r255544) @@ -1645,7 +1645,7 @@ static struct asc_table_entry asc_table[ { SST(0x24, 0x08, SS_RDEF, /* XXX TBD */ "Invalid XCDB") }, /* DTLPWROMAEBKVF */ - { SST(0x25, 0x00, SS_FATAL | ENXIO, + { SST(0x25, 0x00, SS_FATAL | ENXIO | SSQ_LOST, "Logical unit not supported") }, /* DTLPWROMAEBKVF */ { SST(0x26, 0x00, SS_FATAL | EINVAL, @@ -2163,7 +2163,7 @@ static struct asc_table_entry asc_table[ { SST(0x3F, 0x0D, SS_RDEF, "Volume set reassigned") }, /* DTLPWROMAE */ - { SST(0x3F, 0x0E, SS_RDEF, /* XXX TBD */ + { SST(0x3F, 0x0E, SS_RDEF | SSQ_RESCAN , "Reported LUNs data has changed") }, /* DTLPWROMAEBKVF */ { SST(0x3F, 0x0F, SS_RDEF, /* XXX TBD */ @@ -3263,6 +3263,7 @@ scsi_error_action(struct ccb_scsiio *csi action |= SS_RETRY|SSQ_DECREMENT_COUNT| SSQ_PRINT_SENSE; } + action |= SSQ_UA; } } if ((action & SS_MASK) >= SS_START && Modified: stable/9/sys/cam/scsi/scsi_all.h ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.h Sat Sep 14 08:58:28 2013 (r255543) +++ stable/9/sys/cam/scsi/scsi_all.h Sat Sep 14 09:01:42 2013 (r255544) @@ -88,6 +88,9 @@ typedef enum { * and text. */ SSQ_PRINT_SENSE = 0x0800, + SSQ_UA = 0x1000, /* Broadcast UA. */ + SSQ_RESCAN = 0x2000, /* Rescan target for LUNs. */ + SSQ_LOST = 0x4000, /* Destroy the LUNs. */ SSQ_MASK = 0xff00 } scsi_sense_action_qualifier; Modified: stable/9/sys/cam/scsi/scsi_xpt.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_xpt.c Sat Sep 14 08:58:28 2013 (r255543) +++ stable/9/sys/cam/scsi/scsi_xpt.c Sat Sep 14 09:01:42 2013 (r255544) @@ -1877,8 +1877,8 @@ scsi_scan_bus(struct cam_periph *periph, if ((work_ccb->cpi.hba_inquiry & (PI_WIDE_32|PI_WIDE_16|PI_SDTR_ABLE)) && !(work_ccb->cpi.hba_misc & PIM_NOBUSRESET) && - !timevalisset(&request_ccb->ccb_h.path->bus->last_reset)) { - reset_ccb = xpt_alloc_ccb_nowait(); + !timevalisset(&request_ccb->ccb_h.path->bus->last_reset) && + (reset_ccb = xpt_alloc_ccb_nowait()) != NULL) { xpt_setup_ccb(&reset_ccb->ccb_h, request_ccb->ccb_h.path, CAM_PRIORITY_NONE); reset_ccb->ccb_h.func_code = XPT_RESET_BUS; From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:03:21 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id BE5A47C2; Sat, 14 Sep 2013 09:03:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id A9F1A2AB4; Sat, 14 Sep 2013 09:03:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E93Lg6092122; Sat, 14 Sep 2013 09:03:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E93Lcr092121; Sat, 14 Sep 2013 09:03:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140903.r8E93Lcr092121@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:03:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255545 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:03:21 -0000 Author: mav Date: Sat Sep 14 09:03:21 2013 New Revision: 255545 URL: http://svnweb.freebsd.org/changeset/base/255545 Log: MFC r253323: When printing opcode description, map T_NODEVICE to Direct Access Device to handle REPORT LUNS, etc. Modified: stable/9/sys/cam/scsi/scsi_all.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_all.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_all.c Sat Sep 14 09:01:42 2013 (r255544) +++ stable/9/sys/cam/scsi/scsi_all.c Sat Sep 14 09:03:21 2013 (r255545) @@ -665,6 +665,10 @@ scsi_op_desc(u_int16_t opcode, struct sc if (pd_type == T_RBC) pd_type = T_DIRECT; + /* Map NODEVICE to Direct Access Device to handle REPORT LUNS, etc. */ + if (pd_type == T_NODEVICE) + pd_type = T_DIRECT; + opmask = 1 << pd_type; for (j = 0; j < num_tables; j++) { From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:05:04 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 1A0F99E1; Sat, 14 Sep 2013 09:05:04 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 074CC2AC4; Sat, 14 Sep 2013 09:05:04 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E95361092622; Sat, 14 Sep 2013 09:05:03 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E953vv092621; Sat, 14 Sep 2013 09:05:03 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140905.r8E953vv092621@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:05:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255546 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:05:04 -0000 Author: mav Date: Sat Sep 14 09:05:03 2013 New Revision: 255546 URL: http://svnweb.freebsd.org/changeset/base/255546 Log: MFC r253721, r253722: Detect unsupported PREVENT ALLOW MEDIUM REMOVAL and SYNCHRONIZE CACHE(10) to not spam devices with useless commands and logs with errors. Modified: stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:03:21 2013 (r255545) +++ stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:05:03 2013 (r255546) @@ -2797,6 +2797,28 @@ cmd6workaround(union ccb *ccb) return (0); } + /* Detect unsupported PREVENT ALLOW MEDIUM REMOVAL. */ + if ((ccb->ccb_h.flags & CAM_CDB_POINTER) == 0 && + (*cdb == PREVENT_ALLOW) && + (softc->quirks & DA_Q_NO_PREVENT) == 0) { + if (bootverbose) + xpt_print(ccb->ccb_h.path, + "PREVENT ALLOW MEDIUM REMOVAL not supported.\n"); + softc->quirks |= DA_Q_NO_PREVENT; + return (0); + } + + /* Detect unsupported SYNCHRONIZE CACHE(10). */ + if ((ccb->ccb_h.flags & CAM_CDB_POINTER) == 0 && + (*cdb == SYNCHRONIZE_CACHE) && + (softc->quirks & DA_Q_NO_SYNC_CACHE) == 0) { + if (bootverbose) + xpt_print(ccb->ccb_h.path, + "SYNCHRONIZE CACHE(10) not supported.\n"); + softc->quirks |= DA_Q_NO_SYNC_CACHE; + return (0); + } + /* Translation only possible if CDB is an array and cmd is R/W6 */ if ((ccb->ccb_h.flags & CAM_CDB_POINTER) != 0 || (*cdb != READ_6 && *cdb != WRITE_6)) From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:06:32 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E35FDB21; Sat, 14 Sep 2013 09:06:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D01552AD2; Sat, 14 Sep 2013 09:06:32 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E96Wrk093159; Sat, 14 Sep 2013 09:06:32 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E96W7s093157; Sat, 14 Sep 2013 09:06:32 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140906.r8E96W7s093157@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255547 - in stable/9/sys/cam: ata scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:06:33 -0000 Author: mav Date: Sat Sep 14 09:06:32 2013 New Revision: 255547 URL: http://svnweb.freebsd.org/changeset/base/255547 Log: MFC r253724: Synchronize device cache on close only if there were some write operations. While these operations are not really needed otherwise, at least for SCSI they may cause extra errors if some other initiator holds write exclusive reservation on the LUN (SYNCHRONIZE CACHE handled as "write" operation). Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Sat Sep 14 09:05:03 2013 (r255546) +++ stable/9/sys/cam/ata/ata_da.c Sat Sep 14 09:06:32 2013 (r255547) @@ -88,7 +88,8 @@ typedef enum { ADA_FLAG_SCTX_INIT = 0x0200, ADA_FLAG_CAN_CFA = 0x0400, ADA_FLAG_CAN_POWERMGT = 0x0800, - ADA_FLAG_CAN_DMA48 = 0x1000 + ADA_FLAG_CAN_DMA48 = 0x1000, + ADA_FLAG_DIRTY = 0x2000 } ada_flags; typedef enum { @@ -613,6 +614,7 @@ adaclose(struct disk *dp) struct cam_periph *periph; struct ada_softc *softc; union ccb *ccb; + int error; periph = (struct cam_periph *)dp->d_drv1; cam_periph_lock(periph); @@ -628,7 +630,8 @@ adaclose(struct disk *dp) ("adaclose\n")); /* We only sync the cache if the drive is capable of it. */ - if ((softc->flags & ADA_FLAG_CAN_FLUSHCACHE) != 0 && + if ((softc->flags & ADA_FLAG_DIRTY) != 0 && + (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) != 0 && (softc->flags & ADA_FLAG_PACK_INVALID) == 0) { ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); @@ -645,11 +648,13 @@ adaclose(struct disk *dp) ata_48bit_cmd(&ccb->ataio, ATA_FLUSHCACHE48, 0, 0, 0); else ata_28bit_cmd(&ccb->ataio, ATA_FLUSHCACHE, 0, 0, 0); - cam_periph_runccb(ccb, adaerror, /*cam_flags*/0, + error = cam_periph_runccb(ccb, adaerror, /*cam_flags*/0, /*sense_flags*/0, softc->disk->d_devstat); - if ((ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) + if (error != 0) xpt_print(periph->path, "Synchronize cache failed\n"); + else + softc->flags &= ~ADA_FLAG_DIRTY; xpt_release_ccb(ccb); } @@ -1498,8 +1503,10 @@ adastart(struct cam_periph *periph, unio tag_code = 1; } switch (bp->bio_cmd) { - case BIO_READ: case BIO_WRITE: + softc->flags |= ADA_FLAG_DIRTY; + /* FALLTHROUGH */ + case BIO_READ: { uint64_t lba = bp->bio_pblkno; uint16_t count = bp->bio_bcount / softc->params.secsize; Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:05:03 2013 (r255546) +++ stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:06:32 2013 (r255547) @@ -90,7 +90,8 @@ typedef enum { DA_FLAG_OPEN = 0x100, DA_FLAG_SCTX_INIT = 0x200, DA_FLAG_CAN_RC16 = 0x400, - DA_FLAG_PROBED = 0x800 + DA_FLAG_PROBED = 0x800, + DA_FLAG_DIRTY = 0x1000 } da_flags; typedef enum { @@ -1249,6 +1250,7 @@ daclose(struct disk *dp) { struct cam_periph *periph; struct da_softc *softc; + int error; periph = (struct cam_periph *)dp->d_drv1; cam_periph_lock(periph); @@ -1263,8 +1265,9 @@ daclose(struct disk *dp) CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("daclose\n")); - if ((softc->quirks & DA_Q_NO_SYNC_CACHE) == 0 - && (softc->flags & DA_FLAG_PACK_INVALID) == 0) { + if ((softc->flags & DA_FLAG_DIRTY) != 0 && + (softc->quirks & DA_Q_NO_SYNC_CACHE) == 0 && + (softc->flags & DA_FLAG_PACK_INVALID) == 0) { union ccb *ccb; ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); @@ -1278,9 +1281,11 @@ daclose(struct disk *dp) SSD_FULL_SIZE, 5 * 60 * 1000); - cam_periph_runccb(ccb, daerror, /*cam_flags*/0, + error = cam_periph_runccb(ccb, daerror, /*cam_flags*/0, /*sense_flags*/SF_RETRY_UA | SF_QUIET_IR, softc->disk->d_devstat); + if (error == 0) + softc->flags &= ~DA_FLAG_DIRTY; xpt_release_ccb(ccb); } @@ -2252,8 +2257,10 @@ skipstate: } switch (bp->bio_cmd) { - case BIO_READ: case BIO_WRITE: + softc->flags |= DA_FLAG_DIRTY; + /* FALLTHROUGH */ + case BIO_READ: scsi_read_write(&start_ccb->csio, /*retries*/da_retry_count, /*cbfcnp*/dadone, From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:10:01 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 9DBD8C8E; Sat, 14 Sep 2013 09:10:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 8B0632AF3; Sat, 14 Sep 2013 09:10:01 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E9A14k094661; Sat, 14 Sep 2013 09:10:01 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E9A1Ve094660; Sat, 14 Sep 2013 09:10:01 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140910.r8E9A1Ve094660@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:10:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255548 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:10:01 -0000 Author: mav Date: Sat Sep 14 09:10:01 2013 New Revision: 255548 URL: http://svnweb.freebsd.org/changeset/base/255548 Log: MFC r253803: Add NO_RC16 quirk to make da driver avoid using READ CAPACITY(16) command if possible. Use it for Kingston JetFlash USB sticks, that are known to return garbage in response to that command. Modified: stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:06:32 2013 (r255547) +++ stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:10:01 2013 (r255548) @@ -99,7 +99,8 @@ typedef enum { DA_Q_NO_SYNC_CACHE = 0x01, DA_Q_NO_6_BYTE = 0x02, DA_Q_NO_PREVENT = 0x04, - DA_Q_4K = 0x08 + DA_Q_4K = 0x08, + DA_Q_NO_RC16 = 0x10 } da_quirks; #define DA_Q_BIT_STRING \ @@ -107,7 +108,8 @@ typedef enum { "\001NO_SYNC_CACHE" \ "\002NO_6_BYTE" \ "\003NO_PREVENT" \ - "\0044K" + "\0044K" \ + "\005NO_RC16" typedef enum { DA_CCB_PROBE_RC = 0x01, @@ -681,6 +683,11 @@ static struct da_quirk_entry da_quirk_ta {T_DIRECT, SIP_MEDIA_REMOVABLE, "Kingston", "DataTraveler G3", "1.00"}, /*quirks*/ DA_Q_NO_PREVENT }, + { + /* At least several Transcent USB sticks lie on RC16. */ + {T_DIRECT, SIP_MEDIA_REMOVABLE, "JetFlash", "Transcend*", + "*"}, /*quirks*/ DA_Q_NO_RC16 + }, /* ATA/SATA devices over SAS/USB/... */ { /* Hitachi Advanced Format (4k) drives */ @@ -2087,7 +2094,8 @@ daregister(struct cam_periph *periph, vo softc->minimum_cmd_size = 16; /* Predict whether device may support READ CAPACITY(16). */ - if (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC3) { + if (SID_ANSI_REV(&cgd->inq_data) >= SCSI_REV_SPC3 && + (softc->quirks & DA_Q_NO_RC16) == 0) { softc->flags |= DA_FLAG_CAN_RC16; softc->state = DA_STATE_PROBE_RC16; } From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:11:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C25B4DD4; Sat, 14 Sep 2013 09:11:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AF37B2B21; Sat, 14 Sep 2013 09:11:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E9BVmN097545; Sat, 14 Sep 2013 09:11:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E9BV8Y097544; Sat, 14 Sep 2013 09:11:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140911.r8E9BV8Y097544@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:11:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255549 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:11:31 -0000 Author: mav Date: Sat Sep 14 09:11:31 2013 New Revision: 255549 URL: http://svnweb.freebsd.org/changeset/base/255549 Log: MFC r254052: Improve r253721 by reporting detected lack of BIO_FLUSH support to GEOM. That prevents more of such requests from coming and errors from logging. Modified: stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:10:01 2013 (r255548) +++ stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:11:31 2013 (r255549) @@ -2831,6 +2831,7 @@ cmd6workaround(union ccb *ccb) xpt_print(ccb->ccb_h.path, "SYNCHRONIZE CACHE(10) not supported.\n"); softc->quirks |= DA_Q_NO_SYNC_CACHE; + softc->disk->d_flags &= ~DISKFLAG_CANFLUSHCACHE; return (0); } From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:19:28 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 8A345F61; Sat, 14 Sep 2013 09:19:28 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 771D82B54; Sat, 14 Sep 2013 09:19:28 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E9JSG9000243; Sat, 14 Sep 2013 09:19:28 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E9JSOQ000242; Sat, 14 Sep 2013 09:19:28 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140919.r8E9JSOQ000242@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:19:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255550 - stable/9/sys/cam X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:19:28 -0000 Author: mav Date: Sat Sep 14 09:19:27 2013 New Revision: 255550 URL: http://svnweb.freebsd.org/changeset/base/255550 Log: MFC r249008 (by trasz): Fix panic in the error path caused by recursive acquisition of XPT topology lock. Modified: stable/9/sys/cam/cam_periph.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_periph.c ============================================================================== --- stable/9/sys/cam/cam_periph.c Sat Sep 14 09:11:31 2013 (r255549) +++ stable/9/sys/cam/cam_periph.c Sat Sep 14 09:19:27 2013 (r255550) @@ -218,9 +218,9 @@ cam_periph_alloc(periph_ctor_t *periph_c } if (*p_drv == NULL) { printf("cam_periph_alloc: invalid periph name '%s'\n", name); + xpt_unlock_buses(); xpt_free_path(periph->path); free(periph, M_CAMPERIPH); - xpt_unlock_buses(); return (CAM_REQ_INVALID); } periph->unit_number = camperiphunit(*p_drv, path_id, target_id, lun_id); From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:24:41 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 785BA17D; Sat, 14 Sep 2013 09:24:41 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 641F22B9C; Sat, 14 Sep 2013 09:24:41 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E9OfW1004629; Sat, 14 Sep 2013 09:24:41 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E9OfQ3004628; Sat, 14 Sep 2013 09:24:41 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140924.r8E9OfQ3004628@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:24:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255551 - stable/9/sys/cam/ctl X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:24:41 -0000 Author: mav Date: Sat Sep 14 09:24:40 2013 New Revision: 255551 URL: http://svnweb.freebsd.org/changeset/base/255551 Log: MFC r249194 (by trasz): Make SYNCHRONIZE CACHE work with LUNs backed by device files (as opposed to regular files, which already worked fine). With this change, it's no longer neccessary to use "ctladm realsync off" workaround. Modified: stable/9/sys/cam/ctl/ctl_backend_block.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ctl/ctl_backend_block.c ============================================================================== --- stable/9/sys/cam/ctl/ctl_backend_block.c Sat Sep 14 09:19:27 2013 (r255550) +++ stable/9/sys/cam/ctl/ctl_backend_block.c Sat Sep 14 09:24:40 2013 (r255551) @@ -956,6 +956,7 @@ ctl_be_block_cw_dispatch(struct ctl_be_b switch (io->scsiio.cdb[0]) { case SYNCHRONIZE_CACHE: case SYNCHRONIZE_CACHE_16: + beio->bio_cmd = BIO_FLUSH; beio->ds_trans_type = DEVSTAT_NO_DATA; beio->ds_tag_type = DEVSTAT_TAG_ORDERED; beio->io_len = 0; From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:34:26 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id B2FB5403; Sat, 14 Sep 2013 09:34:26 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 912702C05; Sat, 14 Sep 2013 09:34:26 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E9YQVd010206; Sat, 14 Sep 2013 09:34:26 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E9YQPA010204; Sat, 14 Sep 2013 09:34:26 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140934.r8E9YQPA010204@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:34:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255552 - in stable/9/sys/cam: ata scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:34:26 -0000 Author: mav Date: Sat Sep 14 09:34:25 2013 New Revision: 255552 URL: http://svnweb.freebsd.org/changeset/base/255552 Log: MFC r249981: Remove ADA_FLAG_PACK_INVALID flag. Since ATA disks have no concept of media change it only duplicates CAM_PERIPH_INVALID flag, so we can use last one. Slightly cleanup DA_FLAG_PACK_INVALID use. Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Sat Sep 14 09:24:40 2013 (r255551) +++ stable/9/sys/cam/ata/ata_da.c Sat Sep 14 09:34:25 2013 (r255552) @@ -76,7 +76,6 @@ typedef enum { } ada_state; typedef enum { - ADA_FLAG_PACK_INVALID = 0x0001, ADA_FLAG_CAN_48BIT = 0x0002, ADA_FLAG_CAN_FLUSHCACHE = 0x0004, ADA_FLAG_CAN_NCQ = 0x0008, @@ -592,16 +591,11 @@ adaopen(struct disk *dp) return (error); } - softc = (struct ada_softc *)periph->softc; - softc->flags |= ADA_FLAG_OPEN; - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("adaopen\n")); - if ((softc->flags & ADA_FLAG_PACK_INVALID) != 0) { - /* Invalidate our pack information. */ - softc->flags &= ~ADA_FLAG_PACK_INVALID; - } + softc = (struct ada_softc *)periph->softc; + softc->flags |= ADA_FLAG_OPEN; cam_periph_unhold(periph); cam_periph_unlock(periph); @@ -632,7 +626,7 @@ adaclose(struct disk *dp) /* We only sync the cache if the drive is capable of it. */ if ((softc->flags & ADA_FLAG_DIRTY) != 0 && (softc->flags & ADA_FLAG_CAN_FLUSHCACHE) != 0 && - (softc->flags & ADA_FLAG_PACK_INVALID) == 0) { + (periph->flags & CAM_PERIPH_INVALID) == 0) { ccb = cam_periph_getccb(periph, CAM_PRIORITY_NORMAL); cam_fill_ataio(&ccb->ataio, @@ -709,7 +703,7 @@ adastrategy(struct bio *bp) /* * If the device has been made invalid, error out */ - if ((softc->flags & ADA_FLAG_PACK_INVALID)) { + if ((periph->flags & CAM_PERIPH_INVALID) != 0) { cam_periph_unlock(periph); biofinish(bp, NULL, ENXIO); return; @@ -760,7 +754,7 @@ adadump(void *arg, void *virtual, vm_off lba = offset / secsize; count = length / secsize; - if ((softc->flags & ADA_FLAG_PACK_INVALID) != 0) { + if ((periph->flags & CAM_PERIPH_INVALID) != 0) { cam_periph_unlock(periph); return (ENXIO); } @@ -885,8 +879,6 @@ adaoninvalidate(struct cam_periph *perip */ xpt_register_async(0, adaasync, periph, periph->path); - softc->flags |= ADA_FLAG_PACK_INVALID; - /* * Return all queued I/O with ENXIO. * XXX Handle any transactions queued to the card @@ -1050,7 +1042,7 @@ adasysctlinit(void *context, int pending periph = (struct cam_periph *)context; /* periph was held for us when this task was enqueued */ - if (periph->flags & CAM_PERIPH_INVALID) { + if ((periph->flags & CAM_PERIPH_INVALID) != 0) { cam_periph_release(periph); return; } @@ -1664,7 +1656,7 @@ out: case ADA_STATE_RAHEAD: case ADA_STATE_WCACHE: { - if (softc->flags & ADA_FLAG_PACK_INVALID) { + if ((periph->flags & CAM_PERIPH_INVALID) != 0) { softc->state = ADA_STATE_NORMAL; xpt_release_ccb(start_ccb); cam_release_devq(periph->path, @@ -1726,20 +1718,6 @@ adadone(struct cam_periph *periph, union return; } if (error != 0) { - if (error == ENXIO && - (softc->flags & ADA_FLAG_PACK_INVALID) == 0) { - /* - * Catastrophic error. Mark our pack as - * invalid. - */ - /* - * XXX See if this is really a media - * XXX change first? - */ - xpt_print(periph->path, - "Invalidating pack\n"); - softc->flags |= ADA_FLAG_PACK_INVALID; - } bp->bio_error = error; bp->bio_resid = bp->bio_bcount; bp->bio_flags |= BIO_ERROR; Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:24:40 2013 (r255551) +++ stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:34:25 2013 (r255552) @@ -1194,7 +1194,6 @@ daopen(struct disk *dp) { struct cam_periph *periph; struct da_softc *softc; - int unit; int error; periph = (struct cam_periph *)dp->d_drv1; @@ -1209,17 +1208,12 @@ daopen(struct disk *dp) return (error); } - unit = periph->unit_number; - softc = (struct da_softc *)periph->softc; - softc->flags |= DA_FLAG_OPEN; - CAM_DEBUG(periph->path, CAM_DEBUG_TRACE | CAM_DEBUG_PERIPH, ("daopen\n")); - if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) { - /* Invalidate our pack information. */ - softc->flags &= ~DA_FLAG_PACK_INVALID; - } + softc = (struct da_softc *)periph->softc; + softc->flags |= DA_FLAG_OPEN; + softc->flags &= ~DA_FLAG_PACK_INVALID; dareprobe(periph); @@ -2976,11 +2970,6 @@ dadone(struct cam_periph *periph, union if (softc->outstanding_cmds == 0) softc->flags |= DA_FLAG_WENT_IDLE; - if ((softc->flags & DA_FLAG_PACK_INVALID) != 0) { - xpt_print(periph->path, "oustanding %d\n", - softc->outstanding_cmds); - } - if (state == DA_CCB_DELETE) { while ((bp1 = bioq_takefirst(&softc->delete_run_queue)) != NULL) { From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:37:22 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id E6DEF55E; Sat, 14 Sep 2013 09:37:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id D45F92C1B; Sat, 14 Sep 2013 09:37:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E9bLkU010887; Sat, 14 Sep 2013 09:37:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E9bLGQ010886; Sat, 14 Sep 2013 09:37:21 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140937.r8E9bLGQ010886@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:37:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255553 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:37:22 -0000 Author: mav Date: Sat Sep 14 09:37:21 2013 New Revision: 255553 URL: http://svnweb.freebsd.org/changeset/base/255553 Log: MFC r250208: Tune support for removable media in da driver: - remove DA_FLAG_SAW_MEDIA flag, almost opposite to DA_FLAG_PACK_INVALID, using the last instead. - allow opening device with no media present, reporting zero media size and non-zero sector size, as geom/notes suggests. That allow to read device attributes and potentially do other things, not related to media. Modified: stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:34:25 2013 (r255552) +++ stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:37:21 2013 (r255553) @@ -83,7 +83,6 @@ typedef enum { DA_FLAG_NEW_PACK = 0x002, DA_FLAG_PACK_LOCKED = 0x004, DA_FLAG_PACK_REMOVABLE = 0x008, - DA_FLAG_SAW_MEDIA = 0x010, DA_FLAG_NEED_OTAG = 0x020, DA_FLAG_WENT_IDLE = 0x040, DA_FLAG_RETRY_UA = 0x080, @@ -1212,9 +1211,6 @@ daopen(struct disk *dp) ("daopen\n")); softc = (struct da_softc *)periph->softc; - softc->flags |= DA_FLAG_OPEN; - softc->flags &= ~DA_FLAG_PACK_INVALID; - dareprobe(periph); /* Wait for the disk size update. */ @@ -1223,25 +1219,23 @@ daopen(struct disk *dp) if (error != 0) xpt_print(periph->path, "unable to retrieve capacity data"); - if (periph->flags & CAM_PERIPH_INVALID || - softc->disk->d_sectorsize == 0 || - softc->disk->d_mediasize == 0) + if (periph->flags & CAM_PERIPH_INVALID) error = ENXIO; if (error == 0 && (softc->flags & DA_FLAG_PACK_REMOVABLE) != 0 && (softc->quirks & DA_Q_NO_PREVENT) == 0) daprevent(periph, PR_PREVENT); - if (error == 0) - softc->flags |= DA_FLAG_SAW_MEDIA; + if (error == 0) { + softc->flags &= ~DA_FLAG_PACK_INVALID; + softc->flags |= DA_FLAG_OPEN; + } cam_periph_unhold(periph); cam_periph_unlock(periph); - if (error != 0) { - softc->flags &= ~DA_FLAG_OPEN; + if (error != 0) cam_periph_release(periph); - } return (error); } @@ -3045,9 +3039,10 @@ dadone(struct cam_periph *periph, union * here. */ if (block_size == 0 && maxsector == 0) { - snprintf(announce_buf, sizeof(announce_buf), - "0MB (no media?)"); - } else if (block_size >= MAXPHYS || block_size == 0) { + block_size = 512; + maxsector = -1; + } + if (block_size >= MAXPHYS || block_size == 0) { xpt_print(periph->path, "unsupportable block size %ju\n", (uintmax_t) block_size); @@ -3147,6 +3142,7 @@ dadone(struct cam_periph *periph, union const char *sense_key_desc; const char *asc_desc; + dasetgeom(periph, 512, -1, NULL, 0); scsi_sense_desc(sense_key, asc, ascq, &cgd.inq_data, &sense_key_desc, @@ -3525,8 +3521,8 @@ daerror(union ccb *ccb, u_int32_t cam_fl asc == 0x28 && ascq == 0x00) disk_media_changed(softc->disk, M_NOWAIT); else if (sense_key == SSD_KEY_NOT_READY && - asc == 0x3a && (softc->flags & DA_FLAG_SAW_MEDIA)) { - softc->flags &= ~DA_FLAG_SAW_MEDIA; + asc == 0x3a && (softc->flags & DA_FLAG_PACK_INVALID) == 0) { + softc->flags |= DA_FLAG_PACK_INVALID; disk_media_gone(softc->disk, M_NOWAIT); } } From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:40:24 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id DE48C6AD; Sat, 14 Sep 2013 09:40:24 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CBB712C35; Sat, 14 Sep 2013 09:40:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E9eOt2011701; Sat, 14 Sep 2013 09:40:24 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E9eO7N011699; Sat, 14 Sep 2013 09:40:24 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140940.r8E9eO7N011699@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:40:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255554 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:40:25 -0000 Author: mav Date: Sat Sep 14 09:40:24 2013 New Revision: 255554 URL: http://svnweb.freebsd.org/changeset/base/255554 Log: MFC r250557: Suppress error printing for "PREVENT ALLOW MEDIUM REMOVAL" on da open. Change at r250208 exposed more errors here, hidden before. The same flag is used in cd driver. Modified: stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:37:21 2013 (r255553) +++ stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:40:24 2013 (r255554) @@ -3583,7 +3583,7 @@ daprevent(struct cam_periph *periph, int 5000); error = cam_periph_runccb(ccb, daerror, CAM_RETRY_SELTO, - SF_RETRY_UA | SF_QUIET_IR, softc->disk->d_devstat); + SF_RETRY_UA | SF_NO_PRINT, softc->disk->d_devstat); if (error == 0) { if (action == PR_ALLOW) From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:42:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id A9DE9991; Sat, 14 Sep 2013 09:42:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 87EB02C63; Sat, 14 Sep 2013 09:42:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E9g2WQ014390; Sat, 14 Sep 2013 09:42:02 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E9g2Sb014388; Sat, 14 Sep 2013 09:42:02 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140942.r8E9g2Sb014388@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:42:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255555 - in stable/9/sys/cam: ata scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:42:02 -0000 Author: mav Date: Sat Sep 14 09:42:01 2013 New Revision: 255555 URL: http://svnweb.freebsd.org/changeset/base/255555 Log: MFC r253752: Fix returning incorrect bio_resid value with failed BIO_DELETE requests. Neither residual length reported for ATA/SCSI command nor one from another BIO_DELETE request are in any way related to the value to be returned. Modified: stable/9/sys/cam/ata/ata_da.c stable/9/sys/cam/scsi/scsi_da.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ata/ata_da.c ============================================================================== --- stable/9/sys/cam/ata/ata_da.c Sat Sep 14 09:40:24 2013 (r255554) +++ stable/9/sys/cam/ata/ata_da.c Sat Sep 14 09:42:01 2013 (r255555) @@ -1696,37 +1696,27 @@ adadone(struct cam_periph *periph, union struct ada_softc *softc; struct ccb_ataio *ataio; struct ccb_getdev *cgd; + int state; softc = (struct ada_softc *)periph->softc; ataio = &done_ccb->ataio; CAM_DEBUG(periph->path, CAM_DEBUG_TRACE, ("adadone\n")); - switch (ataio->ccb_h.ccb_state & ADA_CCB_TYPE_MASK) { + state = ataio->ccb_h.ccb_state & ADA_CCB_TYPE_MASK; + switch (state) { case ADA_CCB_BUFFER_IO: case ADA_CCB_TRIM: { struct bio *bp; + int error; - bp = (struct bio *)done_ccb->ccb_h.ccb_bp; if ((done_ccb->ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) { - int error; - error = adaerror(done_ccb, 0, 0); if (error == ERESTART) { /* A retry was scheduled, so just return. */ return; } - if (error != 0) { - bp->bio_error = error; - bp->bio_resid = bp->bio_bcount; - bp->bio_flags |= BIO_ERROR; - } else { - bp->bio_resid = ataio->resid; - bp->bio_error = 0; - if (bp->bio_resid != 0) - bp->bio_flags |= BIO_ERROR; - } if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) cam_release_devq(done_ccb->ccb_h.path, /*relsim_flags*/0, @@ -1736,26 +1726,38 @@ adadone(struct cam_periph *periph, union } else { if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) panic("REQ_CMP with QFRZN"); - bp->bio_resid = ataio->resid; - if (ataio->resid > 0) + error = 0; + } + bp = (struct bio *)done_ccb->ccb_h.ccb_bp; + bp->bio_error = error; + if (error != 0) { + bp->bio_resid = bp->bio_bcount; + bp->bio_flags |= BIO_ERROR; + } else { + if (state == ADA_CCB_TRIM) + bp->bio_resid = 0; + else + bp->bio_resid = ataio->resid; + if (bp->bio_resid > 0) bp->bio_flags |= BIO_ERROR; } softc->outstanding_cmds--; if (softc->outstanding_cmds == 0) softc->flags |= ADA_FLAG_WENT_IDLE; - if ((ataio->ccb_h.ccb_state & ADA_CCB_TYPE_MASK) == - ADA_CCB_TRIM) { + if (state == ADA_CCB_TRIM) { struct trim_request *req = (struct trim_request *)ataio->data_ptr; int i; for (i = 1; i < TRIM_MAX_BIOS && req->bps[i]; i++) { struct bio *bp1 = req->bps[i]; - - bp1->bio_resid = bp->bio_resid; + bp1->bio_error = bp->bio_error; - if (bp->bio_flags & BIO_ERROR) + if (bp->bio_flags & BIO_ERROR) { bp1->bio_flags |= BIO_ERROR; + bp1->bio_resid = bp1->bio_bcount; + } else + bp1->bio_resid = 0; biodone(bp1); } softc->trim_running = 0; Modified: stable/9/sys/cam/scsi/scsi_da.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:40:24 2013 (r255554) +++ stable/9/sys/cam/scsi/scsi_da.c Sat Sep 14 09:42:01 2013 (r255555) @@ -2929,7 +2929,10 @@ dadone(struct cam_periph *periph, union bp->bio_flags |= BIO_ERROR; } } else if (bp != NULL) { - bp->bio_resid = csio->resid; + if (state == DA_CCB_DELETE) + bp->bio_resid = 0; + else + bp->bio_resid = csio->resid; bp->bio_error = 0; if (bp->bio_resid != 0) bp->bio_flags |= BIO_ERROR; @@ -2943,7 +2946,10 @@ dadone(struct cam_periph *periph, union } else if (bp != NULL) { if ((done_ccb->ccb_h.status & CAM_DEV_QFRZN) != 0) panic("REQ_CMP with QFRZN"); - bp->bio_resid = csio->resid; + if (state == DA_CCB_DELETE) + bp->bio_resid = 0; + else + bp->bio_resid = csio->resid; if (csio->resid > 0) bp->bio_flags |= BIO_ERROR; if (softc->error_inject != 0) { @@ -2952,7 +2958,6 @@ dadone(struct cam_periph *periph, union bp->bio_flags |= BIO_ERROR; softc->error_inject = 0; } - } /* @@ -2967,10 +2972,12 @@ dadone(struct cam_periph *periph, union if (state == DA_CCB_DELETE) { while ((bp1 = bioq_takefirst(&softc->delete_run_queue)) != NULL) { - bp1->bio_resid = bp->bio_resid; bp1->bio_error = bp->bio_error; - if (bp->bio_flags & BIO_ERROR) + if (bp->bio_flags & BIO_ERROR) { bp1->bio_flags |= BIO_ERROR; + bp1->bio_resid = bp1->bio_bcount; + } else + bp1->bio_resid = 0; biodone(bp1); } softc->delete_running = 0; From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:49:19 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D7BF0B1D; Sat, 14 Sep 2013 09:49:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id AA73A2C8F; Sat, 14 Sep 2013 09:49:19 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E9nJcp017269; Sat, 14 Sep 2013 09:49:19 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E9nJsn017267; Sat, 14 Sep 2013 09:49:19 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140949.r8E9nJsn017267@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:49:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255556 - in stable/9/sys: cam geom X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:49:19 -0000 Author: mav Date: Sat Sep 14 09:49:18 2013 New Revision: 255556 URL: http://svnweb.freebsd.org/changeset/base/255556 Log: MFC r254766: Add new attribute lunname to report only textual LUN-specific device IDs. While lunid attribute prefers to report numeric ones, having both may be useful in some situations. Modified: stable/9/sys/cam/cam_xpt.c stable/9/sys/geom/geom_disk.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/cam_xpt.c ============================================================================== --- stable/9/sys/cam/cam_xpt.c Sat Sep 14 09:42:01 2013 (r255555) +++ stable/9/sys/cam/cam_xpt.c Sat Sep 14 09:49:18 2013 (r255556) @@ -1157,7 +1157,8 @@ xpt_getattr(char *buf, size_t len, const cdai.buftype = CDAI_TYPE_SERIAL_NUM; else if (!strcmp(attr, "GEOM::physpath")) cdai.buftype = CDAI_TYPE_PHYS_PATH; - else if (!strcmp(attr, "GEOM::lunid")) { + else if (strcmp(attr, "GEOM::lunid") == 0 || + strcmp(attr, "GEOM::lunname") == 0) { cdai.buftype = CDAI_TYPE_SCSI_DEVID; cdai.bufsiz = CAM_SCSI_DEVID_MAXLEN; } else @@ -1174,11 +1175,14 @@ xpt_getattr(char *buf, size_t len, const if (cdai.provsiz == 0) goto out; if (cdai.buftype == CDAI_TYPE_SCSI_DEVID) { - idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, - cdai.provsiz, scsi_devid_is_lun_naa); - if (idd == NULL) + if (strcmp(attr, "GEOM::lunid") == 0) { idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, - cdai.provsiz, scsi_devid_is_lun_eui64); + cdai.provsiz, scsi_devid_is_lun_naa); + if (idd == NULL) + idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, + cdai.provsiz, scsi_devid_is_lun_eui64); + } else + idd = NULL; if (idd == NULL) idd = scsi_get_devid((struct scsi_vpd_device_id *)cdai.buf, cdai.provsiz, scsi_devid_is_lun_t10); Modified: stable/9/sys/geom/geom_disk.c ============================================================================== --- stable/9/sys/geom/geom_disk.c Sat Sep 14 09:42:01 2013 (r255555) +++ stable/9/sys/geom/geom_disk.c Sat Sep 14 09:49:18 2013 (r255556) @@ -466,6 +466,12 @@ g_disk_dumpconf(struct sbuf *sb, const c if (dp->d_getattr(bp) == 0) sbuf_printf(sb, "%s%s\n", indent, buf); + bp->bio_attribute = "GEOM::lunname"; + bp->bio_length = DISK_IDENT_SIZE; + bp->bio_data = buf; + if (dp->d_getattr(bp) == 0) + sbuf_printf(sb, "%s%s\n", + indent, buf); g_destroy_bio(bp); g_free(buf); } else From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:50:45 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 3ED9FC4F; Sat, 14 Sep 2013 09:50:45 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 2B8112C97; Sat, 14 Sep 2013 09:50:45 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E9ojla019396; Sat, 14 Sep 2013 09:50:45 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E9oj1k019395; Sat, 14 Sep 2013 09:50:45 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140950.r8E9oj1k019395@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:50:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255557 - stable/9/sys/cam/ctl X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:50:45 -0000 Author: mav Date: Sat Sep 14 09:50:44 2013 New Revision: 255557 URL: http://svnweb.freebsd.org/changeset/base/255557 Log: MFC r255117: Fix the build with CTLFEDEBUG, broken by unmapped I/O support changes. Modified: stable/9/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/9/sys/cam/ctl/scsi_ctl.c Sat Sep 14 09:49:18 2013 (r255556) +++ stable/9/sys/cam/ctl/scsi_ctl.c Sat Sep 14 09:50:44 2013 (r255557) @@ -962,23 +962,23 @@ ctlfestart(struct cam_periph *periph, un /* * Valid combinations: - * - CAM_SEND_STATUS, SCATTER_VALID = 0, dxfer_len = 0, + * - CAM_SEND_STATUS, CAM_DATA_SG = 0, dxfer_len = 0, * sglist_cnt = 0 - * - CAM_SEND_STATUS = 0, SCATTER_VALID = 0, dxfer_len != 0, + * - CAM_SEND_STATUS = 0, CAM_DATA_SG = 0, dxfer_len != 0, * sglist_cnt = 0 - * - CAM_SEND_STATUS = 0, SCATTER_VALID, dxfer_len != 0, + * - CAM_SEND_STATUS = 0, CAM_DATA_SG, dxfer_len != 0, * sglist_cnt != 0 */ #ifdef CTLFEDEBUG if (((flags & CAM_SEND_STATUS) - && (((flags & CAM_SCATTER_VALID) != 0) + && (((flags & CAM_DATA_SG) != 0) || (dxfer_len != 0) || (csio->sglist_cnt != 0))) || (((flags & CAM_SEND_STATUS) == 0) && (dxfer_len == 0)) - || ((flags & CAM_SCATTER_VALID) + || ((flags & CAM_DATA_SG) && (csio->sglist_cnt == 0)) - || (((flags & CAM_SCATTER_VALID) == 0) + || (((flags & CAM_DATA_SG) == 0) && (csio->sglist_cnt != 0))) { printf("%s: tag %04x cdb %02x flags %#x dxfer_len " "%d sg %u\n", __func__, atio->tag_id, From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 09:52:31 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id C9624EC3; Sat, 14 Sep 2013 09:52:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 51CD02CCE; Sat, 14 Sep 2013 09:52:31 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8E9qV7X020203; Sat, 14 Sep 2013 09:52:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8E9qVTj020202; Sat, 14 Sep 2013 09:52:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309140952.r8E9qVTj020202@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 09:52:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255559 - stable/9/sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 09:52:31 -0000 Author: mav Date: Sat Sep 14 09:52:30 2013 New Revision: 255559 URL: http://svnweb.freebsd.org/changeset/base/255559 Log: MFC r255118: Fix targbh crash on XPT_IMMED_NOTIFY error during attach. Modified: stable/9/sys/cam/scsi/scsi_targ_bh.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/cam/scsi/scsi_targ_bh.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_targ_bh.c Sat Sep 14 09:50:45 2013 (r255558) +++ stable/9/sys/cam/scsi/scsi_targ_bh.c Sat Sep 14 09:52:30 2013 (r255559) @@ -283,16 +283,13 @@ targbhenlun(struct cam_periph *periph) xpt_setup_ccb(&atio->ccb_h, periph->path, CAM_PRIORITY_NORMAL); atio->ccb_h.func_code = XPT_ACCEPT_TARGET_IO; atio->ccb_h.cbfcnp = targbhdone; - xpt_action((union ccb *)atio); - status = atio->ccb_h.status; - if (status != CAM_REQ_INPROG) { - targbhfreedescr(atio->ccb_h.ccb_descr); - free(atio, M_SCSIBH); - break; - } ((struct targbh_cmd_desc*)atio->ccb_h.ccb_descr)->atio_link = softc->accept_tio_list; softc->accept_tio_list = atio; + xpt_action((union ccb *)atio); + status = atio->ccb_h.status; + if (status != CAM_REQ_INPROG) + break; } if (i == 0) { @@ -321,14 +318,12 @@ targbhenlun(struct cam_periph *periph) xpt_setup_ccb(&inot->ccb_h, periph->path, CAM_PRIORITY_NORMAL); inot->ccb_h.func_code = XPT_IMMED_NOTIFY; inot->ccb_h.cbfcnp = targbhdone; + SLIST_INSERT_HEAD(&softc->immed_notify_slist, &inot->ccb_h, + periph_links.sle); xpt_action((union ccb *)inot); status = inot->ccb_h.status; - if (status != CAM_REQ_INPROG) { - free(inot, M_SCSIBH); + if (status != CAM_REQ_INPROG) break; - } - SLIST_INSERT_HEAD(&softc->immed_notify_slist, &inot->ccb_h, - periph_links.sle); } if (i == 0) { @@ -413,7 +408,9 @@ targbhctor(struct cam_periph *periph, vo periph->softc = softc; softc->init_level++; - return (targbhenlun(periph)); + if (targbhenlun(periph) != CAM_REQ_CMP) + cam_periph_invalidate(periph); + return (CAM_REQ_CMP); } static void From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 10:00:21 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 55A855C9; Sat, 14 Sep 2013 10:00:21 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3420D2D35; Sat, 14 Sep 2013 10:00:21 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8EA0Lcb023929; Sat, 14 Sep 2013 10:00:21 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8EA0KUd023924; Sat, 14 Sep 2013 10:00:20 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309141000.r8EA0KUd023924@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 10:00:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255562 - in stable/9: share/examples/scsi_target sys/cam/scsi X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 10:00:21 -0000 Author: mav Date: Sat Sep 14 10:00:20 2013 New Revision: 255562 URL: http://svnweb.freebsd.org/changeset/base/255562 Log: MFC r255120: Bring legacy CAM target implementation back into API/KPI-coherent and even functional state. While CTL is much more superior target from all points, there is no reason why this code should not work. Modified: stable/9/share/examples/scsi_target/scsi_target.c stable/9/sys/cam/scsi/scsi_targ_bh.c stable/9/sys/cam/scsi/scsi_target.c Directory Properties: stable/9/share/examples/scsi_target/ (props changed) stable/9/sys/ (props changed) Modified: stable/9/share/examples/scsi_target/scsi_target.c ============================================================================== --- stable/9/share/examples/scsi_target/scsi_target.c Sat Sep 14 09:53:57 2013 (r255561) +++ stable/9/share/examples/scsi_target/scsi_target.c Sat Sep 14 10:00:20 2013 (r255562) @@ -371,7 +371,7 @@ init_ccbs() for (i = 0; i < MAX_INITIATORS; i++) { struct ccb_accept_tio *atio; struct atio_descr *a_descr; - struct ccb_immed_notify *inot; + struct ccb_immediate_notify *inot; atio = (struct ccb_accept_tio *)malloc(sizeof(*atio)); if (atio == NULL) { @@ -388,7 +388,7 @@ init_ccbs() atio->ccb_h.targ_descr = a_descr; send_ccb((union ccb *)atio, /*priority*/1); - inot = (struct ccb_immed_notify *)malloc(sizeof(*inot)); + inot = (struct ccb_immediate_notify *)malloc(sizeof(*inot)); if (inot == NULL) { warn("malloc INOT"); return (-1); @@ -599,7 +599,7 @@ handle_read() oo += run_queue(c_descr->atio); break; } - case XPT_IMMED_NOTIFY: + case XPT_IMMEDIATE_NOTIFY: /* INOTs are handled with priority */ TAILQ_INSERT_HEAD(&work_queue, &ccb->ccb_h, periph_links.tqe); @@ -909,7 +909,7 @@ free_ccb(union ccb *ccb) case XPT_ACCEPT_TARGET_IO: free(ccb->ccb_h.targ_descr); /* FALLTHROUGH */ - case XPT_IMMED_NOTIFY: + case XPT_IMMEDIATE_NOTIFY: default: free(ccb); break; Modified: stable/9/sys/cam/scsi/scsi_targ_bh.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_targ_bh.c Sat Sep 14 09:53:57 2013 (r255561) +++ stable/9/sys/cam/scsi/scsi_targ_bh.c Sat Sep 14 10:00:20 2013 (r255562) @@ -305,10 +305,10 @@ targbhenlun(struct cam_periph *periph) * so the SIM can tell us of asynchronous target mode events. */ for (i = 0; i < MAX_ACCEPT; i++) { - struct ccb_immed_notify *inot; + struct ccb_immediate_notify *inot; - inot = (struct ccb_immed_notify*)malloc(sizeof(*inot), M_SCSIBH, - M_NOWAIT); + inot = (struct ccb_immediate_notify*)malloc(sizeof(*inot), + M_SCSIBH, M_NOWAIT); if (inot == NULL) { status = CAM_RESRC_UNAVAIL; @@ -316,7 +316,7 @@ targbhenlun(struct cam_periph *periph) } xpt_setup_ccb(&inot->ccb_h, periph->path, CAM_PRIORITY_NORMAL); - inot->ccb_h.func_code = XPT_IMMED_NOTIFY; + inot->ccb_h.func_code = XPT_IMMEDIATE_NOTIFY; inot->ccb_h.cbfcnp = targbhdone; SLIST_INSERT_HEAD(&softc->immed_notify_slist, &inot->ccb_h, periph_links.sle); @@ -712,7 +712,7 @@ targbhdone(struct cam_periph *periph, un } break; } - case XPT_IMMED_NOTIFY: + case XPT_IMMEDIATE_NOTIFY: { int frozen; Modified: stable/9/sys/cam/scsi/scsi_target.c ============================================================================== --- stable/9/sys/cam/scsi/scsi_target.c Sat Sep 14 09:53:57 2013 (r255561) +++ stable/9/sys/cam/scsi/scsi_target.c Sat Sep 14 10:00:20 2013 (r255562) @@ -590,6 +590,7 @@ targwrite(struct cdev *dev, struct uio * switch (func_code) { case XPT_ACCEPT_TARGET_IO: case XPT_IMMED_NOTIFY: + case XPT_IMMEDIATE_NOTIFY: cam_periph_lock(softc->periph); ccb = targgetccb(softc, func_code, priority); descr = (struct targ_cmd_descr *)ccb->ccb_h.targ_descr; @@ -820,6 +821,7 @@ targdone(struct cam_periph *periph, unio switch (done_ccb->ccb_h.func_code) { /* All FC_*_QUEUED CCBs go back to userland */ case XPT_IMMED_NOTIFY: + case XPT_IMMEDIATE_NOTIFY: case XPT_ACCEPT_TARGET_IO: case XPT_CONT_TARGET_IO: TAILQ_INSERT_TAIL(&softc->user_ccb_queue, &done_ccb->ccb_h, @@ -1000,6 +1002,7 @@ targfreeccb(struct targ_softc *softc, un switch (ccb->ccb_h.func_code) { case XPT_ACCEPT_TARGET_IO: case XPT_IMMED_NOTIFY: + case XPT_IMMEDIATE_NOTIFY: CAM_DEBUG_PRINT(CAM_DEBUG_PERIPH, ("freeing ccb %p\n", ccb)); free(ccb, M_TARG); break; @@ -1182,6 +1185,9 @@ targccblen(xpt_opcode func_code) case XPT_IMMED_NOTIFY: len = sizeof(struct ccb_immed_notify); break; + case XPT_IMMEDIATE_NOTIFY: + len = sizeof(struct ccb_immediate_notify); + break; case XPT_REL_SIMQ: len = sizeof(struct ccb_relsim); break; From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 10:08:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 376C9818; Sat, 14 Sep 2013 10:08:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 140262D7F; Sat, 14 Sep 2013 10:08:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8EA89i9028360; Sat, 14 Sep 2013 10:08:09 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8EA89Pe028358; Sat, 14 Sep 2013 10:08:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309141008.r8EA89Pe028358@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 10:08:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255563 - stable/9/sys/geom/raid X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 10:08:10 -0000 Author: mav Date: Sat Sep 14 10:08:09 2013 New Revision: 255563 URL: http://svnweb.freebsd.org/changeset/base/255563 Log: MFC r253706: Introduce 3 seconds timeout on `graid stop` command (mostly with -f flag). Since completion waiting goes in g_event thread, it may cause GEOM deadlock if consumer on top (for example, ZFS) uses g_event thread for closing. Modified: stable/9/sys/geom/raid/g_raid.c stable/9/sys/geom/raid/g_raid_ctl.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/raid/g_raid.c ============================================================================== --- stable/9/sys/geom/raid/g_raid.c Sat Sep 14 10:00:20 2013 (r255562) +++ stable/9/sys/geom/raid/g_raid.c Sat Sep 14 10:08:09 2013 (r255563) @@ -2171,7 +2171,7 @@ g_raid_destroy_disk(struct g_raid_disk * int g_raid_destroy(struct g_raid_softc *sc, int how) { - int opens; + int error, opens; g_topology_assert_not(); if (sc == NULL) @@ -2188,11 +2188,13 @@ g_raid_destroy(struct g_raid_softc *sc, G_RAID_DEBUG1(1, sc, "%d volumes are still open.", opens); + sx_xunlock(&sc->sc_lock); return (EBUSY); case G_RAID_DESTROY_DELAYED: G_RAID_DEBUG1(1, sc, "Array will be destroyed on last close."); sc->sc_stopping = G_RAID_DESTROY_DELAYED; + sx_xunlock(&sc->sc_lock); return (EBUSY); case G_RAID_DESTROY_HARD: G_RAID_DEBUG1(1, sc, @@ -2206,9 +2208,9 @@ g_raid_destroy(struct g_raid_softc *sc, /* Wake up worker to let it selfdestruct. */ g_raid_event_send(sc, G_RAID_NODE_E_WAKE, 0); /* Sleep until node destroyed. */ - sx_sleep(&sc->sc_stopping, &sc->sc_lock, - PRIBIO | PDROP, "r:destroy", 0); - return (0); + error = sx_sleep(&sc->sc_stopping, &sc->sc_lock, + PRIBIO | PDROP, "r:destroy", hz * 3); + return (error == EWOULDBLOCK ? EBUSY : 0); } static void @@ -2303,8 +2305,6 @@ g_raid_destroy_geom(struct gctl_req *req sx_xlock(&sc->sc_lock); g_cancel_event(sc); error = g_raid_destroy(gp->softc, G_RAID_DESTROY_SOFT); - if (error != 0) - sx_xunlock(&sc->sc_lock); g_topology_lock(); return (error); } @@ -2469,7 +2469,6 @@ g_raid_shutdown_post_sync(void *arg, int struct g_geom *gp, *gp2; struct g_raid_softc *sc; struct g_raid_volume *vol; - int error; mp = arg; DROP_GIANT(); @@ -2483,9 +2482,7 @@ g_raid_shutdown_post_sync(void *arg, int TAILQ_FOREACH(vol, &sc->sc_volumes, v_next) g_raid_clean(vol, -1); g_cancel_event(sc); - error = g_raid_destroy(sc, G_RAID_DESTROY_DELAYED); - if (error != 0) - sx_xunlock(&sc->sc_lock); + g_raid_destroy(sc, G_RAID_DESTROY_DELAYED); g_topology_lock(); } g_topology_unlock(); Modified: stable/9/sys/geom/raid/g_raid_ctl.c ============================================================================== --- stable/9/sys/geom/raid/g_raid_ctl.c Sat Sep 14 10:00:20 2013 (r255562) +++ stable/9/sys/geom/raid/g_raid_ctl.c Sat Sep 14 10:08:09 2013 (r255563) @@ -181,7 +181,7 @@ g_raid_ctl_stop(struct gctl_req *req, st sx_xlock(&sc->sc_lock); error = g_raid_destroy(sc, how); if (error != 0) - sx_xunlock(&sc->sc_lock); + gctl_error(req, "Array is busy."); g_topology_lock(); } From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 10:10:02 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 30DAA958; Sat, 14 Sep 2013 10:10:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 1D2332D89; Sat, 14 Sep 2013 10:10:02 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8EAA1PO029364; Sat, 14 Sep 2013 10:10:01 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8EAA1Sb029363; Sat, 14 Sep 2013 10:10:01 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309141010.r8EAA1Sb029363@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 10:10:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255564 - stable/9/sys/geom/raid X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 10:10:02 -0000 Author: mav Date: Sat Sep 14 10:10:01 2013 New Revision: 255564 URL: http://svnweb.freebsd.org/changeset/base/255564 Log: MFC r254269, r254271: Fix reasonable but safe Clang warnings. Modified: stable/9/sys/geom/raid/tr_raid5.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/raid/tr_raid5.c ============================================================================== --- stable/9/sys/geom/raid/tr_raid5.c Sat Sep 14 10:08:09 2013 (r255563) +++ stable/9/sys/geom/raid/tr_raid5.c Sat Sep 14 10:10:01 2013 (r255564) @@ -106,7 +106,8 @@ g_raid_tr_taste_raid5(struct g_raid_tr_o trs = (struct g_raid_tr_raid5_object *)tr; qual = tr->tro_volume->v_raid_level_qualifier; if (tr->tro_volume->v_raid_level == G_RAID_VOLUME_RL_RAID4 && - qual >= 0 && qual <= 1) { + (qual == G_RAID_VOLUME_RLQ_R4P0 || + qual == G_RAID_VOLUME_RLQ_R4PN)) { /* RAID4 */ } else if ((tr->tro_volume->v_raid_level == G_RAID_VOLUME_RL_RAID5 || tr->tro_volume->v_raid_level == G_RAID_VOLUME_RL_RAID5E || @@ -114,7 +115,10 @@ g_raid_tr_taste_raid5(struct g_raid_tr_o tr->tro_volume->v_raid_level == G_RAID_VOLUME_RL_RAID5R || tr->tro_volume->v_raid_level == G_RAID_VOLUME_RL_RAID6 || tr->tro_volume->v_raid_level == G_RAID_VOLUME_RL_RAIDMDF) && - qual >= 0 && qual <= 3) { + (qual == G_RAID_VOLUME_RLQ_R5RA || + qual == G_RAID_VOLUME_RLQ_R5RS || + qual == G_RAID_VOLUME_RLQ_R5LA || + qual == G_RAID_VOLUME_RLQ_R5LS)) { /* RAID5/5E/5EE/5R/6/MDF */ } else return (G_RAID_TR_TASTE_FAIL); From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 10:11:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 79147A86; Sat, 14 Sep 2013 10:11:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 4B1B22DB4; Sat, 14 Sep 2013 10:11:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8EABAc9031985; Sat, 14 Sep 2013 10:11:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8EAB9nn031981; Sat, 14 Sep 2013 10:11:09 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309141011.r8EAB9nn031981@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 10:11:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255565 - stable/9/sys/geom/raid X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 10:11:10 -0000 Author: mav Date: Sat Sep 14 10:11:09 2013 New Revision: 255565 URL: http://svnweb.freebsd.org/changeset/base/255565 Log: MFC r254275: Return error when opening read-only volumes (like RAID4/5/...) for writing. Previously opens succeeded, but actual write operations returned errors. Modified: stable/9/sys/geom/raid/g_raid.c stable/9/sys/geom/raid/g_raid.h stable/9/sys/geom/raid/tr_raid5.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/raid/g_raid.c ============================================================================== --- stable/9/sys/geom/raid/g_raid.c Sat Sep 14 10:10:01 2013 (r255564) +++ stable/9/sys/geom/raid/g_raid.c Sat Sep 14 10:11:09 2013 (r255565) @@ -1863,6 +1863,11 @@ g_raid_access(struct g_provider *pp, int error = ENXIO; goto out; } + /* Deny write opens for read-only volumes. */ + if (vol->v_read_only && acw > 0) { + error = EROFS; + goto out; + } if (dcw == 0) g_raid_clean(vol, dcw); vol->v_provider_open += acr + acw + ace; Modified: stable/9/sys/geom/raid/g_raid.h ============================================================================== --- stable/9/sys/geom/raid/g_raid.h Sat Sep 14 10:10:01 2013 (r255564) +++ stable/9/sys/geom/raid/g_raid.h Sat Sep 14 10:11:09 2013 (r255565) @@ -306,6 +306,7 @@ struct g_raid_volume { int v_stopping; /* Volume is stopping */ int v_provider_open; /* Number of opens. */ int v_global_id; /* Global volume ID (rX). */ + int v_read_only; /* Volume is read-only. */ TAILQ_ENTRY(g_raid_volume) v_next; /* List of volumes entry. */ LIST_ENTRY(g_raid_volume) v_global_next; /* Global list entry. */ }; Modified: stable/9/sys/geom/raid/tr_raid5.c ============================================================================== --- stable/9/sys/geom/raid/tr_raid5.c Sat Sep 14 10:10:01 2013 (r255564) +++ stable/9/sys/geom/raid/tr_raid5.c Sat Sep 14 10:11:09 2013 (r255565) @@ -185,8 +185,9 @@ g_raid_tr_start_raid5(struct g_raid_tr_o struct g_raid_volume *vol; trs = (struct g_raid_tr_raid5_object *)tr; - vol = tr->tro_volume; trs->trso_starting = 0; + vol = tr->tro_volume; + vol->v_read_only = 1; g_raid_tr_update_state_raid5(vol, NULL); return (0); } From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 10:12:29 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 85EEACF3; Sat, 14 Sep 2013 10:12:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 583E92DC0; Sat, 14 Sep 2013 10:12:29 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8EACTcU032485; Sat, 14 Sep 2013 10:12:29 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8EACTW9032484; Sat, 14 Sep 2013 10:12:29 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309141012.r8EACTW9032484@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 10:12:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255567 - stable/9/sys/geom/zero X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 10:12:29 -0000 Author: mav Date: Sat Sep 14 10:12:28 2013 New Revision: 255567 URL: http://svnweb.freebsd.org/changeset/base/255567 Log: MFC r254936: Add unmapped BIO support to GEOM ZERO if kern.geom.zero.clear is cleared. Modified: stable/9/sys/geom/zero/g_zero.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/zero/g_zero.c ============================================================================== --- stable/9/sys/geom/zero/g_zero.c Sat Sep 14 10:11:38 2013 (r255566) +++ stable/9/sys/geom/zero/g_zero.c Sat Sep 14 10:12:28 2013 (r255567) @@ -41,16 +41,37 @@ __FBSDID("$FreeBSD$"); #define G_ZERO_CLASS_NAME "ZERO" +static int g_zero_clear_sysctl(SYSCTL_HANDLER_ARGS); + SYSCTL_DECL(_kern_geom); static SYSCTL_NODE(_kern_geom, OID_AUTO, zero, CTLFLAG_RW, 0, "GEOM_ZERO stuff"); static int g_zero_clear = 1; -SYSCTL_INT(_kern_geom_zero, OID_AUTO, clear, CTLFLAG_RW, &g_zero_clear, 0, - "Clear read data buffer"); +SYSCTL_PROC(_kern_geom_zero, OID_AUTO, clear, CTLTYPE_INT|CTLFLAG_RW, + &g_zero_clear, 0, g_zero_clear_sysctl, "I", "Clear read data buffer"); static int g_zero_byte = 0; SYSCTL_INT(_kern_geom_zero, OID_AUTO, byte, CTLFLAG_RW, &g_zero_byte, 0, "Byte (octet) value to clear the buffers with"); +static struct g_provider *gpp; + +static int +g_zero_clear_sysctl(SYSCTL_HANDLER_ARGS) +{ + int error; + + error = sysctl_handle_int(oidp, &g_zero_clear, 0, req); + if (error != 0 || req->newptr == NULL) + return (error); + if (gpp == NULL) + return (ENXIO); + if (g_zero_clear) + gpp->flags &= ~G_PF_ACCEPT_UNMAPPED; + else + gpp->flags |= G_PF_ACCEPT_UNMAPPED; + return (0); +} + static void g_zero_start(struct bio *bp) { @@ -58,7 +79,7 @@ g_zero_start(struct bio *bp) switch (bp->bio_cmd) { case BIO_READ: - if (g_zero_clear) + if (g_zero_clear && (bp->bio_flags & BIO_UNMAPPED) == 0) memset(bp->bio_data, g_zero_byte, bp->bio_length); /* FALLTHROUGH */ case BIO_DELETE: @@ -84,7 +105,9 @@ g_zero_init(struct g_class *mp) gp = g_new_geomf(mp, "gzero"); gp->start = g_zero_start; gp->access = g_std_access; - pp = g_new_providerf(gp, "%s", gp->name); + gpp = pp = g_new_providerf(gp, "%s", gp->name); + if (!g_zero_clear) + pp->flags |= G_PF_ACCEPT_UNMAPPED; pp->mediasize = 1152921504606846976LLU; pp->sectorsize = 512; g_error_provider(pp, 0); @@ -104,6 +127,7 @@ g_zero_destroy_geom(struct gctl_req *req return (0); if (pp->acr > 0 || pp->acw > 0 || pp->ace > 0) return (EBUSY); + gpp = NULL; g_wither_geom(gp, ENXIO); return (0); } From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 10:14:10 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 65B3AE32; Sat, 14 Sep 2013 10:14:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 3791B2DCD; Sat, 14 Sep 2013 10:14:10 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8EAEAJo032835; Sat, 14 Sep 2013 10:14:10 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8EAEASc032834; Sat, 14 Sep 2013 10:14:10 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309141014.r8EAEASc032834@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 10:14:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255568 - stable/9/sys/geom/eli X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 10:14:10 -0000 Author: mav Date: Sat Sep 14 10:14:09 2013 New Revision: 255568 URL: http://svnweb.freebsd.org/changeset/base/255568 Log: MFC r255144: Make ELI destruction (including orphanization) less aggressive, making it always wait for provider close. Old algorithm was reported to cause NULL dereference panic on attempt to close provider after softc destruction. If not global workaroung in GEOM, that could even cause destruction with requests still in flight. Modified: stable/9/sys/geom/eli/g_eli.c Directory Properties: stable/9/sys/ (props changed) Modified: stable/9/sys/geom/eli/g_eli.c ============================================================================== --- stable/9/sys/geom/eli/g_eli.c Sat Sep 14 10:12:28 2013 (r255567) +++ stable/9/sys/geom/eli/g_eli.c Sat Sep 14 10:14:09 2013 (r255568) @@ -620,21 +620,19 @@ end: * to close it when this situation occur. */ static void -g_eli_last_close(struct g_eli_softc *sc) +g_eli_last_close(void *arg, int flags __unused) { struct g_geom *gp; - struct g_provider *pp; - char ppname[64]; + char gpname[64]; int error; g_topology_assert(); - gp = sc->sc_geom; - pp = LIST_FIRST(&gp->provider); - strlcpy(ppname, pp->name, sizeof(ppname)); - error = g_eli_destroy(sc, TRUE); + gp = arg; + strlcpy(gpname, gp->name, sizeof(gpname)); + error = g_eli_destroy(gp->softc, TRUE); KASSERT(error == 0, ("Cannot detach %s on last close (error=%d).", - ppname, error)); - G_ELI_DEBUG(0, "Detached %s on last close.", ppname); + gpname, error)); + G_ELI_DEBUG(0, "Detached %s on last close.", gpname); } int @@ -664,7 +662,7 @@ g_eli_access(struct g_provider *pp, int */ if ((sc->sc_flags & G_ELI_FLAG_RW_DETACH) || (sc->sc_flags & G_ELI_FLAG_WOPEN)) { - g_eli_last_close(sc); + g_post_event(g_eli_last_close, gp, M_WAITOK, NULL); } return (0); } @@ -910,6 +908,10 @@ g_eli_destroy(struct g_eli_softc *sc, bo if (force) { G_ELI_DEBUG(1, "Device %s is still open, so it " "cannot be definitely removed.", pp->name); + sc->sc_flags |= G_ELI_FLAG_RW_DETACH; + gp->access = g_eli_access; + g_wither_provider(pp, ENXIO); + return (EBUSY); } else { G_ELI_DEBUG(1, "Device %s is still open (r%dw%de%d).", pp->name, From owner-svn-src-stable@FreeBSD.ORG Sat Sep 14 13:12:13 2013 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id D516DB6; Sat, 14 Sep 2013 13:12:13 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id C1ABB265B; Sat, 14 Sep 2013 13:12:13 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r8EDCDXk027814; Sat, 14 Sep 2013 13:12:13 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r8EDCDQX027813; Sat, 14 Sep 2013 13:12:13 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201309141312.r8EDCDQX027813@svn.freebsd.org> From: Alexander Motin Date: Sat, 14 Sep 2013 13:12:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r255569 - stable/9/sys/kern X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 14 Sep 2013 13:12:13 -0000 Author: mav Date: Sat Sep 14 13:12:13 2013 New Revision: 255569 URL: http://svnweb.freebsd.org/changeset/base/255569 Log: Temporary revert r255541 since there is no CPU_FFS in stable/9 yet. Sorry. Modified: stable/9/sys/kern/sched_ule.c Modified: stable/9/sys/kern/sched_ule.c ============================================================================== --- stable/9/sys/kern/sched_ule.c Sat Sep 14 10:14:09 2013 (r255568) +++ stable/9/sys/kern/sched_ule.c Sat Sep 14 13:12:13 2013 (r255569) @@ -632,14 +632,10 @@ cpu_search(const struct cpu_group *cg, s } /* Iterate through the child CPU groups and then remaining CPUs. */ - for (i = cg->cg_children, cpu = mp_maxid; ; ) { + for (i = cg->cg_children, cpu = mp_maxid; i >= 0; ) { if (i == 0) { -#ifdef HAVE_INLINE_FFSL - cpu = CPU_FFS(&cpumask) - 1; -#else while (cpu >= 0 && !CPU_ISSET(cpu, &cpumask)) cpu--; -#endif if (cpu < 0) break; child = NULL; @@ -664,7 +660,6 @@ cpu_search(const struct cpu_group *cg, s break; } } else { /* Handle child CPU. */ - CPU_CLR(cpu, &cpumask); tdq = TDQ_CPU(cpu); load = tdq->tdq_load * 256; rndptr = DPCPU_PTR(randomval); @@ -712,11 +707,8 @@ cpu_search(const struct cpu_group *cg, s i--; if (i == 0 && CPU_EMPTY(&cpumask)) break; - } -#ifndef HAVE_INLINE_FFSL - else + } else cpu--; -#endif } return (total); }