From owner-svn-src-stable-10@freebsd.org Sun Apr 23 03:16:40 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C2155D40DD8; Sun, 23 Apr 2017 03:16:40 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 78CF13F4; Sun, 23 Apr 2017 03:16:40 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N3GdTw039932; Sun, 23 Apr 2017 03:16:39 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N3GdCt039931; Sun, 23 Apr 2017 03:16:39 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201704230316.v3N3GdCt039931@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sun, 23 Apr 2017 03:16:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317314 - in stable: 10/contrib/ipfilter/lib 10/contrib/ipfilter/tools 11/contrib/ipfilter/lib 11/contrib/ipfilter/tools X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 03:16:40 -0000 Author: cy Date: Sun Apr 23 03:16:38 2017 New Revision: 317314 URL: https://svnweb.freebsd.org/changeset/base/317314 Log: MFC r316993, r316994, r316997 as follows: r316993: Fix CID 1372601 in ipfilter/lib/parsefields.c, possible NULL pointer dereference should reallocarray() fail. Reported by: Coverity CID 1372601 r316994: Fix CID 1372600 in ipfilter/tools/ipf_y.y, possible NULL pointer dereference should reallocarray() fail. Reported by: Coverity CID 1372600 r316997: Use warnx() to issue error message. Reported by: cem Modified: stable/10/contrib/ipfilter/lib/parsefields.c stable/10/contrib/ipfilter/tools/ipf_y.y Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/ipfilter/lib/parsefields.c stable/11/contrib/ipfilter/tools/ipf_y.y Directory Properties: stable/11/ (props changed) Modified: stable/10/contrib/ipfilter/lib/parsefields.c ============================================================================== --- stable/10/contrib/ipfilter/lib/parsefields.c Sun Apr 23 02:30:06 2017 (r317313) +++ stable/10/contrib/ipfilter/lib/parsefields.c Sun Apr 23 03:16:38 2017 (r317314) @@ -1,4 +1,5 @@ #include "ipf.h" +#include extern int nohdrfields; @@ -32,6 +33,10 @@ wordtab_t *parsefields(table, arg) fields = malloc(2 * sizeof(*fields)); } else { fields = realloc(fields, (num + 1) * sizeof(*fields)); + if (fields == NULL) { + warnx("memory allocation error at %d in %s in %s", __LINE__, __FUNCTION__, __FILE__); + abort(); + } } if (t == NULL) { Modified: stable/10/contrib/ipfilter/tools/ipf_y.y ============================================================================== --- stable/10/contrib/ipfilter/tools/ipf_y.y Sun Apr 23 02:30:06 2017 (r317313) +++ stable/10/contrib/ipfilter/tools/ipf_y.y Sun Apr 23 03:16:38 2017 (r317314) @@ -9,6 +9,7 @@ #include "ipf.h" #include #include +#include #ifdef IPFILTER_BPF # include #endif @@ -2195,6 +2196,10 @@ char *phrase; for (i = 0, s = strtok(phrase, " \r\n\t"); s != NULL; s = strtok(NULL, " \r\n\t"), i++) { fb = realloc(fb, (i / 4 + 1) * sizeof(*fb)); + if (fb == NULL) { + warnx("memory allocation error at %d in %s in %s", __LINE__, __FUNCTION__, __FILE__); + abort(); + } l = (u_32_t)strtol(s, NULL, 0); switch (i & 3) { From owner-svn-src-stable-10@freebsd.org Sun Apr 23 07:35:53 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54E00D4CCDC; Sun, 23 Apr 2017 07:35:53 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0C8B91979; Sun, 23 Apr 2017 07:35:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N7ZqaT045431; Sun, 23 Apr 2017 07:35:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N7ZqGF045429; Sun, 23 Apr 2017 07:35:52 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230735.v3N7ZqGF045429@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 23 Apr 2017 07:35:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317320 - stable/10/sys/cam/ctl X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 07:35:53 -0000 Author: mav Date: Sun Apr 23 07:35:51 2017 New Revision: 317320 URL: https://svnweb.freebsd.org/changeset/base/317320 Log: MFC r316653: Fix few minor issues found by Clang Analyzer. Modified: stable/10/sys/cam/ctl/ctl.c stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/cam/ctl/ctl.c ============================================================================== --- stable/10/sys/cam/ctl/ctl.c Sun Apr 23 07:35:10 2017 (r317319) +++ stable/10/sys/cam/ctl/ctl.c Sun Apr 23 07:35:51 2017 (r317320) @@ -7038,7 +7038,7 @@ ctl_get_lba_status(struct ctl_scsiio *ct lbalen->len = total_len; lbalen->flags = 0; retval = lun->backend->config_read((union ctl_io *)ctsio); - return (CTL_RETVAL_COMPLETE); + return (retval); } int Modified: stable/10/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Sun Apr 23 07:35:10 2017 (r317319) +++ stable/10/sys/cam/ctl/ctl_frontend_iscsi.c Sun Apr 23 07:35:51 2017 (r317320) @@ -318,11 +318,10 @@ cfiscsi_pdu_handle(struct icl_pdu *reque static void cfiscsi_receive_callback(struct icl_pdu *request) { +#ifdef ICL_KERNEL_PROXY struct cfiscsi_session *cs; cs = PDU_SESSION(request); - -#ifdef ICL_KERNEL_PROXY if (cs->cs_waiting_for_ctld || cs->cs_login_phase) { if (cs->cs_login_pdu == NULL) cs->cs_login_pdu = request; @@ -1652,6 +1651,13 @@ cfiscsi_ioctl_list(struct ctl_iscsi *ci) sbuf_finish(sb); error = copyout(sbuf_data(sb), cilp->conn_xml, sbuf_len(sb) + 1); + if (error != 0) { + sbuf_delete(sb); + snprintf(ci->error_str, sizeof(ci->error_str), + "copyout failed with error %d", error); + ci->status = CTL_ISCSI_ERROR; + return; + } cilp->fill_len = sbuf_len(sb) + 1; ci->status = CTL_ISCSI_OK; sbuf_delete(sb); @@ -2082,9 +2088,9 @@ cfiscsi_ioctl_port_create(struct ctl_req retval = ctl_port_register(port); if (retval != 0) { ctl_free_opts(&port->options); - cfiscsi_target_release(ct); free(port->port_devid, M_CFISCSI); free(port->target_devid, M_CFISCSI); + cfiscsi_target_release(ct); req->status = CTL_LUN_ERROR; snprintf(req->error_str, sizeof(req->error_str), "ctl_port_register() failed with error %d", retval); From owner-svn-src-stable-10@freebsd.org Sun Apr 23 07:37:15 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC148D4CDB0; Sun, 23 Apr 2017 07:37:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id ADB0D1C1E; Sun, 23 Apr 2017 07:37:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N7bEdM045591; Sun, 23 Apr 2017 07:37:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N7bEpr045589; Sun, 23 Apr 2017 07:37:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230737.v3N7bEpr045589@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 23 Apr 2017 07:37:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317322 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 07:37:16 -0000 Author: mav Date: Sun Apr 23 07:37:14 2017 New Revision: 317322 URL: https://svnweb.freebsd.org/changeset/base/317322 Log: MFC r316652: Fix few minor issues found by Clang Analyzer. Modified: stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/isp_freebsd.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Sun Apr 23 07:36:44 2017 (r317321) +++ stable/10/sys/dev/isp/isp.c Sun Apr 23 07:37:14 2017 (r317322) @@ -2662,7 +2662,8 @@ isp_plogx(ispsoftc_t *isp, int chan, uin break; } if (msg) { - isp_prt(isp, ISP_LOGERR, "Chan %d PLOGX PortID 0x%06x to N-Port handle 0x%x: %s", chan, portid, handle, msg); + isp_prt(isp, lev, "Chan %d PLOGX PortID 0x%06x to N-Port handle 0x%x: %s", + chan, portid, handle, msg); } return (rval); } Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Sun Apr 23 07:36:44 2017 (r317321) +++ stable/10/sys/dev/isp/isp_freebsd.c Sun Apr 23 07:37:14 2017 (r317322) @@ -3791,7 +3791,6 @@ changed: nlstate = reason = 0; } va_end(ap); - fc = ISP_FC_PC(isp, bus); if (evt == ISPASYNC_CHANGE_PDB) { msg = "Port Database Changed"; From owner-svn-src-stable-10@freebsd.org Sun Apr 23 08:59:58 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BAD75D4C50E; Sun, 23 Apr 2017 08:59:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7134BF85; Sun, 23 Apr 2017 08:59:58 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8xvFw080507; Sun, 23 Apr 2017 08:59:57 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8xvAr080505; Sun, 23 Apr 2017 08:59:57 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201704230859.v3N8xvAr080505@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Sun, 23 Apr 2017 08:59:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317335 - in stable/10/sys: netinet6 netpfil/pf X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:59:58 -0000 Author: kp Date: Sun Apr 23 08:59:57 2017 New Revision: 317335 URL: https://svnweb.freebsd.org/changeset/base/317335 Log: MFC r317186 pf: Fix possible incorrect IPv6 fragmentation When forwarding pf tracks the size of the largest fragment in a fragmented packet, and refragments based on this size. It failed to ensure that this size was a multiple of 8 (as is required for all but the last fragment), so it could end up generating incorrect fragments. For example, if we received an 8 byte and 12 byte fragment pf would emit a first fragment with 12 bytes of payload and the final fragment would claim to be at offset 8 (not 12). We now assert that the fragment size is a multiple of 8 in ip6_fragment(), so other users won't make the same mistake. Reported by: Antonios Atlasis Modified: stable/10/sys/netinet6/ip6_output.c stable/10/sys/netpfil/pf/pf_norm.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netinet6/ip6_output.c ============================================================================== --- stable/10/sys/netinet6/ip6_output.c Sun Apr 23 08:59:35 2017 (r317334) +++ stable/10/sys/netinet6/ip6_output.c Sun Apr 23 08:59:57 2017 (r317335) @@ -219,6 +219,8 @@ ip6_fragment(struct ifnet *ifp, struct m int error; int tlen = m0->m_pkthdr.len; + KASSERT(( mtu % 8 == 0), ("Fragment length must be a multiple of 8")); + m = m0; ip6 = mtod(m, struct ip6_hdr *); mnext = &m->m_nextpkt; Modified: stable/10/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/10/sys/netpfil/pf/pf_norm.c Sun Apr 23 08:59:35 2017 (r317334) +++ stable/10/sys/netpfil/pf/pf_norm.c Sun Apr 23 08:59:57 2017 (r317335) @@ -1128,6 +1128,10 @@ pf_refragment6(struct ifnet *ifp, struct hdr->ip6_nxt = IPPROTO_FRAGMENT; } + /* The MTU must be a multiple of 8 bytes, or we risk doing the + * fragmentation wrong. */ + maxlen = maxlen & ~7; + /* * Maxlen may be less than 8 if there was only a single * fragment. As it was fragmented before, add a fragment From owner-svn-src-stable-10@freebsd.org Mon Apr 24 06:33:09 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C5E39D4CF40; Mon, 24 Apr 2017 06:33:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7E1BE16F6; Mon, 24 Apr 2017 06:33:09 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3O6X8kF012186; Mon, 24 Apr 2017 06:33:08 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3O6X8uU012184; Mon, 24 Apr 2017 06:33:08 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704240633.v3O6X8uU012184@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 06:33:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317352 - stable/10/usr.sbin/ctld X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 06:33:09 -0000 Author: mav Date: Mon Apr 24 06:33:08 2017 New Revision: 317352 URL: https://svnweb.freebsd.org/changeset/base/317352 Log: MFC r316677: Do not register in CTL portal groups without portals. From config synthax point of view such portal groups are not incorrect, but they are useless since can not receive any connection. And since CTL port resource is very limited, it is good to save it. Modified: stable/10/usr.sbin/ctld/ctld.c stable/10/usr.sbin/ctld/ctld.h Directory Properties: stable/10/ (props changed) Modified: stable/10/usr.sbin/ctld/ctld.c ============================================================================== --- stable/10/usr.sbin/ctld/ctld.c Mon Apr 24 06:32:35 2017 (r317351) +++ stable/10/usr.sbin/ctld/ctld.c Mon Apr 24 06:33:08 2017 (r317352) @@ -1219,7 +1219,6 @@ port_new(struct conf *conf, struct targe port->p_target = target; TAILQ_INSERT_TAIL(&pg->pg_ports, port, p_pgs); port->p_portal_group = pg; - port->p_foreign = pg->pg_foreign; return (port); } @@ -1292,6 +1291,19 @@ port_delete(struct port *port) free(port); } +int +port_is_dummy(struct port *port) +{ + + if (port->p_portal_group) { + if (port->p_portal_group->pg_foreign) + return (1); + if (TAILQ_EMPTY(&port->p_portal_group->pg_portals)) + return (1); + } + return (0); +} + struct target * target_new(struct conf *conf, const char *name) { @@ -1867,10 +1879,10 @@ conf_apply(struct conf *oldconf, struct * and missing in the new one. */ TAILQ_FOREACH_SAFE(oldport, &oldconf->conf_ports, p_next, tmpport) { - if (oldport->p_foreign) + if (port_is_dummy(oldport)) continue; newport = port_find(newconf, oldport->p_name); - if (newport != NULL && !newport->p_foreign) + if (newport != NULL && !port_is_dummy(newport)) continue; log_debugx("removing port \"%s\"", oldport->p_name); error = kernel_port_remove(oldport); @@ -1990,11 +2002,11 @@ conf_apply(struct conf *oldconf, struct * Now add new ports or modify existing ones. */ TAILQ_FOREACH(newport, &newconf->conf_ports, p_next) { - if (newport->p_foreign) + if (port_is_dummy(newport)) continue; oldport = port_find(oldconf, newport->p_name); - if (oldport == NULL || oldport->p_foreign) { + if (oldport == NULL || port_is_dummy(oldport)) { log_debugx("adding port \"%s\"", newport->p_name); error = kernel_port_add(newport); } else { Modified: stable/10/usr.sbin/ctld/ctld.h ============================================================================== --- stable/10/usr.sbin/ctld/ctld.h Mon Apr 24 06:32:35 2017 (r317351) +++ stable/10/usr.sbin/ctld/ctld.h Mon Apr 24 06:33:08 2017 (r317352) @@ -149,7 +149,6 @@ struct port { struct portal_group *p_portal_group; struct pport *p_pport; struct target *p_target; - int p_foreign; uint32_t p_ctl_port; }; @@ -363,6 +362,7 @@ struct port *port_find(const struct con struct port *port_find_in_pg(const struct portal_group *pg, const char *target); void port_delete(struct port *port); +int port_is_dummy(struct port *port); struct target *target_new(struct conf *conf, const char *name); void target_delete(struct target *target); From owner-svn-src-stable-10@freebsd.org Mon Apr 24 11:19:48 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9588D4D0AC; Mon, 24 Apr 2017 11:19:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A58D11973; Mon, 24 Apr 2017 11:19:48 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OBJl5V027335; Mon, 24 Apr 2017 11:19:47 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBJloA027331; Mon, 24 Apr 2017 11:19:47 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241119.v3OBJloA027331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 11:19:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317363 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:19:49 -0000 Author: mav Date: Mon Apr 24 11:19:47 2017 New Revision: 317363 URL: https://svnweb.freebsd.org/changeset/base/317363 Log: MFC r315708: Cleanup response queue processing. Modified: stable/10/sys/dev/isp/isp.c stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/dev/isp/isp_freebsd.h stable/10/sys/dev/isp/ispvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp.c ============================================================================== --- stable/10/sys/dev/isp/isp.c Mon Apr 24 11:12:03 2017 (r317362) +++ stable/10/sys/dev/isp/isp.c Mon Apr 24 11:19:47 2017 (r317363) @@ -68,7 +68,7 @@ __FBSDID("$FreeBSD$"); /* * Local static data */ -static const char notresp[] = "Not RESPONSE in RESPONSE Queue (type 0x%x) @ idx %d (next %d) nlooked %d"; +static const char notresp[] = "Unknown IOCB in RESPONSE Queue (type 0x%x) @ idx %d (next %d)"; static const char bun[] = "bad underrun (count %d, resid %d, status %s)"; static const char lipd[] = "Chan %d LIP destroyed %d active commands"; static const char sacq[] = "unable to acquire scratch area"; @@ -98,8 +98,8 @@ static const uint8_t alpa_map[] = { static void isp_parse_async(ispsoftc_t *, uint16_t); static void isp_parse_async_fc(ispsoftc_t *, uint16_t); static int isp_handle_other_response(ispsoftc_t *, int, isphdr_t *, uint32_t *); -static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, long *); -static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, long *); +static void isp_parse_status(ispsoftc_t *, ispstatusreq_t *, XS_T *, uint32_t *); +static void isp_parse_status_24xx(ispsoftc_t *, isp24xx_statusreq_t *, XS_T *, uint32_t *); static void isp_fastpost_complete(ispsoftc_t *, uint32_t); static void isp_scsi_init(ispsoftc_t *); static void isp_scsi_channel_init(ispsoftc_t *, int); @@ -4971,21 +4971,18 @@ isp_intr_mbox(ispsoftc_t *isp, uint16_t MBOX_NOTIFY_COMPLETE(isp); } -/* - * Limit our stack depth by sticking with the max likely number - * of completions on a request queue at any one time. - */ -#ifndef MAX_REQUESTQ_COMPLETIONS -#define MAX_REQUESTQ_COMPLETIONS 32 -#endif - void isp_intr_respq(ispsoftc_t *isp) { - XS_T *complist[MAX_REQUESTQ_COMPLETIONS], *xs; - uint32_t iptr, optr, junk; - int i, nlooked = 0, ndone = 0, continuations_expected = 0; - int etype, last_etype = 0; + XS_T *xs, *cont_xs; + uint8_t qe[QENTRY_LEN]; + ispstatusreq_t *sp = (ispstatusreq_t *)qe; + isp24xx_statusreq_t *sp2 = (isp24xx_statusreq_t *)qe; + isphdr_t *hp; + uint8_t *resp, *snsp; + int buddaboom, completion_status, cont = 0, etype, i; + int req_status_flags, req_state_flags, scsi_status; + uint32_t iptr, junk, cptr, optr, rlen, slen, sptr, totslen, resid; /* * We can't be getting this now. @@ -5007,38 +5004,30 @@ isp_intr_respq(ispsoftc_t *isp) optr = isp->isp_resodx; while (optr != iptr) { - uint8_t qe[QENTRY_LEN]; - ispstatusreq_t *sp = (ispstatusreq_t *) qe; - isphdr_t *hp; - int buddaboom, scsi_status, completion_status; - int req_status_flags, req_state_flags; - uint8_t *snsp, *resp; - uint32_t rlen, slen, totslen; - long resid; - uint16_t oop; - - hp = (isphdr_t *) ISP_QUEUE_ENTRY(isp->isp_result, optr); - oop = optr; + sptr = cptr = optr; + hp = (isphdr_t *) ISP_QUEUE_ENTRY(isp->isp_result, cptr); optr = ISP_NXT_QENTRY(optr, RESULT_QUEUE_LEN(isp)); - nlooked++; - read_again: - buddaboom = req_status_flags = req_state_flags = 0; - resid = 0L; /* * Synchronize our view of this response queue entry. */ - MEMORYBARRIER(isp, SYNC_RESULT, oop, QENTRY_LEN, -1); + MEMORYBARRIER(isp, SYNC_RESULT, cptr, QENTRY_LEN, -1); if (isp->isp_dblev & ISP_LOGDEBUG1) - isp_print_qentry(isp, "Response Queue Entry", oop, hp); + isp_print_qentry(isp, "Response Queue Entry", cptr, hp); isp_get_hdr(isp, hp, &sp->req_header); etype = sp->req_header.rqs_entry_type; + /* We expected Status Continuation, but got different IOCB. */ + if (cont > 0 && etype != RQSTYPE_STATUS_CONT) { + cont = 0; + isp_done(cont_xs); + } + if (IS_24XX(isp) && etype == RQSTYPE_RESPONSE) { - isp24xx_statusreq_t *sp2 = (isp24xx_statusreq_t *)qe; isp_get_24xx_response(isp, (isp24xx_statusreq_t *)hp, sp2); scsi_status = sp2->req_scsi_status; completion_status = sp2->req_completion_status; + req_status_flags = 0; if ((scsi_status & 0xff) != 0) req_state_flags = RQSF_GOT_STATUS; else @@ -5058,79 +5047,52 @@ isp_intr_respq(ispsoftc_t *isp) isp_fastpost_complete(isp, rio->req_handles[i]); } ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; continue; } else if (etype == RQSTYPE_RIO2) { isp_prt(isp, ISP_LOGERR, "dropping RIO2 response"); ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; continue; } else if (etype == RQSTYPE_STATUS_CONT) { - isp_get_cont_response(isp, (ispstatus_cont_t *) hp, (ispstatus_cont_t *) sp); - if (last_etype == RQSTYPE_RESPONSE && continuations_expected && ndone > 0 && (xs = complist[ndone-1]) != NULL) { - ispstatus_cont_t *scp = (ispstatus_cont_t *) sp; - XS_SENSE_APPEND(xs, scp->req_sense_data, sizeof (scp->req_sense_data)); - isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, "%d more Status Continuations expected", --continuations_expected); + ispstatus_cont_t *scp = (ispstatus_cont_t *)qe; + isp_get_cont_response(isp, (ispstatus_cont_t *)hp, scp); + if (cont > 0) { + i = min(cont, sizeof(scp->req_sense_data)); + XS_SENSE_APPEND(cont_xs, scp->req_sense_data, i); + cont -= i; + if (cont == 0) { + isp_done(cont_xs); + } else { + isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, + "Expecting Status Continuations for %u bytes", + cont); + } } else { isp_prt(isp, ISP_LOG_WARN1, "Ignored Continuation Response"); } ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ continue; - } else { - /* - * Somebody reachable via isp_handle_other_response - * may have updated the response queue pointers for - * us, so we reload our goal index. - */ - int r; - uint32_t tsto = oop; - r = isp_handle_other_response(isp, etype, hp, &tsto); - if (r < 0) { - goto read_again; - } - /* - * If somebody updated the output pointer, then reset - * optr to be one more than the updated amount. - */ - while (tsto != oop) { - optr = ISP_NXT_QENTRY(tsto, RESULT_QUEUE_LEN(isp)); - } - if (r > 0) { - ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; - continue; - } - - /* - * After this point, we'll just look at the header as - * we don't know how to deal with the rest of the - * response. - */ - - /* - * It really has to be a bounced request just copied - * from the request queue to the response queue. If - * not, something bad has happened. - */ - if (etype != RQSTYPE_REQUEST) { - isp_prt(isp, ISP_LOGERR, notresp, etype, oop, optr, nlooked); + } else if (isp_handle_other_response(isp, etype, hp, &cptr)) { + /* More then one IOCB could be consumed. */ + while (sptr != cptr) { ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; - continue; + sptr = ISP_NXT_QENTRY(sptr, RESULT_QUEUE_LEN(isp)); + hp = (isphdr_t *)ISP_QUEUE_ENTRY(isp->isp_result, sptr); } - buddaboom = 1; - scsi_status = sp->req_scsi_status; - completion_status = sp->req_completion_status; - req_status_flags = sp->req_status_flags; - req_state_flags = sp->req_state_flags; - resid = sp->req_resid; + ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ + optr = ISP_NXT_QENTRY(cptr, RESULT_QUEUE_LEN(isp)); + continue; + } else { + /* We don't know what was this -- log and skip. */ + isp_prt(isp, ISP_LOGERR, notresp, etype, cptr, optr); + ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ + continue; } + buddaboom = 0; if (sp->req_header.rqs_flags & RQSFLAG_MASK) { if (sp->req_header.rqs_flags & RQSFLAG_CONTINUATION) { isp_print_qentry(isp, "unexpected continuation segment", - oop, hp); - last_etype = etype; + cptr, hp); continue; } if (sp->req_header.rqs_flags & RQSFLAG_FULL) { @@ -5141,23 +5103,22 @@ isp_intr_respq(ispsoftc_t *isp) } if (sp->req_header.rqs_flags & RQSFLAG_BADHEADER) { isp_print_qentry(isp, "bad header flag", - oop, hp); + cptr, hp); buddaboom++; } if (sp->req_header.rqs_flags & RQSFLAG_BADPACKET) { isp_print_qentry(isp, "bad request packet", - oop, hp); + cptr, hp); buddaboom++; } if (sp->req_header.rqs_flags & RQSFLAG_BADCOUNT) { isp_print_qentry(isp, "invalid entry count", - oop, hp); + cptr, hp); buddaboom++; } if (sp->req_header.rqs_flags & RQSFLAG_BADORDER) { isp_print_qentry(isp, "invalid IOCB ordering", - oop, hp); - last_etype = etype; + cptr, hp); continue; } } @@ -5175,7 +5136,6 @@ isp_intr_respq(ispsoftc_t *isp) isp_prt(isp, ISP_LOGERR, "cannot find handle 0x%x (status 0x%x)", sp->req_handle, ts); } ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; continue; } if (req_status_flags & RQSTF_BUS_RESET) { @@ -5190,13 +5150,11 @@ isp_intr_respq(ispsoftc_t *isp) XS_SETERR(xs, HBA_BOTCH); } - resp = NULL; - rlen = 0; - snsp = NULL; - totslen = slen = 0; + resp = snsp = NULL; + rlen = slen = totslen = 0; if (IS_24XX(isp) && (scsi_status & (RQCS_RV|RQCS_SV)) != 0) { - resp = ((isp24xx_statusreq_t *)sp)->req_rsp_sense; - rlen = ((isp24xx_statusreq_t *)sp)->req_response_len; + resp = sp2->req_rsp_sense; + rlen = sp2->req_response_len; } else if (IS_FC(isp) && (scsi_status & RQCS_RV) != 0) { resp = sp->req_response; rlen = sp->req_response_len; @@ -5209,203 +5167,115 @@ isp_intr_respq(ispsoftc_t *isp) */ req_state_flags |= RQSF_GOT_STATUS|RQSF_GOT_SENSE; if (IS_24XX(isp)) { - snsp = ((isp24xx_statusreq_t *)sp)->req_rsp_sense; + snsp = sp2->req_rsp_sense; snsp += rlen; - totslen = ((isp24xx_statusreq_t *)sp)->req_sense_len; - slen = (sizeof (((isp24xx_statusreq_t *)sp)->req_rsp_sense)) - rlen; - if (totslen < slen) - slen = totslen; + totslen = sp2->req_sense_len; + slen = sizeof(sp2->req_rsp_sense) - rlen; } else { snsp = sp->req_sense_data; totslen = sp->req_sense_len; - slen = sizeof (sp->req_sense_data); - if (totslen < slen) - slen = totslen; + slen = sizeof(sp->req_sense_data); } } else if (IS_SCSI(isp) && (req_state_flags & RQSF_GOT_SENSE)) { snsp = sp->req_sense_data; totslen = sp->req_sense_len; slen = sizeof (sp->req_sense_data); - if (totslen < slen) - slen = totslen; } - if (req_state_flags & RQSF_GOT_STATUS) { + if (slen > totslen) + slen = totslen; + if (req_state_flags & RQSF_GOT_STATUS) *XS_STSP(xs) = scsi_status & 0xff; - } - switch (etype) { - case RQSTYPE_RESPONSE: - if (resp && rlen >= 4 && resp[FCP_RSPNS_CODE_OFFSET] != 0) { - const char *ptr; - char lb[64]; - const char *rnames[10] = { - "Task Management function complete", - "FCP_DATA length different than FCP_BURST_LEN", - "FCP_CMND fields invalid", - "FCP_DATA parameter mismatch with FCP_DATA_RO", - "Task Management function rejected", - "Task Management function failed", - NULL, - NULL, - "Task Management function succeeded", - "Task Management function incorrect logical unit number", - }; - uint8_t code = resp[FCP_RSPNS_CODE_OFFSET]; - if (code >= 10 || rnames[code] == NULL) { - ISP_SNPRINTF(lb, sizeof(lb), - "Unknown FCP Response Code 0x%x", - code); - ptr = lb; - } else { - ptr = rnames[code]; - } - isp_xs_prt(isp, xs, ISP_LOGWARN, - "FCP RESPONSE, LENGTH %u: %s CDB0=0x%02x", - rlen, ptr, XS_CDBP(xs)[0] & 0xff); - if (code != 0 && code != 8) - XS_SETERR(xs, HBA_BOTCH); - } - if (IS_24XX(isp)) { - isp_parse_status_24xx(isp, (isp24xx_statusreq_t *)sp, xs, &resid); + if (rlen >= 4 && resp[FCP_RSPNS_CODE_OFFSET] != 0) { + const char *ptr; + char lb[64]; + const char *rnames[10] = { + "Task Management function complete", + "FCP_DATA length different than FCP_BURST_LEN", + "FCP_CMND fields invalid", + "FCP_DATA parameter mismatch with FCP_DATA_RO", + "Task Management function rejected", + "Task Management function failed", + NULL, + NULL, + "Task Management function succeeded", + "Task Management function incorrect logical unit number", + }; + uint8_t code = resp[FCP_RSPNS_CODE_OFFSET]; + if (code >= 10 || rnames[code] == NULL) { + ISP_SNPRINTF(lb, sizeof(lb), + "Unknown FCP Response Code 0x%x", code); + ptr = lb; } else { - isp_parse_status(isp, (void *)sp, xs, &resid); + ptr = rnames[code]; } - if ((XS_NOERR(xs) || XS_ERR(xs) == HBA_NOERROR) && (*XS_STSP(xs) == SCSI_BUSY)) { - XS_SETERR(xs, HBA_TGTBSY); + isp_xs_prt(isp, xs, ISP_LOGWARN, + "FCP RESPONSE, LENGTH %u: %s CDB0=0x%02x", + rlen, ptr, XS_CDBP(xs)[0] & 0xff); + if (code != 0 && code != 8) + XS_SETERR(xs, HBA_BOTCH); + } + if (IS_24XX(isp)) + isp_parse_status_24xx(isp, sp2, xs, &resid); + else + isp_parse_status(isp, sp, xs, &resid); + if ((XS_NOERR(xs) || XS_ERR(xs) == HBA_NOERROR) && + (*XS_STSP(xs) == SCSI_BUSY)) + XS_SETERR(xs, HBA_TGTBSY); + if (IS_SCSI(isp)) { + XS_SET_RESID(xs, resid); + /* + * A new synchronous rate was negotiated for + * this target. Mark state such that we'll go + * look up that which has changed later. + */ + if (req_status_flags & RQSTF_NEGOTIATION) { + int t = XS_TGT(xs); + sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs)); + sdp->isp_devparam[t].dev_refresh = 1; + sdp->update = 1; } - if (IS_SCSI(isp)) { + } else { + if (req_status_flags & RQSF_XFER_COMPLETE) { + XS_SET_RESID(xs, 0); + } else if (scsi_status & RQCS_RESID) { XS_SET_RESID(xs, resid); - /* - * A new synchronous rate was negotiated for - * this target. Mark state such that we'll go - * look up that which has changed later. - */ - if (req_status_flags & RQSTF_NEGOTIATION) { - int t = XS_TGT(xs); - sdparam *sdp = SDPARAM(isp, XS_CHANNEL(xs)); - sdp->isp_devparam[t].dev_refresh = 1; - sdp->update = 1; - } } else { - if (req_status_flags & RQSF_XFER_COMPLETE) { - XS_SET_RESID(xs, 0); - } else if (scsi_status & RQCS_RESID) { - XS_SET_RESID(xs, resid); - } else { - XS_SET_RESID(xs, 0); - } - } - if (snsp && slen) { - if (totslen > slen) { - continuations_expected += ((totslen - slen + QENTRY_LEN - 5) / (QENTRY_LEN - 4)); - if (ndone > (MAX_REQUESTQ_COMPLETIONS - continuations_expected - 1)) { - /* we'll lose some stats, but that's a small price to pay */ - for (i = 0; i < ndone; i++) { - if (complist[i]) - isp_done(complist[i]); - } - ndone = 0; - } - isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, "Expecting %d more Status Continuations for total sense length of %u", - continuations_expected, totslen); - } - XS_SAVE_SENSE(xs, snsp, totslen, slen); - } else if ((req_status_flags & RQSF_GOT_STATUS) && (scsi_status & 0xff) == SCSI_CHECK && IS_FC(isp)) { - isp_prt(isp, ISP_LOGWARN, "CHECK CONDITION w/o sense data for CDB=0x%x", XS_CDBP(xs)[0] & 0xff); - isp_print_qentry(isp, "CC with no Sense", - oop, hp); - } - isp_prt(isp, ISP_LOGDEBUG2, "asked for %ld got raw resid %ld settled for %ld", (long) XS_XFRLEN(xs), resid, (long) XS_GET_RESID(xs)); - break; - case RQSTYPE_REQUEST: - case RQSTYPE_A64: - case RQSTYPE_T2RQS: - case RQSTYPE_T3RQS: - case RQSTYPE_T7RQS: - if (!IS_24XX(isp) && (sp->req_header.rqs_flags & RQSFLAG_FULL)) { - /* - * Force Queue Full status. - */ - *XS_STSP(xs) = SCSI_QFULL; - XS_SETERR(xs, HBA_NOERROR); - } else if (XS_NOERR(xs)) { - isp_prt(isp, ISP_LOG_WARN1, - "%d.%d.%jx badness at %s:%u", - XS_CHANNEL(xs), XS_TGT(xs), - (uintmax_t)XS_LUN(xs), - __func__, __LINE__); - XS_SETERR(xs, HBA_BOTCH); + XS_SET_RESID(xs, 0); } - XS_SET_RESID(xs, XS_XFRLEN(xs)); - break; - default: - isp_print_qentry(isp, "Unhandled Response Type", - oop, hp); - if (XS_NOERR(xs)) { - XS_SETERR(xs, HBA_BOTCH); + } + if (slen > 0) { + XS_SAVE_SENSE(xs, snsp, slen); + if (totslen > slen) { + cont = totslen - slen; + cont_xs = xs; + isp_prt(isp, ISP_LOGDEBUG0|ISP_LOG_CWARN, + "Expecting Status Continuations for %u bytes", + cont); } - break; } + isp_prt(isp, ISP_LOGDEBUG2, "asked for %lu got raw resid %lu settled for %lu", + (u_long)XS_XFRLEN(xs), (u_long)resid, (u_long)XS_GET_RESID(xs)); - /* - * Free any DMA resources. As a side effect, this may - * also do any cache flushing necessary for data coherence. - */ - if (XS_XFRLEN(xs)) { + if (XS_XFRLEN(xs)) ISP_DMAFREE(isp, xs, sp->req_handle); - } isp_destroy_handle(isp, sp->req_handle); - complist[ndone++] = xs; /* defer completion call until later */ ISP_MEMZERO(hp, QENTRY_LEN); /* PERF */ - last_etype = etype; - if (ndone == MAX_REQUESTQ_COMPLETIONS) { - break; - } - } - - /* - * If we looked at any commands, then it's valid to find out - * what the outpointer is. It also is a trigger to update the - * ISP's notion of what we've seen so far. - */ - if (nlooked) { - ISP_WRITE(isp, isp->isp_respoutrp, optr); - isp->isp_resodx = optr; - } - for (i = 0; i < ndone; i++) { - xs = complist[i]; - if (xs) { - if (((isp->isp_dblev & (ISP_LOGDEBUG1|ISP_LOGDEBUG2|ISP_LOGDEBUG3))) || - ((isp->isp_dblev & (ISP_LOGDEBUG0|ISP_LOG_CWARN) && ((!XS_NOERR(xs)) || (*XS_STSP(xs) != SCSI_GOOD))))) { - isp_prt_endcmd(isp, xs); - } + /* Complete command if we expect no Status Continuations. */ + if (cont == 0) isp_done(xs); - } } -} - -/* - * Support routines. - */ -void -isp_prt_endcmd(ispsoftc_t *isp, XS_T *xs) -{ - char cdbstr[16 * 5 + 1]; - int i, lim; + /* We haven't received all Status Continuations, but that is it. */ + if (cont > 0) + isp_done(cont_xs); - lim = XS_CDBLEN(xs) > 16? 16 : XS_CDBLEN(xs); - ISP_SNPRINTF(cdbstr, sizeof (cdbstr), "0x%02x ", XS_CDBP(xs)[0]); - for (i = 1; i < lim; i++) { - ISP_SNPRINTF(cdbstr, sizeof (cdbstr), "%s0x%02x ", cdbstr, XS_CDBP(xs)[i]); - } - if (XS_SENSE_VALID(xs)) { - isp_xs_prt(isp, xs, ISP_LOGALL, "FIN dl%d resid %ld CDB=%s SenseLength=%u/%u KEY/ASC/ASCQ=0x%02x/0x%02x/0x%02x", - XS_XFRLEN(xs), (long) XS_GET_RESID(xs), cdbstr, XS_CUR_SNSLEN(xs), XS_TOT_SNSLEN(xs), XS_SNSKEY(xs), XS_SNSASC(xs), XS_SNSASCQ(xs)); - } else { - isp_xs_prt(isp, xs, ISP_LOGALL, "FIN dl%d resid %ld CDB=%s STS 0x%x XS_ERR=0x%x", XS_XFRLEN(xs), (long) XS_GET_RESID(xs), cdbstr, *XS_STSP(xs), XS_ERR(xs)); + /* If we processed any IOCBs, let ISP know about it. */ + if (optr != isp->isp_resodx) { + ISP_WRITE(isp, isp->isp_respoutrp, optr); + isp->isp_resodx = optr; } } @@ -5990,34 +5860,17 @@ isp_handle_other_response(ispsoftc_t *is case RQSTYPE_ABTS_RCVD: case RQSTYPE_ABTS_RSP: #ifdef ISP_TARGET_MODE - if (isp_target_notify(isp, (ispstatusreq_t *) hp, optrp)) - return (1); + return (isp_target_notify(isp, (ispstatusreq_t *) hp, optrp)); #endif /* FALLTHROUGH */ case RQSTYPE_REQUEST: default: - ISP_DELAY(100); - if (type != isp_get_response_type(isp, hp)) { - /* - * This is questionable- we're just papering over - * something we've seen on SMP linux in target - * mode- we don't really know what's happening - * here that causes us to think we've gotten - * an entry, but that either the entry isn't - * filled out yet or our CPU read data is stale. - */ - isp_prt(isp, ISP_LOGINFO, - "unstable type in response queue"); - return (-1); - } - isp_prt(isp, ISP_LOGWARN, "Unhandled Response Type 0x%x", - isp_get_response_type(isp, hp)); return (0); } } static void -isp_parse_status(ispsoftc_t *isp, ispstatusreq_t *sp, XS_T *xs, long *rp) +isp_parse_status(ispsoftc_t *isp, ispstatusreq_t *sp, XS_T *xs, uint32_t *rp) { switch (sp->req_completion_status & 0xff) { case RQCS_COMPLETE: @@ -6345,7 +6198,7 @@ isp_parse_status(ispsoftc_t *isp, ispsta } static void -isp_parse_status_24xx(ispsoftc_t *isp, isp24xx_statusreq_t *sp, XS_T *xs, long *rp) +isp_parse_status_24xx(ispsoftc_t *isp, isp24xx_statusreq_t *sp, XS_T *xs, uint32_t *rp) { int ru_marked, sv_marked; int chan = XS_CHANNEL(xs); Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:12:03 2017 (r317362) +++ stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:19:47 2017 (r317363) @@ -731,8 +731,6 @@ isp_free_pcmd(ispsoftc_t *isp, union ccb if (ISP_PCMD(ccb)) { #ifdef ISP_TARGET_MODE PISP_PCMD(ccb)->datalen = 0; - PISP_PCMD(ccb)->totslen = 0; - PISP_PCMD(ccb)->cumslen = 0; PISP_PCMD(ccb)->crn = 0; #endif PISP_PCMD(ccb)->next = isp->isp_osinfo.pcmd_free; @@ -2581,7 +2579,6 @@ isp_watchdog(void *arg) isp_prt(isp, ISP_LOGERR, "%s: timeout for handle 0x%x", __func__, handle); xs->ccb_h.status &= ~CAM_STATUS_MASK; xs->ccb_h.status |= CAM_CMD_TIMEOUT; - isp_prt_endcmd(isp, xs); isp_done(xs); } else { if (ohandle != ISP_HANDLE_FREE) { Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:12:03 2017 (r317362) +++ stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:19:47 2017 (r317363) @@ -176,8 +176,6 @@ struct isp_pcmd { struct ispsoftc * isp; /* containing isp */ struct callout wdog; /* watchdog timer */ uint32_t datalen; /* data length for this command (target mode only) */ - uint8_t totslen; /* sense length on status response */ - uint8_t cumslen; /* sense length on status response */ uint8_t crn; /* command reference number */ }; #define ISP_PCMD(ccb) (ccb)->ccb_h.spriv_ptr1 @@ -569,26 +567,19 @@ default: \ #define XS_INITERR(ccb) XS_SETERR(ccb, CAM_REQ_INPROG), ccb->sense_resid = ccb->sense_len -#define XS_SAVE_SENSE(xs, sense_ptr, totslen, slen) do { \ - uint32_t tlen = slen; \ - if (tlen > (xs)->sense_len) \ - tlen = (xs)->sense_len; \ - PISP_PCMD(xs)->totslen = imin((xs)->sense_len, totslen); \ - PISP_PCMD(xs)->cumslen = tlen; \ - memcpy(&(xs)->sense_data, sense_ptr, tlen); \ - (xs)->sense_resid = (xs)->sense_len - tlen; \ - (xs)->ccb_h.status |= CAM_AUTOSNS_VALID; \ +#define XS_SAVE_SENSE(xs, sp, len) do { \ + uint32_t amt = min(len, (xs)->sense_len); \ + memcpy(&(xs)->sense_data, sp, amt); \ + (xs)->sense_resid = (xs)->sense_len - amt; \ + (xs)->ccb_h.status |= CAM_AUTOSNS_VALID; \ } while (0) -#define XS_SENSE_APPEND(xs, xsnsp, xsnsl) do { \ - uint32_t off = PISP_PCMD(xs)->cumslen; \ - uint8_t *ptr = &((uint8_t *)(&(xs)->sense_data))[off]; \ - uint32_t amt = imin(xsnsl, PISP_PCMD(xs)->totslen - off); \ - if (amt) { \ - memcpy(ptr, xsnsp, amt); \ - (xs)->sense_resid -= amt; \ - PISP_PCMD(xs)->cumslen += amt; \ - } \ +#define XS_SENSE_APPEND(xs, sp, len) do { \ + uint8_t *ptr = (uint8_t *)(&(xs)->sense_data) + \ + ((xs)->sense_len - (xs)->sense_resid); \ + uint32_t amt = min((len), (xs)->sense_resid); \ + memcpy(ptr, sp, amt); \ + (xs)->sense_resid -= amt; \ } while (0) #define XS_SENSE_VALID(xs) (((xs)->ccb_h.status & CAM_AUTOSNS_VALID) != 0) Modified: stable/10/sys/dev/isp/ispvar.h ============================================================================== --- stable/10/sys/dev/isp/ispvar.h Mon Apr 24 11:12:03 2017 (r317362) +++ stable/10/sys/dev/isp/ispvar.h Mon Apr 24 11:19:47 2017 (r317363) @@ -914,11 +914,6 @@ void isp_async(ispsoftc_t *, ispasync_t, #define ISPASYNC_CHANGE_OTHER 2 /* - * Platform Independent Error Prinout - */ -void isp_prt_endcmd(ispsoftc_t *, XS_T *); - -/* * Platform Dependent Error and Debug Printout * * Two required functions for each platform must be provided: @@ -1039,8 +1034,7 @@ void isp_prt_endcmd(ispsoftc_t *, XS_T * * XS_NOERR(xs) there is no error currently set * XS_INITERR(xs) initialize error state * - * XS_SAVE_SENSE(xs, sp, total_len, this_len) save sense data (total and current amount) - * + * XS_SAVE_SENSE(xs, sp, len) save sense data * XS_APPEND_SENSE(xs, sp, len) append more sense data * * XS_SENSE_VALID(xs) indicates whether sense is valid From owner-svn-src-stable-10@freebsd.org Mon Apr 24 11:20:23 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E17CD4D147; Mon, 24 Apr 2017 11:20:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F3F7A1BC5; Mon, 24 Apr 2017 11:20:22 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OBKMVD027434; Mon, 24 Apr 2017 11:20:22 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBKLQl027432; Mon, 24 Apr 2017 11:20:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241120.v3OBKLQl027432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 11:20:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317364 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:20:23 -0000 Author: mav Date: Mon Apr 24 11:20:21 2017 New Revision: 317364 URL: https://svnweb.freebsd.org/changeset/base/317364 Log: MFC r315869: Remove write-only crn field from struct isp_pcmd. Modified: stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/dev/isp/isp_freebsd.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:19:47 2017 (r317363) +++ stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:20:21 2017 (r317364) @@ -731,7 +731,6 @@ isp_free_pcmd(ispsoftc_t *isp, union ccb if (ISP_PCMD(ccb)) { #ifdef ISP_TARGET_MODE PISP_PCMD(ccb)->datalen = 0; - PISP_PCMD(ccb)->crn = 0; #endif PISP_PCMD(ccb)->next = isp->isp_osinfo.pcmd_free; isp->isp_osinfo.pcmd_free = ISP_PCMD(ccb); @@ -4207,7 +4206,6 @@ isp_fcp_next_crn(ispsoftc_t *isp, uint8_ } if (nxp->crnseed == 0) nxp->crnseed = 1; - PISP_PCMD(cmd)->crn = nxp->crnseed; *crnp = nxp->crnseed++; return (0); } Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:19:47 2017 (r317363) +++ stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:20:21 2017 (r317364) @@ -176,7 +176,6 @@ struct isp_pcmd { struct ispsoftc * isp; /* containing isp */ struct callout wdog; /* watchdog timer */ uint32_t datalen; /* data length for this command (target mode only) */ - uint8_t crn; /* command reference number */ }; #define ISP_PCMD(ccb) (ccb)->ccb_h.spriv_ptr1 #define PISP_PCMD(ccb) ((struct isp_pcmd *)ISP_PCMD(ccb)) From owner-svn-src-stable-10@freebsd.org Mon Apr 24 11:20:57 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5F638D4D1E3; Mon, 24 Apr 2017 11:20:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 2F89B1E59; Mon, 24 Apr 2017 11:20:57 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OBKuJx030471; Mon, 24 Apr 2017 11:20:56 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBKufQ030470; Mon, 24 Apr 2017 11:20:56 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241120.v3OBKufQ030470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 11:20:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317365 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:20:57 -0000 Author: mav Date: Mon Apr 24 11:20:55 2017 New Revision: 317365 URL: https://svnweb.freebsd.org/changeset/base/317365 Log: MFC r315870: isp field in struct isp_pcmd is also unused. Modified: stable/10/sys/dev/isp/isp_freebsd.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:20:21 2017 (r317364) +++ stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:20:55 2017 (r317365) @@ -173,7 +173,6 @@ typedef struct tstate { struct isp_pcmd { struct isp_pcmd * next; bus_dmamap_t dmap; /* dma map for this command */ - struct ispsoftc * isp; /* containing isp */ struct callout wdog; /* watchdog timer */ uint32_t datalen; /* data length for this command (target mode only) */ }; From owner-svn-src-stable-10@freebsd.org Mon Apr 24 11:21:34 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A3F12D4D267; Mon, 24 Apr 2017 11:21:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 685176C; Mon, 24 Apr 2017 11:21:34 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OBLXQo031288; Mon, 24 Apr 2017 11:21:33 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBLW1W031280; Mon, 24 Apr 2017 11:21:32 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241121.v3OBLW1W031280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 11:21:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317366 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:21:34 -0000 Author: mav Date: Mon Apr 24 11:21:32 2017 New Revision: 317366 URL: https://svnweb.freebsd.org/changeset/base/317366 Log: MFC r315908: Unify initiator and target DMA setup and command sending. The code is so alike that it is pointless to keep it separate. Modified: stable/10/sys/dev/isp/isp_freebsd.c stable/10/sys/dev/isp/isp_freebsd.h stable/10/sys/dev/isp/isp_library.c stable/10/sys/dev/isp/isp_library.h stable/10/sys/dev/isp/isp_pci.c stable/10/sys/dev/isp/isp_sbus.c stable/10/sys/dev/isp/ispvar.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/isp_freebsd.c Mon Apr 24 11:21:32 2017 (r317366) @@ -1372,10 +1372,7 @@ isp_target_start_ctio(ispsoftc_t *isp, u } else { ct2_entry_t *cto = (ct2_entry_t *) local; - if (isp->isp_osinfo.sixtyfourbit) - cto->ct_header.rqs_entry_type = RQSTYPE_CTIO3; - else - cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; + cto->ct_header.rqs_entry_type = RQSTYPE_CTIO2; cto->ct_header.rqs_entry_count = 1; cto->ct_header.rqs_seqno |= ATPD_SEQ_NOTIFY_CAM; ATPD_SET_SEQNO(cto, atp); @@ -1468,14 +1465,8 @@ isp_target_start_ctio(ispsoftc_t *isp, u isp_prt(isp, ISP_LOGTDEBUG0, "%s: ests base %p vaddr %p ecmd_dma %jx addr %jx len %u", __func__, isp->isp_osinfo.ecmd_base, atp->ests, (uintmax_t) isp->isp_osinfo.ecmd_dma, (uintmax_t)addr, MIN_FCP_RESPONSE_SIZE + sense_length); cto->rsp.m2.ct_datalen = MIN_FCP_RESPONSE_SIZE + sense_length; - if (cto->ct_header.rqs_entry_type == RQSTYPE_CTIO3) { - cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_base = DMA_LO32(addr); - cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_basehi = DMA_HI32(addr); - cto->rsp.m2.u.ct_fcp_rsp_iudata_64.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; - } else { - cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr); - cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; - } + cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_base = DMA_LO32(addr); + cto->rsp.m2.u.ct_fcp_rsp_iudata_32.ds_count = MIN_FCP_RESPONSE_SIZE + sense_length; } if (sense_length) { isp_prt(isp, ISP_LOGTDEBUG0, "%s: CTIO2[0x%x] seq %u nc %d CDB0=%x sstatus=0x%x flags=0x%x resid=%d sense: %x %x/%x/%x", __func__, @@ -3467,7 +3458,7 @@ isp_action(struct cam_sim *sim, union cc cpi->max_lun = ISP_MAX_LUNS(isp) == 0 ? 255 : ISP_MAX_LUNS(isp) - 1; cpi->bus_id = cam_sim_bus(sim); - if (isp->isp_osinfo.sixtyfourbit) + if (sizeof (bus_size_t) > 4) cpi->maxio = (ISP_NSEG64_MAX - 1) * PAGE_SIZE; else cpi->maxio = (ISP_NSEG_MAX - 1) * PAGE_SIZE; Modified: stable/10/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/isp_freebsd.h Mon Apr 24 11:21:32 2017 (r317366) @@ -293,7 +293,6 @@ struct isposinfo { struct isp_pcmd * pcmd_pool; struct isp_pcmd * pcmd_free; - int sixtyfourbit; /* sixtyfour bit platform */ int mbox_sleeping; int mbox_sleep_ok; int mboxbsy; @@ -505,6 +504,13 @@ default: \ d->ds_base = DMA_LO32(e->ds_addr); \ d->ds_count = e->ds_len; \ } +#if (BUS_SPACE_MAXADDR > UINT32_MAX) +#define XS_NEED_DMA64_SEG(s, n) \ + (((bus_dma_segment_t *)s)[n].ds_addr + \ + ((bus_dma_segment_t *)s)[n].ds_len > UINT32_MAX) +#else +#define XS_NEED_DMA64_SEG(s, n) (0) +#endif #define XS_ISP(ccb) cam_sim_softc(xpt_path_sim((ccb)->ccb_h.path)) #define XS_CHANNEL(ccb) cam_sim_bus(xpt_path_sim((ccb)->ccb_h.path)) #define XS_TGT(ccb) (ccb)->ccb_h.target_id Modified: stable/10/sys/dev/isp/isp_library.c ============================================================================== --- stable/10/sys/dev/isp/isp_library.c Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/isp_library.c Mon Apr 24 11:21:32 2017 (r317366) @@ -61,8 +61,8 @@ int isp_send_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, ispds64_t *ecmd) { uint8_t storage[QENTRY_LEN]; - uint8_t type, nqe; - uint32_t seg, curseg, seglim, nxt, nxtnxt, ddf; + uint8_t type, nqe, need64; + uint32_t seg, seglim, nxt, nxtnxt, ddf; ispds_t *dsp = NULL; ispds64_t *dsp64 = NULL; void *qe0, *qe1; @@ -88,8 +88,21 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, goto copy_and_sync; } + need64 = 0; + for (seg = 0; seg < nsegs; seg++) + need64 |= XS_NEED_DMA64_SEG(segp, seg); + if (need64) { + if (type == RQSTYPE_T2RQS) + ((isphdr_t *)fqe)->rqs_entry_type = type = RQSTYPE_T3RQS; + else if (type == RQSTYPE_REQUEST) + ((isphdr_t *)fqe)->rqs_entry_type = type = RQSTYPE_A64; + else if (type == RQSTYPE_CTIO2) + ((isphdr_t *)fqe)->rqs_entry_type = type = RQSTYPE_CTIO3; + } + /* - * First figure out how many pieces of data to transfer and what kind and how many we can put into the first queue entry. + * First figure out how many pieces of data to transfer, what + * kind and how many we can put into the first queue entry. */ switch (type) { case RQSTYPE_REQUEST: @@ -121,15 +134,27 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, dsp64 = &((ispreqt7_t *)fqe)->req_dataseg; seglim = 1; break; +#ifdef ISP_TARGET_MODE + case RQSTYPE_CTIO2: + dsp = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg; + seglim = ISP_RQDSEG_T2; + break; + case RQSTYPE_CTIO3: + dsp64 = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg64; + seglim = ISP_RQDSEG_T3; + break; + case RQSTYPE_CTIO7: + dsp64 = &((ct7_entry_t *)fqe)->rsp.m0.ds; + seglim = 1; + break; +#endif default: return (CMD_COMPLETE); } - - if (seglim > nsegs) { + if (seglim > nsegs) seglim = nsegs; - } - - for (seg = curseg = 0; curseg < seglim; curseg++) { + seg = 0; + while (seg < seglim) { if (dsp64) { XS_GET_DMA64_SEG(dsp64++, segp, seg++); } else { @@ -137,7 +162,6 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, } } - /* * Second, start building additional continuation segments as needed. */ @@ -164,10 +188,10 @@ isp_send_cmd(ispsoftc_t *isp, void *fqe, crq->req_header.rqs_entry_count = 1; dsp = crq->req_dataseg; } - if (seg + seglim > nsegs) { - seglim = nsegs - seg; - } - for (curseg = 0; curseg < seglim; curseg++) { + seglim += seg; + if (seglim > nsegs) + seglim = nsegs; + while (seg < seglim) { if (dsp64) { XS_GET_DMA64_SEG(dsp64++, segp, seg++); } else { @@ -191,23 +215,17 @@ copy_and_sync: switch (type) { case RQSTYPE_REQUEST: ((ispreq_t *)fqe)->req_flags |= ddf; - /* - * This is historical and not clear whether really needed. - */ - if (nsegs == 0) { + /* This is historical and not clear whether really needed. */ + if (nsegs == 0) nsegs = 1; - } ((ispreq_t *)fqe)->req_seg_count = nsegs; isp_put_request(isp, fqe, qe0); break; case RQSTYPE_CMDONLY: ((ispreq_t *)fqe)->req_flags |= ddf; - /* - * This is historical and not clear whether really needed. - */ - if (nsegs == 0) { + /* This is historical and not clear whether really needed. */ + if (nsegs == 0) nsegs = 1; - } ((ispextreq_t *)fqe)->req_seg_count = nsegs; isp_put_extended_request(isp, fqe, qe0); break; @@ -233,11 +251,34 @@ copy_and_sync: } break; case RQSTYPE_T7RQS: - ((ispreqt7_t *)fqe)->req_alen_datadir = ddf; + ((ispreqt7_t *)fqe)->req_alen_datadir = ddf; ((ispreqt7_t *)fqe)->req_seg_count = nsegs; ((ispreqt7_t *)fqe)->req_dl = totalcnt; isp_put_request_t7(isp, fqe, qe0); break; +#ifdef ISP_TARGET_MODE + case RQSTYPE_CTIO2: + case RQSTYPE_CTIO3: + if (((ct2_entry_t *)fqe)->ct_flags & CT2_FLAG_MODE2) { + ((ct2_entry_t *)fqe)->ct_seg_count = 1; + } else { + ((ct2_entry_t *)fqe)->ct_seg_count = nsegs; + } + if (ISP_CAP_2KLOGIN(isp)) { + isp_put_ctio2e(isp, fqe, qe0); + } else { + isp_put_ctio2(isp, fqe, qe0); + } + break; + case RQSTYPE_CTIO7: + if (((ct7_entry_t *)fqe)->ct_flags & CT7_FLAG_MODE2) { + ((ct7_entry_t *)fqe)->ct_seg_count = 1; + } else { + ((ct7_entry_t *)fqe)->ct_seg_count = nsegs; + } + isp_put_ctio7(isp, fqe, qe0); + break; +#endif default: return (CMD_COMPLETE); } @@ -2057,168 +2098,6 @@ isp_put_fcp_rsp_iu(ispsoftc_t *isp, fcp_ ISP_IOZPUT_32(isp, src->fcp_rsp_rsplen, &dst->fcp_rsp_rsplen); } -#ifdef ISP_TARGET_MODE - -/* - * Command shipping- finish off first queue entry and do dma mapping and - * additional segments as needed. - * - * Called with the first queue entry mostly filled out. - * Our job here is to finish that and add additional data - * segments if needed. - * - * We used to do synthetic entries to split data and status - * at this level, but that started getting too tricky. - */ -int -isp_send_tgt_cmd(ispsoftc_t *isp, void *fqe, void *segp, uint32_t nsegs, uint32_t totalcnt, isp_ddir_t ddir, void *snsptr, uint32_t snslen) -{ - uint8_t storage[QENTRY_LEN]; - uint8_t type, nqe; - uint32_t seg, curseg, seglim, nxt, nxtnxt; - ispds_t *dsp = NULL; - ispds64_t *dsp64 = NULL; - void *qe0, *qe1; - - qe0 = isp_getrqentry(isp); - if (qe0 == NULL) { - return (CMD_EAGAIN); - } - nxt = ISP_NXT_QENTRY(isp->isp_reqidx, RQUEST_QUEUE_LEN(isp)); - - type = ((isphdr_t *)fqe)->rqs_entry_type; - nqe = 1; - seglim = 0; - - /* - * If we have data to transmit, figure out how many segments can fit into the first entry. - */ - if (ddir != ISP_NOXFR) { - /* - * First, figure out how many pieces of data to transfer and what kind and how many we can put into the first queue entry. - */ - switch (type) { - case RQSTYPE_CTIO2: - dsp = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg; - seglim = ISP_RQDSEG_T2; - break; - case RQSTYPE_CTIO3: - dsp64 = ((ct2_entry_t *)fqe)->rsp.m0.u.ct_dataseg64; - seglim = ISP_RQDSEG_T3; - break; - case RQSTYPE_CTIO7: - dsp64 = &((ct7_entry_t *)fqe)->rsp.m0.ds; - seglim = 1; - break; - default: - return (CMD_COMPLETE); - } - } - - /* - * First, fill out any of the data transfer stuff that fits - * in the first queue entry. - */ - if (seglim > nsegs) { - seglim = nsegs; - } - - for (seg = curseg = 0; curseg < seglim; curseg++) { - if (dsp64) { - XS_GET_DMA64_SEG(dsp64++, segp, seg++); - } else { - XS_GET_DMA_SEG(dsp++, segp, seg++); - } - } - - /* - * Second, start building additional continuation segments as needed. - */ - while (seg < nsegs) { - nxtnxt = ISP_NXT_QENTRY(nxt, RQUEST_QUEUE_LEN(isp)); - if (nxtnxt == isp->isp_reqodx) { - isp->isp_reqodx = ISP_READ(isp, isp->isp_rqstoutrp); - if (nxtnxt == isp->isp_reqodx) - return (CMD_EAGAIN); - } - ISP_MEMZERO(storage, QENTRY_LEN); - qe1 = ISP_QUEUE_ENTRY(isp->isp_rquest, nxt); - nxt = nxtnxt; - if (dsp64) { - ispcontreq64_t *crq = (ispcontreq64_t *) storage; - seglim = ISP_CDSEG64; - crq->req_header.rqs_entry_type = RQSTYPE_A64_CONT; - crq->req_header.rqs_entry_count = 1; - dsp64 = crq->req_dataseg; - } else { - ispcontreq_t *crq = (ispcontreq_t *) storage; - seglim = ISP_CDSEG; - crq->req_header.rqs_entry_type = RQSTYPE_DATASEG; - crq->req_header.rqs_entry_count = 1; - dsp = crq->req_dataseg; - } - if (seg + seglim > nsegs) { - seglim = nsegs - seg; - } - for (curseg = 0; curseg < seglim; curseg++) { - if (dsp64) { - XS_GET_DMA64_SEG(dsp64++, segp, seg++); - } else { - XS_GET_DMA_SEG(dsp++, segp, seg++); - } - } - if (dsp64) { - isp_put_cont64_req(isp, (ispcontreq64_t *)storage, qe1); - } else { - isp_put_cont_req(isp, (ispcontreq_t *)storage, qe1); - } - if (isp->isp_dblev & ISP_LOGTDEBUG1) { - isp_print_bytes(isp, "additional queue entry", - QENTRY_LEN, qe1); - } - nqe++; - } - - /* - * Third, not patch up the first queue entry with the number of segments - * we actually are going to be transmitting. At the same time, handle - * any mode 2 requests. - */ - ((isphdr_t *)fqe)->rqs_entry_count = nqe; - switch (type) { - case RQSTYPE_CTIO2: - case RQSTYPE_CTIO3: - if (((ct2_entry_t *)fqe)->ct_flags & CT2_FLAG_MODE2) { - ((ct2_entry_t *)fqe)->ct_seg_count = 1; - } else { - ((ct2_entry_t *)fqe)->ct_seg_count = nsegs; - } - if (ISP_CAP_2KLOGIN(isp)) { - isp_put_ctio2e(isp, fqe, qe0); - } else { - isp_put_ctio2(isp, fqe, qe0); - } - break; - case RQSTYPE_CTIO7: - if (((ct7_entry_t *)fqe)->ct_flags & CT7_FLAG_MODE2) { - ((ct7_entry_t *)fqe)->ct_seg_count = 1; - } else { - ((ct7_entry_t *)fqe)->ct_seg_count = nsegs; - } - isp_put_ctio7(isp, fqe, qe0); - break; - default: - return (CMD_COMPLETE); - } - if (isp->isp_dblev & ISP_LOGTDEBUG1) { - isp_print_bytes(isp, "first queue entry", QENTRY_LEN, qe0); - } - ISP_ADD_REQUEST(isp, nxt); - return (CMD_QUEUED); -} - -#endif - /* * Find port database entries */ Modified: stable/10/sys/dev/isp/isp_library.h ============================================================================== --- stable/10/sys/dev/isp/isp_library.h Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/isp_library.h Mon Apr 24 11:21:32 2017 (r317366) @@ -156,9 +156,8 @@ void isp_put_fcp_rsp_iu(ispsoftc_t *isp, #else #include "isp_target.h" #endif - -int isp_send_tgt_cmd(ispsoftc_t *, void *, void *, uint32_t, uint32_t, isp_ddir_t, void *, uint32_t); #endif + int isp_find_pdb_empty(ispsoftc_t *, int, fcportdb_t **); int isp_find_pdb_by_wwpn(ispsoftc_t *, int, uint64_t, fcportdb_t **); int isp_find_pdb_by_handle(ispsoftc_t *, int, uint16_t, fcportdb_t **); Modified: stable/10/sys/dev/isp/isp_pci.c ============================================================================== --- stable/10/sys/dev/isp/isp_pci.c Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/isp_pci.c Mon Apr 24 11:21:32 2017 (r317366) @@ -682,8 +682,6 @@ isp_pci_attach(device_t dev) pcs->pci_dev = dev; isp->isp_dev = dev; isp->isp_nchan = 1; - if (sizeof (bus_addr_t) > 4) - isp->isp_osinfo.sixtyfourbit = 1; mtx_init(&isp->isp_lock, "isp", NULL, MTX_DEF); /* @@ -1527,7 +1525,7 @@ isp_pci_mbxdma(ispsoftc_t *isp) slim = (1UL << 24); llim = BUS_SPACE_MAXADDR_32BIT; } - if (isp->isp_osinfo.sixtyfourbit) + if (sizeof (bus_size_t) > 4) nsegs = ISP_NSEG64_MAX; else nsegs = ISP_NSEG_MAX; @@ -1839,122 +1837,39 @@ typedef struct { #define MUSHERR_NOQENTRIES -2 -#ifdef ISP_TARGET_MODE -static void -tdma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) -{ - mush_t *mp; - ispsoftc_t *isp; - struct ccb_scsiio *csio; - isp_ddir_t ddir; - ispreq_t *rq; - - mp = (mush_t *) arg; - if (error) { - mp->error = error; - return; - } - csio = mp->cmd_token; - isp = mp->isp; - rq = mp->rq; - if (nseg) { - if (isp->isp_osinfo.sixtyfourbit) { - if (nseg >= ISP_NSEG64_MAX) { - isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG64_MAX); - mp->error = EFAULT; - return; - } - if (rq->req_header.rqs_entry_type == RQSTYPE_CTIO2) { - rq->req_header.rqs_entry_type = RQSTYPE_CTIO3; - } - } else { - if (nseg >= ISP_NSEG_MAX) { - isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG_MAX); - mp->error = EFAULT; - return; - } - } - if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); - ddir = ISP_TO_DEVICE; - } else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); - ddir = ISP_FROM_DEVICE; - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; - } - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; - } - - error = isp_send_tgt_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, &csio->sense_data, csio->sense_len); - switch (error) { - case CMD_EAGAIN: - mp->error = MUSHERR_NOQENTRIES; - case CMD_QUEUED: - break; - default: - mp->error = EIO; - } -} -#endif - static void dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) { - mush_t *mp; - ispsoftc_t *isp; - struct ccb_scsiio *csio; + mush_t *mp = (mush_t *) arg; + ispsoftc_t *isp= mp->isp; + struct ccb_scsiio *csio = mp->cmd_token; isp_ddir_t ddir; - ispreq_t *rq; + int sdir; - mp = (mush_t *) arg; if (error) { mp->error = error; return; } - csio = mp->cmd_token; - isp = mp->isp; - rq = mp->rq; - if (nseg) { - if (isp->isp_osinfo.sixtyfourbit) { - if (nseg >= ISP_NSEG64_MAX) { - isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG64_MAX); - mp->error = EFAULT; - return; - } - if (rq->req_header.rqs_entry_type == RQSTYPE_T2RQS) { - rq->req_header.rqs_entry_type = RQSTYPE_T3RQS; - } else if (rq->req_header.rqs_entry_type == RQSTYPE_REQUEST) { - rq->req_header.rqs_entry_type = RQSTYPE_A64; - } - } else { - if (nseg >= ISP_NSEG_MAX) { - isp_prt(isp, ISP_LOGERR, "number of segments (%d) exceed maximum we can support (%d)", nseg, ISP_NSEG_MAX); - mp->error = EFAULT; - return; - } - } + if (nseg == 0) { + ddir = ISP_NOXFR; + } else { if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); ddir = ISP_FROM_DEVICE; - } else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); + } else { ddir = ISP_TO_DEVICE; + } + if ((csio->ccb_h.func_code == XPT_CONT_TARGET_IO) ^ + ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)) { + sdir = BUS_DMASYNC_PREREAD; } else { - ddir = ISP_NOXFR; + sdir = BUS_DMASYNC_PREWRITE; } - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; + bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, + sdir); } - error = isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, (ispds64_t *)csio->req_map); + error = isp_send_cmd(isp, mp->rq, dm_segs, nseg, XS_XFRLEN(csio), + ddir, (ispds64_t *)csio->req_map); switch (error) { case CMD_EAGAIN: mp->error = MUSHERR_NOQENTRIES; @@ -1971,7 +1886,6 @@ static int isp_pci_dmasetup(ispsoftc_t *isp, struct ccb_scsiio *csio, void *ff) { mush_t mush, *mp; - void (*eptr)(void *, bus_dma_segment_t *, int, int); int error; mp = &mush; @@ -1980,15 +1894,8 @@ isp_pci_dmasetup(ispsoftc_t *isp, struct mp->rq = ff; mp->error = 0; -#ifdef ISP_TARGET_MODE - if (csio->ccb_h.func_code == XPT_CONT_TARGET_IO) - eptr = tdma2; - else -#endif - eptr = dma2; - error = bus_dmamap_load_ccb(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, - (union ccb *)csio, eptr, mp, 0); + (union ccb *)csio, dma2, mp, 0); if (error == EINPROGRESS) { bus_dmamap_unload(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap); mp->error = EINVAL; Modified: stable/10/sys/dev/isp/isp_sbus.c ============================================================================== --- stable/10/sys/dev/isp/isp_sbus.c Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/isp_sbus.c Mon Apr 24 11:21:32 2017 (r317366) @@ -592,37 +592,36 @@ typedef struct { static void dma2(void *arg, bus_dma_segment_t *dm_segs, int nseg, int error) { - mush_t *mp; - ispsoftc_t *isp; - struct ccb_scsiio *csio; + mush_t *mp = (mush_t *) arg; + ispsoftc_t *isp = mp->isp; + struct ccb_scsiio *csio = mp->cmd_token; isp_ddir_t ddir; - ispreq_t *rq; + int sdir; - mp = (mush_t *) arg; if (error) { mp->error = error; return; } - csio = mp->cmd_token; - isp = mp->isp; - rq = mp->rq; - if (nseg) { + if (nseg == 0) { + ddir = ISP_NOXFR; + } else { if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREREAD); ddir = ISP_FROM_DEVICE; - } else if ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_OUT) { - bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, BUS_DMASYNC_PREWRITE); + } else { ddir = ISP_TO_DEVICE; + } + if ((csio->ccb_h.func_code == XPT_CONT_TARGET_IO) ^ + ((csio->ccb_h.flags & CAM_DIR_MASK) == CAM_DIR_IN)) { + sdir = BUS_DMASYNC_PREREAD; } else { - ddir = ISP_NOXFR; + sdir = BUS_DMASYNC_PREWRITE; } - } else { - dm_segs = NULL; - nseg = 0; - ddir = ISP_NOXFR; + bus_dmamap_sync(isp->isp_osinfo.dmat, PISP_PCMD(csio)->dmap, + sdir); } - if (isp_send_cmd(isp, rq, dm_segs, nseg, XS_XFRLEN(csio), ddir, NULL) != CMD_QUEUED) { + if (isp_send_cmd(isp, mp->rq, dm_segs, nseg, XS_XFRLEN(csio), + ddir, NULL) != CMD_QUEUED) { mp->error = MUSHERR_NOQENTRIES; } } Modified: stable/10/sys/dev/isp/ispvar.h ============================================================================== --- stable/10/sys/dev/isp/ispvar.h Mon Apr 24 11:20:55 2017 (r317365) +++ stable/10/sys/dev/isp/ispvar.h Mon Apr 24 11:21:32 2017 (r317366) @@ -999,6 +999,7 @@ void isp_async(ispsoftc_t *, ispasync_t, * XS_DMA_ADDR_T Platform PCI DMA Address Type * XS_GET_DMA_SEG(..) Get 32 bit dma segment list value * XS_GET_DMA64_SEG(..) Get 64 bit dma segment list value + * XS_NEED_DMA64_SEG(..) dma segment needs 64 bit storage * XS_ISP(xs) gets an instance out of an XS_T * XS_CHANNEL(xs) gets the channel (bus # for DUALBUS cards) "" * XS_TGT(xs) gets the target "" From owner-svn-src-stable-10@freebsd.org Mon Apr 24 11:22:08 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5587CD4D39A; Mon, 24 Apr 2017 11:22:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 275C521C; Mon, 24 Apr 2017 11:22:08 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OBM7pb031383; Mon, 24 Apr 2017 11:22:07 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBM7Js031382; Mon, 24 Apr 2017 11:22:07 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241122.v3OBM7Js031382@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Apr 2017 11:22:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317367 - stable/10/sys/dev/isp X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:22:08 -0000 Author: mav Date: Mon Apr 24 11:22:06 2017 New Revision: 317367 URL: https://svnweb.freebsd.org/changeset/base/317367 Log: MFC r315913: Add brackets to fix incorrect macro expansion. Modified: stable/10/sys/dev/isp/ispmbox.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/isp/ispmbox.h ============================================================================== --- stable/10/sys/dev/isp/ispmbox.h Mon Apr 24 11:21:32 2017 (r317366) +++ stable/10/sys/dev/isp/ispmbox.h Mon Apr 24 11:22:06 2017 (r317367) @@ -1207,7 +1207,7 @@ typedef struct { #define ICB2400_VPINFO_OFF 0x80 /* offset from start of ICB */ #define ICB2400_VPINFO_PORT_OFF(chan) \ (ICB2400_VPINFO_OFF + \ - sizeof (isp_icb_2400_vpinfo_t) + (chan * ICB2400_VPOPT_WRITE_SIZE)) + sizeof (isp_icb_2400_vpinfo_t) + ((chan) * ICB2400_VPOPT_WRITE_SIZE)) #define ICB2400_VPGOPT_FCA 0x01 /* Assume Clean Address bit in FLOGI ACC set (works only in static configurations) */ #define ICB2400_VPGOPT_MID_DISABLE 0x02 /* when set, connection mode2 will work with NPIV-capable switched */ From owner-svn-src-stable-10@freebsd.org Mon Apr 24 16:31:29 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E5F4BD4EA2C; Mon, 24 Apr 2017 16:31:29 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C032E1829; Mon, 24 Apr 2017 16:31:29 +0000 (UTC) (envelope-from smh@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OGVSRn062463; Mon, 24 Apr 2017 16:31:28 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OGVSx1062457; Mon, 24 Apr 2017 16:31:28 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201704241631.v3OGVSx1062457@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Mon, 24 Apr 2017 16:31:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317375 - in stable/10: cddl/lib/libdtrace sys/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 16:31:30 -0000 Author: smh Date: Mon Apr 24 16:31:28 2017 New Revision: 317375 URL: https://svnweb.freebsd.org/changeset/base/317375 Log: Partial MFC r316676 and the required r313045 MFC r316676: Use estimated RTT for receive buffer auto resizing instead of timestamps. This is a partial MFC as stable/10 doesn't include the TCP stack modularisation. MFC r313045: Add an mbuf to ipinfo_t translator to finish cleanup of mbuf passing to TCP probes. This is a partial MFC (missing debug__output & debug__drop changes) due to the massive amount of additional dtrace changes that would be required for a full MFC. Relnotes: Yes Sponsored by: Multiplay Modified: stable/10/cddl/lib/libdtrace/ip.d stable/10/sys/netinet/in_kdtrace.c stable/10/sys/netinet/in_kdtrace.h stable/10/sys/netinet/tcp_input.c stable/10/sys/netinet/tcp_output.c stable/10/sys/netinet/tcp_var.h Directory Properties: stable/10/ (props changed) Modified: stable/10/cddl/lib/libdtrace/ip.d ============================================================================== --- stable/10/cddl/lib/libdtrace/ip.d Mon Apr 24 16:07:30 2017 (r317374) +++ stable/10/cddl/lib/libdtrace/ip.d Mon Apr 24 16:31:28 2017 (r317375) @@ -240,6 +240,24 @@ translator ipinfo_t < uint8_t *p > { #pragma D binding "1.0" IFF_LOOPBACK inline int IFF_LOOPBACK = 0x8; +#pragma D binding "1.13" translator +translator ipinfo_t < struct mbuf *m > { + ip_ver = m == NULL ? 0 : ((struct ip *)m->m_data)->ip_v; + ip_plength = m == NULL ? 0 : + ((struct ip *)m->m_data)->ip_v == 4 ? + ntohs(((struct ip *)m->m_data)->ip_len) - + (((struct ip *)m->m_data)->ip_hl << 2): + ntohs(((struct ip6_hdr *)m->m_data)->ip6_ctlun.ip6_un1.ip6_un1_plen); + ip_saddr = m == NULL ? 0 : + ((struct ip *)m->m_data)->ip_v == 4 ? + inet_ntoa(&((struct ip *)m->m_data)->ip_src.s_addr) : + inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_src); + ip_daddr = m == NULL ? 0 : + ((struct ip *)m->m_data)->ip_v == 4 ? + inet_ntoa(&((struct ip *)m->m_data)->ip_dst.s_addr) : + inet_ntoa6(&((struct ip6_hdr *)m->m_data)->ip6_dst); +}; + #pragma D binding "1.0" translator translator ifinfo_t < struct ifnet *p > { if_name = p->if_xname; Modified: stable/10/sys/netinet/in_kdtrace.c ============================================================================== --- stable/10/sys/netinet/in_kdtrace.c Mon Apr 24 16:07:30 2017 (r317374) +++ stable/10/sys/netinet/in_kdtrace.c Mon Apr 24 16:31:28 2017 (r317375) @@ -58,28 +58,28 @@ SDT_PROBE_DEFINE6_XLATE(ip, , , send, SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__established, "void *", "pktinfo_t *", "struct tcpcb *", "csinfo_t *", - "uint8_t *", "ipinfo_t *", + "struct mbuf *", "ipinfo_t *", "struct tcpcb *", "tcpsinfo_t *" , "struct tcphdr *", "tcpinfoh_t *"); SDT_PROBE_DEFINE5_XLATE(tcp, , , accept__refused, "void *", "pktinfo_t *", "struct tcpcb *", "csinfo_t *", - "uint8_t *", "ipinfo_t *", + "struct mbuf *", "ipinfo_t *", "struct tcpcb *", "tcpsinfo_t *" , "struct tcphdr *", "tcpinfo_t *"); SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__established, "void *", "pktinfo_t *", "struct tcpcb *", "csinfo_t *", - "uint8_t *", "ipinfo_t *", + "struct mbuf *", "ipinfo_t *", "struct tcpcb *", "tcpsinfo_t *" , "struct tcphdr *", "tcpinfoh_t *"); SDT_PROBE_DEFINE5_XLATE(tcp, , , connect__refused, "void *", "pktinfo_t *", "struct tcpcb *", "csinfo_t *", - "uint8_t *", "ipinfo_t *", + "struct mbuf *", "ipinfo_t *", "struct tcpcb *", "tcpsinfo_t *" , "struct tcphdr *", "tcpinfoh_t *"); @@ -93,7 +93,7 @@ SDT_PROBE_DEFINE5_XLATE(tcp, , , connect SDT_PROBE_DEFINE5_XLATE(tcp, , , receive, "void *", "pktinfo_t *", "struct tcpcb *", "csinfo_t *", - "uint8_t *", "ipinfo_t *", + "struct mbuf *", "ipinfo_t *", "struct tcpcb *", "tcpsinfo_t *" , "struct tcphdr *", "tcpinfoh_t *"); @@ -112,6 +112,14 @@ SDT_PROBE_DEFINE6_XLATE(tcp, , , state__ "void *", "void *", "int", "tcplsinfo_t *"); +SDT_PROBE_DEFINE6_XLATE(tcp, , , receive__autoresize, + "void *", "void *", + "struct tcpcb *", "csinfo_t *", + "struct mbuf *", "ipinfo_t *", + "struct tcpcb *", "tcpsinfo_t *" , + "struct tcphdr *", "tcpinfoh_t *", + "int", "int"); + SDT_PROBE_DEFINE5_XLATE(udp, , , receive, "void *", "pktinfo_t *", "struct inpcb *", "csinfo_t *", Modified: stable/10/sys/netinet/in_kdtrace.h ============================================================================== --- stable/10/sys/netinet/in_kdtrace.h Mon Apr 24 16:07:30 2017 (r317374) +++ stable/10/sys/netinet/in_kdtrace.h Mon Apr 24 16:31:28 2017 (r317375) @@ -52,6 +52,7 @@ SDT_PROBE_DECLARE(tcp, , , connect__requ SDT_PROBE_DECLARE(tcp, , , receive); SDT_PROBE_DECLARE(tcp, , , send); SDT_PROBE_DECLARE(tcp, , , state__change); +SDT_PROBE_DECLARE(tcp, , , receive__autoresize); SDT_PROBE_DECLARE(udp, , , receive); SDT_PROBE_DECLARE(udp, , , send); Modified: stable/10/sys/netinet/tcp_input.c ============================================================================== --- stable/10/sys/netinet/tcp_input.c Mon Apr 24 16:07:30 2017 (r317374) +++ stable/10/sys/netinet/tcp_input.c Mon Apr 24 16:31:28 2017 (r317375) @@ -1469,6 +1469,68 @@ drop: m_freem(m); } +/* + * Automatic sizing of receive socket buffer. Often the send + * buffer size is not optimally adjusted to the actual network + * conditions at hand (delay bandwidth product). Setting the + * buffer size too small limits throughput on links with high + * bandwidth and high delay (eg. trans-continental/oceanic links). + * + * On the receive side the socket buffer memory is only rarely + * used to any significant extent. This allows us to be much + * more aggressive in scaling the receive socket buffer. For + * the case that the buffer space is actually used to a large + * extent and we run out of kernel memory we can simply drop + * the new segments; TCP on the sender will just retransmit it + * later. Setting the buffer size too big may only consume too + * much kernel memory if the application doesn't read() from + * the socket or packet loss or reordering makes use of the + * reassembly queue. + * + * The criteria to step up the receive buffer one notch are: + * 1. Application has not set receive buffer size with + * SO_RCVBUF. Setting SO_RCVBUF clears SB_AUTOSIZE. + * 2. the number of bytes received during the time it takes + * one timestamp to be reflected back to us (the RTT); + * 3. received bytes per RTT is within seven eighth of the + * current socket buffer size; + * 4. receive buffer size has not hit maximal automatic size; + * + * This algorithm does one step per RTT at most and only if + * we receive a bulk stream w/o packet losses or reorderings. + * Shrinking the buffer during idle times is not necessary as + * it doesn't consume any memory when idle. + * + * TODO: Only step up if the application is actually serving + * the buffer to better manage the socket buffer resources. + */ +int +tcp_autorcvbuf(struct mbuf *m, struct tcphdr *th, struct socket *so, + struct tcpcb *tp, int tlen) +{ + int newsize = 0; + + if (V_tcp_do_autorcvbuf && (so->so_rcv.sb_flags & SB_AUTOSIZE) && + tp->t_srtt != 0 && tp->rfbuf_ts != 0 && + TCP_TS_TO_TICKS(tcp_ts_getticks() - tp->rfbuf_ts) > + (tp->t_srtt >> TCP_RTT_SHIFT)) { + if (tp->rfbuf_cnt > (so->so_rcv.sb_hiwat / 8 * 7) && + so->so_rcv.sb_hiwat < V_tcp_autorcvbuf_max) { + newsize = min(so->so_rcv.sb_hiwat + + V_tcp_autorcvbuf_inc, V_tcp_autorcvbuf_max); + } + TCP_PROBE6(receive__autoresize, NULL, tp, m, tp, th, newsize); + + /* Start over with next RTT. */ + tp->rfbuf_ts = 0; + tp->rfbuf_cnt = 0; + } else { + tp->rfbuf_cnt += tlen; /* add up */ + } + + return (newsize); +} + static void tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, int drop_hdrlen, int tlen, uint8_t iptos, @@ -1811,60 +1873,7 @@ tcp_do_segment(struct mbuf *m, struct tc tcp_trace(TA_INPUT, ostate, tp, (void *)tcp_saveipgen, &tcp_savetcp, 0); #endif - /* - * Automatic sizing of receive socket buffer. Often the send - * buffer size is not optimally adjusted to the actual network - * conditions at hand (delay bandwidth product). Setting the - * buffer size too small limits throughput on links with high - * bandwidth and high delay (eg. trans-continental/oceanic links). - * - * On the receive side the socket buffer memory is only rarely - * used to any significant extent. This allows us to be much - * more aggressive in scaling the receive socket buffer. For - * the case that the buffer space is actually used to a large - * extent and we run out of kernel memory we can simply drop - * the new segments; TCP on the sender will just retransmit it - * later. Setting the buffer size too big may only consume too - * much kernel memory if the application doesn't read() from - * the socket or packet loss or reordering makes use of the - * reassembly queue. - * - * The criteria to step up the receive buffer one notch are: - * 1. the number of bytes received during the time it takes - * one timestamp to be reflected back to us (the RTT); - * 2. received bytes per RTT is within seven eighth of the - * current socket buffer size; - * 3. receive buffer size has not hit maximal automatic size; - * - * This algorithm does one step per RTT at most and only if - * we receive a bulk stream w/o packet losses or reorderings. - * Shrinking the buffer during idle times is not necessary as - * it doesn't consume any memory when idle. - * - * TODO: Only step up if the application is actually serving - * the buffer to better manage the socket buffer resources. - */ - if (V_tcp_do_autorcvbuf && - (to.to_flags & TOF_TS) && - to.to_tsecr && - (so->so_rcv.sb_flags & SB_AUTOSIZE)) { - if (TSTMP_GT(to.to_tsecr, tp->rfbuf_ts) && - to.to_tsecr - tp->rfbuf_ts < hz) { - if (tp->rfbuf_cnt > - (so->so_rcv.sb_hiwat / 8 * 7) && - so->so_rcv.sb_hiwat < - V_tcp_autorcvbuf_max) { - newsize = - min(so->so_rcv.sb_hiwat + - V_tcp_autorcvbuf_inc, - V_tcp_autorcvbuf_max); - } - /* Start over with next RTT. */ - tp->rfbuf_ts = 0; - tp->rfbuf_cnt = 0; - } else - tp->rfbuf_cnt += tlen; /* add up */ - } + newsize = tcp_autorcvbuf(m, th, so, tp, tlen); /* Add data to socket buffer. */ SOCKBUF_LOCK(&so->so_rcv); @@ -1905,10 +1914,6 @@ tcp_do_segment(struct mbuf *m, struct tc win = 0; tp->rcv_wnd = imax(win, (int)(tp->rcv_adv - tp->rcv_nxt)); - /* Reset receive buffer auto scaling when not in bulk receive mode. */ - tp->rfbuf_ts = 0; - tp->rfbuf_cnt = 0; - switch (tp->t_state) { /* Modified: stable/10/sys/netinet/tcp_output.c ============================================================================== --- stable/10/sys/netinet/tcp_output.c Mon Apr 24 16:07:30 2017 (r317374) +++ stable/10/sys/netinet/tcp_output.c Mon Apr 24 16:31:28 2017 (r317375) @@ -790,11 +790,13 @@ send: to.to_tsval = tcp_ts_getticks() + tp->ts_offset; to.to_tsecr = tp->ts_recent; to.to_flags |= TOF_TS; - /* Set receive buffer autosizing timestamp. */ - if (tp->rfbuf_ts == 0 && - (so->so_rcv.sb_flags & SB_AUTOSIZE)) - tp->rfbuf_ts = tcp_ts_getticks(); } + + /* Set receive buffer autosizing timestamp. */ + if (tp->rfbuf_ts == 0 && + (so->so_rcv.sb_flags & SB_AUTOSIZE)) + tp->rfbuf_ts = tcp_ts_getticks(); + /* Selective ACK's. */ if (tp->t_flags & TF_SACK_PERMIT) { if (flags & TH_SYN) Modified: stable/10/sys/netinet/tcp_var.h ============================================================================== --- stable/10/sys/netinet/tcp_var.h Mon Apr 24 16:07:30 2017 (r317374) +++ stable/10/sys/netinet/tcp_var.h Mon Apr 24 16:31:28 2017 (r317375) @@ -704,6 +704,8 @@ int tcp_reass(struct tcpcb *, struct tc void tcp_reass_global_init(void); void tcp_reass_flush(struct tcpcb *); void tcp_input(struct mbuf *, int); +int tcp_autorcvbuf(struct mbuf *, struct tcphdr *, struct socket *, + struct tcpcb *, int); u_long tcp_maxmtu(struct in_conninfo *, struct tcp_ifcap *); u_long tcp_maxmtu6(struct in_conninfo *, struct tcp_ifcap *); void tcp_mss_update(struct tcpcb *, int, int, struct hc_metrics_lite *, From owner-svn-src-stable-10@freebsd.org Mon Apr 24 21:41:06 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1ED76D4EFDD; Mon, 24 Apr 2017 21:41:06 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E214C1E23; Mon, 24 Apr 2017 21:41:05 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OLf4YD088610; Mon, 24 Apr 2017 21:41:04 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OLf4Uq088609; Mon, 24 Apr 2017 21:41:04 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704242141.v3OLf4Uq088609@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 24 Apr 2017 21:41:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317387 - stable/10/lib/libutil X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 21:41:06 -0000 Author: brooks Date: Mon Apr 24 21:41:04 2017 New Revision: 317387 URL: https://svnweb.freebsd.org/changeset/base/317387 Log: MFC r316766: Correct an out of bounds read with HN_AUTOSCALE and very large numbers. The maximum scale is 6 (K, M, G, T, P, E) (B is 0). Overly large explict scales were checked correctly, but for sufficently large numbers HN_AUTOSCALE would get to 7 resulting in an out of bounds read. Found with humanize_number_test and CHERI bounds checking. Reviewed by: emaste Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/10/lib/libutil/humanize_number.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libutil/humanize_number.c ============================================================================== --- stable/10/lib/libutil/humanize_number.c Mon Apr 24 21:35:02 2017 (r317386) +++ stable/10/lib/libutil/humanize_number.c Mon Apr 24 21:41:04 2017 (r317387) @@ -43,7 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include -static const int maxscale = 7; +static const int maxscale = 6; int humanize_number(char *buf, size_t len, int64_t quotient, @@ -64,7 +64,7 @@ humanize_number(char *buf, size_t len, i return (-1); if (scale < 0) return (-1); - else if (scale >= maxscale && + else if (scale > maxscale && ((scale & ~(HN_AUTOSCALE|HN_GETSCALE)) != 0)) return (-1); if ((flags & HN_DIVISOR_1000) && (flags & HN_IEC_PREFIXES)) From owner-svn-src-stable-10@freebsd.org Mon Apr 24 22:45:01 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 607F0D4E46F; Mon, 24 Apr 2017 22:45:01 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 274591D53; Mon, 24 Apr 2017 22:45:01 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OMj0A9016065; Mon, 24 Apr 2017 22:45:00 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OMj0MG016064; Mon, 24 Apr 2017 22:45:00 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704242245.v3OMj0MG016064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 24 Apr 2017 22:45:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317392 - stable/10/lib/libc/gen X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 22:45:01 -0000 Author: brooks Date: Mon Apr 24 22:44:59 2017 New Revision: 317392 URL: https://svnweb.freebsd.org/changeset/base/317392 Log: MFC r316768: Fix an out-of-bounds write when a zero-length buffer is passed. Found with ttyname_test and CHERI bounds checking. Reviewed by: emaste Obtained from: CheriBSD Sponsored by: DARPA, AFRL Modified: stable/10/lib/libc/gen/ttyname.c Directory Properties: stable/10/ (props changed) Modified: stable/10/lib/libc/gen/ttyname.c ============================================================================== --- stable/10/lib/libc/gen/ttyname.c Mon Apr 24 22:37:54 2017 (r317391) +++ stable/10/lib/libc/gen/ttyname.c Mon Apr 24 22:44:59 2017 (r317392) @@ -61,6 +61,10 @@ ttyname_r(int fd, char *buf, size_t len) { size_t used; + /* Don't write off the end of a zero-length buffer. */ + if (len < 1) + return (ERANGE); + *buf = '\0'; /* Must be a terminal. */ From owner-svn-src-stable-10@freebsd.org Tue Apr 25 11:36:27 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6AE6AD4F0FA; Tue, 25 Apr 2017 11:36:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 328B88AA; Tue, 25 Apr 2017 11:36:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PBaQpC045663; Tue, 25 Apr 2017 11:36:26 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PBaPR1045653; Tue, 25 Apr 2017 11:36:25 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251136.v3PBaPR1045653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 11:36:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317404 - in stable/10/sys/fs: nfs nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 11:36:27 -0000 Author: rmacklem Date: Tue Apr 25 11:36:25 2017 New Revision: 317404 URL: https://svnweb.freebsd.org/changeset/base/317404 Log: MFC: r310491 Fix NFSv4.1 client recovery from NFS4ERR_BAD_SESSION errors. For most NFSv4.1 servers, a NFS4ERR_BAD_SESSION error is a rare failure that indicates that the server has lost session/open/lock state. However, recent testing by cperciva@ against the AmazonEFS server found several problems with client recovery from this due to it generating this failure frequently. Briefly, the problems fixed are: - If all session slots were in use at the time of the failure, some processes would continue to loop waiting for a slot on the old session forever. - If an RPC that doesn't use open/lock state failed with NFS4ERR_BAD_SESSION, it would fail the RPC/syscall instead of initiating recovery and then looping to retry the RPC. - If a successful reply to an RPC for an old session wasn't processed until after a new session was created for a NFS4ERR_BAD_SESSION error, it would erroneously update the new session and corrupt it. - The use of the first element of the session list in the nfs mount structure (which is always the current metadata session) was slightly racey. With changes for the above problems it became more racey, so all uses of this head pointer was wrapped with a NFSLOCKMNT()/NFSUNLOCKMNT(). - Although the kernel malloc() usually allocates more bytes than requested and, as such, this wouldn't have caused problems, the allocation of a session structure was 1 byte smaller than it should have been. (Null termination byte for the string not included in byte count.) There are probably still problems with a pNFS data server that fails with NFS4ERR_BAD_SESSION, but I have no server that does this to test against (the AmazonEFS server doesn't do pNFS), so I can't fix these yet. Although this patch is fairly large, it should only affect the handling of NFS4ERR_BAD_SESSION error replies from an NFSv4.1 server. Thanks go to cperciva@ for the extension testing he did to help isolate/fix these problems. Modified: stable/10/sys/fs/nfs/nfs.h stable/10/sys/fs/nfs/nfs_commonkrpc.c stable/10/sys/fs/nfs/nfs_commonport.c stable/10/sys/fs/nfs/nfs_commonsubs.c stable/10/sys/fs/nfs/nfsclstate.h stable/10/sys/fs/nfsclient/nfs_clcomsubs.c stable/10/sys/fs/nfsclient/nfs_clport.c stable/10/sys/fs/nfsclient/nfs_clrpcops.c stable/10/sys/fs/nfsclient/nfs_clstate.c stable/10/sys/fs/nfsclient/nfs_clvfsops.c stable/10/sys/fs/nfsclient/nfsmount.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs.h ============================================================================== --- stable/10/sys/fs/nfs/nfs.h Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfs/nfs.h Tue Apr 25 11:36:25 2017 (r317404) @@ -601,6 +601,7 @@ struct nfsrv_descript { uint8_t nd_sessionid[NFSX_V4SESSIONID]; /* Session id */ uint32_t nd_slotid; /* Slotid for this RPC */ SVCXPRT *nd_xprt; /* Server RPC handle */ + uint32_t *nd_sequence; /* Sequence Op. ptr */ }; #define nd_princlen nd_gssnamelen @@ -636,6 +637,7 @@ struct nfsrv_descript { #define ND_HASSEQUENCE 0x04000000 #define ND_CACHETHIS 0x08000000 #define ND_LASTOP 0x10000000 +#define ND_LOOPBADSESS 0x20000000 /* * ND_GSS should be the "or" of all GSS type authentications. @@ -649,6 +651,7 @@ struct nfsv4_opflag { int modifyfs; int lktype; int needsseq; + int loopbadsess; }; /* Modified: stable/10/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonkrpc.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfs/nfs_commonkrpc.c Tue Apr 25 11:36:25 2017 (r317404) @@ -90,6 +90,7 @@ uint32_t nfscl_nfs4_done_probes[NFSV41_N NFSSTATESPINLOCK; NFSREQSPINLOCK; NFSDLOCKMUTEX; +NFSCLSTATEMUTEX; extern struct nfsstats newnfsstats; extern struct nfsreqhead nfsd_reqq; extern int nfscl_ticks; @@ -474,13 +475,13 @@ int newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp, struct nfsclient *clp, struct nfssockreq *nrp, vnode_t vp, struct thread *td, struct ucred *cred, u_int32_t prog, u_int32_t vers, - u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *sep) + u_char *retsum, int toplevel, u_int64_t *xidp, struct nfsclsession *dssep) { - u_int32_t retseq, retval, *tl; + uint32_t retseq, retval, slotseq, *tl; time_t waituntil; int i = 0, j = 0, opcnt, set_sigset = 0, slot; int trycnt, error = 0, usegssname = 0, secflavour = AUTH_SYS; - int freeslot, timeo; + int freeslot, maxslot, reterr, slotpos, timeo; u_int16_t procnum; u_int trylater_delay = 1; struct nfs_feedback_arg nf; @@ -492,7 +493,10 @@ newnfs_request(struct nfsrv_descript *nd char *srv_principal = NULL, *clnt_principal = NULL; sigset_t oldset; struct ucred *authcred; + struct nfsclsession *sep; + uint8_t sessionid[NFSX_V4SESSIONID]; + sep = dssep; if (xidp != NULL) *xidp = 0; /* Reject requests while attempting a forced unmount. */ @@ -804,7 +808,7 @@ tryagain: nd->nd_procnum != NFSV4PROC_CBNULL) { /* If sep == NULL, set it to the default in nmp. */ if (sep == NULL && nmp != NULL) - sep = NFSMNT_MDSSESSION(nmp); + sep = nfsmnt_mdssession(nmp); /* * and now the actual NFS xdr. */ @@ -848,18 +852,25 @@ tryagain: NFSX_V4SESSIONID + 4 * NFSX_UNSIGNED); mtx_lock(&sep->nfsess_mtx); - tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; - retseq = fxdr_unsigned(uint32_t, *tl++); - slot = fxdr_unsigned(int, *tl++); - freeslot = slot; - if (retseq != sep->nfsess_slotseq[slot]) - printf("retseq diff 0x%x\n", retseq); - retval = fxdr_unsigned(uint32_t, *++tl); - if ((retval + 1) < sep->nfsess_foreslots) - sep->nfsess_foreslots = (retval + 1); - else if ((retval + 1) > sep->nfsess_foreslots) - sep->nfsess_foreslots = (retval < 64) ? - (retval + 1) : 64; + if (bcmp(tl, sep->nfsess_sessionid, + NFSX_V4SESSIONID) == 0) { + tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; + retseq = fxdr_unsigned(uint32_t, *tl++); + slot = fxdr_unsigned(int, *tl++); + freeslot = slot; + if (retseq != sep->nfsess_slotseq[slot]) + printf("retseq diff 0x%x\n", + retseq); + retval = fxdr_unsigned(uint32_t, *++tl); + if ((retval + 1) < sep->nfsess_foreslots + ) + sep->nfsess_foreslots = (retval + + 1); + else if ((retval + 1) > + sep->nfsess_foreslots) + sep->nfsess_foreslots = (retval + < 64) ? (retval + 1) : 64; + } mtx_unlock(&sep->nfsess_mtx); /* Grab the op and status for the next one. */ @@ -872,6 +883,76 @@ tryagain: } } if (nd->nd_repstat != 0) { + if (nd->nd_repstat == NFSERR_BADSESSION && + nmp != NULL && dssep == NULL) { + /* + * If this is a client side MDS RPC, mark + * the MDS session defunct and initiate + * recovery, as required. + * The nfsess_defunct field is protected by + * the NFSLOCKMNT()/nm_mtx lock and not the + * nfsess_mtx lock to simplify its handling, + * for the MDS session. This lock is also + * sufficient for nfsess_sessionid, since it + * never changes in the structure. + */ + NFSCL_DEBUG(1, "Got badsession\n"); + NFSLOCKCLSTATE(); + NFSLOCKMNT(nmp); + sep = NFSMNT_MDSSESSION(nmp); + if (bcmp(sep->nfsess_sessionid, nd->nd_sequence, + NFSX_V4SESSIONID) == 0) { + /* Initiate recovery. */ + sep->nfsess_defunct = 1; + NFSCL_DEBUG(1, "Marked defunct\n"); + if (nmp->nm_clp != NULL) { + nmp->nm_clp->nfsc_flags |= + NFSCLFLAGS_RECOVER; + wakeup(nmp->nm_clp); + } + } + NFSUNLOCKCLSTATE(); + /* + * Sleep for up to 1sec waiting for a new + * session. + */ + mtx_sleep(&nmp->nm_sess, &nmp->nm_mtx, PZERO, + "nfsbadsess", hz); + /* + * Get the session again, in case a new one + * has been created during the sleep. + */ + sep = NFSMNT_MDSSESSION(nmp); + NFSUNLOCKMNT(nmp); + if ((nd->nd_flag & ND_LOOPBADSESS) != 0) { + reterr = nfsv4_sequencelookup(nmp, sep, + &slotpos, &maxslot, &slotseq, + sessionid); + if (reterr == 0) { + /* Fill in new session info. */ + NFSCL_DEBUG(1, + "Filling in new sequence\n"); + tl = nd->nd_sequence; + bcopy(sessionid, tl, + NFSX_V4SESSIONID); + tl += NFSX_V4SESSIONID / + NFSX_UNSIGNED; + *tl++ = txdr_unsigned(slotseq); + *tl++ = txdr_unsigned(slotpos); + *tl = txdr_unsigned(maxslot); + } + if (reterr == NFSERR_BADSESSION || + reterr == 0) { + NFSCL_DEBUG(1, + "Badsession looping\n"); + m_freem(nd->nd_mrep); + nd->nd_mrep = NULL; + goto tryagain; + } + nd->nd_repstat = reterr; + NFSCL_DEBUG(1, "Got err=%d\n", reterr); + } + } if (((nd->nd_repstat == NFSERR_DELAY || nd->nd_repstat == NFSERR_GRACE) && (nd->nd_flag & ND_NFSV4) && Modified: stable/10/sys/fs/nfs/nfs_commonport.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonport.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfs/nfs_commonport.c Tue Apr 25 11:36:25 2017 (r317404) @@ -129,6 +129,7 @@ struct mtx nfs_state_mutex; struct mtx nfs_nameid_mutex; struct mtx nfs_req_mutex; struct mtx nfs_slock_mutex; +struct mtx nfs_clstate_mutex; /* local functions */ static int nfssvc_call(struct thread *, struct nfssvc_args *, struct ucred *); @@ -565,6 +566,7 @@ newnfs_portinit(void) /* Initialize SMP locks used by both client and server. */ mtx_init(&newnfsd_mtx, "newnfsd_mtx", NULL, MTX_DEF); mtx_init(&nfs_state_mutex, "nfs_state_mutex", NULL, MTX_DEF); + mtx_init(&nfs_clstate_mutex, "nfs_clstate_mutex", NULL, MTX_DEF); } /* @@ -630,6 +632,7 @@ nfscommon_modevent(module_t mod, int typ mtx_destroy(&nfs_nameid_mutex); mtx_destroy(&newnfsd_mtx); mtx_destroy(&nfs_state_mutex); + mtx_destroy(&nfs_clstate_mutex); mtx_destroy(&nfs_sockl_mutex); mtx_destroy(&nfs_slock_mutex); mtx_destroy(&nfs_req_mutex); Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 11:36:25 2017 (r317404) @@ -90,65 +90,65 @@ extern int nfsrv_lughashsize; * Define it here, since it is used by both the client and server. */ struct nfsv4_opflag nfsv4_opflag[NFSV41_NOPS] = { - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* undef */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* undef */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* undef */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Access */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Close */ - { 0, 2, 0, 1, LK_EXCLUSIVE, 1 }, /* Commit */ - { 1, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Create */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Delegpurge */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Delegreturn */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Getattr */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* GetFH */ - { 2, 1, 1, 1, LK_EXCLUSIVE, 1 }, /* Link */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Lock */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* LockT */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* LockU */ - { 1, 2, 0, 0, LK_EXCLUSIVE, 1 }, /* Lookup */ - { 1, 2, 0, 0, LK_EXCLUSIVE, 1 }, /* Lookupp */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* NVerify */ - { 1, 1, 0, 1, LK_EXCLUSIVE, 1 }, /* Open */ - { 1, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* OpenAttr */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* OpenConfirm */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* OpenDowngrade */ - { 1, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* PutFH */ - { 1, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* PutPubFH */ - { 1, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* PutRootFH */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Read */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* Readdir */ - { 0, 1, 0, 0, LK_SHARED, 1 }, /* ReadLink */ - { 0, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Remove */ - { 2, 1, 1, 1, LK_EXCLUSIVE, 1 }, /* Rename */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Renew */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* RestoreFH */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* SaveFH */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* SecInfo */ - { 0, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Setattr */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* SetClientID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* SetClientIDConfirm */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Verify */ - { 0, 2, 1, 1, LK_EXCLUSIVE, 1 }, /* Write */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* ReleaseLockOwner */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Backchannel Ctrl */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Bind Conn to Sess */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Exchange ID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Create Session */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Destroy Session */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Free StateID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Get Dir Deleg */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Get Device Info */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Get Device List */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Layout Commit */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Layout Get */ - { 0, 1, 0, 0, LK_EXCLUSIVE, 1 }, /* Layout Return */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Secinfo No name */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Sequence */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Set SSV */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Test StateID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Want Delegation */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 0 }, /* Destroy ClientID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1 }, /* Reclaim Complete */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* undef */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* undef */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* undef */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* Access */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Close */ + { 0, 2, 0, 1, LK_EXCLUSIVE, 1, 1 }, /* Commit */ + { 1, 2, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Create */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Delegpurge */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Delegreturn */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* Getattr */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* GetFH */ + { 2, 1, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Link */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Lock */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* LockT */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* LockU */ + { 1, 2, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Lookup */ + { 1, 2, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Lookupp */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* NVerify */ + { 1, 1, 0, 1, LK_EXCLUSIVE, 1, 0 }, /* Open */ + { 1, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* OpenAttr */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* OpenConfirm */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* OpenDowngrade */ + { 1, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* PutFH */ + { 1, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* PutPubFH */ + { 1, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* PutRootFH */ + { 0, 1, 0, 0, LK_SHARED, 1, 0 }, /* Read */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* Readdir */ + { 0, 1, 0, 0, LK_SHARED, 1, 1 }, /* ReadLink */ + { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Remove */ + { 2, 1, 1, 1, LK_EXCLUSIVE, 1, 1 }, /* Rename */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Renew */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* RestoreFH */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SaveFH */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SecInfo */ + { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Setattr */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SetClientID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* SetClientIDConfirm */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Verify */ + { 0, 2, 1, 1, LK_EXCLUSIVE, 1, 0 }, /* Write */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* ReleaseLockOwner */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Backchannel Ctrl */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Bind Conn to Sess */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Exchange ID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Create Session */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy Session */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Free StateID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Get Dir Deleg */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Get Device Info */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Get Device List */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Layout Commit */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Layout Get */ + { 0, 1, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Layout Return */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Secinfo No name */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Sequence */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Set SSV */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Test StateID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Want Delegation */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy ClientID */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Reclaim Complete */ }; #endif /* !APPLEKEXT */ @@ -4122,22 +4122,35 @@ nfsv4_setsequence(struct nfsmount *nmp, error = nfsv4_sequencelookup(nmp, sep, &slotpos, &maxslot, &slotseq, sessionid); - if (error != 0) - return; - KASSERT(maxslot >= 0, ("nfscl_setsequence neg maxslot")); /* Build the Sequence arguments. */ NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID + 4 * NFSX_UNSIGNED); + nd->nd_sequence = tl; bcopy(sessionid, tl, NFSX_V4SESSIONID); tl += NFSX_V4SESSIONID / NFSX_UNSIGNED; nd->nd_slotseq = tl; - *tl++ = txdr_unsigned(slotseq); - *tl++ = txdr_unsigned(slotpos); - *tl++ = txdr_unsigned(maxslot); - if (dont_replycache == 0) - *tl = newnfs_true; - else - *tl = newnfs_false; + if (error == 0) { + *tl++ = txdr_unsigned(slotseq); + *tl++ = txdr_unsigned(slotpos); + *tl++ = txdr_unsigned(maxslot); + if (dont_replycache == 0) + *tl = newnfs_true; + else + *tl = newnfs_false; + } else { + /* + * There are two errors and the rest of the session can + * just be zeros. + * NFSERR_BADSESSION: This bad session should just generate + * the same error again when the RPC is retried. + * ESTALE: A forced dismount is in progress and will cause the + * RPC to fail later. + */ + *tl++ = 0; + *tl++ = 0; + *tl++ = 0; + *tl = 0; + } nd->nd_flag |= ND_HASSEQUENCE; } @@ -4153,6 +4166,13 @@ nfsv4_sequencelookup(struct nfsmount *nm maxslot = -1; mtx_lock(&sep->nfsess_mtx); do { + if (nmp != NULL && sep->nfsess_defunct != 0) { + /* Just return the bad session. */ + bcopy(sep->nfsess_sessionid, sessionid, + NFSX_V4SESSIONID); + mtx_unlock(&sep->nfsess_mtx); + return (NFSERR_BADSESSION); + } bitval = 1; for (i = 0; i < sep->nfsess_foreslots; i++) { if ((bitval & sep->nfsess_slots) == 0) { Modified: stable/10/sys/fs/nfs/nfsclstate.h ============================================================================== --- stable/10/sys/fs/nfs/nfsclstate.h Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfs/nfsclstate.h Tue Apr 25 11:36:25 2017 (r317404) @@ -65,6 +65,7 @@ struct nfsclsession { uint16_t nfsess_foreslots; uint16_t nfsess_backslots; uint8_t nfsess_sessionid[NFSX_V4SESSIONID]; + uint8_t nfsess_defunct; /* Non-zero for old sessions */ }; /* Modified: stable/10/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clcomsubs.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfsclient/nfs_clcomsubs.c Tue Apr 25 11:36:25 2017 (r317404) @@ -200,13 +200,16 @@ nfscl_reqstart(struct nfsrv_descript *nd *tl = txdr_unsigned(opcnt); if ((nd->nd_flag & ND_NFSV41) != 0 && nfsv4_opflag[nfsv4_opmap[procnum].op].needsseq > 0) { + if (nfsv4_opflag[nfsv4_opmap[procnum].op].loopbadsess > + 0) + nd->nd_flag |= ND_LOOPBADSESS; NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED); *tl = txdr_unsigned(NFSV4OP_SEQUENCE); - if (sep == NULL) - nfsv4_setsequence(nmp, nd, - NFSMNT_MDSSESSION(nmp), + if (sep == NULL) { + sep = nfsmnt_mdssession(nmp); + nfsv4_setsequence(nmp, nd, sep, nfs_bigreply[procnum]); - else + } else nfsv4_setsequence(nmp, nd, sep, nfs_bigreply[procnum]); } Modified: stable/10/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clport.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfsclient/nfs_clport.c Tue Apr 25 11:36:25 2017 (r317404) @@ -78,7 +78,6 @@ extern short nfsv4_cbport; extern int nfscl_enablecallb; extern int nfs_numnfscbd; extern int nfscl_inited; -struct mtx nfs_clstate_mutex; struct mtx ncl_iod_mutex; NFSDLOCKMUTEX; @@ -1310,8 +1309,6 @@ nfscl_modevent(module_t mod, int type, v if (loaded) return (0); newnfs_portinit(); - mtx_init(&nfs_clstate_mutex, "nfs_clstate_mutex", NULL, - MTX_DEF); mtx_init(&ncl_iod_mutex, "ncl_iod_mutex", NULL, MTX_DEF); nfscl_init(); NFSD_LOCK(); @@ -1335,7 +1332,6 @@ nfscl_modevent(module_t mod, int type, v ncl_call_invalcaches = NULL; nfsd_call_nfscl = NULL; /* and get rid of the mutexes */ - mtx_destroy(&nfs_clstate_mutex); mtx_destroy(&ncl_iod_mutex); loaded = 0; break; Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 25 11:36:25 2017 (r317404) @@ -384,6 +384,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno u_int32_t rflags, deleg; nfsattrbit_t attrbits; int error, ret, acesize, limitby; + struct nfsclsession *tsep; dp = *dpp; *dpp = NULL; @@ -392,8 +393,9 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno *tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid); *tl++ = txdr_unsigned(mode & NFSV4OPEN_ACCESSBOTH); *tl++ = txdr_unsigned((mode >> NFSLCK_SHIFT) & NFSV4OPEN_DENYBOTH); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; (void) nfsm_strtom(nd, op->nfso_own->nfsow_owner, NFSV4CL_LOCKNAMELEN); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV4OPEN_NOCREATE); @@ -555,7 +557,7 @@ nfsrpc_openrpc(struct nfsmount *nmp, vno } if (nd->nd_repstat != 0 && error == 0) error = nd->nd_repstat; - if (error == NFSERR_STALECLIENTID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALECLIENTID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: if (!error) @@ -602,7 +604,7 @@ nfsrpc_opendowngrade(vnode_t vp, u_int32 } if (nd->nd_repstat && error == 0) error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -760,7 +762,7 @@ nfsrpc_closerpc(struct nfsrv_descript *n if (nd->nd_repstat == 0) NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID); error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -801,7 +803,7 @@ nfsrpc_openconfirm(vnode_t vp, u_int8_t op->nfso_stateid.other[2] = *tl; } error = nd->nd_repstat; - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(op->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -826,32 +828,52 @@ nfsrpc_setclient(struct nfsmount *nmp, s nfsquad_t confirm; u_int32_t lease; static u_int32_t rev = 0; - struct nfsclds *dsp, *ndsp, *tdsp; + struct nfsclds *dsp; + struct nfsclsession *tsep; if (nfsboottime.tv_sec == 0) NFSSETBOOTTIME(nfsboottime); clp->nfsc_rev = rev++; if (NFSHASNFSV4N(nmp)) { + /* + * Either there was no previous session or the + * previous session has failed, so... + * do an ExchangeID followed by the CreateSession. + */ error = nfsrpc_exchangeid(nmp, clp, &nmp->nm_sockreq, NFSV4EXCH_USEPNFSMDS | NFSV4EXCH_USENONPNFS, &dsp, cred, p); NFSCL_DEBUG(1, "aft exch=%d\n", error); - if (error == 0) { + if (error == 0) error = nfsrpc_createsession(nmp, &dsp->nfsclds_sess, &nmp->nm_sockreq, dsp->nfsclds_sess.nfsess_sequenceid, 1, cred, p); - if (error == 0) { - NFSLOCKMNT(nmp); - TAILQ_FOREACH_SAFE(tdsp, &nmp->nm_sess, - nfsclds_list, ndsp) - nfscl_freenfsclds(tdsp); - TAILQ_INIT(&nmp->nm_sess); - TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, - nfsclds_list); - NFSUNLOCKMNT(nmp); - } else - nfscl_freenfsclds(dsp); - NFSCL_DEBUG(1, "aft createsess=%d\n", error); - } + if (error == 0) { + NFSLOCKMNT(nmp); + /* + * The old sessions cannot be safely free'd + * here, since they may still be used by + * in-progress RPCs. + */ + tsep = NULL; + if (TAILQ_FIRST(&nmp->nm_sess) != NULL) + tsep = NFSMNT_MDSSESSION(nmp); + TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, + nfsclds_list); + /* + * Wake up RPCs waiting for a slot on the + * old session. These will then fail with + * NFSERR_BADSESSION and be retried with the + * new session by nfsv4_setsequence(). + * Also wakeup() processes waiting for the + * new session. + */ + if (tsep != NULL) + wakeup(&tsep->nfsess_slots); + wakeup(&nmp->nm_sess); + NFSUNLOCKMNT(nmp); + } else + nfscl_freenfsclds(dsp); + NFSCL_DEBUG(1, "aft createsess=%d\n", error); if (error == 0 && reclaim == 0) { error = nfsrpc_reclaimcomplete(nmp, cred, p); NFSCL_DEBUG(1, "aft reclaimcomp=%d\n", error); @@ -872,6 +894,7 @@ nfsrpc_setclient(struct nfsmount *nmp, s mtx_init(&dsp->nfsclds_sess.nfsess_mtx, "nfssession", NULL, MTX_DEF); NFSLOCKMNT(nmp); TAILQ_INSERT_HEAD(&nmp->nm_sess, dsp, nfsclds_list); + tsep = NFSMNT_MDSSESSION(nmp); NFSUNLOCKMNT(nmp); nfscl_reqstart(nd, NFSPROC_SETCLIENTID, nmp, NULL, 0, NULL, NULL); @@ -933,8 +956,8 @@ nfsrpc_setclient(struct nfsmount *nmp, s return (error); if (nd->nd_repstat == 0) { NFSM_DISSECT(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0] = *tl++; - NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1] = *tl++; + tsep->nfsess_clientid.lval[0] = *tl++; + tsep->nfsess_clientid.lval[1] = *tl++; confirm.lval[0] = *tl++; confirm.lval[1] = *tl; mbuf_freem(nd->nd_mrep); @@ -946,8 +969,8 @@ nfsrpc_setclient(struct nfsmount *nmp, s nfscl_reqstart(nd, NFSPROC_SETCLIENTIDCFRM, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, u_int32_t *, 4 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl++ = tsep->nfsess_clientid.lval[1]; *tl++ = confirm.lval[0]; *tl = confirm.lval[1]; nd->nd_flag |= ND_USEGSSNAME; @@ -1108,7 +1131,7 @@ nfsrpc_setattr(vnode_t vp, struct vattr else error = nfsrpc_setaclrpc(vp, cred, p, aclp, &stateid, stuff); - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) nfscl_lockderef(lckp); @@ -1365,7 +1388,7 @@ nfsrpc_read(vnode_t vp, struct uio *uiop &lckp); error = nfsrpc_readrpc(vp, uiop, newcred, &stateid, p, nap, attrflagp, stuff); - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) nfscl_lockderef(lckp); @@ -1535,7 +1558,7 @@ nfsrpc_write(vnode_t vp, struct uio *uio else error = nfsrpc_writerpc(vp, uiop, iomode, must_commit, newcred, &stateid, p, nap, attrflagp, stuff); - if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALESTATEID) nfscl_initiate_recovery(nmp->nm_clp); if (lckp != NULL) nfscl_lockderef(lckp); @@ -1961,6 +1984,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, nfsv4stateid_t stateid; u_int32_t rflags; struct nfsmount *nmp; + struct nfsclsession *tsep; nmp = VFSTONFS(dvp->v_mount); np = VTONFS(dvp); @@ -1980,8 +2004,9 @@ nfsrpc_createv4(vnode_t dvp, char *name, *tl++ = txdr_unsigned(NFSV4OPEN_ACCESSWRITE | NFSV4OPEN_ACCESSREAD); *tl++ = txdr_unsigned(NFSV4OPEN_DENYNONE); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; (void) nfsm_strtom(nd, owp->nfsow_owner, NFSV4CL_LOCKNAMELEN); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); *tl++ = txdr_unsigned(NFSV4OPEN_CREATE); @@ -2175,7 +2200,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, } if (nd->nd_repstat != 0 && error == 0) error = nd->nd_repstat; - if (error == NFSERR_STALECLIENTID || error == NFSERR_BADSESSION) + if (error == NFSERR_STALECLIENTID) nfscl_initiate_recovery(owp->nfsow_clp); nfsmout: if (!error) @@ -3837,6 +3862,7 @@ nfsrpc_lockt(struct nfsrv_descript *nd, uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; struct nfsnode *np; struct nfsmount *nmp; + struct nfsclsession *tsep; nmp = VFSTONFS(vp->v_mount); NFSCL_REQSTART(nd, NFSPROC_LOCKT, vp); @@ -3849,8 +3875,9 @@ nfsrpc_lockt(struct nfsrv_descript *nd, tl += 2; txdr_hyper(len, tl); tl += 2; - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; nfscl_filllockowner(id, own, flags); np = VTONFS(vp); NFSBCOPY(np->n_fhp->nfh_fh, &own[NFSV4CL_LOCKNAMELEN], @@ -3890,8 +3917,7 @@ nfsrpc_lockt(struct nfsrv_descript *nd, error = EBADRPC; if (!error) error = nfsm_advance(nd, NFSM_RNDUP(size), -1); - } else if (nd->nd_repstat == NFSERR_STALECLIENTID || - nd->nd_repstat == NFSERR_BADSESSION) + } else if (nd->nd_repstat == NFSERR_STALECLIENTID) nfscl_initiate_recovery(clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -3941,8 +3967,7 @@ nfsrpc_locku(struct nfsrv_descript *nd, lp->nfsl_stateid.other[0] = *tl++; lp->nfsl_stateid.other[1] = *tl++; lp->nfsl_stateid.other[2] = *tl; - } else if (nd->nd_repstat == NFSERR_STALESTATEID || - nd->nd_repstat == NFSERR_BADSESSION) + } else if (nd->nd_repstat == NFSERR_STALESTATEID) nfscl_initiate_recovery(lp->nfsl_open->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -3961,6 +3986,7 @@ nfsrpc_lock(struct nfsrv_descript *nd, s u_int32_t *tl; int error, size; uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; + struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_LOCK, nmp, nfhp, fhlen, NULL, NULL); NFSM_BUILD(tl, u_int32_t *, 7 * NFSX_UNSIGNED); @@ -3986,8 +4012,9 @@ nfsrpc_lock(struct nfsrv_descript *nd, s *tl++ = lp->nfsl_open->nfso_stateid.other[1]; *tl++ = lp->nfsl_open->nfso_stateid.other[2]; *tl++ = txdr_unsigned(lp->nfsl_seqid); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; NFSBCOPY(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN); NFSBCOPY(nfhp, &own[NFSV4CL_LOCKNAMELEN], fhlen); (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + fhlen); @@ -4028,8 +4055,7 @@ nfsrpc_lock(struct nfsrv_descript *nd, s error = EBADRPC; if (!error) error = nfsm_advance(nd, NFSM_RNDUP(size), -1); - } else if (nd->nd_repstat == NFSERR_STALESTATEID || - nd->nd_repstat == NFSERR_BADSESSION) + } else if (nd->nd_repstat == NFSERR_STALESTATEID) nfscl_initiate_recovery(lp->nfsl_open->nfso_own->nfsow_clp); nfsmout: mbuf_freem(nd->nd_mrep); @@ -4229,25 +4255,36 @@ nfsrpc_renew(struct nfsclclient *clp, st struct nfsmount *nmp; int error; struct nfssockreq *nrp; + struct nfsclsession *tsep; nmp = clp->nfsc_nmp; if (nmp == NULL) return (0); - nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, - &dsp->nfsclds_sess); + if (dsp == NULL) + nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, NULL); + else + nfscl_reqstart(nd, NFSPROC_RENEW, nmp, NULL, 0, NULL, + &dsp->nfsclds_sess); if (!NFSHASNFSV4N(nmp)) { /* NFSv4.1 just uses a Sequence Op and not a Renew. */ NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; - } - nrp = dsp->nfsclds_sockp; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; + } + nrp = NULL; + if (dsp != NULL) + nrp = dsp->nfsclds_sockp; if (nrp == NULL) /* If NULL, use the MDS socket. */ nrp = &nmp->nm_sockreq; nd->nd_flag |= ND_USEGSSNAME; - error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, - NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess); + if (dsp == NULL) + error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, + NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); + else + error = newnfs_request(nd, nmp, NULL, nrp, NULL, p, cred, + NFS_PROG, NFS_VER4, NULL, 1, NULL, &dsp->nfsclds_sess); if (error) return (error); error = nd->nd_repstat; @@ -4266,6 +4303,7 @@ nfsrpc_rellockown(struct nfsmount *nmp, u_int32_t *tl; int error; uint8_t own[NFSV4CL_LOCKNAMELEN + NFSX_V4FHMAX]; + struct nfsclsession *tsep; if (NFSHASNFSV4N(nmp)) { /* For NFSv4.1, do a FreeStateID. */ @@ -4276,8 +4314,9 @@ nfsrpc_rellockown(struct nfsmount *nmp, nfscl_reqstart(nd, NFSPROC_RELEASELCKOWN, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, u_int32_t *, 2 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; NFSBCOPY(lp->nfsl_owner, own, NFSV4CL_LOCKNAMELEN); NFSBCOPY(fh, &own[NFSV4CL_LOCKNAMELEN], fhlen); (void)nfsm_strtom(nd, own, NFSV4CL_LOCKNAMELEN + fhlen); @@ -4515,7 +4554,7 @@ nfsrpc_exchangeid(struct nfsmount *nmp, error = NFSERR_BADXDR; goto nfsmout; } - dsp = malloc(sizeof(struct nfsclds) + len, M_NFSCLDS, + dsp = malloc(sizeof(struct nfsclds) + len + 1, M_NFSCLDS, M_WAITOK | M_ZERO); dsp->nfsclds_expire = NFSD_MONOSEC + clp->nfsc_renew; dsp->nfsclds_servownlen = len; @@ -4658,10 +4697,12 @@ nfsrpc_destroysession(struct nfsmount *n struct nfsrv_descript nfsd; struct nfsrv_descript *nd = &nfsd; int error; + struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_DESTROYSESSION, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, uint32_t *, NFSX_V4SESSIONID); - bcopy(NFSMNT_MDSSESSION(nmp)->nfsess_sessionid, tl, NFSX_V4SESSIONID); + tsep = nfsmnt_mdssession(nmp); + bcopy(tsep->nfsess_sessionid, tl, NFSX_V4SESSIONID); nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); @@ -4683,11 +4724,13 @@ nfsrpc_destroyclient(struct nfsmount *nm struct nfsrv_descript nfsd; struct nfsrv_descript *nd = &nfsd; int error; + struct nfsclsession *tsep; nfscl_reqstart(nd, NFSPROC_DESTROYCLIENT, nmp, NULL, 0, NULL, NULL); NFSM_BUILD(tl, uint32_t *, 2 * NFSX_UNSIGNED); - *tl++ = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[0]; - *tl = NFSMNT_MDSSESSION(nmp)->nfsess_clientid.lval[1]; + tsep = nfsmnt_mdssession(nmp); + *tl++ = tsep->nfsess_clientid.lval[0]; + *tl = tsep->nfsess_clientid.lval[1]; nd->nd_flag |= ND_USEGSSNAME; error = newnfs_request(nd, nmp, NULL, &nmp->nm_sockreq, NULL, p, cred, NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL); @@ -5155,6 +5198,7 @@ nfsrpc_getlayout(struct nfsmount *nmp, v struct nfsclflayouthead flh; int error = 0, islocked, layoutlen, recalled, retonclose; nfsv4stateid_t stateid; + struct nfsclsession *tsep; *lypp = NULL; /* @@ -5169,7 +5213,8 @@ nfsrpc_getlayout(struct nfsmount *nmp, v if (recalled != 0) return (EIO); LIST_INIT(&flh); - layoutlen = NFSMNT_MDSSESSION(nmp)->nfsess_maxcache - + tsep = nfsmnt_mdssession(nmp); + layoutlen = tsep->nfsess_maxcache - (NFSX_STATEID + 3 * NFSX_UNSIGNED); if (lyp == NULL) { stateid.seqid = 0; @@ -5266,7 +5311,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru if (msad != NULL && msad->sin_family == AF_INET && ssd->sin_addr.s_addr == msad->sin_addr.s_addr && ssd->sin_port == msad->sin_port && - (tdsp->nfsclds_flags & NFSCLDS_DS) != 0) { + (tdsp->nfsclds_flags & NFSCLDS_DS) != 0 && + tdsp->nfsclds_sess.nfsess_defunct == 0) { *dspp = tdsp; NFSUNLOCKMNT(nmp); NFSCL_DEBUG(4, "fnd same addr\n"); @@ -5306,7 +5352,8 @@ nfsrpc_fillsa(struct nfsmount *nmp, stru IN6_ARE_ADDR_EQUAL(&ssd6->sin6_addr, &msad6->sin6_addr) && ssd6->sin6_port == msad6->sin6_port && - (tdsp->nfsclds_flags & NFSCLDS_DS) != 0) { + (tdsp->nfsclds_flags & NFSCLDS_DS) != 0 && + tdsp->nfsclds_sess.nfsess_defunct == 0) { *dspp = tdsp; NFSUNLOCKMNT(nmp); return (0); @@ -5859,7 +5906,8 @@ nfscl_getsameserver(struct nfsmount *nmp if (dsp->nfsclds_servownlen == newdsp->nfsclds_servownlen && dsp->nfsclds_servownlen != 0 && !NFSBCMP(dsp->nfsclds_serverown, newdsp->nfsclds_serverown, - dsp->nfsclds_servownlen)) { + dsp->nfsclds_servownlen) && + dsp->nfsclds_sess.nfsess_defunct == 0) { NFSCL_DEBUG(4, "fnd same fdsp=%p dsp=%p flg=0x%x\n", TAILQ_FIRST(&nmp->nm_sess), dsp, dsp->nfsclds_flags); Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clstate.c Tue Apr 25 11:19:22 2017 (r317403) +++ stable/10/sys/fs/nfsclient/nfs_clstate.c Tue Apr 25 11:36:25 2017 (r317404) @@ -2470,8 +2470,11 @@ nfscl_renewthread(struct nfsclclient *cl if (recover_done_time < NFSD_MONOSEC) { recover_done_time = NFSD_MONOSEC + clp->nfsc_renew; + NFSCL_DEBUG(1, "Doing recovery..\n"); nfscl_recover(clp, cred, p); } else { + NFSCL_DEBUG(1, "Clear Recovery dt=%u ms=%jd\n", + recover_done_time, (intmax_t)NFSD_MONOSEC); NFSLOCKCLSTATE(); clp->nfsc_flags &= ~NFSCLFLAGS_RECOVER; NFSUNLOCKCLSTATE(); @@ -2481,8 +2484,7 @@ nfscl_renewthread(struct nfsclclient *cl (clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID)) { clp->nfsc_expire = NFSD_MONOSEC + clp->nfsc_renew; clidrev = clp->nfsc_clientidrev; - error = nfsrpc_renew(clp, - TAILQ_FIRST(&clp->nfsc_nmp->nm_sess), cred, p); + error = nfsrpc_renew(clp, NULL, cred, p); if (error == NFSERR_CBPATHDOWN) cbpathdown = 1; else if (error == NFSERR_STALECLIENTID || @@ -2494,24 +2496,27 @@ nfscl_renewthread(struct nfsclclient *cl (void) nfscl_hasexpired(clp, clidrev, p); } - /* Do renews for any DS sessions. */ checkdsrenew: - NFSLOCKMNT(clp->nfsc_nmp); - /* Skip first entry, since the MDS is handled above. */ - dsp = TAILQ_FIRST(&clp->nfsc_nmp->nm_sess); - if (dsp != NULL) - dsp = TAILQ_NEXT(dsp, nfsclds_list); - while (dsp != NULL) { - if (dsp->nfsclds_expire <= NFSD_MONOSEC) { - dsp->nfsclds_expire = NFSD_MONOSEC + - clp->nfsc_renew; - NFSUNLOCKMNT(clp->nfsc_nmp); - (void)nfsrpc_renew(clp, dsp, cred, p); - goto checkdsrenew; + if (NFSHASNFSV4N(clp->nfsc_nmp)) { + /* Do renews for any DS sessions. */ + NFSLOCKMNT(clp->nfsc_nmp); + /* Skip first entry, since the MDS is handled above. */ + dsp = TAILQ_FIRST(&clp->nfsc_nmp->nm_sess); + if (dsp != NULL) + dsp = TAILQ_NEXT(dsp, nfsclds_list); + while (dsp != NULL) { + if (dsp->nfsclds_expire <= NFSD_MONOSEC && + dsp->nfsclds_sess.nfsess_defunct == 0) { + dsp->nfsclds_expire = NFSD_MONOSEC + + clp->nfsc_renew; + NFSUNLOCKMNT(clp->nfsc_nmp); + (void)nfsrpc_renew(clp, dsp, cred, p); + goto checkdsrenew; + } + dsp = TAILQ_NEXT(dsp, nfsclds_list); } - dsp = TAILQ_NEXT(dsp, nfsclds_list); + NFSUNLOCKMNT(clp->nfsc_nmp); } - NFSUNLOCKMNT(clp->nfsc_nmp); TAILQ_INIT(&dh); NFSLOCKCLSTATE(); @@ -3163,6 +3168,7 @@ nfscl_docb(struct nfsrv_descript *nd, NF int changed, gotone, laytype, recalltype; uint32_t iomode; struct nfsclrecalllayout *recallp = NULL; + struct nfsclsession *tsep; gotseq_ok = 0; nfsrvd_rephead(nd); @@ -3472,13 +3478,12 @@ nfscl_docb(struct nfsrv_descript *nd, NF error = NFSERR_SERVERFAULT; } else error = NFSERR_SEQUENCEPOS; - if (error == 0) + if (error == 0) { + tsep = nfsmnt_mdssession(clp->nfsc_nmp); error = nfsv4_seqsession(seqid, slotid, - highslot, - NFSMNT_MDSSESSION(clp->nfsc_nmp)-> - nfsess_cbslots, &rep, - NFSMNT_MDSSESSION(clp->nfsc_nmp)-> - nfsess_backslots); + highslot, tsep->nfsess_cbslots, &rep, + tsep->nfsess_backslots); + } NFSUNLOCKCLSTATE(); if (error == 0) { gotseq_ok = 1; @@ -3546,8 +3551,8 @@ out: NFSLOCKCLSTATE(); clp = nfscl_getclntsess(sessionid); if (clp != NULL) { - nfsv4_seqsess_cacherep(slotid, - NFSMNT_MDSSESSION(clp->nfsc_nmp)->nfsess_cbslots, + tsep = nfsmnt_mdssession(clp->nfsc_nmp); + nfsv4_seqsess_cacherep(slotid, tsep->nfsess_cbslots, NFSERR_OK, &rep); NFSUNLOCKCLSTATE(); } else { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable-10@freebsd.org Tue Apr 25 12:07:05 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8F570D4DA0B; Tue, 25 Apr 2017 12:07:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59E50C4; Tue, 25 Apr 2017 12:07:05 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PC74XO057928; Tue, 25 Apr 2017 12:07:04 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PC74fr057927; Tue, 25 Apr 2017 12:07:04 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251207.v3PC74fr057927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 12:07:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317406 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 12:07:05 -0000 Author: rmacklem Date: Tue Apr 25 12:07:04 2017 New Revision: 317406 URL: https://svnweb.freebsd.org/changeset/base/317406 Log: MFC: r316655 Fix parsing failure for NFSv4 Setattr operation for failed case. If an operation that preceeds a Setattr in an NFSv4 compound fails, there is no bitmap of attributes to parse. Without this patch, the parsing would fail and return EBADRPC instead of the correct failure error. This could break recovery from a server crash/reboot. Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 25 11:59:23 2017 (r317405) +++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 25 12:07:04 2017 (r317406) @@ -1187,7 +1187,7 @@ nfsrpc_setattrrpc(vnode_t vp, struct vat return (error); if (nd->nd_flag & (ND_NFSV3 | ND_NFSV4)) error = nfscl_wcc_data(nd, vp, rnap, attrflagp, NULL, stuff); - if ((nd->nd_flag & ND_NFSV4) && !error) + if ((nd->nd_flag & (ND_NFSV4 | ND_NOMOREDATA)) == ND_NFSV4 && !error) error = nfsrv_getattrbits(nd, &attrbits, NULL, NULL); if (!(nd->nd_flag & ND_NFSV3) && !nd->nd_repstat && !error) error = nfscl_postop_attr(nd, rnap, attrflagp, stuff); From owner-svn-src-stable-10@freebsd.org Tue Apr 25 13:17:35 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 714B9D50574; Tue, 25 Apr 2017 13:17:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3F29BD4; Tue, 25 Apr 2017 13:17:35 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PDHYTf087139; Tue, 25 Apr 2017 13:17:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PDHYco087138; Tue, 25 Apr 2017 13:17:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704251317.v3PDHYco087138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 25 Apr 2017 13:17:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317408 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 13:17:35 -0000 Author: kib Date: Tue Apr 25 13:17:34 2017 New Revision: 317408 URL: https://svnweb.freebsd.org/changeset/base/317408 Log: MFC r316698: Remove debugging printf. Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clvnops.c Tue Apr 25 13:07:06 2017 (r317407) +++ stable/10/sys/fs/nfsclient/nfs_clvnops.c Tue Apr 25 13:17:34 2017 (r317408) @@ -2969,14 +2969,17 @@ done: free(bvec, M_TEMP); if (error == 0 && commit != 0 && waitfor == MNT_WAIT && (bo->bo_dirty.bv_cnt != 0 || bo->bo_numoutput != 0 || - np->n_directio_asyncwr != 0) && trycnt++ < 5) { - /* try, try again... */ - passone = 1; - wcred = NULL; - bvec = NULL; - bvecsize = 0; -printf("try%d\n", trycnt); - goto again; + np->n_directio_asyncwr != 0)) { + if (trycnt++ < 5) { + /* try, try again... */ + passone = 1; + wcred = NULL; + bvec = NULL; + bvecsize = 0; + goto again; + } + vn_printf(vp, "ncl_flush failed"); + error = called_from_renewthread != 0 ? EIO : EBUSY; } return (error); } From owner-svn-src-stable-10@freebsd.org Tue Apr 25 19:35:15 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1FFCBD509D0; Tue, 25 Apr 2017 19:35:15 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E57A314E3; Tue, 25 Apr 2017 19:35:14 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PJZD1n043604; Tue, 25 Apr 2017 19:35:13 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PJZDng043603; Tue, 25 Apr 2017 19:35:13 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251935.v3PJZDng043603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 19:35:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317419 - stable/10/sys/fs/nfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 19:35:15 -0000 Author: rmacklem Date: Tue Apr 25 19:35:13 2017 New Revision: 317419 URL: https://svnweb.freebsd.org/changeset/base/317419 Log: MFC: r316666 Fix the NFSv4.1 client for NFSERR_BADSESSION recovery via ReclaimComplete. For the ReclaimComplete operation, the RPC layer should not loop on NFSERR_BADSESSION. If it does, the recovery thread (nfscl) can get stuck looping and will not do a recovery. This patch fixes it so it does not loop. This bug only affects NFSv4.1 and only when a server reboots. Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 19:14:31 2017 (r317418) +++ stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 19:35:13 2017 (r317419) @@ -148,7 +148,7 @@ struct nfsv4_opflag nfsv4_opflag[NFSV41_ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Test StateID */ { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Want Delegation */ { 0, 0, 0, 0, LK_EXCLUSIVE, 0, 0 }, /* Destroy ClientID */ - { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 1 }, /* Reclaim Complete */ + { 0, 0, 0, 0, LK_EXCLUSIVE, 1, 0 }, /* Reclaim Complete */ }; #endif /* !APPLEKEXT */ From owner-svn-src-stable-10@freebsd.org Tue Apr 25 19:48:27 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 53313D50DCE; Tue, 25 Apr 2017 19:48:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 249441BF8; Tue, 25 Apr 2017 19:48:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PJmQJR048034; Tue, 25 Apr 2017 19:48:26 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PJmQpx048033; Tue, 25 Apr 2017 19:48:26 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251948.v3PJmQpx048033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 19:48:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317420 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 19:48:27 -0000 Author: rmacklem Date: Tue Apr 25 19:48:25 2017 New Revision: 317420 URL: https://svnweb.freebsd.org/changeset/base/317420 Log: MFC: r316667 Fix the NFSv4 client hndling of a stale write verifier in the Commit operation. When the NFSv4 client Commit operation encountered a stale write verifier, it erroneously mapped that to EIO. This could have caused recently written data to be lost when a server crashes/reboots between an UNSTABLE write and the subsequent commit. This patch fixes this. The bug was only for the NFSv4 client and did not affect NFSv3. Modified: stable/10/sys/fs/nfsclient/nfs_clport.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clport.c Tue Apr 25 19:35:13 2017 (r317419) +++ stable/10/sys/fs/nfsclient/nfs_clport.c Tue Apr 25 19:48:25 2017 (r317420) @@ -1125,7 +1125,7 @@ nfscl_maperr(struct thread *td, int erro { struct proc *p; - if (error < 10000) + if (error < 10000 || error >= NFSERR_STALEWRITEVERF) return (error); if (td != NULL) p = td->td_proc; From owner-svn-src-stable-10@freebsd.org Tue Apr 25 20:34:57 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A5EC3D4F1B9; Tue, 25 Apr 2017 20:34:57 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 7245E10E2; Tue, 25 Apr 2017 20:34:57 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PKYuhP068211; Tue, 25 Apr 2017 20:34:56 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PKYuCR068210; Tue, 25 Apr 2017 20:34:56 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704252034.v3PKYuCR068210@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 25 Apr 2017 20:34:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317423 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 20:34:57 -0000 Author: rmacklem Date: Tue Apr 25 20:34:56 2017 New Revision: 317423 URL: https://svnweb.freebsd.org/changeset/base/317423 Log: MFC: r316669 Avoid starvation of the server crash recovery thread for the NFSv4 client. This patch gives a requestor of the exclusive lock on the client state in the NFSv4 client priority over shared lock requestors. This avoids the server crash recovery thread being starved out by other threads doing RPCs. Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clstate.c Tue Apr 25 20:24:00 2017 (r317422) +++ stable/10/sys/fs/nfsclient/nfs_clstate.c Tue Apr 25 20:34:56 2017 (r317423) @@ -797,8 +797,18 @@ nfscl_getcl(struct mount *mp, struct ucr (mp->mnt_kern_flag & MNTK_UNMOUNTF) == 0) igotlock = nfsv4_lock(&clp->nfsc_lock, 1, NULL, NFSCLSTATEMUTEXPTR, mp); - if (!igotlock) + if (igotlock == 0) { + /* + * Call nfsv4_lock() with "iwantlock == 0" so that it will + * wait for a pending exclusive lock request. This gives the + * exclusive lock request priority over this shared lock + * request. + * An exclusive lock on nfsc_lock is used mainly for server + * crash recoveries. + */ + nfsv4_lock(&clp->nfsc_lock, 0, NULL, NFSCLSTATEMUTEXPTR, mp); nfsv4_getref(&clp->nfsc_lock, NULL, NFSCLSTATEMUTEXPTR, mp); + } if (igotlock == 0 && (mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) { /* * Both nfsv4_lock() and nfsv4_getref() know to check From owner-svn-src-stable-10@freebsd.org Wed Apr 26 00:03:04 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF625D50CAA; Wed, 26 Apr 2017 00:03:04 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id BF1571F0; Wed, 26 Apr 2017 00:03:04 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3Q033EA053251; Wed, 26 Apr 2017 00:03:03 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3Q033UN053250; Wed, 26 Apr 2017 00:03:03 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704260003.v3Q033UN053250@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 26 Apr 2017 00:03:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317429 - stable/10/sys/fs/nfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 00:03:05 -0000 Author: rmacklem Date: Wed Apr 26 00:03:03 2017 New Revision: 317429 URL: https://svnweb.freebsd.org/changeset/base/317429 Log: MFC: r316692 Set initial values for nfsstatfs in the NFSv4 client. The AmazonEFS NFSv4.1 server does not support the FILES_FREE and FILES_TOTAL attributes. As such, an NFSv4.1 mount to the server would return garbage for these values. This patch initializes the fields of the nfsstatfs structure, so that "df" and friends will at least return consistent bogus values. Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/10/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 23:46:53 2017 (r317428) +++ stable/10/sys/fs/nfs/nfs_commonsubs.c Wed Apr 26 00:03:03 2017 (r317429) @@ -888,6 +888,14 @@ nfsv4_loadattr(struct nfsrv_descript *nd pc->pc_caseinsensitive = 0; pc->pc_casepreserving = 1; } + if (sfp != NULL) { + sfp->sf_ffiles = UINT64_MAX; + sfp->sf_tfiles = UINT64_MAX; + sfp->sf_afiles = UINT64_MAX; + sfp->sf_fbytes = UINT64_MAX; + sfp->sf_tbytes = UINT64_MAX; + sfp->sf_abytes = UINT64_MAX; + } } /* From owner-svn-src-stable-10@freebsd.org Wed Apr 26 02:37:28 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 016E4D50031; Wed, 26 Apr 2017 02:37:28 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D0F9FE54; Wed, 26 Apr 2017 02:37:27 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3Q2bQx1013874; Wed, 26 Apr 2017 02:37:26 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3Q2bQVv013871; Wed, 26 Apr 2017 02:37:26 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201704260237.v3Q2bQVv013871@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Wed, 26 Apr 2017 02:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317434 - in stable: 10 10/sys/contrib/ipfilter/netinet 11 11/sys/contrib/ipfilter/netinet X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 02:37:28 -0000 Author: cy Date: Wed Apr 26 02:37:25 2017 New Revision: 317434 URL: https://svnweb.freebsd.org/changeset/base/317434 Log: MFC r316810, r316814, r316816, r316991: Keep state incorrectly assumes keep frags. This is counter to the ipfilter man pages. This also currently restricts keep frags to only when keep state is used, which is redundant because keep state currently assumes keep frags. This commit fixes this. To the user this change means that to maintain the current behaviour one must add keep frags to any ipfilter keep state rule (as documented in the man pages). This patch also allows the flexability to specify and use keep frags separate from keep state, as documented in an example in ipf.conf.5, instead of the currently broken behaviour. MFC suggested by: rgrimes Relnotes: yes Modified: stable/10/UPDATING stable/10/sys/contrib/ipfilter/netinet/fil.c stable/10/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/UPDATING stable/11/sys/contrib/ipfilter/netinet/fil.c stable/11/sys/contrib/ipfilter/netinet/ip_state.c Directory Properties: stable/11/ (props changed) Modified: stable/10/UPDATING ============================================================================== --- stable/10/UPDATING Wed Apr 26 01:08:25 2017 (r317433) +++ stable/10/UPDATING Wed Apr 26 02:37:25 2017 (r317434) @@ -16,6 +16,15 @@ from older versions of FreeBSD, try WITH stable/10, and then rebuild without this option. The bootstrap process from older version of current is a bit fragile. +20170413: + As of r316810 for ipfilter, keep frags is no longer assumed when + keep state is specified in a rule. r316810 aligns ipfilter with + documentation in man pages separating keep frags from keep state. + This allows keep state to specified without forcing keep frags + and allows keep frags to be specified independently of keep state. + To maintain previous behaviour, also specify keep frags with + keep state (as documented in ipf.conf.5). + 20170323: The code that provides support for ZFS .zfs/ directory functionality has been reimplemented. It's not possible now to create a snapshot Modified: stable/10/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/fil.c Wed Apr 26 01:08:25 2017 (r317433) +++ stable/10/sys/contrib/ipfilter/netinet/fil.c Wed Apr 26 02:37:25 2017 (r317434) @@ -2752,7 +2752,7 @@ ipf_firewall(fin, passp) * If the rule has "keep frag" and the packet is actually a fragment, * then create a fragment state entry. */ - if ((pass & (FR_KEEPFRAG|FR_KEEPSTATE)) == FR_KEEPFRAG) { + if (pass & FR_KEEPFRAG) { if (fin->fin_flx & FI_FRAG) { if (ipf_frag_new(softc, fin, pass) == -1) { LBUMP(ipf_stats[out].fr_bnfr); Modified: stable/10/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- stable/10/sys/contrib/ipfilter/netinet/ip_state.c Wed Apr 26 01:08:25 2017 (r317433) +++ stable/10/sys/contrib/ipfilter/netinet/ip_state.c Wed Apr 26 02:37:25 2017 (r317434) @@ -3408,7 +3408,8 @@ ipf_state_check(fin, passp) * If this packet is a fragment and the rule says to track fragments, * then create a new fragment cache entry. */ - if ((fin->fin_flx & FI_FRAG) && FR_ISPASS(is->is_pass)) + if (fin->fin_flx & FI_FRAG && FR_ISPASS(is->is_pass) && + is->is_pass & FR_KEEPFRAG) (void) ipf_frag_new(softc, fin, is->is_pass); /* From owner-svn-src-stable-10@freebsd.org Wed Apr 26 16:27:21 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 62276D515B4; Wed, 26 Apr 2017 16:27:21 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 339AD277; Wed, 26 Apr 2017 16:27:21 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QGRKZY054856; Wed, 26 Apr 2017 16:27:20 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QGRKSW054855; Wed, 26 Apr 2017 16:27:20 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201704261627.v3QGRKSW054855@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Wed, 26 Apr 2017 16:27:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317442 - in stable: 10/release/tools 11/release/tools X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 16:27:21 -0000 Author: gjb Date: Wed Apr 26 16:27:20 2017 New Revision: 317442 URL: https://svnweb.freebsd.org/changeset/base/317442 Log: MFC r317169: Trim trailing '/release/..' when setting _OBJDIR so arm64/aarch64 boot1.efifat is properly located when creating virtual machine images. Note, the underlying issue has no direct impact against stable/10, as arm64/aarch64 virtual machine images are not created for 10-STABLE. Sponsored by: The FreeBSD Foundation Modified: stable/10/release/tools/vmimage.subr Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/release/tools/vmimage.subr Directory Properties: stable/11/ (props changed) Modified: stable/10/release/tools/vmimage.subr ============================================================================== --- stable/10/release/tools/vmimage.subr Wed Apr 26 16:13:22 2017 (r317441) +++ stable/10/release/tools/vmimage.subr Wed Apr 26 16:27:20 2017 (r317442) @@ -15,6 +15,7 @@ write_partition_layout() { fi _OBJDIR="$(make -C ${WORLDDIR} -V .OBJDIR)" + _OBJDIR="$(realpath ${_OBJDIR})" if [ -d "${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}" ]; then BOOTFILES="/${_OBJDIR%%/usr/src}/${TARGET}.${TARGET_ARCH}/usr/src/sys/boot" else From owner-svn-src-stable-10@freebsd.org Wed Apr 26 22:40:09 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D9E56D51A8C; Wed, 26 Apr 2017 22:40:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8F9C515CF; Wed, 26 Apr 2017 22:40:09 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QMe8P0009417; Wed, 26 Apr 2017 22:40:08 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QMe81k009414; Wed, 26 Apr 2017 22:40:08 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704262240.v3QMe81k009414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 26 Apr 2017 22:40:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317473 - stable/10/sys/rpc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 22:40:10 -0000 Author: rmacklem Date: Wed Apr 26 22:40:08 2017 New Revision: 317473 URL: https://svnweb.freebsd.org/changeset/base/317473 Log: MFC: r316694 Fix a crash during unmount of an NFSv4.1 mount. Larry Rosenman reported a crash on freebsd-current@ which was caused by a premature release of the krpc backchannel socket structure. I believe this was caused by a race between the SVC_RELEASE() in clnt_vc.c and the xprt_unregister() in the higher layer (clnt_rc.c), which tried to lock the mutex in the xprt structure and crashed. This patch fixes this by removing the xprt_unregister() in the clnt_vc layer and allowing this to always be done by the clnt_rc (higher reconnect layer). Modified: stable/10/sys/rpc/clnt_rc.c stable/10/sys/rpc/clnt_vc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/rpc/clnt_rc.c ============================================================================== --- stable/10/sys/rpc/clnt_rc.c Wed Apr 26 22:33:09 2017 (r317472) +++ stable/10/sys/rpc/clnt_rc.c Wed Apr 26 22:40:08 2017 (r317473) @@ -450,7 +450,6 @@ clnt_reconnect_control(CLIENT *cl, u_int case CLSET_BACKCHANNEL: xprt = (SVCXPRT *)info; - SVC_ACQUIRE(xprt); xprt_register(xprt); rc->rc_backchannel = info; break; Modified: stable/10/sys/rpc/clnt_vc.c ============================================================================== --- stable/10/sys/rpc/clnt_vc.c Wed Apr 26 22:33:09 2017 (r317472) +++ stable/10/sys/rpc/clnt_vc.c Wed Apr 26 22:40:08 2017 (r317473) @@ -790,7 +790,7 @@ clnt_vc_destroy(CLIENT *cl) sx_xlock(&xprt->xp_lock); mtx_lock(&ct->ct_lock); xprt->xp_p2 = NULL; - xprt_unregister(xprt); + sx_xunlock(&xprt->xp_lock); } if (ct->ct_socket) { @@ -800,10 +800,6 @@ clnt_vc_destroy(CLIENT *cl) } mtx_unlock(&ct->ct_lock); - if (xprt != NULL) { - sx_xunlock(&xprt->xp_lock); - SVC_RELEASE(xprt); - } mtx_destroy(&ct->ct_lock); if (so) { From owner-svn-src-stable-10@freebsd.org Wed Apr 26 22:53:31 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 073E3D510CE; Wed, 26 Apr 2017 22:53:31 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C013D1FEC; Wed, 26 Apr 2017 22:53:30 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QMrT6M016991; Wed, 26 Apr 2017 22:53:29 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QMrT2P016990; Wed, 26 Apr 2017 22:53:29 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704262253.v3QMrT2P016990@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 26 Apr 2017 22:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317474 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 22:53:31 -0000 Author: rmacklem Date: Wed Apr 26 22:53:29 2017 New Revision: 317474 URL: https://svnweb.freebsd.org/changeset/base/317474 Log: MFC: r316717 During a server crash recovery, fix the NFSv4.1 client for a NFSERR_BADSESSION during recovery. If the NFSv4.1 client gets a NFSv4.1 NFSERR_BADSESSION reply to an Open/Lock operation while recovering from the server crash/reboot, allow the opens to be retained for a subsequent recovery attempt. Since NFSv4.1 servers should only reply NFSERR_BADSESSION after a crash/reboot that has lost state, this case should almost never happen. However, for the AmazonEFS file service, this has been observed when the client does a fresh TCP connection for RPCs. Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clstate.c Wed Apr 26 22:40:08 2017 (r317473) +++ stable/10/sys/fs/nfsclient/nfs_clstate.c Wed Apr 26 22:53:29 2017 (r317474) @@ -1981,7 +1981,7 @@ nfscl_recover(struct nfsclclient *clp, s op = LIST_FIRST(&owp->nfsow_open); while (op != NULL) { nop = LIST_NEXT(op, nfso_list); - if (error != NFSERR_NOGRACE) { + if (error != NFSERR_NOGRACE && error != NFSERR_BADSESSION) { /* Search for a delegation to reclaim with the open */ TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) { if (!(dp->nfsdl_flags & NFSCLDL_NEEDRECLAIM)) @@ -2050,11 +2050,10 @@ nfscl_recover(struct nfsclclient *clp, s len = NFS64BITSSET; else len = lop->nfslo_end - lop->nfslo_first; - if (error != NFSERR_NOGRACE) - error = nfscl_trylock(nmp, NULL, - op->nfso_fh, op->nfso_fhlen, lp, - firstlock, 1, lop->nfslo_first, len, - lop->nfslo_type, tcred, p); + error = nfscl_trylock(nmp, NULL, + op->nfso_fh, op->nfso_fhlen, lp, + firstlock, 1, lop->nfslo_first, len, + lop->nfslo_type, tcred, p); if (error != 0) nfscl_freelock(lop, 0); else @@ -2066,10 +2065,10 @@ nfscl_recover(struct nfsclclient *clp, s nfscl_freelockowner(lp, 0); lp = nlp; } - } else { - nfscl_freeopen(op, 0); } } + if (error != 0 && error != NFSERR_BADSESSION) + nfscl_freeopen(op, 0); op = nop; } owp = nowp; @@ -2100,7 +2099,7 @@ nfscl_recover(struct nfsclclient *clp, s nfscl_lockinit(&nowp->nfsow_rwlock); } nop = NULL; - if (error != NFSERR_NOGRACE) { + if (error != NFSERR_NOGRACE && error != NFSERR_BADSESSION) { MALLOC(nop, struct nfsclopen *, sizeof (struct nfsclopen) + dp->nfsdl_fhlen - 1, M_NFSCLOPEN, M_WAITOK); nop->nfso_own = nowp; From owner-svn-src-stable-10@freebsd.org Wed Apr 26 23:01:51 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2EC14D511EC; Wed, 26 Apr 2017 23:01:51 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DA91A6AC; Wed, 26 Apr 2017 23:01:50 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QN1nNO020279; Wed, 26 Apr 2017 23:01:49 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QN1n57020278; Wed, 26 Apr 2017 23:01:49 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704262301.v3QN1n57020278@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 26 Apr 2017 23:01:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317475 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 23:01:51 -0000 Author: rmacklem Date: Wed Apr 26 23:01:49 2017 New Revision: 317475 URL: https://svnweb.freebsd.org/changeset/base/317475 Log: MFC: r316719 Don't throw away Open state when a NFSv4.1 client recovery fails. If the ExchangeID/CreateSession operations done by an NFSv4.1 client after the server crashes/reboots fails, it is possible that some process/thread is waiting for an open_owner lock. If the client state is free'd, this can cause a crash. This would not normally happen, but has been observed on a mount of the AmazonEFS service. Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clstate.c Wed Apr 26 22:53:29 2017 (r317474) +++ stable/10/sys/fs/nfsclient/nfs_clstate.c Wed Apr 26 23:01:49 2017 (r317475) @@ -1934,10 +1934,9 @@ nfscl_recover(struct nfsclclient *clp, s error == NFSERR_BADSESSION || error == NFSERR_STALEDONTRECOVER) && --trycnt > 0); if (error) { - nfscl_cleanclient(clp); NFSLOCKCLSTATE(); - clp->nfsc_flags &= ~(NFSCLFLAGS_HASCLIENTID | - NFSCLFLAGS_RECOVER | NFSCLFLAGS_RECVRINPROG); + clp->nfsc_flags &= ~(NFSCLFLAGS_RECOVER | + NFSCLFLAGS_RECVRINPROG); wakeup(&clp->nfsc_flags); nfsv4_unlock(&clp->nfsc_lock, 0); NFSUNLOCKCLSTATE(); @@ -2254,13 +2253,8 @@ nfscl_hasexpired(struct nfsclclient *clp error == NFSERR_BADSESSION || error == NFSERR_STALEDONTRECOVER) && --trycnt > 0); if (error) { - /* - * Clear out any state. - */ - nfscl_cleanclient(clp); NFSLOCKCLSTATE(); - clp->nfsc_flags &= ~(NFSCLFLAGS_HASCLIENTID | - NFSCLFLAGS_RECOVER); + clp->nfsc_flags &= ~NFSCLFLAGS_RECOVER; } else { /* * Expire the state for the client. From owner-svn-src-stable-10@freebsd.org Wed Apr 26 23:24:06 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2ABED517C6; Wed, 26 Apr 2017 23:24:06 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 90D463B4; Wed, 26 Apr 2017 23:24:06 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QNO5Ew029317; Wed, 26 Apr 2017 23:24:05 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QNO5Dn029316; Wed, 26 Apr 2017 23:24:05 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704262324.v3QNO5Dn029316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Wed, 26 Apr 2017 23:24:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317476 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 23:24:06 -0000 Author: rmacklem Date: Wed Apr 26 23:24:05 2017 New Revision: 317476 URL: https://svnweb.freebsd.org/changeset/base/317476 Log: MFC: r316745 Fix the NFS client for "text file modified, process killed" mmap'd case. When an mmap'd text file is written and then executed immediately afterwards, it was possible that the modify time would change after the text file was executing, resulting in the process executing the file being killed. This was usually only observed when the file system's times were set to higher resolution, but could have occurred for any time resolution. This patch adds a VOP_SET_TEXT() to the NFS client which flushed all dirty pages to the NFS server and then makes sure that n_mtime is up to date to avoid this from occurring. Thanks go to kib@ and pho@ for their help with developing this patch. The call to ncl_flush() has been removed. If r316532 is merged into stable/10, this call needs to go back into nfs_set_text(). Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clvnops.c Wed Apr 26 23:01:49 2017 (r317475) +++ stable/10/sys/fs/nfsclient/nfs_clvnops.c Wed Apr 26 23:24:05 2017 (r317476) @@ -150,6 +150,7 @@ static vop_advlock_t nfs_advlock; static vop_advlockasync_t nfs_advlockasync; static vop_getacl_t nfs_getacl; static vop_setacl_t nfs_setacl; +static vop_set_text_t nfs_set_text; /* * Global vfs data structures for nfs @@ -186,6 +187,7 @@ struct vop_vector newnfs_vnodeops = { .vop_write = ncl_write, .vop_getacl = nfs_getacl, .vop_setacl = nfs_setacl, + .vop_set_text = nfs_set_text, }; struct vop_vector newnfs_fifoops = { @@ -3387,6 +3389,36 @@ nfs_setacl(struct vop_setacl_args *ap) return (error); } +static int +nfs_set_text(struct vop_set_text_args *ap) +{ + struct vnode *vp = ap->a_vp; + struct nfsnode *np; + + /* + * If the text file has been mmap'd, flush any dirty pages to the + * buffer cache and then... + * Make sure all writes are pushed to the NFS server. If this is not + * done, the modify time of the file can change while the text + * file is being executed. This will cause the process that is + * executing the text file to be terminated. + */ + if (vp->v_object != NULL) { + VM_OBJECT_WLOCK(vp->v_object); + vm_object_page_clean(vp->v_object, 0, 0, OBJPC_SYNC); + VM_OBJECT_WUNLOCK(vp->v_object); + } + + /* And, finally, make sure that n_mtime is up to date. */ + np = VTONFS(vp); + mtx_lock(&np->n_mtx); + np->n_mtime = np->n_vattr.na_mtime; + mtx_unlock(&np->n_mtx); + + vp->v_vflag |= VV_TEXT; + return (0); +} + /* * Return POSIX pathconf information applicable to nfs filesystems. */ From owner-svn-src-stable-10@freebsd.org Thu Apr 27 02:17:46 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB480D52723; Thu, 27 Apr 2017 02:17:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8846D106E; Thu, 27 Apr 2017 02:17:46 +0000 (UTC) (envelope-from sephe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3R2HjZr000792; Thu, 27 Apr 2017 02:17:45 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3R2HjVB000791; Thu, 27 Apr 2017 02:17:45 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201704270217.v3R2HjVB000791@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sephe set sender to sephe@FreeBSD.org using -f From: Sepherosa Ziehau Date: Thu, 27 Apr 2017 02:17:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317482 - stable/10/sys/dev/hyperv/netvsc X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 02:17:46 -0000 Author: sephe Date: Thu Apr 27 02:17:45 2017 New Revision: 317482 URL: https://svnweb.freebsd.org/changeset/base/317482 Log: MFC 317353 hyperv/hn: Use channel0, i.e. TX ring0, for TCP SYN/SYN|ACK. Hyper-V hot channel effect: Operation latency on hot channel is only _half_ of the operation latency on cold channels. This commit takes the advantage of the above Hyper-V host channel effect, and can reduce more than 75% latency and more than 50% latency stdev, i.e. lower and more stable/predictable latency, for various types of web server workloads. Sponsored by: Microsoft Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/10/sys/dev/hyperv/netvsc/if_hn.c Thu Apr 27 01:58:20 2017 (r317481) +++ stable/10/sys/dev/hyperv/netvsc/if_hn.c Thu Apr 27 02:17:45 2017 (r317482) @@ -611,6 +611,16 @@ hn_chim_free(struct hn_softc *sc, uint32 } #if defined(INET6) || defined(INET) + +#define PULLUP_HDR(m, len) \ +do { \ + if (__predict_false((m)->m_len < (len))) { \ + (m) = m_pullup((m), (len)); \ + if ((m) == NULL) \ + return (NULL); \ + } \ +} while (0) + /* * NOTE: If this function failed, the m_head would be freed. */ @@ -623,15 +633,6 @@ hn_tso_fixup(struct mbuf *m_head) KASSERT(M_WRITABLE(m_head), ("TSO mbuf not writable")); -#define PULLUP_HDR(m, len) \ -do { \ - if (__predict_false((m)->m_len < (len))) { \ - (m) = m_pullup((m), (len)); \ - if ((m) == NULL) \ - return (NULL); \ - } \ -} while (0) - PULLUP_HDR(m_head, sizeof(*evl)); evl = mtod(m_head, struct ether_vlan_header *); if (evl->evl_encap_proto == ntohs(ETHERTYPE_VLAN)) @@ -680,8 +681,65 @@ do { \ #endif return (m_head); -#undef PULLUP_HDR } + +/* + * NOTE: If this function failed, the m_head would be freed. + */ +static __inline struct mbuf * +hn_check_tcpsyn(struct mbuf *m_head, int *tcpsyn) +{ + const struct ether_vlan_header *evl; + const struct tcphdr *th; + int ehlen; + + *tcpsyn = 0; + + PULLUP_HDR(m_head, sizeof(*evl)); + evl = mtod(m_head, const struct ether_vlan_header *); + if (evl->evl_encap_proto == ntohs(ETHERTYPE_VLAN)) + ehlen = ETHER_HDR_LEN + ETHER_VLAN_ENCAP_LEN; + else + ehlen = ETHER_HDR_LEN; + +#ifdef INET + if (m_head->m_pkthdr.csum_flags & CSUM_IP_TCP) { + const struct ip *ip; + int iphlen; + + PULLUP_HDR(m_head, ehlen + sizeof(*ip)); + ip = mtodo(m_head, ehlen); + iphlen = ip->ip_hl << 2; + + PULLUP_HDR(m_head, ehlen + iphlen + sizeof(*th)); + th = mtodo(m_head, ehlen + iphlen); + if (th->th_flags & TH_SYN) + *tcpsyn = 1; + } +#endif +#if defined(INET6) && defined(INET) + else +#endif +#ifdef INET6 + { + const struct ip6_hdr *ip6; + + PULLUP_HDR(m_head, ehlen + sizeof(*ip6)); + ip6 = mtodo(m_head, ehlen); + if (ip6->ip6_nxt != IPPROTO_TCP) + return (m_head); + + PULLUP_HDR(m_head, ehlen + sizeof(*ip6) + sizeof(*th)); + th = mtodo(m_head, ehlen + sizeof(*ip6)); + if (th->th_flags & TH_SYN) + *tcpsyn = 1; + } +#endif + return (m_head); +} + +#undef PULLUP_HDR + #endif /* INET6 || INET */ static int @@ -4343,8 +4401,28 @@ hn_transmit(struct ifnet *ifp, struct mb /* * Select the TX ring based on flowid */ - if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) - idx = m->m_pkthdr.flowid % sc->hn_tx_ring_inuse; + if (M_HASHTYPE_GET(m) != M_HASHTYPE_NONE) { +#if defined(INET6) || defined(INET) + int tcpsyn = 0; + + if (m->m_pkthdr.len < 128 && + (m->m_pkthdr.csum_flags & (CSUM_IP_TCP | CSUM_IP6_TCP)) && + (m->m_pkthdr.csum_flags & CSUM_TSO) == 0) { + m = hn_check_tcpsyn(m, &tcpsyn); + if (__predict_false(m == NULL)) { + if_inc_counter(ifp, + IFCOUNTER_OERRORS, 1); + return (EIO); + } + } +#else + const int tcpsyn = 0; +#endif + if (tcpsyn) + idx = 0; + else + idx = m->m_pkthdr.flowid % sc->hn_tx_ring_inuse; + } txr = &sc->hn_tx_ring[idx]; error = drbr_enqueue(ifp, txr->hn_mbuf_br, m); From owner-svn-src-stable-10@freebsd.org Thu Apr 27 07:32:09 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CFF6D52DE8; Thu, 27 Apr 2017 07:32:09 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id C722E89C; Thu, 27 Apr 2017 07:32:08 +0000 (UTC) (envelope-from truckman@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3R7W7EJ031033; Thu, 27 Apr 2017 07:32:07 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3R7W7WE031031; Thu, 27 Apr 2017 07:32:07 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201704270732.v3R7W7WE031031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: truckman set sender to truckman@FreeBSD.org using -f From: Don Lewis Date: Thu, 27 Apr 2017 07:32:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317489 - stable/10/sys/netpfil/ipfw X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 07:32:09 -0000 Author: truckman Date: Thu Apr 27 07:32:07 2017 New Revision: 317489 URL: https://svnweb.freebsd.org/changeset/base/317489 Log: MFC r316777 (by cem) dummynet: Use strlcpy to appease static checkers Some dummynet modules used strcpy() to copy from a larger buffer (dn_aqm->name) to a smaller buffer (dn_extra_parms->name). It happens that the lengths of the strings in the dn_aqm buffers were always hardcoded to be smaller than the dn_extra_parms buffer ("CODEL", "PIE"). Use strlcpy() instead, to appease static checkers. No functional change. Reported by: Coverity CIDs: 1356163, 1356165 Sponsored by: Dell EMC Isilon Modified: stable/10/sys/netpfil/ipfw/dn_aqm_codel.c stable/10/sys/netpfil/ipfw/dn_aqm_pie.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/netpfil/ipfw/dn_aqm_codel.c ============================================================================== --- stable/10/sys/netpfil/ipfw/dn_aqm_codel.c Thu Apr 27 07:30:48 2017 (r317488) +++ stable/10/sys/netpfil/ipfw/dn_aqm_codel.c Thu Apr 27 07:32:07 2017 (r317489) @@ -416,7 +416,7 @@ aqm_codel_getconfig(struct dn_fsk *fs, s struct dn_aqm_codel_parms *ccfg; if (fs->aqmcfg) { - strcpy(ep->name, codel_desc.name); + strlcpy(ep->name, codel_desc.name, sizeof(ep->name)); ccfg = fs->aqmcfg; ep->par[0] = ccfg->target / AQM_TIME_1US; ep->par[1] = ccfg->interval / AQM_TIME_1US; Modified: stable/10/sys/netpfil/ipfw/dn_aqm_pie.c ============================================================================== --- stable/10/sys/netpfil/ipfw/dn_aqm_pie.c Thu Apr 27 07:30:48 2017 (r317488) +++ stable/10/sys/netpfil/ipfw/dn_aqm_pie.c Thu Apr 27 07:32:07 2017 (r317489) @@ -755,7 +755,7 @@ aqm_pie_getconfig (struct dn_fsk *fs, st { struct dn_aqm_pie_parms *pcfg; if (fs->aqmcfg) { - strcpy(ep->name, pie_desc.name); + strlcpy(ep->name, pie_desc.name, sizeof(ep->name)); pcfg = fs->aqmcfg; ep->par[0] = pcfg->qdelay_ref / AQM_TIME_1US; ep->par[1] = pcfg->tupdate / AQM_TIME_1US; From owner-svn-src-stable-10@freebsd.org Thu Apr 27 12:15:17 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3F3B0D50C90; Thu, 27 Apr 2017 12:15:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 11144E8D; Thu, 27 Apr 2017 12:15:17 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3RCFGlX047755; Thu, 27 Apr 2017 12:15:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3RCFGHU047754; Thu, 27 Apr 2017 12:15:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704271215.v3RCFGHU047754@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 27 Apr 2017 12:15:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317501 - stable/10/sys/dev/fb X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 12:15:17 -0000 Author: kib Date: Thu Apr 27 12:15:15 2017 New Revision: 317501 URL: https://svnweb.freebsd.org/changeset/base/317501 Log: MFC r317196: Write-combine framebuffer writes through user-space mappings, if possible. Modified: stable/10/sys/dev/fb/vesa.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/dev/fb/vesa.c ============================================================================== --- stable/10/sys/dev/fb/vesa.c Thu Apr 27 12:12:33 2017 (r317500) +++ stable/10/sys/dev/fb/vesa.c Thu Apr 27 12:15:15 2017 (r317501) @@ -1636,6 +1636,9 @@ vesa_mmap(video_adapter_t *adp, vm_ooffs if (offset > adp->va_window_size - PAGE_SIZE) return (-1); *paddr = adp->va_info.vi_buffer + offset; +#ifdef VM_MEMATTR_WRITE_COMBINING + *memattr = VM_MEMATTR_WRITE_COMBINING; +#endif return (0); } return ((*prevvidsw->mmap)(adp, offset, paddr, prot, memattr)); From owner-svn-src-stable-10@freebsd.org Thu Apr 27 18:21:40 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AFFAD53B82; Thu, 27 Apr 2017 18:21:40 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CB70316C4; Thu, 27 Apr 2017 18:21:39 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3RILcpJ097579; Thu, 27 Apr 2017 18:21:38 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3RILcwn097578; Thu, 27 Apr 2017 18:21:38 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201704271821.v3RILcwn097578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 27 Apr 2017 18:21:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317513 - stable/10/sys/kern X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 18:21:40 -0000 Author: emaste Date: Thu Apr 27 18:21:38 2017 New Revision: 317513 URL: https://svnweb.freebsd.org/changeset/base/317513 Log: MFC r315237 (kib): Hide kev_iovlen() definition under #ifdef KTRACE Fixes build of kernel configs without KTRACE. Sponsored by: The FreeBSD Foundation Modified: stable/10/sys/kern/kern_event.c Modified: stable/10/sys/kern/kern_event.c ============================================================================== --- stable/10/sys/kern/kern_event.c Thu Apr 27 17:53:05 2017 (r317512) +++ stable/10/sys/kern/kern_event.c Thu Apr 27 18:21:38 2017 (r317513) @@ -825,6 +825,7 @@ done2: return (error); } +#ifdef KTRACE static size_t kev_iovlen(int n, u_int kgio) { @@ -833,6 +834,7 @@ kev_iovlen(int n, u_int kgio) return (kgio); return (n * sizeof(struct kevent)); } +#endif #ifndef _SYS_SYSPROTO_H_ struct kevent_args { From owner-svn-src-stable-10@freebsd.org Thu Apr 27 20:08:04 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CA0A3D4BE82; Thu, 27 Apr 2017 20:08:04 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x242.google.com (mail-it0-x242.google.com [IPv6:2607:f8b0:4001:c0b::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 936BC13B3; Thu, 27 Apr 2017 20:08:04 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x242.google.com with SMTP id x188so3496144itb.3; Thu, 27 Apr 2017 13:08:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=SRVbuXaKRfoYoKm/TJIpDz19e8U0ELRkLS1cWk4yMfI=; b=NJyVmIGSrIhgHHCzQxE49bwu7SaZhJRD/YflPWiFBYklXdq1Td6Y5rXmrYliw12A5G NYmbLk6mPKUhHwqkCQU81S+2sNMIuQzBR6rwXVUGWL8sk8OYa5euKb1KgDi9J3hxI9lr ikCCezUs5wyxHdtsDkap0siqwydrtQwTw0OxB4QSYRPToIM6SoGYwkEuGOBCRqznUoEU NY3/0FsGknGcK47bo94QH+vroHYs4lOAIxPC6Dep/IQ9A2Y655DHCY8tMJo9ofMIf8QK eHvQVCfvnKd5S+9oyiTsrSrM+B1y2Wz0BVFjWMW8ScHFr9G7V42O4RDZqlRewMWiqr3/ vwtg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=SRVbuXaKRfoYoKm/TJIpDz19e8U0ELRkLS1cWk4yMfI=; b=NqJKhygoV+v6K5Le8DqqK3jVTo9rwTDLFOz6/7v6ZGLCnMPzJTsZdlCJktCOd01oUJ 6Eu7Q2NTAzLSyevWNXTD1tBPW85IODP9CGtean/JPEIMFfB/ds/7HPwJkLIDU6X6f6Cm ryhzlymq4M9Rntzgl8H9ryFuyxyXkjxmR0SqN5QsaqrkyUV210GUJvUAddDisnjrpZoP b5fk8pAtk7ve+psbQzSzoRNzaRGO/zHThASEmRdLjABa2AN4tZf0Ob6IdgJPNm75R6cI eGbGBBnm0D5PhcV9v/hzPCFW0RajO2dy16Q9bKfGQk2J21GzGqYrYKkKmvYp7L0LHmu7 cfcw== X-Gm-Message-State: AN3rC/7wbCHlesY4xnMIsBrsD+SHZlallT52mY0EVe0BQJvjDy7UcdVD 7JyPFHj6toxhZHwff4hxhtNd/h8jZdP5HZ0= X-Received: by 10.36.185.85 with SMTP id k21mr22999iti.7.1493323683569; Thu, 27 Apr 2017 13:08:03 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.30.136 with HTTP; Thu, 27 Apr 2017 13:07:43 -0700 (PDT) In-Reply-To: <201703152120.v2FLKHUs052999@repo.freebsd.org> References: <201703152120.v2FLKHUs052999@repo.freebsd.org> From: Ed Maste Date: Thu, 27 Apr 2017 16:07:43 -0400 X-Google-Sender-Auth: dLb6UozH2WeTmuljXIp_LROs2pk Message-ID: Subject: Re: svn commit: r315333 - in stable/10/sys: conf dev/ixgbe modules/ix modules/ixv To: Eric Joyner Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 20:08:04 -0000 On 15 March 2017 at 17:20, Eric Joyner wrote: > Author: erj > Date: Wed Mar 15 21:20:17 2017 > New Revision: 315333 > URL: https://svnweb.freebsd.org/changeset/base/315333 > > Log: > ixgbe(4): Update to 3.2.11-k This broke tinderbox on many architectures: ia64 GENERIC and powerpc GENERIC64: /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_osdep.c:39: warning: no previous prototype for 'ixv_read_pci_cfg' [-Wmissing-prototypes] /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_osdep.c:45: warning: no previous prototype for 'ixv_write_pci_cfg' [-Wmissing-prototypes] sparc64 LINT: /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ix_txrx.c:43: warning: redundant redeclaration of 'ix_crcstrip' [-Wredundant-decls] /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixgbe_netmap.h:45: warning: previous declaration of 'ix_crcstrip' was here amd64 LINT: /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_netmap.c:(.text+0x0): multiple definition of `ixgbe_netmap_attach' ixgbe_netmap.o:/scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixgbe_netmap.c:(.text+0x0): first defined here From owner-svn-src-stable-10@freebsd.org Thu Apr 27 20:52:37 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 076DBD53049; Thu, 27 Apr 2017 20:52:37 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x243.google.com (mail-it0-x243.google.com [IPv6:2607:f8b0:4001:c0b::243]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C47F21202; Thu, 27 Apr 2017 20:52:36 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x243.google.com with SMTP id c26so3643232itd.1; Thu, 27 Apr 2017 13:52:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=Z8DOuwKJZX7MZrXT0pTn2f9vpWLAUageCTF0NmLQLyg=; b=G04YfYQG1ik3idJ7yv+ddt8GXNsUnY61zrbD7I4yLGN2jtluntzWyggjuPj+tU7MJS b4RLVdlpx70ewYhOUZFlnEsCn48Y26I14/fIiKzYNkWsnlKIBB15v5w09FJuUf9L6KNo 0nqBzz5Z3scaPpcy5GwG9Ga1bOS5wnDB3NS+pnPWjKNLu7ha2mqdRBb/kiD+34xz2T6c MrzKKCs4Aw1pJwuo11KP5DXrwgdnic80Se8oqQtt1vznDEynXcd3RWPQdzucLYpxRo2D PKdmrfUEFYh6bGkV4RvyYVgEspn/MjrXq/IPVXkYoMj8QSw0kAAfjMZ+kzhRAGfXc100 6Z5w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=Z8DOuwKJZX7MZrXT0pTn2f9vpWLAUageCTF0NmLQLyg=; b=Vl88D0bc9wWsOIqWT5iPEKp0lVTP9vIgDCmr+69TEuT6ddXF953ExiwkyWV1Uae8nj UDBwfQ/NUkSuiTjuBlIlP2+VetCkx32YqNyNmY9Ag8AafmKkQCz+q4XNShePypwERTD2 WcJqEfBXbDSXDjJ08a9ahr3kGzzjIl2PrBekuYKsDWD5Mo+xhF+/78nlOBJI+G1KXxkd YpaplgwGil5H+ym2oGFrjeU27U0yPiCRpN790N8k0rJEkufCS4qUvvLm7VuDY5ywb7LX UCeKNaigXU+Z9JLyn0D4aP+kEDiubk9Yzcm32nS08I+DAuoY2sKI89iq8hkMTrVclN7v DZfw== X-Gm-Message-State: AN3rC/6GkmAf8HpdQFekkJwx2F/CsqDIwjoRbexVP7orOFyWyf8LzS6E E0APx4A+3jQkSTY0Rb6F+8ff98CCwrPhLq0= X-Received: by 10.36.117.5 with SMTP id y5mr437122itc.19.1493326356020; Thu, 27 Apr 2017 13:52:36 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.30.136 with HTTP; Thu, 27 Apr 2017 13:52:15 -0700 (PDT) In-Reply-To: <201703090247.v292l1Ws098712@repo.freebsd.org> References: <201703090247.v292l1Ws098712@repo.freebsd.org> From: Ed Maste Date: Thu, 27 Apr 2017 16:52:15 -0400 X-Google-Sender-Auth: M_CmU8cpdTkTusT69vZXcSMPt3w Message-ID: Subject: Re: svn commit: r314937 - in stable/10/sys: fs/ext2fs modules/ext2fs To: "Pedro F. Giffuni" Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 20:52:37 -0000 On 8 March 2017 at 21:47, Pedro F. Giffuni wrote: > Author: pfg > Date: Thu Mar 9 02:47:01 2017 > New Revision: 314937 > URL: https://svnweb.freebsd.org/changeset/base/314937 > > Log: > Revert 294545: > Bringing back ext4: add support for reading sparse files Tinderbox is broken on GCC architectures, e.g. from powerpc.LINT64: In file included from /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/inode.h:46, from /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_alloc.c:50: /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_extents.h:91: warning: declaration does not declare anything From owner-svn-src-stable-10@freebsd.org Thu Apr 27 21:27:22 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15190D53EA3; Thu, 27 Apr 2017 21:27:22 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D9FA010C5; Thu, 27 Apr 2017 21:27:21 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3RLRK1S074592; Thu, 27 Apr 2017 21:27:20 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3RLRKBl074591; Thu, 27 Apr 2017 21:27:20 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704272127.v3RLRKBl074591@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 27 Apr 2017 21:27:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317524 - stable/10/sys/fs/nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 21:27:22 -0000 Author: rmacklem Date: Thu Apr 27 21:27:20 2017 New Revision: 317524 URL: https://svnweb.freebsd.org/changeset/base/317524 Log: MFC: r316782 Add call to svcpool_close() for the NFSv4 callback pool (svcpool_nfscbd). A function called svcpool_close() was added to the server side krpc by r313735, so that a pool could be closed without destroying the data structures. This little patch adds a call to it for the callback pool (svcpool_nfscbd), so that the nfscbd daemon can be killed/restarted and continue to work correctly. Modified: stable/10/sys/fs/nfsclient/nfs_clkrpc.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfsclient/nfs_clkrpc.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clkrpc.c Thu Apr 27 21:24:50 2017 (r317523) +++ stable/10/sys/fs/nfsclient/nfs_clkrpc.c Thu Apr 27 21:27:20 2017 (r317524) @@ -278,6 +278,11 @@ nfsrvd_cbinit(int terminating) while (nfs_numnfscbd > 0) msleep(&nfs_numnfscbd, NFSDLOCKMUTEXPTR, PZERO, "nfscbdt", 0); + if (nfscbd_pool != NULL) { + NFSD_UNLOCK(); + svcpool_close(nfscbd_pool); + NFSD_LOCK(); + } } if (nfscbd_pool == NULL) { From owner-svn-src-stable-10@freebsd.org Thu Apr 27 21:37:41 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38AFFD53348; Thu, 27 Apr 2017 21:37:41 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 07AF21CFE; Thu, 27 Apr 2017 21:37:40 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3RLbebF079651; Thu, 27 Apr 2017 21:37:40 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3RLbdSC079644; Thu, 27 Apr 2017 21:37:39 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704272137.v3RLbdSC079644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 27 Apr 2017 21:37:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317525 - in stable/10/sys: fs/nfs fs/nfsclient nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 21:37:41 -0000 Author: rmacklem Date: Thu Apr 27 21:37:39 2017 New Revision: 317525 URL: https://svnweb.freebsd.org/changeset/base/317525 Log: MFC: r316792 Add an NFSv4.1 mount option for "use one openowner". Some NFSv4.1 servers such as AmazonEFS can only support a small fixed number of open_owner4s. This patch adds a mount option called "oneopenown" that can be used for NFSv4.1 mounts to make the client do all Opens with the same open_owner4 string. This option can only be used with NFSv4.1 and may not work correctly when Delegations are is use. Differential Revision: https://reviews.freebsd.org/D8988 Modified: stable/10/sys/fs/nfs/nfs_var.h stable/10/sys/fs/nfs/nfsport.h stable/10/sys/fs/nfsclient/nfs_clport.c stable/10/sys/fs/nfsclient/nfs_clrpcops.c stable/10/sys/fs/nfsclient/nfs_clstate.c stable/10/sys/fs/nfsclient/nfs_clvfsops.c stable/10/sys/nfsclient/nfsargs.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/10/sys/fs/nfs/nfs_var.h Thu Apr 27 21:27:20 2017 (r317524) +++ stable/10/sys/fs/nfs/nfs_var.h Thu Apr 27 21:37:39 2017 (r317525) @@ -502,8 +502,8 @@ int nfscl_open(vnode_t, u_int8_t *, int, int *, int *, int); int nfscl_getstateid(vnode_t, u_int8_t *, int, u_int32_t, int, struct ucred *, NFSPROC_T *, nfsv4stateid_t *, void **); -void nfscl_ownerrelease(struct nfsclowner *, int, int, int); -void nfscl_openrelease(struct nfsclopen *, int, int); +void nfscl_ownerrelease(struct nfsmount *, struct nfsclowner *, int, int, int); +void nfscl_openrelease(struct nfsmount *, struct nfsclopen *, int, int); int nfscl_getcl(struct mount *, struct ucred *, NFSPROC_T *, int, struct nfsclclient **); struct nfsclclient *nfscl_findcl(struct nfsmount *); Modified: stable/10/sys/fs/nfs/nfsport.h ============================================================================== --- stable/10/sys/fs/nfs/nfsport.h Thu Apr 27 21:27:20 2017 (r317524) +++ stable/10/sys/fs/nfs/nfsport.h Thu Apr 27 21:37:39 2017 (r317525) @@ -862,6 +862,8 @@ int newnfs_realign(struct mbuf **, int); #define NFSHASNOLAYOUTCOMMIT(n) ((n)->nm_state & NFSSTA_NOLAYOUTCOMMIT) #define NFSHASSESSPERSIST(n) ((n)->nm_state & NFSSTA_SESSPERSIST) #define NFSHASPNFS(n) ((n)->nm_state & NFSSTA_PNFS) +#define NFSHASONEOPENOWN(n) (((n)->nm_flag & NFSMNT_ONEOPENOWN) != 0 && \ + (n)->nm_minorvers > 0) /* * Gets the stats field out of the mount structure. Modified: stable/10/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clport.c Thu Apr 27 21:27:20 2017 (r317524) +++ stable/10/sys/fs/nfsclient/nfs_clport.c Thu Apr 27 21:37:39 2017 (r317525) @@ -557,7 +557,7 @@ nfscl_filllockowner(void *id, u_int8_t * struct proc *p; if (id == NULL) { - printf("NULL id\n"); + /* Return the single open_owner of all 0 bytes. */ bzero(cp, NFSV4CL_LOCKNAMELEN); return; } @@ -1184,7 +1184,14 @@ nfscl_procdoesntexist(u_int8_t *own) } tl; struct proc *p; pid_t pid; - int ret = 0; + int i, ret = 0; + + /* For the single open_owner of all 0 bytes, just return 0. */ + for (i = 0; i < NFSV4CL_LOCKNAMELEN; i++) + if (own[i] != 0) + break; + if (i == NFSV4CL_LOCKNAMELEN) + return (0); tl.cval[0] = *own++; tl.cval[1] = *own++; Modified: stable/10/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clrpcops.c Thu Apr 27 21:27:20 2017 (r317524) +++ stable/10/sys/fs/nfsclient/nfs_clrpcops.c Thu Apr 27 21:37:39 2017 (r317525) @@ -347,7 +347,7 @@ else printf(" fhl=0\n"); */ if (!error) op->nfso_opencnt++; - nfscl_openrelease(op, error, newone); + nfscl_openrelease(nmp, op, error, newone); if (error == NFSERR_GRACE || error == NFSERR_STALECLIENTID || error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY || error == NFSERR_BADSESSION) { @@ -1890,7 +1890,7 @@ nfsrpc_create(vnode_t dvp, char *name, i if (dp != NULL) (void) nfscl_deleg(nmp->nm_mountp, owp->nfsow_clp, (*nfhpp)->nfh_fh, (*nfhpp)->nfh_len, cred, p, &dp); - nfscl_ownerrelease(owp, error, newone, unlocked); + nfscl_ownerrelease(nmp, owp, error, newone, unlocked); if (error == NFSERR_GRACE || error == NFSERR_STALECLIENTID || error == NFSERR_STALEDONTRECOVER || error == NFSERR_DELAY || error == NFSERR_BADSESSION) { @@ -2195,7 +2195,7 @@ nfsrpc_createv4(vnode_t dvp, char *name, error = ret; } } - nfscl_openrelease(op, error, newone); + nfscl_openrelease(nmp, op, error, newone); *unlockedp = 1; } if (nd->nd_repstat != 0 && error == 0) Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clstate.c Thu Apr 27 21:27:20 2017 (r317524) +++ stable/10/sys/fs/nfsclient/nfs_clstate.c Thu Apr 27 21:37:39 2017 (r317525) @@ -247,7 +247,6 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i * If none found, add the new one or return error, depending upon * "create". */ - nfscl_filllockowner(p->td_proc, own, F_POSIX); NFSLOCKCLSTATE(); dp = NULL; /* First check the delegation list */ @@ -264,10 +263,17 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i } } - if (dp != NULL) + if (dp != NULL) { + nfscl_filllockowner(p->td_proc, own, F_POSIX); ohp = &dp->nfsdl_owner; - else + } else { + /* For NFSv4.1 and this option, use a single open_owner. */ + if (NFSHASONEOPENOWN(VFSTONFS(vnode_mount(vp)))) + nfscl_filllockowner(NULL, own, F_POSIX); + else + nfscl_filllockowner(p->td_proc, own, F_POSIX); ohp = &clp->nfsc_owner; + } /* Now, search for an openowner */ LIST_FOREACH(owp, ohp, nfsow_list) { if (!NFSBCMP(owp->nfsow_owner, own, NFSV4CL_LOCKNAMELEN)) @@ -300,9 +306,24 @@ nfscl_open(vnode_t vp, u_int8_t *nfhp, i /* * Serialize modifications to the open owner for multiple threads * within the same process using a read/write sleep lock. + * For NFSv4.1 and a single OpenOwner, allow concurrent open operations + * by acquiring a shared lock. The close operations still use an + * exclusive lock for this case. */ - if (lockit) - nfscl_lockexcl(&owp->nfsow_rwlock, NFSCLSTATEMUTEXPTR); + if (lockit != 0) { + if (NFSHASONEOPENOWN(VFSTONFS(vnode_mount(vp)))) { + /* + * Get a shared lock on the OpenOwner, but first + * wait for any pending exclusive lock, so that the + * exclusive locker gets priority. + */ + nfsv4_lock(&owp->nfsow_rwlock, 0, NULL, + NFSCLSTATEMUTEXPTR, NULL); + nfsv4_getref(&owp->nfsow_rwlock, NULL, + NFSCLSTATEMUTEXPTR, NULL); + } else + nfscl_lockexcl(&owp->nfsow_rwlock, NFSCLSTATEMUTEXPTR); + } NFSUNLOCKCLSTATE(); if (nowp != NULL) FREE((caddr_t)nowp, M_NFSCLOWNER); @@ -545,7 +566,10 @@ nfscl_getstateid(vnode_t vp, u_int8_t *n * If p != NULL, we want to search the parentage tree * for a matching OpenOwner and use that. */ - nfscl_filllockowner(p->td_proc, own, F_POSIX); + if (NFSHASONEOPENOWN(VFSTONFS(vnode_mount(vp)))) + nfscl_filllockowner(NULL, own, F_POSIX); + else + nfscl_filllockowner(p->td_proc, own, F_POSIX); lp = NULL; error = nfscl_getopen(&clp->nfsc_owner, nfhp, fhlen, own, own, mode, &lp, &op); @@ -679,15 +703,19 @@ nfscl_getopen(struct nfsclownerhead *ohp * with the open owner. */ APPLESTATIC void -nfscl_ownerrelease(struct nfsclowner *owp, __unused int error, - __unused int candelete, int unlocked) +nfscl_ownerrelease(struct nfsmount *nmp, struct nfsclowner *owp, + __unused int error, __unused int candelete, int unlocked) { if (owp == NULL) return; NFSLOCKCLSTATE(); - if (!unlocked) - nfscl_lockunlock(&owp->nfsow_rwlock); + if (unlocked == 0) { + if (NFSHASONEOPENOWN(nmp)) + nfsv4_relref(&owp->nfsow_rwlock); + else + nfscl_lockunlock(&owp->nfsow_rwlock); + } nfscl_clrelease(owp->nfsow_clp); NFSUNLOCKCLSTATE(); } @@ -696,7 +724,8 @@ nfscl_ownerrelease(struct nfsclowner *ow * Release use of an open structure under an open owner. */ APPLESTATIC void -nfscl_openrelease(struct nfsclopen *op, int error, int candelete) +nfscl_openrelease(struct nfsmount *nmp, struct nfsclopen *op, int error, + int candelete) { struct nfsclclient *clp; struct nfsclowner *owp; @@ -705,7 +734,10 @@ nfscl_openrelease(struct nfsclopen *op, return; NFSLOCKCLSTATE(); owp = op->nfso_own; - nfscl_lockunlock(&owp->nfsow_rwlock); + if (NFSHASONEOPENOWN(nmp)) + nfsv4_relref(&owp->nfsow_rwlock); + else + nfscl_lockunlock(&owp->nfsow_rwlock); clp = owp->nfsow_clp; if (error && candelete && op->nfso_opencnt == 0) nfscl_freeopen(op, 0); @@ -997,7 +1029,10 @@ nfscl_getbytelock(vnode_t vp, u_int64_t } else { nfscl_filllockowner(id, own, flags); ownp = own; - nfscl_filllockowner(p->td_proc, openown, F_POSIX); + if (NFSHASONEOPENOWN(VFSTONFS(vnode_mount(vp)))) + nfscl_filllockowner(NULL, openown, F_POSIX); + else + nfscl_filllockowner(p->td_proc, openown, F_POSIX); openownp = openown; } if (!recovery) { @@ -1725,6 +1760,7 @@ nfscl_cleanupkext(struct nfsclclient *cl struct nfsclowner *owp, *nowp; struct nfsclopen *op; struct nfscllockowner *lp, *nlp; + struct nfscldeleg *dp; NFSPROCLISTLOCK(); NFSLOCKCLSTATE(); @@ -1738,6 +1774,20 @@ nfscl_cleanupkext(struct nfsclclient *cl if (nfscl_procdoesntexist(owp->nfsow_owner)) nfscl_cleanup_common(clp, owp->nfsow_owner); } + + /* + * For the single open_owner case, these lock owners need to be + * checked to see if they still exist separately. + * This is because nfscl_procdoesntexist() never returns true for + * the single open_owner so that the above doesn't ever call + * nfscl_cleanup_common(). + */ + TAILQ_FOREACH(dp, &clp->nfsc_deleg, nfsdl_list) { + LIST_FOREACH_SAFE(lp, &dp->nfsdl_lock, nfsl_list, nlp) { + if (nfscl_procdoesntexist(lp->nfsl_owner)) + nfscl_cleanup_common(clp, lp->nfsl_owner); + } + } NFSUNLOCKCLSTATE(); NFSPROCLISTUNLOCK(); } Modified: stable/10/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clvfsops.c Thu Apr 27 21:27:20 2017 (r317524) +++ stable/10/sys/fs/nfsclient/nfs_clvfsops.c Thu Apr 27 21:37:39 2017 (r317525) @@ -596,6 +596,12 @@ nfs_decode_args(struct mount *mp, struct nmp->nm_flag &= ~NFSMNT_RDIRPLUS; } + /* Clear ONEOPENOWN for NFSv2, 3 and 4.0. */ + if (nmp->nm_minorvers == 0) { + argp->flags &= ~NFSMNT_ONEOPENOWN; + nmp->nm_flag &= ~NFSMNT_ONEOPENOWN; + } + /* Re-bind if rsrvd port requested and wasn't on one */ adjsock = !(nmp->nm_flag & NFSMNT_RESVPORT) && (argp->flags & NFSMNT_RESVPORT); @@ -732,7 +738,7 @@ static const char *nfs_opts[] = { "from" "resvport", "readahead", "hostname", "timeo", "timeout", "addr", "fh", "nfsv3", "sec", "principal", "nfsv4", "gssname", "allgssname", "dirpath", "minorversion", "nametimeo", "negnametimeo", "nocto", "noncontigwr", - "pnfs", "wcommitsize", + "pnfs", "wcommitsize", "oneopenown", NULL }; /* @@ -863,6 +869,8 @@ nfs_mount(struct mount *mp) args.flags |= NFSMNT_NONCONTIGWR; if (vfs_getopt(mp->mnt_optnew, "pnfs", NULL, NULL) == 0) args.flags |= NFSMNT_PNFS; + if (vfs_getopt(mp->mnt_optnew, "oneopenown", NULL, NULL) == 0) + args.flags |= NFSMNT_ONEOPENOWN; if (vfs_getopt(mp->mnt_optnew, "readdirsize", (void **)&opt, NULL) == 0) { if (opt == NULL) { vfs_mount_error(mp, "illegal readdirsize"); @@ -1073,8 +1081,8 @@ nfs_mount(struct mount *mp) /* * When doing an update, we can't change version, - * security, switch lockd strategies or change cookie - * translation + * security, switch lockd strategies, change cookie + * translation or switch oneopenown. */ args.flags = (args.flags & ~(NFSMNT_NFSV3 | @@ -1082,6 +1090,7 @@ nfs_mount(struct mount *mp) NFSMNT_KERB | NFSMNT_INTEGRITY | NFSMNT_PRIVACY | + NFSMNT_ONEOPENOWN | NFSMNT_NOLOCKD /*|NFSMNT_XLATECOOKIE*/)) | (nmp->nm_flag & (NFSMNT_NFSV3 | @@ -1089,6 +1098,7 @@ nfs_mount(struct mount *mp) NFSMNT_KERB | NFSMNT_INTEGRITY | NFSMNT_PRIVACY | + NFSMNT_ONEOPENOWN | NFSMNT_NOLOCKD /*|NFSMNT_XLATECOOKIE*/)); nfs_decode_args(mp, nmp, &args, NULL, td->td_ucred, td); goto out; @@ -1830,6 +1840,8 @@ void nfscl_retopts(struct nfsmount *nmp, &blen); nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_PNFS) != 0, ",pnfs", &buf, &blen); + nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_ONEOPENOWN) != 0 && + nmp->nm_minorvers > 0, ",oneopenown", &buf, &blen); } nfscl_printopt(nmp, (nmp->nm_flag & NFSMNT_NFSV3) != 0, "nfsv3", &buf, &blen); Modified: stable/10/sys/nfsclient/nfsargs.h ============================================================================== --- stable/10/sys/nfsclient/nfsargs.h Thu Apr 27 21:27:20 2017 (r317524) +++ stable/10/sys/nfsclient/nfsargs.h Thu Apr 27 21:37:39 2017 (r317525) @@ -76,7 +76,7 @@ struct nfs_args { #define NFSMNT_MAXGRPS 0x00000020 /* set maximum grouplist size */ #define NFSMNT_INT 0x00000040 /* allow interrupts on hard mount */ #define NFSMNT_NOCONN 0x00000080 /* Don't Connect the socket */ -/* 0x100 free, was NFSMNT_NQNFS */ +#define NFSMNT_ONEOPENOWN 0x00000100 /* Use one OpenOwner for NFSv4.1 */ #define NFSMNT_NFSV3 0x00000200 /* Use NFS Version 3 protocol */ #define NFSMNT_KERB 0x00000400 /* Use RPCSEC_GSS/Krb5 */ #define NFSMNT_DUMBTIMR 0x00000800 /* Don't estimate rtt dynamically */ From owner-svn-src-stable-10@freebsd.org Thu Apr 27 21:45:52 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3CD60D53884; Thu, 27 Apr 2017 21:45:52 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 0BB86A46; Thu, 27 Apr 2017 21:45:51 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3RLjpmg084195; Thu, 27 Apr 2017 21:45:51 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3RLjpZr084194; Thu, 27 Apr 2017 21:45:51 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704272145.v3RLjpZr084194@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Thu, 27 Apr 2017 21:45:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317526 - stable/10/sbin/mount_nfs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 21:45:52 -0000 Author: rmacklem Date: Thu Apr 27 21:45:50 2017 New Revision: 317526 URL: https://svnweb.freebsd.org/changeset/base/317526 Log: MFC: r316793 Document the "oneopenown" option added by r316792. This is a content change. Modified: stable/10/sbin/mount_nfs/mount_nfs.8 Directory Properties: stable/10/ (props changed) Modified: stable/10/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- stable/10/sbin/mount_nfs/mount_nfs.8 Thu Apr 27 21:37:39 2017 (r317525) +++ stable/10/sbin/mount_nfs/mount_nfs.8 Thu Apr 27 21:45:50 2017 (r317526) @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd October 30, 2014 +.Dd April 13, 2017 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -207,6 +207,14 @@ The only minor version currently support This option is only meaningful when used with the .Cm nfsv4 option. +.It Cm oneopenown +Make a minor version 1 of the NFS Version 4 protocol mount use a single OpenOwner +for all Opens. +This may be useful for a server with a very low limit on OpenOwners, such as +AmazonEFS. +It can only be used with an NFSv4.1 mount. +It may not work correctly when Delegations are being issued by a server, +but note that the AmazonEFS server does not issued delegations at this time. .It Cm pnfs Enable support for parallel NFS (pNFS) for minor version 1 of the NFS Version 4 protocol. From owner-svn-src-stable-10@freebsd.org Thu Apr 27 22:00:58 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C80FD53E36; Thu, 27 Apr 2017 22:00:58 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qk0-x230.google.com (mail-qk0-x230.google.com [IPv6:2607:f8b0:400d:c09::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CB1DC13A9; Thu, 27 Apr 2017 22:00:57 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qk0-x230.google.com with SMTP id u75so39320632qka.3; Thu, 27 Apr 2017 15:00:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=tTTi5QWEoDXuX7IPsl6TQHlr8lN6kuSAGGm8+oUuBeE=; b=L2c4kffnNH5rBusyutEXAySfvDUtj5wLq70P8u6B8WZTvOJ7wYapVprlt4zXwjOnfM CLvC9yb/jk5WdHYnaoYCwVN5j39MyKyn5qh44fokn+gd/lznaYTaoinqltowBI1CcnHQ 1HbCkf8TGbR2Qjy+UsFspqsnYlKoXDVP/MDKdn+8Kxyi0KUkLgEA3VX21Ax6kzLb1amm n5IGe716XTcm8ukFERg7JKXek1hw26MSQ/QVhNnqx2ww92EZD5/D8II5QzkeMVgV96wb edYlcLfs0HLwh+gmZ6YN+PQMQoexY+PWPUVePOaHyRCVPdps8bLr0blaFouT39tM/cbS /kzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=tTTi5QWEoDXuX7IPsl6TQHlr8lN6kuSAGGm8+oUuBeE=; b=ql/5/r9t8puSfddr9Cm+P79Ok+kfBvtvhm2mLuvQFOf8Voq5fBhtb4dlxP5Rw+miKk CQh7rYZBRwikkqH4pAA2pkbyFGrdlwQu8mf6ISMmJ6tJ6ee3Nxhx7Qf/K86Fy+Gl9RkB B+2clOJS9VG/+BaUlq9SmkEEbrXafGvuv8wTqZvYXTKq9im06LO/wgMFfKGNWXYHkp+e GL/h8Xlil9mWy1Ay+ph5qUYoI5Ezs3XWSvEgUeAGZpSX5Lo8axSRPfdiPnhQiPeG7Dm1 biduqY7L8nsT3nUNxY1nTcZb7wZH1EZNPI7+q5CpdtnlRhWMLo18NwNlkPdPx/gCXLJV H5Sg== X-Gm-Message-State: AN3rC/72oGjDbICq6t8AVie1/TERLhOAAZRgvZyjYdBiBe2Bm6TtaGTm EBdHzp/fQTqrMD9CmNY8+og1Z5RNKesK X-Received: by 10.55.78.18 with SMTP id c18mr7640832qkb.297.1493330456763; Thu, 27 Apr 2017 15:00:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.93.83 with HTTP; Thu, 27 Apr 2017 15:00:56 -0700 (PDT) In-Reply-To: References: <201703090247.v292l1Ws098712@repo.freebsd.org> From: Ngie Cooper Date: Thu, 27 Apr 2017 15:00:56 -0700 Message-ID: Subject: Re: svn commit: r314937 - in stable/10/sys: fs/ext2fs modules/ext2fs To: Ed Maste Cc: "Pedro F. Giffuni" , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-stable-10@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 22:00:58 -0000 On Thu, Apr 27, 2017 at 1:52 PM, Ed Maste wrote: > On 8 March 2017 at 21:47, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Thu Mar 9 02:47:01 2017 >> New Revision: 314937 >> URL: https://svnweb.freebsd.org/changeset/base/314937 >> >> Log: >> Revert 294545: >> Bringing back ext4: add support for reading sparse files > > Tinderbox is broken on GCC architectures, e.g. from powerpc.LINT64: > > In file included from /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/inode.h:46, > from /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_alloc.c:50: > /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_extents.h:91: warning: > declaration does not declare anything ... because of anonymous unions not being supported in gcc 4.2.1. HTH, -Ngie From owner-svn-src-stable-10@freebsd.org Thu Apr 27 22:06:38 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EC957D53114; Thu, 27 Apr 2017 22:06:38 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-qt0-x22b.google.com (mail-qt0-x22b.google.com [IPv6:2607:f8b0:400d:c0d::22b]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A75A51A53; Thu, 27 Apr 2017 22:06:38 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-qt0-x22b.google.com with SMTP id m36so37668135qtb.0; Thu, 27 Apr 2017 15:06:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=TWpdiqERwKHvFJ9XHMXwljpt520lWaE7RKfiLvZ7NeY=; b=cRsMas35dubBerY6tp/lXh1xEALL+4sG8pVtMk7R05zJ5fLUm6XGCC0tXTTF+HtxY5 g9r7d/nzeGm8J3wNrXliklSopubpQwgTImCY1uHhYuGOWqNwP8Abj3YXxS0Ljb0WTURr hGXnZL6uOiFFVYqXs56/zViFjKkMm+03Y/7l8xLJT3BK/YY42ob70sOv1gQ6MCE9UIX7 9A5HXzzaTkwebjl3feBC00pToGul6NN+EpdRgsHHmhE7JFSGvrivfTyPu1es6tZqbFTW 4j2JlQXbO9dcH9ekxtOnxdn2Cu1yqrQBrSlJ7oRcFbPf05GeSwbBJnEkQkXoo30UWvJl n+jg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=TWpdiqERwKHvFJ9XHMXwljpt520lWaE7RKfiLvZ7NeY=; b=V9mQoDo1VMQqKsxigREU+F5ezNctYJVM7p36O/zU8QimP6bDwxeZwYk1+ILK4fJJX0 7sFHQpyHkdFVg4RXUO0TqXhAUsr8gU1CFajr4C+K88IIITwvDHVkPQiXgvNnwZEaJSCw lDsahqPrO7TSQhpRy1FpfJqAQG6nN4Yuk7KdfBbiLPdYrOIQhhRrEeEqSKVsMLigryp0 ChZ4NfDPDLP/OkXEQFYTz0ftZyn2PyZwY07lGK4xIKAPvGD9bfYRqiyT69o+uKjlZmqy E1otJ9jX36cN2UB5DVc5tg8cVrxnykPwrCH9WLf1FW6PIAPyYXl7V7TKUjUEgLgibpmd Y1nw== X-Gm-Message-State: AN3rC/6YyM7r8LvstbBfoTlW8JUJUX+Co9XhCVDa9ChjNeAyJ4BTYQo6 qInsI8cHOQU+bYSjDL082hB7ZMp0IEDP X-Received: by 10.200.50.48 with SMTP id x45mr7566714qta.246.1493330797626; Thu, 27 Apr 2017 15:06:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.93.83 with HTTP; Thu, 27 Apr 2017 15:06:37 -0700 (PDT) In-Reply-To: References: <201703152120.v2FLKHUs052999@repo.freebsd.org> From: Ngie Cooper Date: Thu, 27 Apr 2017 15:06:37 -0700 Message-ID: Subject: Re: svn commit: r315333 - in stable/10/sys: conf dev/ixgbe modules/ix modules/ixv To: Ed Maste Cc: Eric Joyner , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-stable-10@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 22:06:39 -0000 On Thu, Apr 27, 2017 at 1:07 PM, Ed Maste wrote: > On 15 March 2017 at 17:20, Eric Joyner wrote: >> Author: erj >> Date: Wed Mar 15 21:20:17 2017 >> New Revision: 315333 >> URL: https://svnweb.freebsd.org/changeset/base/315333 >> >> Log: >> ixgbe(4): Update to 3.2.11-k > > This broke tinderbox on many architectures: > > ia64 GENERIC and powerpc GENERIC64: > > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_osdep.c:39: warning: no > previous prototype for 'ixv_read_pci_cfg' [-Wmissing-prototypes] > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_osdep.c:45: warning: no > previous prototype for 'ixv_write_pci_cfg' [-Wmissing-prototypes] > > sparc64 LINT: > > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ix_txrx.c:43: warning: > redundant redeclaration of 'ix_crcstrip' [-Wredundant-decls] > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixgbe_netmap.h:45: warning: > previous declaration of 'ix_crcstrip' was here > > amd64 LINT: > > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_netmap.c:(.text+0x0): > multiple definition of `ixgbe_netmap_attach' > ixgbe_netmap.o:/scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixgbe_netmap.c:(.text+0x0): > first defined here Hi Ed, It has to do with netmap(4) refactoring on head not being backported, in combination with ixgbe/ix being MFCed in a refactored state back to ^/stable/10 (it wasn't easy to backport due to PCI-IOV only being on ^/stable/10 -- I tried starting this work and failed because I lacked the hardware to test this out with). This has been known to be broken for almost two months -- a surgical fix should probably be applied to do what's required to make the symbol appear in the appropriate places, since this basically was a direct commit to ^/stable/10 in some regards. Thanks, -Ngie From owner-svn-src-stable-10@freebsd.org Thu Apr 27 22:10:37 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75950D531D7; Thu, 27 Apr 2017 22:10:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 5BAAE1BFA; Thu, 27 Apr 2017 22:10:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id v3RMAUcQ068266 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 27 Apr 2017 15:10:30 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id v3RMAUbr068265; Thu, 27 Apr 2017 15:10:30 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Thu, 27 Apr 2017 15:10:30 -0700 From: Gleb Smirnoff To: Ngie Cooper Cc: Ed Maste , "Pedro F. Giffuni" , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-stable-10@freebsd.org" Subject: Re: svn commit: r314937 - in stable/10/sys: fs/ext2fs modules/ext2fs Message-ID: <20170427221030.GL56922@FreeBSD.org> References: <201703090247.v292l1Ws098712@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.8.0 (2017-02-23) X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 22:10:37 -0000 On Thu, Apr 27, 2017 at 03:00:56PM -0700, Ngie Cooper wrote: N> On Thu, Apr 27, 2017 at 1:52 PM, Ed Maste wrote: N> > On 8 March 2017 at 21:47, Pedro F. Giffuni wrote: N> >> Author: pfg N> >> Date: Thu Mar 9 02:47:01 2017 N> >> New Revision: 314937 N> >> URL: https://svnweb.freebsd.org/changeset/base/314937 N> >> N> >> Log: N> >> Revert 294545: N> >> Bringing back ext4: add support for reading sparse files N> > N> > Tinderbox is broken on GCC architectures, e.g. from powerpc.LINT64: N> > N> > In file included from /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/inode.h:46, N> > from /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_alloc.c:50: N> > /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_extents.h:91: warning: N> > declaration does not declare anything N> N> ... because of anonymous unions not being supported in gcc 4.2.1. The whole kernel is built with option that enables them on 4.2.1. CFLAGS.gcc+= -fms-extensions -- Totus tuus, Glebius. From owner-svn-src-stable-10@freebsd.org Thu Apr 27 22:11:51 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 379FDD5340D; Thu, 27 Apr 2017 22:11:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0041A1F39; Thu, 27 Apr 2017 22:11:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::1c6f:f3df:ce68:ae19] (unknown [IPv6:2001:470:7a58:0:1c6f:f3df:ce68:ae19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 9151C326EB; Fri, 28 Apr 2017 00:11:48 +0200 (CEST) From: Dimitry Andric Message-Id: Content-Type: multipart/signed; boundary="Apple-Mail=_324F7E5F-12B9-4A54-B4D4-775FCA4A4F06"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r314937 - in stable/10/sys: fs/ext2fs modules/ext2fs Date: Fri, 28 Apr 2017 00:11:36 +0200 In-Reply-To: Cc: Ed Maste , "Pedro F. Giffuni" , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-stable-10@freebsd.org" To: Ngie Cooper References: <201703090247.v292l1Ws098712@repo.freebsd.org> X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 22:11:51 -0000 --Apple-Mail=_324F7E5F-12B9-4A54-B4D4-775FCA4A4F06 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii On 28 Apr 2017, at 00:00, Ngie Cooper wrote: >=20 > On Thu, Apr 27, 2017 at 1:52 PM, Ed Maste wrote: >> On 8 March 2017 at 21:47, Pedro F. Giffuni wrote: >>> Author: pfg >>> Date: Thu Mar 9 02:47:01 2017 >>> New Revision: 314937 >>> URL: https://svnweb.freebsd.org/changeset/base/314937 >>>=20 >>> Log: >>> Revert 294545: >>> Bringing back ext4: add support for reading sparse files >>=20 >> Tinderbox is broken on GCC architectures, e.g. from powerpc.LINT64: >>=20 >> In file included from = /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/inode.h:46, >> from = /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_alloc.c:50: >> /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_extents.h:91: warning: >> declaration does not declare anything >=20 > ... because of anonymous unions not being supported in gcc 4.2.1. They are, if you use the aptly-named -fms-extensions flag. In r278913 this was enabled globally for gcc, see sys/conf/kern.pre.mk. Not sure what happened that it breaks now, though. -Dimitry --Apple-Mail=_324F7E5F-12B9-4A54-B4D4-775FCA4A4F06 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.0.30 iEYEARECAAYFAlkCbKMACgkQsF6jCi4glqPdEQCgy/LqZZNK11BxzjqPFu18v7cz 7icAniByIL9dpx+D5HVoPNMOXvqdQzpm =b4Dx -----END PGP SIGNATURE----- --Apple-Mail=_324F7E5F-12B9-4A54-B4D4-775FCA4A4F06-- From owner-svn-src-stable-10@freebsd.org Thu Apr 27 22:28:51 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8C4F8D5378D; Thu, 27 Apr 2017 22:28:51 +0000 (UTC) (envelope-from badger@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5B1A781D; Thu, 27 Apr 2017 22:28:51 +0000 (UTC) (envelope-from badger@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3RMSoqx000681; Thu, 27 Apr 2017 22:28:50 GMT (envelope-from badger@FreeBSD.org) Received: (from badger@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3RMSoIg000680; Thu, 27 Apr 2017 22:28:50 GMT (envelope-from badger@FreeBSD.org) Message-Id: <201704272228.v3RMSoIg000680@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: badger set sender to badger@FreeBSD.org using -f From: Eric Badger Date: Thu, 27 Apr 2017 22:28:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317529 - in stable: 10/sys/sys 11/sys/sys X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 22:28:51 -0000 Author: badger Date: Thu Apr 27 22:28:49 2017 New Revision: 317529 URL: https://svnweb.freebsd.org/changeset/base/317529 Log: Move td_sigqueue to the end of struct thread In order to preserve KBI in stable branches, replace the existing td_sigqueue slot with padding and move the expanded (as of r315949) td_sigqueue to the end of the struct. Reported by: jhb Suggested by: kib Reviewed by: jhb, kib, vangyzen Sponsored by: Dell EMC Differential Revision: https://reviews.freebsd.org/D10515 Modified: stable/10/sys/sys/proc.h Changes in other areas also in this revision: Modified: stable/11/sys/sys/proc.h Modified: stable/10/sys/sys/proc.h ============================================================================== --- stable/10/sys/sys/proc.h Thu Apr 27 22:03:08 2017 (r317528) +++ stable/10/sys/sys/proc.h Thu Apr 27 22:28:49 2017 (r317529) @@ -218,8 +218,8 @@ struct thread { struct rl_q_entry *td_rlqe; /* (k) Associated range lock entry. */ struct umtx_q *td_umtxq; /* (c?) Link for when we're blocked. */ lwpid_t td_tid; /* (b) Thread ID. */ - sigqueue_t td_sigqueue; /* (c) Sigs arrived, not delivered. */ -#define td_siglist td_sigqueue.sq_signals + uint64_t padding1[4]; + void *padding2[4]; u_char td_lend_user_pri; /* (t) Lend user pri. */ /* Cleared during fork1() */ @@ -326,6 +326,8 @@ struct thread { u_int td_dbg_sc_narg; /* (c) Syscall arg count to debugger.*/ void *td_emuldata; /* Emulator state data */ sbintime_t td_sleeptimo; /* (t) Sleep timeout. */ + sigqueue_t td_sigqueue; /* (c) Sigs arrived, not delivered. */ +#define td_siglist td_sigqueue.sq_signals }; struct mtx *thread_lock_block(struct thread *); From owner-svn-src-stable-10@freebsd.org Thu Apr 27 22:33:35 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C980D53A16; Thu, 27 Apr 2017 22:33:35 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail108.syd.optusnet.com.au (mail108.syd.optusnet.com.au [211.29.132.59]) by mx1.freebsd.org (Postfix) with ESMTP id DE966D61; Thu, 27 Apr 2017 22:33:33 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from besplex.bde.org (c122-106-153-191.carlnfd1.nsw.optusnet.com.au [122.106.153.191]) by mail108.syd.optusnet.com.au (Postfix) with ESMTPS id 54CAB1A3D9B; Fri, 28 Apr 2017 08:33:26 +1000 (AEST) Date: Fri, 28 Apr 2017 08:33:22 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Gleb Smirnoff cc: Ngie Cooper , Ed Maste , "Pedro F. Giffuni" , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-stable-10@freebsd.org" Subject: Re: svn commit: r314937 - in stable/10/sys: fs/ext2fs modules/ext2fs In-Reply-To: <20170427221030.GL56922@FreeBSD.org> Message-ID: <20170428081746.H4303@besplex.bde.org> References: <201703090247.v292l1Ws098712@repo.freebsd.org> <20170427221030.GL56922@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=VbSHBBh9 c=1 sm=1 tr=0 a=Tj3pCpwHnMupdyZSltBt7Q==:117 a=Tj3pCpwHnMupdyZSltBt7Q==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=aQXtb6P68bEKc4GWETgA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 22:33:35 -0000 On Thu, 27 Apr 2017, Gleb Smirnoff wrote: > On Thu, Apr 27, 2017 at 03:00:56PM -0700, Ngie Cooper wrote: > N> On Thu, Apr 27, 2017 at 1:52 PM, Ed Maste wrote: > N> > On 8 March 2017 at 21:47, Pedro F. Giffuni wrote: > N> >> Author: pfg > N> >> Date: Thu Mar 9 02:47:01 2017 > N> >> New Revision: 314937 > N> >> URL: https://svnweb.freebsd.org/changeset/base/314937 > N> >> > N> >> Log: > N> >> Revert 294545: > N> >> Bringing back ext4: add support for reading sparse files > N> > > N> > Tinderbox is broken on GCC architectures, e.g. from powerpc.LINT64: > N> > > N> > In file included from /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/inode.h:46, > N> > from /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_alloc.c:50: > N> > /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_extents.h:91: warning: > N> > declaration does not declare anything > N> > N> ... because of anonymous unions not being supported in gcc 4.2.1. Anonymous unions have been a standard gcc feature since nearly gcc-1. > The whole kernel is built with option that enables them on 4.2.1. > > CFLAGS.gcc+= -fms-extensions This is a bad way to enable standard gcc anonymous unions. It also enables ms extensions which also gives unused extensions of standard gcc anonymous, and other even more unwanted ms features. The correct way to enable gcc features is to compile with -std=gnu99. This has been done for a long time in userland, but the has been misconfigured to use -std=c99 for a long time. This is sort of backwards -- the kernel is inherently more unportable and can't possible be compiled by a C99 compiler, while parts of userland can. However, userland is larger, so people setting excessive -std flags soon found that -std=c99 doesn't work. With no -std flag, gcc defaults to something like -std=gnu89, so it supports its old anonymous unions feature but not the many C99 features needed to compile almost anything now. Bruce From owner-svn-src-stable-10@freebsd.org Thu Apr 27 23:10:35 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 990BFD5357E for ; Thu, 27 Apr 2017 23:10:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from nm15-vm0.bullet.mail.ne1.yahoo.com (nm15-vm0.bullet.mail.ne1.yahoo.com [98.138.91.70]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6A8A51EF1 for ; Thu, 27 Apr 2017 23:10:35 +0000 (UTC) (envelope-from pfg@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1493334965; bh=ddQZaJK8IKNYf0dR1bbqXa+MHAq/+62MPrXC5451NJI=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From:Subject; b=huvSFtIPq6pZJWB3Q65bZXYgGQeGxkvIHNDnx+I4ELFDI3rxVSwl4cPJK2nXz0HsJkaW8SUIt6QJCm8Mvl+00pZusML2cuqQpdKa5LTa8nKlcjRmMXwBErQy+6RBMyU4YXamJZlxcV3liSRrcr6gKHx8sesDWWR4/Wsi1N6qkCMBzCxdK7W2Qvtol4Q/PY9TgTlL+twJvix447diSZgF8+OFtWJmhkVm8iW8tDiPsjuOBidPR0MSX4q7LOkKYioor7npJqi1bl0P32+69HcMz/V637X4hIBA/xzlQKfYY+pff0HYN5F0u1R6C5rqj2ocrlqy8U1pZs6eJv3jRKBbNQ== Received: from [98.138.226.180] by nm15.bullet.mail.ne1.yahoo.com with NNFMP; 27 Apr 2017 23:16:05 -0000 Received: from [98.138.226.124] by tm15.bullet.mail.ne1.yahoo.com with NNFMP; 27 Apr 2017 23:10:28 -0000 Received: from [127.0.0.1] by smtp203.mail.ne1.yahoo.com with NNFMP; 27 Apr 2017 23:10:28 -0000 X-Yahoo-Newman-Id: 273011.40312.bm@smtp203.mail.ne1.yahoo.com X-Yahoo-Newman-Property: ymail-3 X-YMail-OSG: VDWKmWkVM1mgzsqO6ue0tSJtj933mkhV2HMgWml2w3u75Ja Id0cWbyGivDpnfTq42VnQRHghi7cr5FpHVNtv2hUP_p5JcAJGlNCuE.x7_Id ewd71ze3zGHczjvWXEDV_3Ge6850ljfQ1DsMSKCcO4Yyys5JB_fGggI_lNik d6bTgaEqVkqoJsWK7Y7h0AkYQJefJgqPJXCIrqwfeV_uGULtRymW5jnGm13C a12mhUhGxNlQvD.1u3QTyWMOr2o3JK.YF9LNM5yXBF0A9ldPCgnGDIu1qdqT adeVeXM3M_HVnLu92RD29XTsE8nfXv5EXN.lTvx5mAliob4nbT2CIrU9.74C LveJwkNxwlKOA4Yh_fLOGh5NL1RRFX8FeHBFg3HYQLIKP182vBJPKNDFiAUH TIBbZWHiF9uzIXs1Mwx.TExktcx_TU1Ycc7hQ.Up3uq6.x_Nt7oaSHZj5tVm p2jYwkVkxqMcYtdoYNUgwlYrvQs2OSVrmtqhFxW8szWB0ONlVvB3zKlo1GD9 GWDGOQV_nEoyFvDCyDU4eR41TtGvCNM80HM8RJ5P8.c2o X-Yahoo-SMTP: xcjD0guswBAZaPPIbxpWwLcp9Unf Subject: Re: svn commit: r314937 - in stable/10/sys: fs/ext2fs modules/ext2fs To: Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org References: <201703090247.v292l1Ws098712@repo.freebsd.org> From: Pedro Giffuni Organization: FreeBSD Message-ID: <6764293d-5b56-08cb-2a48-1f213fc6663a@FreeBSD.org> Date: Thu, 27 Apr 2017 18:10:27 -0500 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:52.0) Gecko/20100101 Thunderbird/52.0.1 MIME-Version: 1.0 In-Reply-To: Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 23:10:35 -0000 On 04/27/17 15:52, Ed Maste wrote: > On 8 March 2017 at 21:47, Pedro F. Giffuni wrote: >> Author: pfg >> Date: Thu Mar 9 02:47:01 2017 >> New Revision: 314937 >> URL: https://svnweb.freebsd.org/changeset/base/314937 >> >> Log: >> Revert 294545: >> Bringing back ext4: add support for reading sparse files > Tinderbox is broken on GCC architectures, e.g. from powerpc.LINT64: > > In file included from /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/inode.h:46, > from /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_alloc.c:50: > /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_extents.h:91: warning: > declaration does not declare anything And sys/modules/ext2fs/Makefile on line 11 reads: CFLAGS+= ${GCC_MS_EXTENSIONS} So .. ultimately it doesn't matter what is going on here I'll just revert (again) as I am not really using stable-10 anymore :(. Pedro. From owner-svn-src-stable-10@freebsd.org Thu Apr 27 23:14:02 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CF4B9D537C5; Thu, 27 Apr 2017 23:14:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A82A23C7; Thu, 27 Apr 2017 23:14:02 +0000 (UTC) (envelope-from pfg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3RNE1FC020943; Thu, 27 Apr 2017 23:14:01 GMT (envelope-from pfg@FreeBSD.org) Received: (from pfg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3RNE1Cf020938; Thu, 27 Apr 2017 23:14:01 GMT (envelope-from pfg@FreeBSD.org) Message-Id: <201704272314.v3RNE1Cf020938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: pfg set sender to pfg@FreeBSD.org using -f From: "Pedro F. Giffuni" Date: Thu, 27 Apr 2017 23:14:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317532 - in stable/10/sys: fs/ext2fs modules/ext2fs X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 23:14:02 -0000 Author: pfg Date: Thu Apr 27 23:14:01 2017 New Revision: 317532 URL: https://svnweb.freebsd.org/changeset/base/317532 Log: Revert r314937 as anonymous unions in GCC don't seem to work. This has been breaking the powerpc(LINT64 at least) for quite a while now. Reported by: emaste Modified: stable/10/sys/fs/ext2fs/ext2_bmap.c stable/10/sys/fs/ext2fs/ext2_extents.c stable/10/sys/fs/ext2fs/ext2_extents.h stable/10/sys/fs/ext2fs/ext2_vnops.c stable/10/sys/modules/ext2fs/Makefile Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/ext2fs/ext2_bmap.c ============================================================================== --- stable/10/sys/fs/ext2fs/ext2_bmap.c Thu Apr 27 22:53:38 2017 (r317531) +++ stable/10/sys/fs/ext2fs/ext2_bmap.c Thu Apr 27 23:14:01 2017 (r317532) @@ -102,6 +102,9 @@ ext4_bmapext(struct vnode *vp, int32_t b fs = ip->i_e2fs; lbn = bn; + /* + * TODO: need to implement read ahead to improve the performance. + */ if (runp != NULL) *runp = 0; @@ -109,25 +112,15 @@ ext4_bmapext(struct vnode *vp, int32_t b *runb = 0; ext4_ext_find_extent(fs, ip, lbn, &path); - if (path.ep_is_sparse) { - *bnp = -1; - if (runp != NULL) - *runp = path.ep_sparse_ext.e_len - - (lbn - path.ep_sparse_ext.e_blk) - 1; - } else { - ep = path.ep_ext; - if (ep == NULL) - ret = EIO; - else { - *bnp = fsbtodb(fs, lbn - ep->e_blk + - (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32)); + ep = path.ep_ext; + if (ep == NULL) + ret = EIO; + else { + *bnp = fsbtodb(fs, lbn - ep->e_blk + + (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32)); - if (*bnp == 0) - *bnp = -1; - - if (runp != NULL) - *runp = ep->e_len - (lbn - ep->e_blk) - 1; - } + if (*bnp == 0) + *bnp = -1; } if (path.ep_bp != NULL) { Modified: stable/10/sys/fs/ext2fs/ext2_extents.c ============================================================================== --- stable/10/sys/fs/ext2fs/ext2_extents.c Thu Apr 27 22:53:38 2017 (r317531) +++ stable/10/sys/fs/ext2fs/ext2_extents.c Thu Apr 27 23:14:01 2017 (r317532) @@ -66,14 +66,13 @@ static void ext4_ext_binsearch(struct inode *ip, struct ext4_extent_path *path, daddr_t lbn) { struct ext4_extent_header *ehp = path->ep_header; - struct ext4_extent *first, *l, *r, *m; + struct ext4_extent *l, *r, *m; if (ehp->eh_ecount == 0) return; - first = (struct ext4_extent *)(char *)(ehp + 1); - l = first; - r = first + ehp->eh_ecount - 1; + l = (struct ext4_extent *)(char *)(ehp + 1); + r = (struct ext4_extent *)(char *)(ehp + 1) + ehp->eh_ecount - 1; while (l <= r) { m = l + (r - l) / 2; if (lbn < m->e_blk) @@ -82,25 +81,7 @@ ext4_ext_binsearch(struct inode *ip, str l = m + 1; } - if (l == first) { - path->ep_sparse_ext.e_blk = lbn; - path->ep_sparse_ext.e_len = first->e_blk - lbn; - path->ep_sparse_ext.e_start_hi = 0; - path->ep_sparse_ext.e_start_lo = 0; - path->ep_is_sparse = 1; - return; - } path->ep_ext = l - 1; - if (path->ep_ext->e_blk + path->ep_ext->e_len <= lbn) { - path->ep_sparse_ext.e_blk = lbn; - if (l <= (first + ehp->eh_ecount - 1)) - path->ep_sparse_ext.e_len = l->e_blk - lbn; - else // XXX: where does it end? - path->ep_sparse_ext.e_len = 1; - path->ep_sparse_ext.e_start_hi = 0; - path->ep_sparse_ext.e_start_lo = 0; - path->ep_is_sparse = 1; - } } /* @@ -188,7 +169,6 @@ ext4_ext_find_extent(struct m_ext2fs *fs path->ep_depth = i; path->ep_ext = NULL; path->ep_index = NULL; - path->ep_is_sparse = 0; ext4_ext_binsearch(ip, path, lbn); return (path); Modified: stable/10/sys/fs/ext2fs/ext2_extents.h ============================================================================== --- stable/10/sys/fs/ext2fs/ext2_extents.h Thu Apr 27 22:53:38 2017 (r317531) +++ stable/10/sys/fs/ext2fs/ext2_extents.h Thu Apr 27 23:14:01 2017 (r317532) @@ -84,11 +84,7 @@ struct ext4_extent_cache { struct ext4_extent_path { uint16_t ep_depth; struct buf *ep_bp; - int ep_is_sparse; - union { - struct ext4_extent ep_sparse_ext; - struct ext4_extent *ep_ext; - }; + struct ext4_extent *ep_ext; struct ext4_extent_index *ep_index; struct ext4_extent_header *ep_header; }; Modified: stable/10/sys/fs/ext2fs/ext2_vnops.c ============================================================================== --- stable/10/sys/fs/ext2fs/ext2_vnops.c Thu Apr 27 22:53:38 2017 (r317531) +++ stable/10/sys/fs/ext2fs/ext2_vnops.c Thu Apr 27 23:14:01 2017 (r317532) @@ -1790,7 +1790,6 @@ ext2_ioctl(struct vop_ioctl_args *ap) static int ext4_ext_read(struct vop_read_args *ap) { - static unsigned char zeroes[EXT2_MAX_BLOCK_SIZE]; struct vnode *vp; struct inode *ip; struct uio *uio; @@ -1835,15 +1834,11 @@ ext4_ext_read(struct vop_read_args *ap) switch (cache_type) { case EXT4_EXT_CACHE_NO: ext4_ext_find_extent(fs, ip, lbn, &path); - if (path.ep_is_sparse) - ep = &path.ep_sparse_ext; - else - ep = path.ep_ext; + ep = path.ep_ext; if (ep == NULL) return (EIO); - ext4_ext_put_cache(ip, ep, - path.ep_is_sparse ? EXT4_EXT_CACHE_GAP : EXT4_EXT_CACHE_IN); + ext4_ext_put_cache(ip, ep, EXT4_EXT_CACHE_IN); newblk = lbn - ep->e_blk + (ep->e_start_lo | (daddr_t)ep->e_start_hi << 32); @@ -1856,7 +1851,7 @@ ext4_ext_read(struct vop_read_args *ap) case EXT4_EXT_CACHE_GAP: /* block has not been allocated yet */ - break; + return (0); case EXT4_EXT_CACHE_IN: newblk = lbn - nex.e_blk + (nex.e_start_lo | @@ -1867,34 +1862,24 @@ ext4_ext_read(struct vop_read_args *ap) panic("%s: invalid cache type", __func__); } - if (cache_type == EXT4_EXT_CACHE_GAP || - (cache_type == EXT4_EXT_CACHE_NO && path.ep_is_sparse)) { - if (xfersize > sizeof(zeroes)) - xfersize = sizeof(zeroes); - error = uiomove(zeroes, xfersize, uio); - if (error) - return (error); - } else { - error = bread(ip->i_devvp, fsbtodb(fs, newblk), size, - NOCRED, &bp); - if (error) { - brelse(bp); - return (error); - } + error = bread(ip->i_devvp, fsbtodb(fs, newblk), size, NOCRED, &bp); + if (error) { + brelse(bp); + return (error); + } - size -= bp->b_resid; - if (size < xfersize) { - if (size == 0) { - bqrelse(bp); - break; - } - xfersize = size; + size -= bp->b_resid; + if (size < xfersize) { + if (size == 0) { + bqrelse(bp); + break; } - error = uiomove(bp->b_data + blkoffset, xfersize, uio); - bqrelse(bp); - if (error) - return (error); + xfersize = size; } + error = uiomove(bp->b_data + blkoffset, (int)xfersize, uio); + bqrelse(bp); + if (error) + return (error); } return (0); Modified: stable/10/sys/modules/ext2fs/Makefile ============================================================================== --- stable/10/sys/modules/ext2fs/Makefile Thu Apr 27 22:53:38 2017 (r317531) +++ stable/10/sys/modules/ext2fs/Makefile Thu Apr 27 23:14:01 2017 (r317532) @@ -7,7 +7,4 @@ SRCS= opt_ddb.h opt_directio.h opt_quota ext2_htree.c ext2_inode.c ext2_inode_cnv.c ext2_lookup.c ext2_subr.c \ ext2_vfsops.c ext2_vnops.c -# Uses unamed union fields -CFLAGS+= ${GCC_MS_EXTENSIONS} - .include From owner-svn-src-stable-10@freebsd.org Fri Apr 28 01:02:27 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 79918D531B4; Fri, 28 Apr 2017 01:02:27 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 333856B8; Fri, 28 Apr 2017 01:02:26 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id v3S12KVi073905; Thu, 27 Apr 2017 18:02:20 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id v3S12KFL073904; Thu, 27 Apr 2017 18:02:20 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201704280102.v3S12KFL073904@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r314937 - in stable/10/sys: fs/ext2fs modules/ext2fs In-Reply-To: <20170428081746.H4303@besplex.bde.org> To: Bruce Evans Date: Thu, 27 Apr 2017 18:02:20 -0700 (PDT) CC: Gleb Smirnoff , Ngie Cooper , Ed Maste , "Pedro F. Giffuni" , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-stable-10@freebsd.org" Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 01:02:27 -0000 > On Thu, 27 Apr 2017, Gleb Smirnoff wrote: > > > On Thu, Apr 27, 2017 at 03:00:56PM -0700, Ngie Cooper wrote: > > N> On Thu, Apr 27, 2017 at 1:52 PM, Ed Maste wrote: > > N> > On 8 March 2017 at 21:47, Pedro F. Giffuni wrote: > > N> >> Author: pfg > > N> >> Date: Thu Mar 9 02:47:01 2017 > > N> >> New Revision: 314937 > > N> >> URL: https://svnweb.freebsd.org/changeset/base/314937 > > N> >> > > N> >> Log: > > N> >> Revert 294545: > > N> >> Bringing back ext4: add support for reading sparse files > > N> > > > N> > Tinderbox is broken on GCC architectures, e.g. from powerpc.LINT64: > > N> > > > N> > In file included from /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/inode.h:46, > > N> > from /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_alloc.c:50: > > N> > /scratch/tmp/emaste/freebsd/sys/fs/ext2fs/ext2_extents.h:91: warning: > > N> > declaration does not declare anything > > N> > > N> ... because of anonymous unions not being supported in gcc 4.2.1. > > Anonymous unions have been a standard gcc feature since nearly gcc-1. > > > The whole kernel is built with option that enables them on 4.2.1. > > > > CFLAGS.gcc+= -fms-extensions > > This is a bad way to enable standard gcc anonymous unions. It also > enables ms extensions which also gives unused extensions of standard > gcc anonymous, and other even more unwanted ms features. > > The correct way to enable gcc features is to compile with -std=gnu99. > This has been done for a long time in userland, but the has been ^+kernel? > misconfigured to use -std=c99 for a long time. This is sort of > backwards -- the kernel is inherently more unportable and can't > possible be compiled by a C99 compiler, while parts of userland > can. However, userland is larger, so people setting excessive > -std flags soon found that -std=c99 doesn't work. > > With no -std flag, gcc defaults to something like -std=gnu89, so > it supports its old anonymous unions feature but not the many > C99 features needed to compile almost anything now. > > Bruce > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-stable-10@freebsd.org Fri Apr 28 20:40:41 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84CD7D5458E; Fri, 28 Apr 2017 20:40:41 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: from mail-it0-f43.google.com (mail-it0-f43.google.com [209.85.214.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 53E86676; Fri, 28 Apr 2017 20:40:40 +0000 (UTC) (envelope-from ricera10@gmail.com) Received: by mail-it0-f43.google.com with SMTP id x188so49824732itb.0; Fri, 28 Apr 2017 13:40:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=6zBMw/J04+/bk+DoKEJ6gfYyMX0wo9ucSa6LNJFa8bQ=; b=glOokbT2+dBEjzQGMix+KCCg5PO0Hj92CfdZTiiu+6rPUwLJI0/TLYKi8qGiof4gvz A5V/ZMKQIH716kQ8I7625lFQqy7UNPtTZlKBwZddRNPZpUzvHcQm9hhCJqHThUn9tgC6 UZwjqRy17aKtQTQIG/ydkbfgbqK24V9lLdyOCLZ3ch/y6J26YUGkOksV+ThTYBACcy4y HncClo74HORDKiUpmXVDkZ8pB5ljVScucopMDokzesGcA7VnPECsTdMiiIcgMnIUQ/1w dIMcmx5UkTxowj6U4Igy/THgOQ0vILs5CcpBMP6/iedj3t1TIybH82tGEYqqF1QK/gSg hchA== X-Gm-Message-State: AN3rC/7yACiaQOw2EyDoorIS3NU4iWKGc0ttlDPxvP9fbtB+Sa7B4TTU TFK3zhMK+RBem9m9jfYc0XUi X-Received: by 10.36.51.133 with SMTP id k127mr159917itk.17.1493412039563; Fri, 28 Apr 2017 13:40:39 -0700 (PDT) Received: from mail-it0-f54.google.com (mail-it0-f54.google.com. [209.85.214.54]) by smtp.gmail.com with ESMTPSA id g69sm264987itg.17.2017.04.28.13.40.38 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 28 Apr 2017 13:40:38 -0700 (PDT) Received: by mail-it0-f54.google.com with SMTP id e65so1046454ita.1; Fri, 28 Apr 2017 13:40:38 -0700 (PDT) X-Received: by 10.202.61.65 with SMTP id k62mr4560405oia.43.1493412038727; Fri, 28 Apr 2017 13:40:38 -0700 (PDT) MIME-Version: 1.0 References: <201703152120.v2FLKHUs052999@repo.freebsd.org> In-Reply-To: From: Eric Joyner Date: Fri, 28 Apr 2017 20:40:28 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r315333 - in stable/10/sys: conf dev/ixgbe modules/ix modules/ixv To: Ngie Cooper , Ed Maste Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-stable@freebsd.org" , "svn-src-stable-10@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 20:40:41 -0000 I notified Jeb (the original patch submitter) about that netmap symbol issue, but we've both been distracted with other development. I'll work on updating it. - Eric On Thu, Apr 27, 2017 at 3:06 PM Ngie Cooper wrote: > On Thu, Apr 27, 2017 at 1:07 PM, Ed Maste wrote: > > On 15 March 2017 at 17:20, Eric Joyner wrote: > >> Author: erj > >> Date: Wed Mar 15 21:20:17 2017 > >> New Revision: 315333 > >> URL: https://svnweb.freebsd.org/changeset/base/315333 > >> > >> Log: > >> ixgbe(4): Update to 3.2.11-k > > > > This broke tinderbox on many architectures: > > > > ia64 GENERIC and powerpc GENERIC64: > > > > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_osdep.c:39: warning: no > > previous prototype for 'ixv_read_pci_cfg' [-Wmissing-prototypes] > > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_osdep.c:45: warning: no > > previous prototype for 'ixv_write_pci_cfg' [-Wmissing-prototypes] > > > > sparc64 LINT: > > > > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ix_txrx.c:43: warning: > > redundant redeclaration of 'ix_crcstrip' [-Wredundant-decls] > > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixgbe_netmap.h:45: warning: > > previous declaration of 'ix_crcstrip' was here > > > > amd64 LINT: > > > > /scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixv_netmap.c:(.text+0x0): > > multiple definition of `ixgbe_netmap_attach' > > > ixgbe_netmap.o:/scratch/tmp/emaste/freebsd/sys/dev/ixgbe/ixgbe_netmap.c:(.text+0x0): > > first defined here > > Hi Ed, > > It has to do with netmap(4) refactoring on head not being backported, > in combination with ixgbe/ix being MFCed in a refactored state back to > ^/stable/10 (it wasn't easy to backport due to PCI-IOV only being on > ^/stable/10 -- I tried starting this work and failed because I lacked > the hardware to test this out with). > > This has been known to be broken for almost two months -- a surgical > fix should probably be applied to do what's required to make the > symbol appear in the appropriate places, since this basically was a > direct commit to ^/stable/10 in some regards. > > Thanks, > -Ngie > From owner-svn-src-stable-10@freebsd.org Sat Apr 29 01:04:41 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 974E8D52826; Sat, 29 Apr 2017 01:04:41 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6969E1FA0; Sat, 29 Apr 2017 01:04:41 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3T14evl061664; Sat, 29 Apr 2017 01:04:40 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3T14eBv061660; Sat, 29 Apr 2017 01:04:40 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704290104.v3T14eBv061660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Sat, 29 Apr 2017 01:04:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317579 - in stable/10/sys/fs: nfs nfsclient X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Apr 2017 01:04:41 -0000 Author: rmacklem Date: Sat Apr 29 01:04:39 2017 New Revision: 317579 URL: https://svnweb.freebsd.org/changeset/base/317579 Log: MFC: r316829 Remove unused "cred" argument to ncl_flush(). The "cred" argument of ncl_flush() is unused and it was confusing to have the code passing in NULL for this argument in some cases. This patch deletes this argument. There is no semantic change because of this patch. Modified: stable/10/sys/fs/nfs/nfs_var.h stable/10/sys/fs/nfsclient/nfs_clnode.c stable/10/sys/fs/nfsclient/nfs_clstate.c stable/10/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/10/sys/fs/nfs/nfs_var.h Sat Apr 29 00:53:17 2017 (r317578) +++ stable/10/sys/fs/nfs/nfs_var.h Sat Apr 29 01:04:39 2017 (r317579) @@ -592,7 +592,7 @@ int nfscl_maperr(NFSPROC_T *, int, uid_t void nfscl_init(void); /* nfs_clbio.c */ -int ncl_flush(vnode_t, int, struct ucred *, NFSPROC_T *, int, int); +int ncl_flush(vnode_t, int, NFSPROC_T *, int, int); /* nfs_clnode.c */ void ncl_invalcaches(vnode_t); Modified: stable/10/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clnode.c Sat Apr 29 00:53:17 2017 (r317578) +++ stable/10/sys/fs/nfsclient/nfs_clnode.c Sat Apr 29 01:04:39 2017 (r317579) @@ -250,7 +250,7 @@ ncl_inactive(struct vop_inactive_args *a } else retv = TRUE; if (retv == TRUE) { - (void)ncl_flush(vp, MNT_WAIT, NULL, ap->a_td, 1, 0); + (void)ncl_flush(vp, MNT_WAIT, ap->a_td, 1, 0); (void)nfsrpc_close(vp, 1, ap->a_td); } } Modified: stable/10/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clstate.c Sat Apr 29 00:53:17 2017 (r317578) +++ stable/10/sys/fs/nfsclient/nfs_clstate.c Sat Apr 29 01:04:39 2017 (r317579) @@ -3878,8 +3878,7 @@ nfscl_recalldeleg(struct nfsclclient *cl if ((dp->nfsdl_flags & NFSCLDL_WRITE) && (np->n_flag & NMODIFIED)) { np->n_flag |= NDELEGRECALL; NFSUNLOCKNODE(np); - ret = ncl_flush(vp, MNT_WAIT, cred, p, 1, - called_from_renewthread); + ret = ncl_flush(vp, MNT_WAIT, p, 1, called_from_renewthread); NFSLOCKNODE(np); np->n_flag &= ~NDELEGRECALL; } Modified: stable/10/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/10/sys/fs/nfsclient/nfs_clvnops.c Sat Apr 29 00:53:17 2017 (r317578) +++ stable/10/sys/fs/nfsclient/nfs_clvnops.c Sat Apr 29 01:04:39 2017 (r317579) @@ -721,12 +721,12 @@ nfs_close(struct vop_close_args *ap) * traditional vnode locking implemented for Vnode Ops. */ int cm = newnfs_commit_on_close ? 1 : 0; - error = ncl_flush(vp, MNT_WAIT, cred, ap->a_td, cm, 0); + error = ncl_flush(vp, MNT_WAIT, ap->a_td, cm, 0); /* np->n_flag &= ~NMODIFIED; */ } else if (NFS_ISV4(vp)) { if (nfscl_mustflush(vp) != 0) { int cm = newnfs_commit_on_close ? 1 : 0; - error = ncl_flush(vp, MNT_WAIT, cred, ap->a_td, + error = ncl_flush(vp, MNT_WAIT, ap->a_td, cm, 0); /* * as above w.r.t races when clearing @@ -2629,7 +2629,7 @@ nfs_fsync(struct vop_fsync_args *ap) */ return (0); } - return (ncl_flush(ap->a_vp, ap->a_waitfor, NULL, ap->a_td, 1, 0)); + return (ncl_flush(ap->a_vp, ap->a_waitfor, ap->a_td, 1, 0)); } /* @@ -2641,7 +2641,7 @@ nfs_fsync(struct vop_fsync_args *ap) * waiting for a buffer write to complete. */ int -ncl_flush(struct vnode *vp, int waitfor, struct ucred *cred, struct thread *td, +ncl_flush(struct vnode *vp, int waitfor, struct thread *td, int commit, int called_from_renewthread) { struct nfsnode *np = VTONFS(vp); @@ -3022,7 +3022,7 @@ nfs_advlock(struct vop_advlock_args *ap) if (ap->a_op == F_UNLCK && nfscl_checkwritelocked(vp, ap->a_fl, cred, td, ap->a_id, ap->a_flags)) - (void) ncl_flush(vp, MNT_WAIT, cred, td, 1, 0); + (void) ncl_flush(vp, MNT_WAIT, td, 1, 0); /* * Loop around doing the lock op, while a blocking lock From owner-svn-src-stable-10@freebsd.org Sat Apr 29 23:26:37 2017 Return-Path: Delivered-To: svn-src-stable-10@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1146D552A4; Sat, 29 Apr 2017 23:26:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 97FEA15D9; Sat, 29 Apr 2017 23:26:37 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3TNQap1019585; Sat, 29 Apr 2017 23:26:36 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3TNQars019583; Sat, 29 Apr 2017 23:26:36 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704292326.v3TNQars019583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 29 Apr 2017 23:26:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r317599 - in stable: 10/lib/clang 10/lib/clang/include/llvm/Config 11/lib/clang 11/lib/clang/include/llvm/Config X-SVN-Group: stable-10 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-10@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 10-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Apr 2017 23:26:38 -0000 Author: dim Date: Sat Apr 29 23:26:36 2017 New Revision: 317599 URL: https://svnweb.freebsd.org/changeset/base/317599 Log: MFC r317214: Turn off llvm/clang's ENABLE_BACKTRACES setting, since it never worked properly anyway. (Upstream has reorganized this somewhat in the mean time, but for proper backtraces we would need llvm-symbolizer in base.) MFC r317215: Add function and data sections when building llvm, clang, lld and lldb, and allow the linker to garbage collect them. This shaves off up to a few MB from the final executables. Modified: stable/10/lib/clang/clang.build.mk stable/10/lib/clang/include/llvm/Config/config.h Directory Properties: stable/10/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/clang/include/llvm/Config/config.h stable/11/lib/clang/llvm.build.mk Directory Properties: stable/11/ (props changed) Modified: stable/10/lib/clang/clang.build.mk ============================================================================== --- stable/10/lib/clang/clang.build.mk Sat Apr 29 21:48:11 2017 (r317598) +++ stable/10/lib/clang/clang.build.mk Sat Apr 29 23:26:36 2017 (r317599) @@ -31,7 +31,9 @@ TARGET_TRIPLE?= ${TARGET_ARCH:C/amd64/x8 BUILD_TRIPLE?= ${BUILD_ARCH:C/amd64/x86_64/}-unknown-freebsd10.3 CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_TRIPLE}\" \ -DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\" \ - -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\" + -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\" \ + -ffunction-sections -fdata-sections +LDFLAGS+= -Wl,--gc-sections CXXFLAGS+= -fno-exceptions -fno-rtti .PATH: ${LLVM_SRCS}/${SRCDIR} Modified: stable/10/lib/clang/include/llvm/Config/config.h ============================================================================== --- stable/10/lib/clang/include/llvm/Config/config.h Sat Apr 29 21:48:11 2017 (r317598) +++ stable/10/lib/clang/include/llvm/Config/config.h Sat Apr 29 23:26:36 2017 (r317599) @@ -24,7 +24,7 @@ /* #undef DEFAULT_SYSROOT */ /* Define if you want backtraces on crash */ -#define ENABLE_BACKTRACES 1 +#define ENABLE_BACKTRACES 0 /* Define to enable crash handling overrides */ #define ENABLE_CRASH_OVERRIDES 1