From owner-svn-src-stable@freebsd.org Sun Apr 23 03:16:40 2017 Return-Path: Delivered-To: svn-src-stable@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 69404D40DD2; 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 211953F1; 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 v3N3GdFa039925; 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 v3N3Gdi2039923; Sun, 23 Apr 2017 03:16:39 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201704230316.v3N3Gdi2039923@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-11@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-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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/11/contrib/ipfilter/lib/parsefields.c stable/11/contrib/ipfilter/tools/ipf_y.y Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/contrib/ipfilter/lib/parsefields.c stable/10/contrib/ipfilter/tools/ipf_y.y Directory Properties: stable/10/ (props changed) Modified: stable/11/contrib/ipfilter/lib/parsefields.c ============================================================================== --- stable/11/contrib/ipfilter/lib/parsefields.c Sun Apr 23 02:30:06 2017 (r317313) +++ stable/11/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/11/contrib/ipfilter/tools/ipf_y.y ============================================================================== --- stable/11/contrib/ipfilter/tools/ipf_y.y Sun Apr 23 02:30:06 2017 (r317313) +++ stable/11/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@freebsd.org Sun Apr 23 03:16:40 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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@freebsd.org Sun Apr 23 06:43:53 2017 Return-Path: Delivered-To: svn-src-stable@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 C5E5CD4CDCA; Sun, 23 Apr 2017 06:43:53 +0000 (UTC) (envelope-from dchagin@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 A126EEC7; Sun, 23 Apr 2017 06:43:53 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N6hqVn025036; Sun, 23 Apr 2017 06:43:52 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N6hqkA025031; Sun, 23 Apr 2017 06:43:52 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201704230643.v3N6hqkA025031@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 23 Apr 2017 06:43:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317317 - in stable/11/sys: amd64/linux amd64/linux32 compat/linux i386/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 06:43:53 -0000 Author: dchagin Date: Sun Apr 23 06:43:52 2017 New Revision: 317317 URL: https://svnweb.freebsd.org/changeset/base/317317 Log: MFC r315505: Implement getrandom() syscall. Note. GRND_RANDOM option is not supported for now. Modified: stable/11/sys/amd64/linux/linux_dummy.c stable/11/sys/amd64/linux32/linux32_dummy.c stable/11/sys/compat/linux/linux_misc.c stable/11/sys/compat/linux/linux_misc.h stable/11/sys/i386/linux/linux_dummy.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_dummy.c ============================================================================== --- stable/11/sys/amd64/linux/linux_dummy.c Sun Apr 23 03:36:03 2017 (r317316) +++ stable/11/sys/amd64/linux/linux_dummy.c Sun Apr 23 06:43:52 2017 (r317317) @@ -135,7 +135,6 @@ DUMMY(sched_getattr); DUMMY(renameat2); /* linux 3.15: */ DUMMY(seccomp); -DUMMY(getrandom); DUMMY(memfd_create); DUMMY(kexec_file_load); /* linux 3.18: */ Modified: stable/11/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- stable/11/sys/amd64/linux32/linux32_dummy.c Sun Apr 23 03:36:03 2017 (r317316) +++ stable/11/sys/amd64/linux32/linux32_dummy.c Sun Apr 23 06:43:52 2017 (r317317) @@ -144,7 +144,6 @@ DUMMY(sched_getattr); DUMMY(renameat2); /* linux 3.15: */ DUMMY(seccomp); -DUMMY(getrandom); DUMMY(memfd_create); /* linux 3.18: */ DUMMY(bpf); Modified: stable/11/sys/compat/linux/linux_misc.c ============================================================================== --- stable/11/sys/compat/linux/linux_misc.c Sun Apr 23 03:36:03 2017 (r317316) +++ stable/11/sys/compat/linux/linux_misc.c Sun Apr 23 06:43:52 2017 (r317317) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -65,6 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -2508,3 +2510,27 @@ linux_to_bsd_waitopts(int options, int * if (options & __WCLONE) *bsdopts |= WLINUXCLONE; } + +int +linux_getrandom(struct thread *td, struct linux_getrandom_args *args) +{ + struct uio uio; + struct iovec iov; + + if (args->flags & ~(LINUX_GRND_NONBLOCK|LINUX_GRND_RANDOM)) + return (EINVAL); + if (args->count > INT_MAX) + args->count = INT_MAX; + + iov.iov_base = args->buf; + iov.iov_len = args->count; + + uio.uio_iov = &iov; + uio.uio_iovcnt = 1; + uio.uio_resid = iov.iov_len; + uio.uio_segflg = UIO_USERSPACE; + uio.uio_rw = UIO_READ; + uio.uio_td = td; + + return (read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK)); +} Modified: stable/11/sys/compat/linux/linux_misc.h ============================================================================== --- stable/11/sys/compat/linux/linux_misc.h Sun Apr 23 03:36:03 2017 (r317316) +++ stable/11/sys/compat/linux/linux_misc.h Sun Apr 23 06:43:52 2017 (r317317) @@ -145,6 +145,10 @@ extern int stclohz; #define LINUX_RLIM_INFINITY (~0UL) +/* Linux getrandom flags */ +#define LINUX_GRND_NONBLOCK 0x0001 +#define LINUX_GRND_RANDOM 0x0002 + int linux_common_wait(struct thread *td, int pid, int *status, int options, struct rusage *ru); void linux_to_bsd_waitopts(int options, int *bsdopts); Modified: stable/11/sys/i386/linux/linux_dummy.c ============================================================================== --- stable/11/sys/i386/linux/linux_dummy.c Sun Apr 23 03:36:03 2017 (r317316) +++ stable/11/sys/i386/linux/linux_dummy.c Sun Apr 23 06:43:52 2017 (r317317) @@ -140,7 +140,6 @@ DUMMY(sched_getattr); DUMMY(renameat2); /* linux 3.15: */ DUMMY(seccomp); -DUMMY(getrandom); DUMMY(memfd_create); /* linux 3.18: */ DUMMY(bpf); From owner-svn-src-stable@freebsd.org Sun Apr 23 06:45:22 2017 Return-Path: Delivered-To: svn-src-stable@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 B0CECD4CE73; Sun, 23 Apr 2017 06:45:22 +0000 (UTC) (envelope-from dchagin@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 753EE6E; Sun, 23 Apr 2017 06:45:22 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N6jLbG025166; Sun, 23 Apr 2017 06:45:21 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N6jLFE025165; Sun, 23 Apr 2017 06:45:21 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201704230645.v3N6jLFE025165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sun, 23 Apr 2017 06:45:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317318 - stable/11/sys/compat/linsysfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 06:45:22 -0000 Author: dchagin Date: Sun Apr 23 06:45:21 2017 New Revision: 317318 URL: https://svnweb.freebsd.org/changeset/base/317318 Log: MFC r315506: Glibc get_nprocs() and get_nprocs_conf() uses the sysfs cpu infrastructure to get number of processors. Implement /sys/devices/system/cpu/. Modified: stable/11/sys/compat/linsysfs/linsysfs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linsysfs/linsysfs.c ============================================================================== --- stable/11/sys/compat/linsysfs/linsysfs.c Sun Apr 23 06:43:52 2017 (r317317) +++ stable/11/sys/compat/linsysfs/linsysfs.c Sun Apr 23 06:45:21 2017 (r317318) @@ -221,13 +221,62 @@ linsysfs_run_bus(device_t dev, struct pf } /* + * Filler function for sys/devices/system/cpu/online + */ +static int +linsysfs_cpuonline(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "%d-%d\n", CPU_FIRST(), mp_maxid); + return (0); +} + +/* + * Filler function for sys/devices/system/cpu/cpuX/online + */ +static int +linsysfs_cpuxonline(PFS_FILL_ARGS) +{ + + sbuf_printf(sb, "1\n"); + return (0); +} + +static void +linsysfs_listcpus(struct pfs_node *dir) +{ + struct pfs_node *cpu; + char *name; + int i, count, len; + + len = 1; + count = mp_maxcpus; + while (count > 10) { + count /= 10; + len++; + } + len += sizeof("cpu"); + name = malloc(len, M_TEMP, M_WAITOK); + + for (i = 0; i < mp_ncpus; ++i) { + /* /sys/devices/system/cpu/cpuX */ + sprintf(name, "cpu%d", i); + cpu = pfs_create_dir(dir, name, NULL, NULL, NULL, 0); + + pfs_create_file(cpu, "online", &linsysfs_cpuxonline, + NULL, NULL, NULL, PFS_RD); + } + free(name, M_TEMP); +} + +/* * Constructor */ static int linsysfs_init(PFS_INIT_ARGS) { struct pfs_node *root; - struct pfs_node *dir; + struct pfs_node *dir, *sys, *cpu; struct pfs_node *pci; struct pfs_node *scsi; devclass_t devclass; @@ -241,10 +290,10 @@ linsysfs_init(PFS_INIT_ARGS) scsi = pfs_create_dir(root, "class", NULL, NULL, NULL, 0); scsi = pfs_create_dir(scsi, "scsi_host", NULL, NULL, NULL, 0); - /* /sys/device */ + /* /sys/devices */ dir = pfs_create_dir(root, "devices", NULL, NULL, NULL, 0); - /* /sys/device/pci0000:00 */ + /* /sys/devices/pci0000:00 */ pci = pfs_create_dir(dir, "pci0000:00", NULL, NULL, NULL, 0); devclass = devclass_find("root"); @@ -254,6 +303,18 @@ linsysfs_init(PFS_INIT_ARGS) dev = devclass_get_device(devclass, 0); linsysfs_run_bus(dev, pci, scsi, "/pci0000:00", "0000"); + + /* /sys/devices/system */ + sys = pfs_create_dir(dir, "system", NULL, NULL, NULL, 0); + + /* /sys/devices/system/cpu */ + cpu = pfs_create_dir(sys, "cpu", NULL, NULL, NULL, 0); + + pfs_create_file(cpu, "online", &linsysfs_cpuonline, + NULL, NULL, NULL, PFS_RD); + + linsysfs_listcpus(cpu); + return (0); } From owner-svn-src-stable@freebsd.org Sun Apr 23 07:35:12 2017 Return-Path: Delivered-To: svn-src-stable@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 2B97FD4CC74; Sun, 23 Apr 2017 07:35:12 +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 D765E1836; Sun, 23 Apr 2017 07:35:11 +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 v3N7ZAkc045354; Sun, 23 Apr 2017 07:35:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N7ZACN045352; Sun, 23 Apr 2017 07:35:10 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230735.v3N7ZACN045352@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:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317319 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 07:35:12 -0000 Author: mav Date: Sun Apr 23 07:35:10 2017 New Revision: 317319 URL: https://svnweb.freebsd.org/changeset/base/317319 Log: MFC r316653: Fix few minor issues found by Clang Analyzer. Modified: stable/11/sys/cam/ctl/ctl.c stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/ctl.c ============================================================================== --- stable/11/sys/cam/ctl/ctl.c Sun Apr 23 06:45:21 2017 (r317318) +++ stable/11/sys/cam/ctl/ctl.c Sun Apr 23 07:35:10 2017 (r317319) @@ -7047,7 +7047,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/11/sys/cam/ctl/ctl_frontend_iscsi.c ============================================================================== --- stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Sun Apr 23 06:45:21 2017 (r317318) +++ stable/11/sys/cam/ctl/ctl_frontend_iscsi.c Sun Apr 23 07:35:10 2017 (r317319) @@ -321,11 +321,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; @@ -1706,6 +1705,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); @@ -2158,9 +2164,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@freebsd.org Sun Apr 23 07:35:53 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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@freebsd.org Sun Apr 23 07:36:46 2017 Return-Path: Delivered-To: svn-src-stable@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 58B77D4CD4C; Sun, 23 Apr 2017 07:36:46 +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 28D3F1ABF; Sun, 23 Apr 2017 07:36:46 +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 v3N7ajO3045515; Sun, 23 Apr 2017 07:36:45 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N7ajh2045513; Sun, 23 Apr 2017 07:36:45 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230736.v3N7ajh2045513@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:36:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317321 - stable/11/sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 07:36:46 -0000 Author: mav Date: Sun Apr 23 07:36:44 2017 New Revision: 317321 URL: https://svnweb.freebsd.org/changeset/base/317321 Log: MFC r316652: Fix few minor issues found by Clang Analyzer. Modified: stable/11/sys/dev/isp/isp.c stable/11/sys/dev/isp/isp_freebsd.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp.c ============================================================================== --- stable/11/sys/dev/isp/isp.c Sun Apr 23 07:35:51 2017 (r317320) +++ stable/11/sys/dev/isp/isp.c Sun Apr 23 07:36:44 2017 (r317321) @@ -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/11/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.c Sun Apr 23 07:35:51 2017 (r317320) +++ stable/11/sys/dev/isp/isp_freebsd.c Sun Apr 23 07:36:44 2017 (r317321) @@ -3792,7 +3792,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@freebsd.org Sun Apr 23 07:37:15 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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@freebsd.org Sun Apr 23 08:36:30 2017 Return-Path: Delivered-To: svn-src-stable@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 D2EF0D4A5DA; Sun, 23 Apr 2017 08:36:30 +0000 (UTC) (envelope-from trasz@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 A2BB6147D; Sun, 23 Apr 2017 08:36:30 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8aT0v071471; Sun, 23 Apr 2017 08:36:29 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8aTia071470; Sun, 23 Apr 2017 08:36:29 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230836.v3N8aTia071470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:36:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317325 - stable/11/sbin/reboot X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:36:30 -0000 Author: trasz Date: Sun Apr 23 08:36:29 2017 New Revision: 317325 URL: https://svnweb.freebsd.org/changeset/base/317325 Log: MFC r315560: Document how to use reroot with NFS. Sponsored by: DARPA, AFRL Modified: stable/11/sbin/reboot/reboot.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/reboot/reboot.8 ============================================================================== --- stable/11/sbin/reboot/reboot.8 Sun Apr 23 07:57:30 2017 (r317324) +++ stable/11/sbin/reboot/reboot.8 Sun Apr 23 08:36:29 2017 (r317325) @@ -28,7 +28,7 @@ .\" @(#)reboot.8 8.1 (Berkeley) 6/9/93 .\" $FreeBSD$ .\" -.Dd Dec 12, 2015 +.Dd March 19, 2017 .Dt REBOOT 8 .Os .Sh NAME @@ -152,6 +152,13 @@ Replace current root filesystem with UFS kenv vfs.root.mountfrom=ufs:/dev/ada0s1a reboot -r .Ed +.Pp +This mechanism can also be used with NFS, with a caveat that +it only works with NFSv4, and requires a numeric IPv4 address: +.Bd -literal -offset indent +kenv vfs.root.mountfrom=nfs:192.168.1.1:/share/name +reboot -r +.Ed .Sh SEE ALSO .Xr kenv 1 , .Xr getutxent 3 , From owner-svn-src-stable@freebsd.org Sun Apr 23 08:38:48 2017 Return-Path: Delivered-To: svn-src-stable@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 73241D4A78F; Sun, 23 Apr 2017 08:38:48 +0000 (UTC) (envelope-from trasz@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 42307183F; Sun, 23 Apr 2017 08:38:48 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8clQB071967; Sun, 23 Apr 2017 08:38:47 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8clXx071966; Sun, 23 Apr 2017 08:38:47 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230838.v3N8clXx071966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:38:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317326 - stable/11/share/man/man9 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:38:48 -0000 Author: trasz Date: Sun Apr 23 08:38:47 2017 New Revision: 317326 URL: https://svnweb.freebsd.org/changeset/base/317326 Log: MFC r316056: The cn_consume was removed in r296716. Sponsored by: DARPA, AFRL Modified: stable/11/share/man/man9/VOP_LOOKUP.9 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/VOP_LOOKUP.9 ============================================================================== --- stable/11/share/man/man9/VOP_LOOKUP.9 Sun Apr 23 08:36:29 2017 (r317325) +++ stable/11/share/man/man9/VOP_LOOKUP.9 Sun Apr 23 08:38:47 2017 (r317326) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 24, 1997 +.Dd March 27, 2017 .Dt VOP_LOOKUP 9 .Os .Sh NAME @@ -71,7 +71,6 @@ struct componentname { char *cn_nameptr; /* pointer to looked up name */ long cn_namelen; /* length of looked up component */ u_long cn_hash; /* hash value of looked up name */ - long cn_consume; /* chars to consume in lookup() */ }; .Ed .Pp From owner-svn-src-stable@freebsd.org Sun Apr 23 08:39:47 2017 Return-Path: Delivered-To: svn-src-stable@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 750CAD4A821; Sun, 23 Apr 2017 08:39:47 +0000 (UTC) (envelope-from trasz@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 508D61989; Sun, 23 Apr 2017 08:39:47 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8dkIM072059; Sun, 23 Apr 2017 08:39:46 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8dkFm072057; Sun, 23 Apr 2017 08:39:46 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230839.v3N8dkFm072057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:39:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317327 - stable/11/share/man/man9 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:39:47 -0000 Author: trasz Date: Sun Apr 23 08:39:46 2017 New Revision: 317327 URL: https://svnweb.freebsd.org/changeset/base/317327 Log: MFC r316057: Document EVENTHANDLER_DEFINE(9). Sponsored by: DARPA, AFRL Modified: stable/11/share/man/man9/EVENTHANDLER.9 stable/11/share/man/man9/Makefile Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/EVENTHANDLER.9 ============================================================================== --- stable/11/share/man/man9/EVENTHANDLER.9 Sun Apr 23 08:38:47 2017 (r317326) +++ stable/11/share/man/man9/EVENTHANDLER.9 Sun Apr 23 08:39:46 2017 (r317327) @@ -23,7 +23,7 @@ .\" SUCH DAMAGE. .\" $FreeBSD$ .\" -.Dd April 19, 2014 +.Dd March 27, 2017 .Dt EVENTHANDLER 9 .Os .Sh NAME @@ -32,6 +32,7 @@ .Sh SYNOPSIS .In sys/eventhandler.h .Fn EVENTHANDLER_DECLARE name type +.Fn EVENTHANDLER_DEFINE name func arg priority .Fn EVENTHANDLER_INVOKE name ... .Ft eventhandler_tag .Fn EVENTHANDLER_REGISTER name func arg priority @@ -60,6 +61,20 @@ mechanism provides a way for kernel subs kernel events and have their callback functions invoked when these events occur. .Pp +Callback functions are invoked in order of priority. +The relative priority of each callback among other callbacks +associated with an event is given by argument +.Fa priority , +which is an integer ranging from +.Dv EVENTHANDLER_PRI_FIRST +(highest priority), to +.Dv EVENTHANDLER_PRI_LAST +(lowest priority). +The symbol +.Dv EVENTHANDLER_PRI_ANY +may be used if the handler does not have a specific priority +associated with it. +.Pp The normal way to use this subsystem is via the macro interface. The macros that can be used for working with event handlers and callback function lists are: @@ -69,6 +84,21 @@ This macro declares an event handler nam .Fa name with callback functions of type .Fa type . +.It Fn EVENTHANDLER_DEFINE +This macro uses +.Xr SYSINIT 9 +to register a callback function +.Fa func +with event handler +.Fa name . +When invoked, function +.Fa func +will be invoked with argument +.Fa arg +as its first parameter along with any additional parameters passed in +via macro +.Fn EVENTHANDLER_INVOKE +(see below). .It Fn EVENTHANDLER_REGISTER This macro registers a callback function .Fa func @@ -82,19 +112,6 @@ as its first parameter along with any ad via macro .Fn EVENTHANDLER_INVOKE (see below). -Callback functions are invoked in order of priority. -The relative priority of each callback among other callbacks -associated with an event is given by argument -.Fa priority , -which is an integer ranging from -.Dv EVENTHANDLER_PRI_FIRST -(highest priority), to -.Dv EVENTHANDLER_PRI_LAST -(lowest priority). -The symbol -.Dv EVENTHANDLER_PRI_ANY -may be used if the handler does not have a specific priority -associated with it. If registration is successful, .Fn EVENTHANDLER_REGISTER returns a cookie of type Modified: stable/11/share/man/man9/Makefile ============================================================================== --- stable/11/share/man/man9/Makefile Sun Apr 23 08:38:47 2017 (r317326) +++ stable/11/share/man/man9/Makefile Sun Apr 23 08:39:46 2017 (r317327) @@ -744,6 +744,7 @@ MLINKS+=DRIVER_MODULE.9 DRIVER_MODULE_OR DRIVER_MODULE.9 EARLY_DRIVER_MODULE.9 \ DRIVER_MODULE.9 EARLY_DRIVER_MODULE_ORDERED.9 MLINKS+=EVENTHANDLER.9 EVENTHANDLER_DECLARE.9 \ + EVENTHANDLER.9 EVENTHANDLER_DEFINE.9 \ EVENTHANDLER.9 EVENTHANDLER_DEREGISTER.9 \ EVENTHANDLER.9 eventhandler_deregister.9 \ EVENTHANDLER.9 eventhandler_find_list.9 \ From owner-svn-src-stable@freebsd.org Sun Apr 23 08:40:36 2017 Return-Path: Delivered-To: svn-src-stable@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 30754D4AA0E; Sun, 23 Apr 2017 08:40:36 +0000 (UTC) (envelope-from trasz@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 024981B1F; Sun, 23 Apr 2017 08:40:35 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8eZii072163; Sun, 23 Apr 2017 08:40:35 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8eZYb072162; Sun, 23 Apr 2017 08:40:35 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230840.v3N8eZYb072162@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:40:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317328 - stable/11/lib/libpmc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:40:36 -0000 Author: trasz Date: Sun Apr 23 08:40:34 2017 New Revision: 317328 URL: https://svnweb.freebsd.org/changeset/base/317328 Log: MFC r316468: Fix typo. Sponsored by: DARPA, AFRL Modified: stable/11/lib/libpmc/pmc.haswell.3 Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libpmc/pmc.haswell.3 ============================================================================== --- stable/11/lib/libpmc/pmc.haswell.3 Sun Apr 23 08:39:46 2017 (r317327) +++ stable/11/lib/libpmc/pmc.haswell.3 Sun Apr 23 08:40:34 2017 (r317328) @@ -31,7 +31,7 @@ .Nm pmc.haswell .Nd measurement events for .Tn Intel -.Tn Haswsell +.Tn Haswell family CPUs .Sh LIBRARY .Lb libpmc From owner-svn-src-stable@freebsd.org Sun Apr 23 08:41:59 2017 Return-Path: Delivered-To: svn-src-stable@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 B1AFED4AB6E; Sun, 23 Apr 2017 08:41:59 +0000 (UTC) (envelope-from trasz@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 8CAD21F4A; Sun, 23 Apr 2017 08:41:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8fwk1073652; Sun, 23 Apr 2017 08:41:58 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8fwHt073651; Sun, 23 Apr 2017 08:41:58 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230841.v3N8fwHt073651@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:41:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317329 - stable/11/share/man/man7 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:41:59 -0000 Author: trasz Date: Sun Apr 23 08:41:58 2017 New Revision: 317329 URL: https://svnweb.freebsd.org/changeset/base/317329 Log: MFC r316466: Remove excessive horizontal whitespace from hier(7) by correctly using "-width". The http://mdocml.bsd.lv/mdoc/details/width.html says: "Do not use macros in the argument specifying the width, that's not portable. While GNU troff can handle it, mandoc cannot." The same problem seems to exist in many other man pages. Modified: stable/11/share/man/man7/hier.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sun Apr 23 08:40:34 2017 (r317328) +++ stable/11/share/man/man7/hier.7 Sun Apr 23 08:41:58 2017 (r317329) @@ -36,7 +36,7 @@ .Nd layout of file systems .Sh DESCRIPTION A sketch of the file system hierarchy. -.Bl -tag -width ".Pa /libexec/" +.Bl -tag -width "/libexec/" .It Pa / root directory of the file system .It Pa /bin/ @@ -44,7 +44,7 @@ user utilities fundamental to both singl .It Pa /boot/ programs and configuration files used during operating system bootstrap .Pp -.Bl -tag -width ".Pa defaults/" -compact +.Bl -tag -width "defaults/" -compact .It Pa defaults/ default bootstrapping configuration files; see .Xr loader.conf 5 @@ -80,7 +80,7 @@ comments apply device special files managed by .Xr devfs 5 .Pp -.Bl -tag -width ".Pa net/" -compact +.Bl -tag -width "net/" -compact .It Pa fd/ file descriptor files; see @@ -91,7 +91,7 @@ network devices .It Pa /etc/ system configuration files and scripts .Pp -.Bl -tag -width ".Pa bluetooth/" -compact +.Bl -tag -width "bluetooth/" -compact .It Pa defaults/ default system configuration files; see @@ -141,7 +141,7 @@ critical system libraries needed for bin and .Pa /sbin .Pp -.Bl -tag -width ".Pa geom/" -compact +.Bl -tag -width "geom/" -compact .It Pa geom/ class-specific libraries for the .Xr geom 8 @@ -181,7 +181,7 @@ temporary files that are not guaranteed .It Pa /usr/ contains the majority of user utilities and applications .Pp -.Bl -tag -width ".Pa libdata/" -compact +.Bl -tag -width "libdata/" -compact .It Pa bin/ common utilities, programming tools, and applications .It Pa compat/ @@ -190,7 +190,7 @@ such as Linux .It Pa include/ standard C include files .Pp -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa altq/ C include files for alternate queueing .It Pa arpa/ @@ -201,7 +201,7 @@ C include files for the SNMP daemon C++ include files .It Pa cam/ C include files for the Common Access Methods Layer -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa scsi/ The SCSI device on top of CAM .El @@ -209,7 +209,7 @@ The SCSI device on top of CAM C include files for programming various .Fx devices -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa ic/ Various header files describing driver- and bus-independent hardware circuits @@ -235,7 +235,7 @@ The WaveLAN driver .El .It Pa fs/ -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa cd9660/ iso9660 file system .It Pa fdescfs/ @@ -260,7 +260,7 @@ union file system .El .It Pa geom/ GEOM framework -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa concat/ CONCAT GEOM class .It Pa gate/ @@ -306,7 +306,7 @@ see NATM include files; see .Xr natm 4 -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa api/ include files for the signalling API .It Pa msg/ @@ -349,7 +349,7 @@ system C include files (kernel data stru .\" Tcl language; .\" see .\" .Xr Tcl n -.\" .Bl -tag -width ".Pa kerberos5/" -compact +.\" .Bl -tag -width "kerberos5/" -compact .\" .It Pa generic/ .\" ??? .\" .It Pa unix/ @@ -357,7 +357,7 @@ system C include files (kernel data stru .\" .El .It Pa ufs/ C include files for UFS (The U-word File System) -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa ffs/ Fast file system .It Pa ufs/ @@ -472,7 +472,7 @@ system daemons & system utilities (execu .It Pa share/ architecture-independent files .Pp -.Bl -tag -width ".Pa calendar/" -compact +.Bl -tag -width "calendar/" -compact .It Pa calendar/ a variety of pre-fab calendar files; see @@ -553,7 +553,7 @@ ASCII text files used by various games device description file for device name .It Pa keys/ known trusted and revoked keys. -.Bl -tag -width ".Pa keys/pkg/" -compact +.Bl -tag -width "keys/pkg/" -compact .It Pa keys/pkg/ fingerprints for .Xr pkg 7 @@ -614,7 +614,7 @@ MIB files files used by syscons; see .Xr syscons 4 -.Bl -tag -width ".Pa scrnmaps/" -compact +.Bl -tag -width "scrnmaps/" -compact .It Pa fonts/ console fonts; see @@ -648,7 +648,7 @@ localization support and utilities for files used by vt; see .Xr vt 4 -.Bl -tag -width ".Pa scrnmaps/" -compact +.Bl -tag -width "scrnmaps/" -compact .It Pa fonts/ console fonts; see @@ -673,7 +673,7 @@ see .Bx , third-party, and/or local source files .Pp -.Bl -tag -width ".Pa kerberos5/" -compact +.Bl -tag -width "kerberos5/" -compact .It Pa bin/ source code for files in /bin .It Pa cddl/ @@ -743,7 +743,7 @@ for more details. .It Pa /var/ multi-purpose log, temporary, transient, and spool files .Pp -.Bl -tag -width ".Pa preserve/" -compact +.Bl -tag -width "preserve/" -compact .It Pa account/ system accounting files .Pp @@ -758,7 +758,7 @@ see timed command scheduling files; see .Xr \&at 1 -.Bl -tag -width ".Pa preserve/" -compact +.Bl -tag -width "preserve/" -compact .It Pa jobs/ directory containing job files .It Pa spool/ @@ -769,7 +769,7 @@ directory containing output spool files miscellaneous backup files .It Pa cache/ miscellaneous cached files -.Bl -tag -width ".Pa pkg/" -compact +.Bl -tag -width "pkg/" -compact .It Pa pkg/ cached packages for .Xr pkg 8 @@ -784,7 +784,7 @@ and files used by cron; see .Xr cron 8 -.Bl -tag -width ".Pa preserve/" -compact +.Bl -tag -width "preserve/" -compact .It Pa tabs/ crontab files; see From owner-svn-src-stable@freebsd.org Sun Apr 23 08:43:46 2017 Return-Path: Delivered-To: svn-src-stable@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 956DCD4AC5C; Sun, 23 Apr 2017 08:43:46 +0000 (UTC) (envelope-from trasz@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 4268B155; Sun, 23 Apr 2017 08:43:46 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8hj75076045; Sun, 23 Apr 2017 08:43:45 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8hj5S076044; Sun, 23 Apr 2017 08:43:45 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230843.v3N8hj5S076044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:43:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317330 - stable/11/share/man/man7 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:43:46 -0000 Author: trasz Date: Sun Apr 23 08:43:45 2017 New Revision: 317330 URL: https://svnweb.freebsd.org/changeset/base/317330 Log: MFC r316467: Add basic description of kernel source layout. Modified: stable/11/share/man/man7/hier.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sun Apr 23 08:41:58 2017 (r317329) +++ stable/11/share/man/man7/hier.7 Sun Apr 23 08:43:45 2017 (r317330) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd March 13, 2017 +.Dd April 3, 2017 .Dt HIER 7 .Os .Sh NAME @@ -716,6 +716,67 @@ source for files in .Pa /usr/share .It Pa sys/ kernel source code +.Bl -tag -width ".Pa opencrypto/" -compact +.It Pa amd64/ +AMD64 architecture support +.It Pa arm/ +ARM architecture support +.It Pa arm64/ +ARMv8 architecture support +.It Pa boot/ +bootloader code +.It Pa cam/ +.Xr cam 4 +.It Pa cddl/ +CDDL-licensed optional sources, including ZFS +and DTrace +.It Pa ddb/ +.Xr ddb 4 +.It Pa fs/ +most filesystems +.It Pa dev/ +device drivers +.It Pa geom/ +.Xr geom 4 +.It Pa i386/ +i386 (32 bit) architecture support +.It Pa kern/ +main part of the kernel +.It Pa mips/ +MIPS architecture support +.It Pa net80211/ +.Xr net80211 4 +.It Pa netgraph/ +.Xr netgraph 4 +.It Pa netinet/ +.Xr inet 4 +.It Pa netinet6/ +.Xr inet6 4 +.It Pa netipsec/ +.Xr ipsec 4 +.It Pa netpfil/ +.Xr ipfw 4 +and +.Xr pf 4 +.It Pa opencrypto/ +.Xr crypto 7 +.It Pa powerpc/ +PowerPC/POWER architecture support +.It Pa riscv/ +RISC-V architecture support +.It Pa security/ +.Xr audit 4 +and +.Xr mac 4 +.It Pa sparc64/ +SPARC64 architecture support +.It Pa sys/ +kernel headers +.It Pa ufs/ +Unix File System +.It Pa x86/ +code shared by AMD64 and i386 architectures +.El .It Pa targets/ support for experimental DIRDEPS_BUILD .It Pa tests/ From owner-svn-src-stable@freebsd.org Sun Apr 23 08:44:51 2017 Return-Path: Delivered-To: svn-src-stable@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 95605D4AD2C; Sun, 23 Apr 2017 08:44:51 +0000 (UTC) (envelope-from trasz@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 6D3DD2B5; Sun, 23 Apr 2017 08:44:51 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8iotu076152; Sun, 23 Apr 2017 08:44:50 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8ioaR076151; Sun, 23 Apr 2017 08:44:50 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230844.v3N8ioaR076151@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:44:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317331 - stable/11/share/man/man7 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:44:51 -0000 Author: trasz Date: Sun Apr 23 08:44:50 2017 New Revision: 317331 URL: https://svnweb.freebsd.org/changeset/base/317331 Log: MFC r316587: Update hier(7) by removing files and directories that no longer exist and doing a few random tweaks. Modified: stable/11/share/man/man7/hier.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sun Apr 23 08:43:45 2017 (r317330) +++ stable/11/share/man/man7/hier.7 Sun Apr 23 08:44:50 2017 (r317331) @@ -28,7 +28,7 @@ .\" @(#)hier.7 8.1 (Berkeley) 6/5/93 .\" $FreeBSD$ .\" -.Dd April 3, 2017 +.Dd April 6, 2017 .Dt HIER 7 .Os .Sh NAME @@ -58,7 +58,7 @@ Loadable modules containing binary firmw firmware downloaded to it to function .It Pa kernel/ pure kernel executable (the operating system loaded into memory -at boot time) +at boot time) and kernel modules .It Pa modules/ third-party loadable kernel modules; see @@ -85,8 +85,6 @@ device special files managed by file descriptor files; see .Xr \&fd 4 -.It Pa net/ -network devices .El .It Pa /etc/ system configuration files and scripts @@ -191,8 +189,6 @@ such as Linux standard C include files .Pp .Bl -tag -width "kerberos5/" -compact -.It Pa altq/ -C include files for alternate queueing .It Pa arpa/ C include files for Internet service protocols .It Pa bsnmp/ @@ -236,13 +232,8 @@ WaveLAN driver .El .It Pa fs/ .Bl -tag -width "kerberos5/" -compact -.It Pa cd9660/ -iso9660 file system .It Pa fdescfs/ per-process file descriptors file system -.It Pa fifofs/ -.St -p1003.1 -FIFOs file system .It Pa msdosfs/ MS-DOS file system .It Pa nfs/ @@ -275,8 +266,6 @@ RAID3 GEOM class STRIPE GEOM class .El .Pp -.It Pa isc/ -ISC utility library libisc include files .It Pa libmilter/ C include files for libmilter, the @@ -286,6 +275,10 @@ mail filter API machine-specific C include files .It Pa net/ miscellaneous network C include files +.Bl -tag -width "altq/" -compact +.It Pa altq/ +C include files for alternate queueing +.El .It Pa net80211/ C include files for 802.11 wireless networking; see @@ -321,12 +314,8 @@ include files for the UNI signalling pro SMB/CIFS requester .It Pa nfs/ C include files for NFS (Network File System) version 2 and 3 (legacy) -.It Pa objc/ -Objective C include files .It Pa openssl/ OpenSSL (Cryptography/SSL toolkit) headers -.It Pa pccard/ -PC-CARD controllers .It Pa protocols/ C include files for Berkeley service protocols .It Pa readline/ @@ -388,9 +377,6 @@ standalone debug data for the kernel and DTrace library scripts .It Pa engines/ OpenSSL (Cryptography/SSL toolkit) dynamically loadable engines -.It Pa private/ -Private system libraries not for use by third-party programs. -ABI and API stability are not guaranteed. .El .Pp .It Pa libdata/ @@ -436,8 +422,8 @@ see .It Pa local/ local executables, libraries, etc. Also used as the default destination for the -.Fx -ports framework. +.Xr ports 7 +framework. Within .Pa local/ , the general layout sketched out by @@ -464,9 +450,10 @@ architecture-specific target tree produc .Pa /usr/src tree .It Pa ports/ -The +.Xr ports 7 , +the .Fx -ports collection (optional). +ports collection. .It Pa sbin/ system daemons & system utilities (executed by users) .It Pa share/ @@ -486,14 +473,8 @@ see .It Pa freebsd .Fx Ns -specific terms, proper names, and jargon -.It Pa words -common words .It Pa web2 words from Webster's 2nd International -.It Pa papers/ -reference databases; -see -.Xr refer 1 .El .Pp .It Pa doc/ @@ -553,8 +534,8 @@ ASCII text files used by various games device description file for device name .It Pa keys/ known trusted and revoked keys. -.Bl -tag -width "keys/pkg/" -compact -.It Pa keys/pkg/ +.Bl -tag -width "pkg/" -compact +.It Pa pkg/ fingerprints for .Xr pkg 7 and @@ -567,8 +548,6 @@ see .Xr setlocale 3 .It Pa man/ manual pages -.It Pa mdocml/ -data files used by mdocml .It Pa me/ macros for use with the me macro package; see @@ -694,6 +673,8 @@ source code for files in build infrastructure for kerberos version 5 .It Pa lib/ source code for files in +.Pa /lib +and .Pa /usr/lib .It Pa libexec/ source code for files in @@ -727,6 +708,8 @@ ARMv8 architecture support bootloader code .It Pa cam/ .Xr cam 4 +and +.Xr ctl 4 .It Pa cddl/ CDDL-licensed optional sources, including ZFS and DTrace From owner-svn-src-stable@freebsd.org Sun Apr 23 08:45:56 2017 Return-Path: Delivered-To: svn-src-stable@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 EC126D4AE08; Sun, 23 Apr 2017 08:45:56 +0000 (UTC) (envelope-from trasz@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 C78AA63E; Sun, 23 Apr 2017 08:45:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3N8jtiM076254; Sun, 23 Apr 2017 08:45:55 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8jte1076253; Sun, 23 Apr 2017 08:45:55 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201704230845.v3N8jte1076253@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Sun, 23 Apr 2017 08:45:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317332 - stable/11/share/man/man7 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:45:57 -0000 Author: trasz Date: Sun Apr 23 08:45:55 2017 New Revision: 317332 URL: https://svnweb.freebsd.org/changeset/base/317332 Log: MFC r316589: Unify capitalization. Modified: stable/11/share/man/man7/hier.7 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man7/hier.7 ============================================================================== --- stable/11/share/man/man7/hier.7 Sun Apr 23 08:44:50 2017 (r317331) +++ stable/11/share/man/man7/hier.7 Sun Apr 23 08:45:55 2017 (r317332) @@ -54,7 +54,7 @@ Compiled flattened device tree (FDT) fil and .Xr dtc 1 .It Pa firmware/ -Loadable modules containing binary firmware for hardware that needs +loadable kernel modules containing binary firmware for hardware that needs firmware downloaded to it to function .It Pa kernel/ pure kernel executable (the operating system loaded into memory @@ -64,9 +64,8 @@ third-party loadable kernel modules; see .Xr kldstat 8 .It Pa zfs/ -Contains .Xr zfs 8 -zpool cache files. +zpool cache files .El .It Pa /cdrom/ default mount point for CD-ROM drives @@ -115,7 +114,7 @@ scripts that are run daily, weekly, and see .Xr periodic 8 .It Pa rc.d/ -System and daemon startup/control scripts; +system and daemon startup/control scripts; see .Xr rc 8 .It Pa security/ @@ -199,7 +198,7 @@ C++ include files C include files for the Common Access Methods Layer .Bl -tag -width "kerberos5/" -compact .It Pa scsi/ -The SCSI device on top of CAM +SCSI device on top of CAM .El .It Pa dev/ C include files for programming various @@ -207,7 +206,7 @@ C include files for programming various devices .Bl -tag -width "kerberos5/" -compact .It Pa ic/ -Various header files describing driver- and bus-independent +various header files describing driver- and bus-independent hardware circuits .It Pa ofw/ Open Firmware support @@ -216,17 +215,16 @@ Open Firmware support see .Xr pbio 4 .It Pa ppbus/ -The parallel port bus; +parallel port bus; see .Xr ppbus 4 .It Pa usb/ -The USB subsystem +USB subsystem .It Pa utopia/ -Physical chip driver for ATM interfaces; +physical chip driver for ATM interfaces; see .Xr utopia 4 .It Pa wi/ -The .Xr wi 4 WaveLAN driver .El @@ -527,7 +525,7 @@ Chinese translations of documents in /us .It Pa examples/ various examples for users and programmers .It Pa firmware/ -Firmware images loaded by userland programs +firmware images loaded by userland programs .It Pa games/ ASCII text files used by various games .It Pa groff_font/ @@ -584,7 +582,7 @@ example MIBs, example files and tree definitions for the SNMP daemon. .Bl -tag -width Fl -compact .It Pa defs/ -Tree definition files for use with +tree definition files for use with .Xr gensnmptree 1 .It Pa mibs/ MIB files @@ -656,7 +654,7 @@ third-party, and/or local source files .It Pa bin/ source code for files in /bin .It Pa cddl/ -Utilities covered by the Common Development and Distribution License +utilities covered by the Common Development and Distribution License .It Pa contrib/ source code for contributed software .It Pa crypto/ @@ -665,7 +663,7 @@ source code for contributed cryptography source code for files in .Pa /etc .It Pa gnu/ -Utilities covered by the GNU General Public License +utilities covered by the GNU General Public License .It Pa include/ source code for files in .Pa /usr/include From owner-svn-src-stable@freebsd.org Sun Apr 23 08:58:51 2017 Return-Path: Delivered-To: svn-src-stable@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 D3E60D4C38C; Sun, 23 Apr 2017 08:58:51 +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 8B563C1E; Sun, 23 Apr 2017 08:58:51 +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 v3N8wosT080344; Sun, 23 Apr 2017 08:58:50 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N8wote080342; Sun, 23 Apr 2017 08:58:50 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201704230858.v3N8wote080342@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:58:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317333 - in stable/11/sys: netinet6 netpfil/pf X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 08:58:51 -0000 Author: kp Date: Sun Apr 23 08:58:50 2017 New Revision: 317333 URL: https://svnweb.freebsd.org/changeset/base/317333 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/11/sys/netinet6/ip6_output.c stable/11/sys/netpfil/pf/pf_norm.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet6/ip6_output.c ============================================================================== --- stable/11/sys/netinet6/ip6_output.c Sun Apr 23 08:45:55 2017 (r317332) +++ stable/11/sys/netinet6/ip6_output.c Sun Apr 23 08:58:50 2017 (r317333) @@ -225,6 +225,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/11/sys/netpfil/pf/pf_norm.c ============================================================================== --- stable/11/sys/netpfil/pf/pf_norm.c Sun Apr 23 08:45:55 2017 (r317332) +++ stable/11/sys/netpfil/pf/pf_norm.c Sun Apr 23 08:58:50 2017 (r317333) @@ -762,6 +762,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@freebsd.org Sun Apr 23 08:59:58 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 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@freebsd.org Sun Apr 23 09:00:28 2017 Return-Path: Delivered-To: svn-src-stable@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 0EDD7D4C77C; Sun, 23 Apr 2017 09:00:28 +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 DE3F3133; Sun, 23 Apr 2017 09:00:27 +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 v3N90Rtv080628; Sun, 23 Apr 2017 09:00:27 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N90Rg4080627; Sun, 23 Apr 2017 09:00:27 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230900.v3N90Rg4080627@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 09:00:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317336 - stable/11/sys/dev/usb/storage X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 09:00:28 -0000 Author: mav Date: Sun Apr 23 09:00:26 2017 New Revision: 317336 URL: https://svnweb.freebsd.org/changeset/base/317336 Log: MFC r314254: Update kern_data_resid according to r312291. This now mandatory for correct operation. Modified: stable/11/sys/dev/usb/storage/cfumass.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/storage/cfumass.c ============================================================================== --- stable/11/sys/dev/usb/storage/cfumass.c Sun Apr 23 08:59:57 2017 (r317335) +++ stable/11/sys/dev/usb/storage/cfumass.c Sun Apr 23 09:00:26 2017 (r317336) @@ -720,11 +720,6 @@ cfumass_t_data_out_callback(struct usb_x int actlen, ctl_sg_count; sc = usbd_xfer_softc(xfer); - - CFUMASS_DEBUG(sc, "go"); - - usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); - io = sc->sc_ctl_io; if (io->scsiio.kern_sg_entries > 0) { @@ -741,25 +736,17 @@ cfumass_t_data_out_callback(struct usb_x case USB_ST_TRANSFERRED: CFUMASS_DEBUG(sc, "USB_ST_TRANSFERRED"); - /* - * If the host sent less data than required, zero-out - * the remaining buffer space, to prevent a malicious host - * to writing uninitialized kernel memory to the disk. - */ + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); if (actlen != ctl_sglist[0].len) { KASSERT(actlen <= ctl_sglist[0].len, ("actlen %d > ctl_sglist.len %zd", actlen, ctl_sglist[0].len)); - CFUMASS_DEBUG(sc, "host transferred %d bytes" "instead of expected %zd bytes", actlen, ctl_sglist[0].len); - - memset((char *)(ctl_sglist[0].addr) + actlen, 0, - ctl_sglist[0].len - actlen); } - - sc->sc_current_residue = 0; + sc->sc_current_residue -= actlen; + io->scsiio.kern_data_resid -= actlen; io->scsiio.be_move_done(io); sc->sc_ctl_io = NULL; break; @@ -795,17 +782,18 @@ cfumass_t_data_in_callback(struct usb_xf union ctl_io *io; uint32_t max_bulk; struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; - int ctl_sg_count; + int actlen, ctl_sg_count; sc = usbd_xfer_softc(xfer); - max_bulk = usbd_xfer_max_len(xfer); - io = sc->sc_ctl_io; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: CFUMASS_DEBUG(sc, "USB_ST_TRANSFERRED"); + usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); + sc->sc_current_residue -= actlen; + io->scsiio.kern_data_resid -= actlen; io->scsiio.be_move_done(io); sc->sc_ctl_io = NULL; break; @@ -829,12 +817,9 @@ tr_setup: "we will send %ju and stall", sc->sc_current_transfer_length, (uintmax_t)io->scsiio.kern_total_len); - sc->sc_current_residue = sc->sc_current_transfer_length - - io->scsiio.kern_total_len; - } else { - sc->sc_current_residue = 0; } + max_bulk = usbd_xfer_max_len(xfer); CFUMASS_DEBUG(sc, "max_bulk %d, requested size %d, " "CTL segment size %zd", max_bulk, sc->sc_current_transfer_length, ctl_sglist[0].len); @@ -956,8 +941,6 @@ cfumass_datamove(union ctl_io *io) goto fail; } - /* We hadn't received anything during this datamove yet. */ - io->scsiio.ext_data_filled = 0; cfumass_transfer_start(sc, CFUMASS_T_DATA_OUT); } @@ -1028,8 +1011,7 @@ cfumass_init(void) cfumass_port.frontend = &cfumass_frontend; cfumass_port.port_type = CTL_PORT_UMASS; - /* XXX KDM what should the real number be here? */ - cfumass_port.num_requested_ctl_io = 4096; + cfumass_port.num_requested_ctl_io = 1; cfumass_port.port_name = "cfumass"; cfumass_port.physical_port = 0; cfumass_port.virtual_port = 0; From owner-svn-src-stable@freebsd.org Sun Apr 23 09:01:03 2017 Return-Path: Delivered-To: svn-src-stable@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 1E223D4C7F8; Sun, 23 Apr 2017 09:01:03 +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 E24C52FB; Sun, 23 Apr 2017 09:01:02 +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 v3N912vg081576; Sun, 23 Apr 2017 09:01:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N912di081575; Sun, 23 Apr 2017 09:01:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230901.v3N912di081575@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 09:01:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317337 - stable/11/sys/dev/usb/storage X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 09:01:03 -0000 Author: mav Date: Sun Apr 23 09:01:01 2017 New Revision: 317337 URL: https://svnweb.freebsd.org/changeset/base/317337 Log: MFC r314256: Use ctl_queue_sense() to implement sense data reporting. USB MS BBB transport does not support autosense, so we have to queue any sense data back to CTL for later fetching via REQUEST SENSE. Modified: stable/11/sys/dev/usb/storage/cfumass.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/storage/cfumass.c ============================================================================== --- stable/11/sys/dev/usb/storage/cfumass.c Sun Apr 23 09:00:26 2017 (r317336) +++ stable/11/sys/dev/usb/storage/cfumass.c Sun Apr 23 09:01:01 2017 (r317337) @@ -987,19 +987,21 @@ cfumass_done(union ctl_io *io) return; } - switch (io->scsiio.scsi_status) { - case SCSI_STATUS_OK: + if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SUCCESS) sc->sc_current_status = 0; - break; - default: + else sc->sc_current_status = 1; - break; - } + + /* XXX: How should we report BUSY, RESERVATION CONFLICT, etc? */ + if ((io->io_hdr.status & CTL_STATUS_MASK) == CTL_SCSI_ERROR && + io->scsiio.scsi_status == SCSI_STATUS_CHECK_COND) + ctl_queue_sense(io); + else + ctl_free_io(io); CFUMASS_LOCK(sc); cfumass_transfer_start(sc, CFUMASS_T_STATUS); CFUMASS_UNLOCK(sc); - ctl_free_io(io); refcount_release(&sc->sc_queued); } From owner-svn-src-stable@freebsd.org Sun Apr 23 09:01:41 2017 Return-Path: Delivered-To: svn-src-stable@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 4C553D4C9B8; Sun, 23 Apr 2017 09:01:41 +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 271B184C; Sun, 23 Apr 2017 09:01:41 +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 v3N91eMn084472; Sun, 23 Apr 2017 09:01:40 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3N91eJm084471; Sun, 23 Apr 2017 09:01:40 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704230901.v3N91eJm084471@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 09:01:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317338 - stable/11/sys/dev/usb/storage X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 09:01:41 -0000 Author: mav Date: Sun Apr 23 09:01:40 2017 New Revision: 317338 URL: https://svnweb.freebsd.org/changeset/base/317338 Log: MFC r314290: Implement use of multiple transfers per I/O. This change removes limitation of single S/G list entry and limitation on maximal I/O size, using multiple data transfers per I/O if needed. Also it removes code duplication between send and receive paths, which are now completely equal. Modified: stable/11/sys/dev/usb/storage/cfumass.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/storage/cfumass.c ============================================================================== --- stable/11/sys/dev/usb/storage/cfumass.c Sun Apr 23 09:01:01 2017 (r317337) +++ stable/11/sys/dev/usb/storage/cfumass.c Sun Apr 23 09:01:40 2017 (r317338) @@ -200,8 +200,7 @@ static device_resume_t cfumass_resume; static usb_handle_request_t cfumass_handle_request; static usb_callback_t cfumass_t_command_callback; -static usb_callback_t cfumass_t_data_out_callback; -static usb_callback_t cfumass_t_data_in_callback; +static usb_callback_t cfumass_t_data_callback; static usb_callback_t cfumass_t_status_callback; static device_method_t cfumass_methods[] = { @@ -250,7 +249,7 @@ static struct usb_config cfumass_config[ .bufsize = CFUMASS_BULK_SIZE, .flags = {.proxy_buffer = 1, .short_xfer_ok = 1, .ext_buffer = 1}, - .callback = &cfumass_t_data_out_callback, + .callback = &cfumass_t_data_callback, .usb_mode = USB_MODE_DEVICE, }, @@ -261,7 +260,7 @@ static struct usb_config cfumass_config[ .bufsize = CFUMASS_BULK_SIZE, .flags = {.proxy_buffer = 1, .short_xfer_ok = 1, .ext_buffer = 1}, - .callback = &cfumass_t_data_in_callback, + .callback = &cfumass_t_data_callback, .usb_mode = USB_MODE_DEVICE, }, @@ -712,124 +711,66 @@ tr_setup: } static void -cfumass_t_data_out_callback(struct usb_xfer *xfer, usb_error_t usb_error) +cfumass_t_data_callback(struct usb_xfer *xfer, usb_error_t usb_error) { - struct cfumass_softc *sc; - union ctl_io *io; - struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; - int actlen, ctl_sg_count; - - sc = usbd_xfer_softc(xfer); - io = sc->sc_ctl_io; - - if (io->scsiio.kern_sg_entries > 0) { - ctl_sglist = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr; - ctl_sg_count = io->scsiio.kern_sg_entries; - } else { - ctl_sglist = &ctl_sg_entry; - ctl_sglist->addr = io->scsiio.kern_data_ptr; - ctl_sglist->len = io->scsiio.kern_data_len; - ctl_sg_count = 1; - } + struct cfumass_softc *sc = usbd_xfer_softc(xfer); + union ctl_io *io = sc->sc_ctl_io; + uint32_t max_bulk; + struct ctl_sg_entry sg_entry, *sglist; + int actlen, sumlen, sg_count; switch (USB_GET_STATE(xfer)) { case USB_ST_TRANSFERRED: CFUMASS_DEBUG(sc, "USB_ST_TRANSFERRED"); - usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); - if (actlen != ctl_sglist[0].len) { - KASSERT(actlen <= ctl_sglist[0].len, - ("actlen %d > ctl_sglist.len %zd", - actlen, ctl_sglist[0].len)); - CFUMASS_DEBUG(sc, "host transferred %d bytes" - "instead of expected %zd bytes", - actlen, ctl_sglist[0].len); - } + usbd_xfer_status(xfer, &actlen, &sumlen, NULL, NULL); sc->sc_current_residue -= actlen; + io->scsiio.ext_data_filled += actlen; io->scsiio.kern_data_resid -= actlen; - io->scsiio.be_move_done(io); - sc->sc_ctl_io = NULL; - break; - - case USB_ST_SETUP: -tr_setup: - CFUMASS_DEBUG(sc, "USB_ST_SETUP"); - - CFUMASS_DEBUG(sc, "requested size %d, CTL segment size %zd", - sc->sc_current_transfer_length, ctl_sglist[0].len); - - usbd_xfer_set_frame_data(xfer, 0, ctl_sglist[0].addr, ctl_sglist[0].len); - usbd_transfer_submit(xfer); - break; - - default: - if (usb_error == USB_ERR_CANCELLED) { - CFUMASS_DEBUG(sc, "USB_ERR_CANCELLED"); + if (actlen < sumlen || + sc->sc_current_residue == 0 || + io->scsiio.kern_data_resid == 0) { + sc->sc_ctl_io = NULL; + io->scsiio.be_move_done(io); break; } - - CFUMASS_DEBUG(sc, "USB_ST_ERROR: %s", - usbd_errstr(usb_error)); - - goto tr_setup; - } -} - -static void -cfumass_t_data_in_callback(struct usb_xfer *xfer, usb_error_t usb_error) -{ - struct cfumass_softc *sc; - union ctl_io *io; - uint32_t max_bulk; - struct ctl_sg_entry ctl_sg_entry, *ctl_sglist; - int actlen, ctl_sg_count; - - sc = usbd_xfer_softc(xfer); - io = sc->sc_ctl_io; - - switch (USB_GET_STATE(xfer)) { - case USB_ST_TRANSFERRED: - CFUMASS_DEBUG(sc, "USB_ST_TRANSFERRED"); - - usbd_xfer_status(xfer, &actlen, NULL, NULL, NULL); - sc->sc_current_residue -= actlen; - io->scsiio.kern_data_resid -= actlen; - io->scsiio.be_move_done(io); - sc->sc_ctl_io = NULL; - break; + /* FALLTHROUGH */ case USB_ST_SETUP: tr_setup: CFUMASS_DEBUG(sc, "USB_ST_SETUP"); if (io->scsiio.kern_sg_entries > 0) { - ctl_sglist = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr; - ctl_sg_count = io->scsiio.kern_sg_entries; + sglist = (struct ctl_sg_entry *)io->scsiio.kern_data_ptr; + sg_count = io->scsiio.kern_sg_entries; } else { - ctl_sglist = &ctl_sg_entry; - ctl_sglist->addr = io->scsiio.kern_data_ptr; - ctl_sglist->len = io->scsiio.kern_data_len; - ctl_sg_count = 1; + sglist = &sg_entry; + sglist->addr = io->scsiio.kern_data_ptr; + sglist->len = io->scsiio.kern_data_len; + sg_count = 1; } - if (sc->sc_current_transfer_length > io->scsiio.kern_total_len) { - CFUMASS_DEBUG(sc, "initiator requested %d bytes, " - "we will send %ju and stall", - sc->sc_current_transfer_length, - (uintmax_t)io->scsiio.kern_total_len); + sumlen = io->scsiio.ext_data_filled - + io->scsiio.kern_rel_offset; + while (sumlen >= sglist->len && sg_count > 0) { + sumlen -= sglist->len; + sglist++; + sg_count--; } + KASSERT(sg_count > 0, ("Run out of S/G list entries")); max_bulk = usbd_xfer_max_len(xfer); - CFUMASS_DEBUG(sc, "max_bulk %d, requested size %d, " - "CTL segment size %zd", max_bulk, - sc->sc_current_transfer_length, ctl_sglist[0].len); - - if (max_bulk >= ctl_sglist[0].len) - max_bulk = ctl_sglist[0].len; + actlen = min(sglist->len - sumlen, max_bulk); + actlen = min(actlen, sc->sc_current_transfer_length - + io->scsiio.ext_data_filled); + CFUMASS_DEBUG(sc, "requested %d, done %d, max_bulk %d, " + "segment %zd => transfer %d", + sc->sc_current_transfer_length, io->scsiio.ext_data_filled, + max_bulk, sglist->len - sumlen, actlen); - usbd_xfer_set_frame_data(xfer, 0, ctl_sglist[0].addr, max_bulk); + usbd_xfer_set_frame_data(xfer, 0, + (uint8_t *)sglist->addr + sumlen, actlen); usbd_transfer_submit(xfer); - break; default: @@ -837,9 +778,7 @@ tr_setup: CFUMASS_DEBUG(sc, "USB_ERR_CANCELLED"); break; } - CFUMASS_DEBUG(sc, "USB_ST_ERROR: %s", usbd_errstr(usb_error)); - goto tr_setup; } } From owner-svn-src-stable@freebsd.org Sun Apr 23 10:29:10 2017 Return-Path: Delivered-To: svn-src-stable@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 CF9D4D4CA3C; Sun, 23 Apr 2017 10:29:10 +0000 (UTC) (envelope-from bcr@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 9684DB43; Sun, 23 Apr 2017 10:29:10 +0000 (UTC) (envelope-from bcr@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3NAT90h018102; Sun, 23 Apr 2017 10:29:09 GMT (envelope-from bcr@FreeBSD.org) Received: (from bcr@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NAT9Xs018101; Sun, 23 Apr 2017 10:29:09 GMT (envelope-from bcr@FreeBSD.org) Message-Id: <201704231029.v3NAT9Xs018101@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bcr set sender to bcr@FreeBSD.org using -f From: Benedict Reuschling Date: Sun, 23 Apr 2017 10:29:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317339 - stable/11/sbin/setkey X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 10:29:10 -0000 Author: bcr (doc committer) Date: Sun Apr 23 10:29:09 2017 New Revision: 317339 URL: https://svnweb.freebsd.org/changeset/base/317339 Log: MFC r316657: Make setkey(8) more clear about anti-replay window size option semantics. PR: 172913 Submitted by: john@saltant.com Reviewed by: ae@ Differential Revision: https://reviews.freebsd.org/D10304 Modified: stable/11/sbin/setkey/setkey.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/setkey/setkey.8 ============================================================================== --- stable/11/sbin/setkey/setkey.8 Sun Apr 23 09:01:40 2017 (r317338) +++ stable/11/sbin/setkey/setkey.8 Sun Apr 23 10:29:09 2017 (r317339) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 5, 2017 +.Dd April 9, 2017 .Dt SETKEY 8 .Os .\" @@ -290,12 +290,13 @@ The default value is .Li any . .\" .It Fl r Ar size -Specify window size of bytes for replay prevention. +Specify the bitmap size in octets of the anti-replay window. .Ar size -must be decimal number in 32-bit word. +is a 32-bit unsigned integer, and its value is one eighth of the +anti-replay window size in packets. If .Ar size -is zero or not specified, replay check does not take place. +is zero or not specified, an anti-replay check does not take place. .\" .It Fl u Ar id Specify the identifier of the policy entry in SPD. From owner-svn-src-stable@freebsd.org Sun Apr 23 20:32:49 2017 Return-Path: Delivered-To: svn-src-stable@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 16BFBD4D22E; Sun, 23 Apr 2017 20:32:49 +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 DAB2C12BC; Sun, 23 Apr 2017 20:32:48 +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 v3NKWmBV069187; Sun, 23 Apr 2017 20:32:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3NKWkpm069169; Sun, 23 Apr 2017 20:32:46 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704232032.v3NKWkpm069169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 23 Apr 2017 20:32:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317342 - in stable/11: include lib/libc/include lib/libc/stdlib lib/libc/string lib/libc/tests/stdlib lib/libc/tests/string sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 23 Apr 2017 20:32:49 -0000 Author: kib Date: Sun Apr 23 20:32:46 2017 New Revision: 317342 URL: https://svnweb.freebsd.org/changeset/base/317342 Log: MFC r316213: Implement the memset_s(3) function as specified by the C11 ISO/IEC 9899:2011 Appendix K 3.7.4.1. MFC r316258: Only activate __EXT1_VISIBLE block when using sys/errno.h in userspace. Added: stable/11/lib/libc/stdlib/set_constraint_handler_s.c - copied unchanged from r316213, head/lib/libc/stdlib/set_constraint_handler_s.c stable/11/lib/libc/string/memset_s.c - copied unchanged from r316213, head/lib/libc/string/memset_s.c stable/11/lib/libc/tests/stdlib/set_constraint_handler_s_test.c - copied unchanged from r316213, head/lib/libc/tests/stdlib/set_constraint_handler_s_test.c stable/11/lib/libc/tests/string/memset_s_test.c - copied unchanged from r316213, head/lib/libc/tests/string/memset_s_test.c Modified: stable/11/include/stddef.h stable/11/include/stdlib.h stable/11/include/string.h stable/11/lib/libc/include/libc_private.h stable/11/lib/libc/stdlib/Makefile.inc stable/11/lib/libc/stdlib/Symbol.map stable/11/lib/libc/string/Makefile.inc stable/11/lib/libc/string/Symbol.map stable/11/lib/libc/tests/stdlib/Makefile stable/11/lib/libc/tests/string/Makefile stable/11/sys/sys/cdefs.h stable/11/sys/sys/errno.h stable/11/sys/sys/stdint.h Directory Properties: stable/11/ (props changed) Modified: stable/11/include/stddef.h ============================================================================== --- stable/11/include/stddef.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/include/stddef.h Sun Apr 23 20:32:46 2017 (r317342) @@ -72,4 +72,12 @@ typedef __max_align_t max_align_t; #define offsetof(type, member) __offsetof(type, member) +#if __EXT1_VISIBLE +/* ISO/IEC 9899:2011 K.3.3.2 */ +#ifndef _RSIZE_T_DEFINED +#define _RSIZE_T_DEFINED +typedef size_t rsize_t; +#endif +#endif /* __EXT1_VISIBLE */ + #endif /* _STDDEF_H_ */ Modified: stable/11/include/stdlib.h ============================================================================== --- stable/11/include/stdlib.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/include/stdlib.h Sun Apr 23 20:32:46 2017 (r317342) @@ -327,6 +327,26 @@ __uint64_t extern char *suboptarg; /* getsubopt(3) external variable */ #endif /* __BSD_VISIBLE */ + +#if __EXT1_VISIBLE + +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif + +/* K.3.6 */ +typedef void (*constraint_handler_t)(const char * __restrict, + void * __restrict, errno_t); +/* K.3.6.1.1 */ +constraint_handler_t set_constraint_handler_s(constraint_handler_t handler); +/* K.3.6.1.2 */ +_Noreturn void abort_handler_s(const char * __restrict, void * __restrict, + errno_t); +/* K3.6.1.3 */ +void ignore_handler_s(const char * __restrict, void * __restrict, errno_t); +#endif /* __EXT1_VISIBLE */ + __END_DECLS __NULLABILITY_PRAGMA_POP Modified: stable/11/include/string.h ============================================================================== --- stable/11/include/string.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/include/string.h Sun Apr 23 20:32:46 2017 (r317342) @@ -139,6 +139,22 @@ void swab(const void * __restrict, void #if __POSIX_VISIBLE >= 200809 || defined(_XLOCALE_H_) #include #endif + +#if __EXT1_VISIBLE + +#ifndef _RSIZE_T_DEFINED +#define _RSIZE_T_DEFINED +typedef size_t rsize_t; +#endif + +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif + +/* ISO/IEC 9899:2011 K.3.7.4.1.1 */ +errno_t memset_s(void *, rsize_t, int, rsize_t); +#endif /* __EXT1_VISIBLE */ __END_DECLS #endif /* _STRING_H_ */ Modified: stable/11/lib/libc/include/libc_private.h ============================================================================== --- stable/11/lib/libc/include/libc_private.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/include/libc_private.h Sun Apr 23 20:32:46 2017 (r317342) @@ -401,4 +401,6 @@ void __libc_map_stacks_exec(void); void _pthread_cancel_enter(int); void _pthread_cancel_leave(int); +void __throw_constraint_handler_s(const char * restrict msg, int error); + #endif /* _LIBC_PRIVATE_H_ */ Modified: stable/11/lib/libc/stdlib/Makefile.inc ============================================================================== --- stable/11/lib/libc/stdlib/Makefile.inc Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/stdlib/Makefile.inc Sun Apr 23 20:32:46 2017 (r317342) @@ -13,8 +13,8 @@ MISRCS+=C99_Exit.c a64l.c abort.c abs.c insque.c l64a.c labs.c ldiv.c llabs.c lldiv.c lsearch.c \ merge.c mergesort_b.c ptsname.c qsort.c qsort_r.c quick_exit.c \ radixsort.c rand.c \ - random.c reallocarray.c reallocf.c realpath.c remque.c strfmon.c \ - strtoimax.c \ + random.c reallocarray.c reallocf.c realpath.c remque.c \ + set_constraint_handler_s.c strfmon.c strtoimax.c \ strtol.c strtoll.c strtoq.c strtoul.c strtonum.c strtoull.c \ strtoumax.c strtouq.c system.c tdelete.c tfind.c tsearch.c twalk.c Modified: stable/11/lib/libc/stdlib/Symbol.map ============================================================================== --- stable/11/lib/libc/stdlib/Symbol.map Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/stdlib/Symbol.map Sun Apr 23 20:32:46 2017 (r317342) @@ -119,6 +119,9 @@ FBSD_1.4 { FBSD_1.5 { __cxa_thread_atexit; __cxa_thread_atexit_impl; + abort_handler_s; + ignore_handler_s; + set_constraint_handler_s; }; FBSDprivate_1.0 { Copied: stable/11/lib/libc/stdlib/set_constraint_handler_s.c (from r316213, head/lib/libc/stdlib/set_constraint_handler_s.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libc/stdlib/set_constraint_handler_s.c Sun Apr 23 20:32:46 2017 (r317342, copy of r316213, head/lib/libc/stdlib/set_constraint_handler_s.c) @@ -0,0 +1,95 @@ +/*- + * Copyright (c) 2017 Juniper Networks. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "namespace.h" +#include +#include +#include +#include +#include +#include +#include "un-namespace.h" +#include "libc_private.h" + +/* + * Rationale recommends allocating new memory each time. + */ +static constraint_handler_t *_ch = NULL; +static pthread_mutex_t ch_lock = PTHREAD_MUTEX_INITIALIZER; + +constraint_handler_t +set_constraint_handler_s(constraint_handler_t handler) +{ + constraint_handler_t *new, *old, ret; + + new = malloc(sizeof(constraint_handler_t)); + if (new == NULL) + return (NULL); + *new = handler; + if (__isthreaded) + _pthread_mutex_lock(&ch_lock); + old = _ch; + _ch = new; + if (__isthreaded) + _pthread_mutex_unlock(&ch_lock); + if (old == NULL) { + ret = NULL; + } else { + ret = *old; + free(old); + } + return (ret); +} + +void +__throw_constraint_handler_s(const char * restrict msg, errno_t error) +{ + constraint_handler_t ch; + + if (__isthreaded) + _pthread_mutex_lock(&ch_lock); + ch = _ch != NULL ? *_ch : NULL; + if (__isthreaded) + _pthread_mutex_unlock(&ch_lock); + if (ch != NULL) + ch(msg, NULL, error); +} + +void +abort_handler_s(const char * restrict msg __unused, + void * restrict ptr __unused, errno_t error __unused) +{ + + abort(); +} + +void +ignore_handler_s(const char * restrict msg __unused, + void * restrict ptr __unused, errno_t error __unused) +{ +} Modified: stable/11/lib/libc/string/Makefile.inc ============================================================================== --- stable/11/lib/libc/string/Makefile.inc Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/string/Makefile.inc Sun Apr 23 20:32:46 2017 (r317342) @@ -10,7 +10,7 @@ CFLAGS+= -I${LIBC_SRCTOP}/locale MISRCS+=bcmp.c bcopy.c bzero.c explicit_bzero.c \ ffs.c ffsl.c ffsll.c fls.c flsl.c flsll.c \ memccpy.c memchr.c memrchr.c memcmp.c \ - memcpy.c memmem.c memmove.c memset.c \ + memcpy.c memmem.c memmove.c memset.c memset_s.c \ stpcpy.c stpncpy.c strcasecmp.c \ strcat.c strcasestr.c strchr.c strchrnul.c strcmp.c strcoll.c strcpy.c\ strcspn.c strdup.c strerror.c strlcat.c strlcpy.c strlen.c strmode.c \ Modified: stable/11/lib/libc/string/Symbol.map ============================================================================== --- stable/11/lib/libc/string/Symbol.map Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/string/Symbol.map Sun Apr 23 20:32:46 2017 (r317342) @@ -104,6 +104,10 @@ FBSD_1.4 { explicit_bzero; }; +FBSD_1.5 { + memset_s; +}; + FBSDprivate_1.0 { __strtok_r; }; Copied: stable/11/lib/libc/string/memset_s.c (from r316213, head/lib/libc/string/memset_s.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libc/string/memset_s.c Sun Apr 23 20:32:46 2017 (r317342, copy of r316213, head/lib/libc/string/memset_s.c) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2017 Juniper Networks. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include "libc_private.h" + +/* ISO/IEC 9899:2011 K.3.7.4.1 */ +errno_t +memset_s(void *s, rsize_t smax, int c, rsize_t n) +{ + errno_t ret; + rsize_t lim; + unsigned char v; + volatile unsigned char *dst; + + ret = EINVAL; + lim = smax; + v = (unsigned char)c; + dst = (unsigned char *)s; + if (s == NULL) { + __throw_constraint_handler_s("memset_s : s is NULL", ret); + } else if (smax > RSIZE_MAX) { + __throw_constraint_handler_s("memset_s : smax > RSIZE_MAX", + ret); + } else if (n > RSIZE_MAX) { + __throw_constraint_handler_s("memset_s : n > RSIZE_MAX", ret); + } else { + if (n < smax) + lim = n; + while (lim > 0) + dst[--lim] = v; + ret = 0; + } + return (ret); +} Modified: stable/11/lib/libc/tests/stdlib/Makefile ============================================================================== --- stable/11/lib/libc/tests/stdlib/Makefile Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/tests/stdlib/Makefile Sun Apr 23 20:32:46 2017 (r317342) @@ -5,6 +5,7 @@ ATF_TESTS_C+= heapsort_test ATF_TESTS_C+= mergesort_test ATF_TESTS_C+= qsort_test +ATF_TESTS_C+= set_constraint_handler_s_test ATF_TESTS_C+= tsearch_test .if ${COMPILER_FEATURES:Mc++11} ATF_TESTS_CXX+= cxa_thread_atexit_test Copied: stable/11/lib/libc/tests/stdlib/set_constraint_handler_s_test.c (from r316213, head/lib/libc/tests/stdlib/set_constraint_handler_s_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libc/tests/stdlib/set_constraint_handler_s_test.c Sun Apr 23 20:32:46 2017 (r317342, copy of r316213, head/lib/libc/tests/stdlib/set_constraint_handler_s_test.c) @@ -0,0 +1,63 @@ +/*- + * Copyright (c) 2017 Juniper Networks. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include + +#include + +/* null */ +ATF_TC_WITHOUT_HEAD(null_handler); +ATF_TC_BODY(null_handler, tc) +{ + assert(set_constraint_handler_s(abort_handler_s) == NULL); +} + +/* abort handler */ +ATF_TC_WITHOUT_HEAD(abort_handler); +ATF_TC_BODY(abort_handler, tc) +{ + set_constraint_handler_s(abort_handler_s); + assert(set_constraint_handler_s(ignore_handler_s) == abort_handler_s); +} + +/* ignore handler */ +ATF_TC_WITHOUT_HEAD(ignore_handler); +ATF_TC_BODY(ignore_handler, tc) +{ + set_constraint_handler_s(ignore_handler_s); + assert(set_constraint_handler_s(abort_handler_s) == ignore_handler_s); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, null_handler); + ATF_TP_ADD_TC(tp, abort_handler); + ATF_TP_ADD_TC(tp, ignore_handler); + return (atf_no_error()); +} Modified: stable/11/lib/libc/tests/string/Makefile ============================================================================== --- stable/11/lib/libc/tests/string/Makefile Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/lib/libc/tests/string/Makefile Sun Apr 23 20:32:46 2017 (r317342) @@ -1,6 +1,7 @@ # $FreeBSD$ ATF_TESTS_C+= memcmp_test +ATF_TESTS_C+= memset_s_test ATF_TESTS_C+= stpncpy_test ATF_TESTS_C+= strerror2_test ATF_TESTS_C+= wcscasecmp_test Copied: stable/11/lib/libc/tests/string/memset_s_test.c (from r316213, head/lib/libc/tests/string/memset_s_test.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/lib/libc/tests/string/memset_s_test.c Sun Apr 23 20:32:46 2017 (r317342, copy of r316213, head/lib/libc/tests/string/memset_s_test.c) @@ -0,0 +1,195 @@ +/*- + * Copyright (c) 2017 Juniper Networks. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include + +static errno_t e; +static const char * restrict m; + +void +h(const char * restrict msg, void * restrict ptr __unused, errno_t error) +{ + e = error; + m = msg; +} + +/* null ptr */ +ATF_TC_WITHOUT_HEAD(null_ptr); +ATF_TC_BODY(null_ptr, tc) +{ + assert(memset_s(0, 1, 1, 1) != 0); +} + +/* smax > rmax */ +ATF_TC_WITHOUT_HEAD(smax_gt_rmax); +ATF_TC_BODY(smax_gt_rmax, tc) +{ + char b; + + assert(memset_s(&b, RSIZE_MAX + 1, 1, 1) != 0); +} + +/* smax < 0 */ +ATF_TC_WITHOUT_HEAD(smax_lt_zero); +ATF_TC_BODY(smax_lt_zero, tc) +{ + char b; + + assert(memset_s(&b, -1, 1, 1) != 0); +} + +/* normal */ +ATF_TC_WITHOUT_HEAD(normal); +ATF_TC_BODY(normal, tc) +{ + char b; + + b = 3; + assert(memset_s(&b, 1, 5, 1) == 0); + assert(b == 5); +} + +/* n > rmax */ +ATF_TC_WITHOUT_HEAD(n_gt_rmax); +ATF_TC_BODY(n_gt_rmax, tc) +{ + char b; + + assert(memset_s(&b, 1, 1, RSIZE_MAX + 1) != 0); +} + +/* n < 0 */ +ATF_TC_WITHOUT_HEAD(n_lt_zero); +ATF_TC_BODY(n_lt_zero, tc) +{ + char b; + + assert(memset_s(&b, 1, 1, -1) != 0); +} + +/* n < smax */ +ATF_TC_WITHOUT_HEAD(n_lt_smax); +ATF_TC_BODY(n_lt_smax, tc) +{ + char b[3] = {1, 2, 3}; + + assert(memset_s(&b[0], 3, 9, 1) == 0); + assert(b[0] == 9); + assert(b[1] == 2); + assert(b[2] == 3); +} + +/* n > smax */ +ATF_TC_WITHOUT_HEAD(n_gt_smax); +ATF_TC_BODY(n_gt_smax, tc) +{ + char b[3] = {1, 2, 3}; + + assert(memset_s(&b[0], 1, 9, 3) == 0); + assert(b[0] == 9); + assert(b[1] == 2); + assert(b[2] == 3); +} + +/* smax > rmax, handler */ +ATF_TC_WITHOUT_HEAD(smax_gt_rmax_handler); +ATF_TC_BODY(smax_gt_rmax_handler, tc) +{ + char b; + + e = 0; + m = NULL; + set_constraint_handler_s(h); + assert(memset_s(&b, RSIZE_MAX + 1, 1, 1) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s : smax > RSIZE_MAX") == 0); +} + +/* smax < 0, handler */ +ATF_TC_WITHOUT_HEAD(smax_lt_zero_handler); +ATF_TC_BODY(smax_lt_zero_handler, tc) +{ + char b; + + e = 0; + m = NULL; + set_constraint_handler_s(h); + assert(memset_s(&b, -1, 1, 1) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s : smax > RSIZE_MAX") == 0); +} + +/* n > rmax, handler */ +ATF_TC_WITHOUT_HEAD(n_gt_rmax_handler); +ATF_TC_BODY(n_gt_rmax_handler, tc) +{ + char b; + + e = 0; + m = NULL; + set_constraint_handler_s(h); + assert(memset_s(&b, 1, 1, RSIZE_MAX + 1) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s : n > RSIZE_MAX") == 0); +} + +/* n < 0, handler */ +ATF_TC_WITHOUT_HEAD(n_lt_zero_handler); +ATF_TC_BODY(n_lt_zero_handler, tc) +{ + char b; + + e = 0; + m = NULL; + set_constraint_handler_s(h); + assert(memset_s(&b, 1, 1, -1) != 0); + assert(e > 0); + assert(strcmp(m, "memset_s : n > RSIZE_MAX") == 0); +} + +ATF_TP_ADD_TCS(tp) +{ + ATF_TP_ADD_TC(tp, null_ptr); + ATF_TP_ADD_TC(tp, smax_gt_rmax); + ATF_TP_ADD_TC(tp, smax_lt_zero); + ATF_TP_ADD_TC(tp, normal); + ATF_TP_ADD_TC(tp, n_gt_rmax); + ATF_TP_ADD_TC(tp, n_lt_zero); + ATF_TP_ADD_TC(tp, n_gt_smax); + ATF_TP_ADD_TC(tp, n_lt_smax); + ATF_TP_ADD_TC(tp, smax_gt_rmax_handler); + ATF_TP_ADD_TC(tp, smax_lt_zero_handler); + ATF_TP_ADD_TC(tp, n_gt_rmax_handler); + ATF_TP_ADD_TC(tp, n_lt_zero_handler); + return (atf_no_error()); +} Modified: stable/11/sys/sys/cdefs.h ============================================================================== --- stable/11/sys/sys/cdefs.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/sys/sys/cdefs.h Sun Apr 23 20:32:46 2017 (r317342) @@ -758,24 +758,38 @@ #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 1990 +#define __EXT1_VISIBLE 0 #elif defined(_C99_SOURCE) /* Localism to specify strict C99 env. */ #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 1999 +#define __EXT1_VISIBLE 0 #elif defined(_C11_SOURCE) /* Localism to specify strict C11 env. */ #define __POSIX_VISIBLE 0 #define __XSI_VISIBLE 0 #define __BSD_VISIBLE 0 #define __ISO_C_VISIBLE 2011 +#define __EXT1_VISIBLE 0 #else /* Default environment: show everything. */ #define __POSIX_VISIBLE 200809 #define __XSI_VISIBLE 700 #define __BSD_VISIBLE 1 #define __ISO_C_VISIBLE 2011 +#define __EXT1_VISIBLE 1 #endif #endif +/* User override __EXT1_VISIBLE */ +#if defined(__STDC_WANT_LIB_EXT1__) +#undef __EXT1_VISIBLE +#if __STDC_WANT_LIB_EXT1__ +#define __EXT1_VISIBLE 1 +#else +#define __EXT1_VISIBLE 0 +#endif +#endif /* __STDC_WANT_LIB_EXT1__ */ + #if defined(__mips) || defined(__powerpc64__) || defined(__riscv__) #define __NO_TLS 1 #endif Modified: stable/11/sys/sys/errno.h ============================================================================== --- stable/11/sys/sys/errno.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/sys/sys/errno.h Sun Apr 23 20:32:46 2017 (r317342) @@ -193,4 +193,14 @@ __END_DECLS #define ERELOOKUP (-5) /* retry the directory lookup */ #endif +#ifndef _KERNEL +#if __EXT1_VISIBLE +/* ISO/IEC 9899:2011 K.3.2.2 */ +#ifndef _ERRNO_T_DEFINED +#define _ERRNO_T_DEFINED +typedef int errno_t; +#endif +#endif /* __EXT1_VISIBLE */ +#endif + #endif Modified: stable/11/sys/sys/stdint.h ============================================================================== --- stable/11/sys/sys/stdint.h Sun Apr 23 17:39:31 2017 (r317341) +++ stable/11/sys/sys/stdint.h Sun Apr 23 20:32:46 2017 (r317342) @@ -66,4 +66,11 @@ typedef __uint_fast64_t uint_fast64_t; #define WCHAR_MIN __WCHAR_MIN #define WCHAR_MAX __WCHAR_MAX +#if __EXT1_VISIBLE +/* ISO/IEC 9899:2011 K.3.4.4 */ +#ifndef RSIZE_MAX +#define RSIZE_MAX (SIZE_MAX >> 1) +#endif +#endif /* __EXT1_VISIBLE */ + #endif /* !_SYS_STDINT_H_ */ From owner-svn-src-stable@freebsd.org Mon Apr 24 06:32:36 2017 Return-Path: Delivered-To: svn-src-stable@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 CDFC6D4CEB2; Mon, 24 Apr 2017 06:32:36 +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 914C415C1; Mon, 24 Apr 2017 06:32:36 +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 v3O6WZkn012091; Mon, 24 Apr 2017 06:32:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3O6WZvS012089; Mon, 24 Apr 2017 06:32:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704240632.v3O6WZvS012089@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:32:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317351 - stable/11/usr.sbin/ctld X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 06:32:36 -0000 Author: mav Date: Mon Apr 24 06:32:35 2017 New Revision: 317351 URL: https://svnweb.freebsd.org/changeset/base/317351 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/11/usr.sbin/ctld/ctld.c stable/11/usr.sbin/ctld/ctld.h Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/ctld/ctld.c ============================================================================== --- stable/11/usr.sbin/ctld/ctld.c Sun Apr 23 23:09:02 2017 (r317350) +++ stable/11/usr.sbin/ctld/ctld.c Mon Apr 24 06:32:35 2017 (r317351) @@ -1237,7 +1237,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); } @@ -1310,6 +1309,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) { @@ -1885,10 +1897,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); @@ -2008,11 +2020,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/11/usr.sbin/ctld/ctld.h ============================================================================== --- stable/11/usr.sbin/ctld/ctld.h Sun Apr 23 23:09:02 2017 (r317350) +++ stable/11/usr.sbin/ctld/ctld.h Mon Apr 24 06:32:35 2017 (r317351) @@ -151,7 +151,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; }; @@ -371,6 +370,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@freebsd.org Mon Apr 24 06:33:09 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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@freebsd.org Mon Apr 24 07:52:46 2017 Return-Path: Delivered-To: svn-src-stable@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 1C116D4C398; Mon, 24 Apr 2017 07:52:46 +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 DF6C71C54; Mon, 24 Apr 2017 07:52:45 +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 v3O7qjRn044431; Mon, 24 Apr 2017 07:52:45 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3O7qigH044430; Mon, 24 Apr 2017 07:52:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704240752.v3O7qigH044430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 24 Apr 2017 07:52:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317354 - stable/11/sys/arm64/arm64 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 07:52:46 -0000 Author: kib Date: Mon Apr 24 07:52:44 2017 New Revision: 317354 URL: https://svnweb.freebsd.org/changeset/base/317354 Log: MFC r316679: Do not lose dirty bits for removing PROT_WRITE on arm64. Modified: stable/11/sys/arm64/arm64/pmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/arm64/arm64/pmap.c ============================================================================== --- stable/11/sys/arm64/arm64/pmap.c Mon Apr 24 07:52:27 2017 (r317353) +++ stable/11/sys/arm64/arm64/pmap.c Mon Apr 24 07:52:44 2017 (r317354) @@ -2481,6 +2481,11 @@ pmap_protect(pmap_t pmap, vm_offset_t sv sva += L3_SIZE) { l3 = pmap_load(l3p); if (pmap_l3_valid(l3)) { + if ((l3 & ATTR_SW_MANAGED) && + pmap_page_dirty(l3)) { + vm_page_dirty(PHYS_TO_VM_PAGE(l3 & + ~ATTR_MASK)); + } pmap_set(l3p, ATTR_AP(ATTR_AP_RO)); PTE_SYNC(l3p); /* XXX: Use pmap_invalidate_range */ From owner-svn-src-stable@freebsd.org Mon Apr 24 10:19:27 2017 Return-Path: Delivered-To: svn-src-stable@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 E26D8D4D342; Mon, 24 Apr 2017 10:19:27 +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 AAAB7ABA; Mon, 24 Apr 2017 10:19:27 +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 v3OAJQmA001744; Mon, 24 Apr 2017 10:19:26 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OAJQAF001739; Mon, 24 Apr 2017 10:19:26 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241019.v3OAJQAF001739@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 10:19:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317357 - stable/11/sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 10:19:28 -0000 Author: mav Date: Mon Apr 24 10:19:26 2017 New Revision: 317357 URL: https://svnweb.freebsd.org/changeset/base/317357 Log: MFC r315708: Cleanup response queue processing. Modified: stable/11/sys/dev/isp/isp.c stable/11/sys/dev/isp/isp_freebsd.c stable/11/sys/dev/isp/isp_freebsd.h stable/11/sys/dev/isp/ispvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp.c ============================================================================== --- stable/11/sys/dev/isp/isp.c Mon Apr 24 10:16:12 2017 (r317356) +++ stable/11/sys/dev/isp/isp.c Mon Apr 24 10:19:26 2017 (r317357) @@ -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/11/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:16:12 2017 (r317356) +++ stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:19:26 2017 (r317357) @@ -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/11/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:16:12 2017 (r317356) +++ stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:19:26 2017 (r317357) @@ -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/11/sys/dev/isp/ispvar.h ============================================================================== --- stable/11/sys/dev/isp/ispvar.h Mon Apr 24 10:16:12 2017 (r317356) +++ stable/11/sys/dev/isp/ispvar.h Mon Apr 24 10:19:26 2017 (r317357) @@ -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@freebsd.org Mon Apr 24 10:20:01 2017 Return-Path: Delivered-To: svn-src-stable@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 01A1BD4D3D1; Mon, 24 Apr 2017 10:20:01 +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 C77B1C66; Mon, 24 Apr 2017 10:20:00 +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 v3OAJxJ9001816; Mon, 24 Apr 2017 10:19:59 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OAJxMx001814; Mon, 24 Apr 2017 10:19:59 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241019.v3OAJxMx001814@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 10:19:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317358 - stable/11/sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 10:20:01 -0000 Author: mav Date: Mon Apr 24 10:19:59 2017 New Revision: 317358 URL: https://svnweb.freebsd.org/changeset/base/317358 Log: MFC r315869: Remove write-only crn field from struct isp_pcmd. Modified: stable/11/sys/dev/isp/isp_freebsd.c stable/11/sys/dev/isp/isp_freebsd.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:19:26 2017 (r317357) +++ stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:19:59 2017 (r317358) @@ -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); @@ -4208,7 +4207,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/11/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:19:26 2017 (r317357) +++ stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:19:59 2017 (r317358) @@ -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@freebsd.org Mon Apr 24 10:20:37 2017 Return-Path: Delivered-To: svn-src-stable@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 66E41D4D47D; Mon, 24 Apr 2017 10:20:37 +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 36E2DDC1; Mon, 24 Apr 2017 10:20:37 +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 v3OAKaZv001918; Mon, 24 Apr 2017 10:20:36 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OAKaqR001917; Mon, 24 Apr 2017 10:20:36 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241020.v3OAKaqR001917@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 10:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317359 - stable/11/sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 10:20:37 -0000 Author: mav Date: Mon Apr 24 10:20:36 2017 New Revision: 317359 URL: https://svnweb.freebsd.org/changeset/base/317359 Log: MFC r315870: isp field in struct isp_pcmd is also unused. Modified: stable/11/sys/dev/isp/isp_freebsd.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:19:59 2017 (r317358) +++ stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:20:36 2017 (r317359) @@ -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@freebsd.org Mon Apr 24 10:21:15 2017 Return-Path: Delivered-To: svn-src-stable@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 BF047D4D4FD; Mon, 24 Apr 2017 10:21: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 8892C107F; Mon, 24 Apr 2017 10:21: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 v3OALEsv002734; Mon, 24 Apr 2017 10:21:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OALEuc002726; Mon, 24 Apr 2017 10:21:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241021.v3OALEuc002726@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 10:21:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317360 - stable/11/sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 10:21:15 -0000 Author: mav Date: Mon Apr 24 10:21:13 2017 New Revision: 317360 URL: https://svnweb.freebsd.org/changeset/base/317360 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/11/sys/dev/isp/isp_freebsd.c stable/11/sys/dev/isp/isp_freebsd.h stable/11/sys/dev/isp/isp_library.c stable/11/sys/dev/isp/isp_library.h stable/11/sys/dev/isp/isp_pci.c stable/11/sys/dev/isp/isp_sbus.c stable/11/sys/dev/isp/ispvar.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/isp_freebsd.c ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/isp_freebsd.c Mon Apr 24 10:21:13 2017 (r317360) @@ -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__, @@ -3468,7 +3459,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/11/sys/dev/isp/isp_freebsd.h ============================================================================== --- stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/isp_freebsd.h Mon Apr 24 10:21:13 2017 (r317360) @@ -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/11/sys/dev/isp/isp_library.c ============================================================================== --- stable/11/sys/dev/isp/isp_library.c Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/isp_library.c Mon Apr 24 10:21:13 2017 (r317360) @@ -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/11/sys/dev/isp/isp_library.h ============================================================================== --- stable/11/sys/dev/isp/isp_library.h Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/isp_library.h Mon Apr 24 10:21:13 2017 (r317360) @@ -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/11/sys/dev/isp/isp_pci.c ============================================================================== --- stable/11/sys/dev/isp/isp_pci.c Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/isp_pci.c Mon Apr 24 10:21:13 2017 (r317360) @@ -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/11/sys/dev/isp/isp_sbus.c ============================================================================== --- stable/11/sys/dev/isp/isp_sbus.c Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/isp_sbus.c Mon Apr 24 10:21:13 2017 (r317360) @@ -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/11/sys/dev/isp/ispvar.h ============================================================================== --- stable/11/sys/dev/isp/ispvar.h Mon Apr 24 10:20:36 2017 (r317359) +++ stable/11/sys/dev/isp/ispvar.h Mon Apr 24 10:21:13 2017 (r317360) @@ -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@freebsd.org Mon Apr 24 11:12:05 2017 Return-Path: Delivered-To: svn-src-stable@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 4E3A7D4DE3F; Mon, 24 Apr 2017 11:12:05 +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 1A8221528; Mon, 24 Apr 2017 11:12:04 +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 v3OBC4br026758; Mon, 24 Apr 2017 11:12:04 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBC4ew026757; Mon, 24 Apr 2017 11:12:04 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704241112.v3OBC4ew026757@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:12:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317362 - stable/11/sys/dev/isp X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:12:05 -0000 Author: mav Date: Mon Apr 24 11:12:03 2017 New Revision: 317362 URL: https://svnweb.freebsd.org/changeset/base/317362 Log: MFC r315913: Add brackets to fix incorrect macro expansion. Modified: stable/11/sys/dev/isp/ispmbox.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/isp/ispmbox.h ============================================================================== --- stable/11/sys/dev/isp/ispmbox.h Mon Apr 24 11:06:10 2017 (r317361) +++ stable/11/sys/dev/isp/ispmbox.h Mon Apr 24 11:12:03 2017 (r317362) @@ -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@freebsd.org Mon Apr 24 11:19:48 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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@freebsd.org Mon Apr 24 11:20:23 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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@freebsd.org Mon Apr 24 11:20:57 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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@freebsd.org Mon Apr 24 11:21:34 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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@freebsd.org Mon Apr 24 11:22:08 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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@freebsd.org Mon Apr 24 11:34:04 2017 Return-Path: Delivered-To: svn-src-stable@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 727C5D4DA9D; Mon, 24 Apr 2017 11:34:04 +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 4F783AD6; Mon, 24 Apr 2017 11:34:04 +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 v3OBY3EP035344; Mon, 24 Apr 2017 11:34:03 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OBY28p035338; Mon, 24 Apr 2017 11:34:02 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201704241134.v3OBY28p035338@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 11:34:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317368 - in stable/11/sys/netinet: . tcp_stacks X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 11:34:04 -0000 Author: smh Date: Mon Apr 24 11:34:02 2017 New Revision: 317368 URL: https://svnweb.freebsd.org/changeset/base/317368 Log: MFC r316676: Use estimated RTT for receive buffer auto resizing instead of timestamps Relnotes: Yes Sponsored by: Multiplay Modified: stable/11/sys/netinet/in_kdtrace.c stable/11/sys/netinet/in_kdtrace.h stable/11/sys/netinet/tcp_input.c stable/11/sys/netinet/tcp_output.c stable/11/sys/netinet/tcp_stacks/fastpath.c stable/11/sys/netinet/tcp_var.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netinet/in_kdtrace.c ============================================================================== --- stable/11/sys/netinet/in_kdtrace.c Mon Apr 24 11:22:06 2017 (r317367) +++ stable/11/sys/netinet/in_kdtrace.c Mon Apr 24 11:34:02 2017 (r317368) @@ -132,6 +132,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/11/sys/netinet/in_kdtrace.h ============================================================================== --- stable/11/sys/netinet/in_kdtrace.h Mon Apr 24 11:22:06 2017 (r317367) +++ stable/11/sys/netinet/in_kdtrace.h Mon Apr 24 11:34:02 2017 (r317368) @@ -65,6 +65,7 @@ SDT_PROBE_DECLARE(tcp, , , debug__input) SDT_PROBE_DECLARE(tcp, , , debug__output); SDT_PROBE_DECLARE(tcp, , , debug__user); SDT_PROBE_DECLARE(tcp, , , debug__drop); +SDT_PROBE_DECLARE(tcp, , , receive__autoresize); SDT_PROBE_DECLARE(udp, , , receive); SDT_PROBE_DECLARE(udp, , , send); Modified: stable/11/sys/netinet/tcp_input.c ============================================================================== --- stable/11/sys/netinet/tcp_input.c Mon Apr 24 11:22:06 2017 (r317367) +++ stable/11/sys/netinet/tcp_input.c Mon Apr 24 11:34:02 2017 (r317368) @@ -1473,6 +1473,68 @@ drop: return (IPPROTO_DONE); } +/* + * 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); +} + void tcp_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, struct tcpcb *tp, int drop_hdrlen, int tlen, uint8_t iptos, @@ -1832,62 +1894,7 @@ tcp_do_segment(struct mbuf *m, struct tc #endif TCP_PROBE3(debug__input, tp, th, 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. - */ - 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); @@ -1928,10 +1935,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/11/sys/netinet/tcp_output.c ============================================================================== --- stable/11/sys/netinet/tcp_output.c Mon Apr 24 11:22:06 2017 (r317367) +++ stable/11/sys/netinet/tcp_output.c Mon Apr 24 11:34:02 2017 (r317368) @@ -821,11 +821,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/11/sys/netinet/tcp_stacks/fastpath.c ============================================================================== --- stable/11/sys/netinet/tcp_stacks/fastpath.c Mon Apr 24 11:22:06 2017 (r317367) +++ stable/11/sys/netinet/tcp_stacks/fastpath.c Mon Apr 24 11:34:02 2017 (r317368) @@ -390,62 +390,8 @@ tcp_do_fastnewdata(struct mbuf *m, struc (void *)tcp_saveipgen, &tcp_savetcp, 0); #endif TCP_PROBE3(debug__input, tp, th, 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. - */ - 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); @@ -520,10 +466,6 @@ tcp_do_slowpath(struct mbuf *m, struct t 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/11/sys/netinet/tcp_var.h ============================================================================== --- stable/11/sys/netinet/tcp_var.h Mon Apr 24 11:22:06 2017 (r317367) +++ stable/11/sys/netinet/tcp_var.h Mon Apr 24 11:34:02 2017 (r317368) @@ -764,6 +764,8 @@ void hhook_run_tcp_est_in(struct tcpcb * struct tcphdr *th, struct tcpopt *to); int tcp_input(struct mbuf **, int *, int); +int tcp_autorcvbuf(struct mbuf *, struct tcphdr *, struct socket *, + struct tcpcb *, int); void tcp_do_segment(struct mbuf *, struct tcphdr *, struct socket *, struct tcpcb *, int, int, uint8_t, int); From owner-svn-src-stable@freebsd.org Mon Apr 24 15:29:19 2017 Return-Path: Delivered-To: svn-src-stable@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 AF18BD4D41D; Mon, 24 Apr 2017 15:29:19 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 660CDE95; Mon, 24 Apr 2017 15:29:19 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OFTIdm034673; Mon, 24 Apr 2017 15:29:18 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OFTIt1034669; Mon, 24 Apr 2017 15:29:18 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704241529.v3OFTIt1034669@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 24 Apr 2017 15:29:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317373 - in stable/11: etc/defaults etc/periodic/daily share/man/man5 usr.sbin/periodic X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 15:29:19 -0000 Author: asomers Date: Mon Apr 24 15:29:17 2017 New Revision: 317373 URL: https://svnweb.freebsd.org/changeset/base/317373 Log: MFC r316342, r316358 r316342: Consolidate random sleeps in periodic scripts Multiple periodic scripts sleep for a random amount of time in order to mitigate the thundering herd problem. This is bad, because the sum of multiple uniformly distributed random variables approaches a normal distribution, so the problem isn't mitigated as effectively as it would be with a single sleep. This change creates a single configurable anticongestion sleep. periodic will only sleep if at least one script requires it, and it will never sleep more than once per invocation. It also won't sleep if periodic was run interactively, fixing an unrelated longstanding bug. PR: 217055 PR: 210188 Reviewed by: cy MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D10211 r316358: Fix man page typo from r316342 Reported by: rgrimes MFC after: 20 days X-MFC-With: 316342 Modified: stable/11/etc/defaults/periodic.conf stable/11/etc/periodic/daily/480.leapfile-ntpd stable/11/share/man/man5/periodic.conf.5 stable/11/usr.sbin/periodic/periodic.sh Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/defaults/periodic.conf ============================================================================== --- stable/11/etc/defaults/periodic.conf Mon Apr 24 14:56:41 2017 (r317372) +++ stable/11/etc/defaults/periodic.conf Mon Apr 24 15:29:17 2017 (r317373) @@ -22,6 +22,8 @@ periodic_conf_files="/etc/periodic.conf # periodic script dirs local_periodic="/usr/local/etc/periodic" +# Max time to sleep to avoid causing congestion on download servers +anticongestion_sleeptime=3600 # Daily options @@ -136,8 +138,6 @@ daily_status_mail_rejects_shorten="NO" # 480.leapfile-ntpd daily_ntpd_leapfile_enable="YES" # Fetch NTP leapfile -daily_ntpd_avoid_congestion="YES" # Avoid congesting - # leapfile sources # 480.status-ntpd daily_status_ntpd_enable="NO" # Check NTP status @@ -307,6 +307,18 @@ security_status_tcpwrap_period="daily" if [ -z "${source_periodic_confs_defined}" ]; then source_periodic_confs_defined=yes + # Sleep for a random amount of time in order to mitigate the thundering + # herd problem of multiple hosts running periodic simultaneously. + # Will not sleep when used interactively. + # Will sleep at most once per invocation of periodic + anticongestion() { + [ -n "$PERIODIC_IS_INTERACTIVE" ] && return + if [ -f "$PERIODIC_ANTICONGESTION_FILE" ]; then + rm -f $PERIODIC_ANTICONGESTION_FILE + sleep `jot -r 1 0 ${anticongestion_sleeptime}` + fi + } + # Compatibility with old daily variable names. # They can be removed in stable/11. security_daily_compat_var() { Modified: stable/11/etc/periodic/daily/480.leapfile-ntpd ============================================================================== --- stable/11/etc/periodic/daily/480.leapfile-ntpd Mon Apr 24 14:56:41 2017 (r317372) +++ stable/11/etc/periodic/daily/480.leapfile-ntpd Mon Apr 24 15:29:17 2017 (r317373) @@ -13,16 +13,9 @@ fi case "$daily_ntpd_leapfile_enable" in [Yy][Ee][Ss]) - case "$daily_ntpd_avoid_congestion" in - [Yy][Ee][Ss]) - # Avoid dogpiling - (sleep $(jot -r 1 0 3600); service ntpd onefetch) & - ;; - *) - service ntpd onefetch - ;; - esac - ;; + anticongestion + service ntpd onefetch + ;; esac exit $rc Modified: stable/11/share/man/man5/periodic.conf.5 ============================================================================== --- stable/11/share/man/man5/periodic.conf.5 Mon Apr 24 14:56:41 2017 (r317372) +++ stable/11/share/man/man5/periodic.conf.5 Mon Apr 24 15:29:17 2017 (r317373) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 26, 2015 +.Dd March 31, 2017 .Dt PERIODIC.CONF 5 .Os .Sh NAME @@ -133,6 +133,10 @@ respectively. Refer to the .Xr periodic 8 manual page for how script return codes are interpreted. +.It Va anticongestion_sleeptime +.Pq Vt int +The maximum number of seconds to randomly sleep in order to smooth bursty loads +on a shared resource, such as a download mirror. .El .Pp The following variables are used by the standard scripts that reside in Modified: stable/11/usr.sbin/periodic/periodic.sh ============================================================================== --- stable/11/usr.sbin/periodic/periodic.sh Mon Apr 24 14:56:41 2017 (r317372) +++ stable/11/usr.sbin/periodic/periodic.sh Mon Apr 24 15:29:17 2017 (r317373) @@ -76,6 +76,12 @@ fi shift arg=$1 +if [ -z "$PERIODIC_ANTICONGESTION_FILE" ] ; then + export PERIODIC_ANTICONGESTION_FILE=`mktemp ${TMPDIR:-/tmp}/periodic.anticongestion.XXXXXXXXXX` +fi +if tty > /dev/null 2>&1; then + export PERIODIC_IS_INTERACTIVE=1 +fi tmp_output=`mktemp ${TMPDIR:-/tmp}/periodic.XXXXXXXXXX` context="$PERIODIC" export PERIODIC="$arg${PERIODIC:+ }${PERIODIC}" @@ -141,3 +147,4 @@ esac } | output_pipe $arg "$context" rm -f $tmp_output +rm -f $PERIODIC_ANTICONGESTION_FILE From owner-svn-src-stable@freebsd.org Mon Apr 24 16:07:32 2017 Return-Path: Delivered-To: svn-src-stable@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 94CD4D4E493; Mon, 24 Apr 2017 16:07:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4FE71B2E; Mon, 24 Apr 2017 16:07:32 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OG7VKM050847; Mon, 24 Apr 2017 16:07:31 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OG7Vnk050843; Mon, 24 Apr 2017 16:07:31 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704241607.v3OG7Vnk050843@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Mon, 24 Apr 2017 16:07:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317374 - stable/11/sbin/camcontrol X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 16:07:32 -0000 Author: asomers Date: Mon Apr 24 16:07:30 2017 New Revision: 317374 URL: https://svnweb.freebsd.org/changeset/base/317374 Log: MFC r312558: Misc Coverity fixes in camcontrol(8) CID 1229913 Fix output of "camcontrol persist -i report_capabilities". The reported Persistent Reservation Types were wrong in all cases. CID 1356029 Annotate the code so Coverity will know that this is a false positive. CID 1366830 Fix a memory leak in "camcontrol timestamp -s" CID 1366832 Fix a segfault that could be caused by bad drive firmware Also, fix the man page entry for the "camcontrol epc state" command to match what the code does. Reviewed by: ken, wblock MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9239 Modified: stable/11/sbin/camcontrol/camcontrol.8 stable/11/sbin/camcontrol/epc.c stable/11/sbin/camcontrol/persist.c stable/11/sbin/camcontrol/timestamp.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/camcontrol/camcontrol.8 ============================================================================== --- stable/11/sbin/camcontrol/camcontrol.8 Mon Apr 24 15:29:17 2017 (r317373) +++ stable/11/sbin/camcontrol/camcontrol.8 Mon Apr 24 16:07:30 2017 (r317374) @@ -2385,6 +2385,20 @@ this power condition will be affected. .It state Enable or disable a particular power condition. .Bl -tag -width 7n +.It Fl e +Enable the power condition. +One of +.Fl e +or +.Fl d +is required. +.It Fl d +Disable the power condition. +One of +.Fl d +or +.Fl e +is required. .It Fl p Ar cond Specify the power condition: Idle_a, Idle_b, Idle_c, Standby_y, Standby_z. This argument is required. Modified: stable/11/sbin/camcontrol/epc.c ============================================================================== --- stable/11/sbin/camcontrol/epc.c Mon Apr 24 15:29:17 2017 (r317373) +++ stable/11/sbin/camcontrol/epc.c Mon Apr 24 16:07:30 2017 (r317374) @@ -783,6 +783,7 @@ epc(struct cam_device *device, int argc, warnx("Must specify a timer value (-T time)"); error = 1; } + /* FALLTHROUGH */ case ATA_SF_EPC_SET_STATE: if (enable == -1) { warnx("Must specify enable (-e) or disable (-d)"); Modified: stable/11/sbin/camcontrol/persist.c ============================================================================== --- stable/11/sbin/camcontrol/persist.c Mon Apr 24 15:29:17 2017 (r317373) +++ stable/11/sbin/camcontrol/persist.c Mon Apr 24 16:07:30 2017 (r317374) @@ -241,9 +241,11 @@ persist_print_cap(struct scsi_per_res_ca { uint32_t length; int check_type_mask = 0; + uint32_t type_mask; length = scsi_2btoul(cap->length); length = MIN(length, valid_len); + type_mask = scsi_2btoul(cap->type_mask); if (length < __offsetof(struct scsi_per_res_cap, type_mask)) { fprintf(stdout, "Insufficient data (%u bytes) to report " @@ -345,20 +347,20 @@ persist_print_cap(struct scsi_per_res_ca fprintf(stdout, "Supported Persistent Reservation Types:\n"); fprintf(stdout, " Write Exclusive - All Registrants " "(WR_EX_AR): %d\n", - (cap->type_mask[0] & SPRI_TM_WR_EX_AR)? 1 : 0); + (type_mask & SPRI_TM_WR_EX_AR)? 1 : 0); fprintf(stdout, " Exclusive Access - Registrants Only " "(EX_AC_RO): %d\n", - (cap->type_mask[0] & SPRI_TM_EX_AC_RO) ? 1 : 0); + (type_mask & SPRI_TM_EX_AC_RO) ? 1 : 0); fprintf(stdout, " Write Exclusive - Registrants Only " "(WR_EX_RO): %d\n", - (cap->type_mask[0] & SPRI_TM_WR_EX_RO)? 1 : 0); + (type_mask & SPRI_TM_WR_EX_RO)? 1 : 0); fprintf(stdout, " Exclusive Access (EX_AC): %d\n", - (cap->type_mask[0] & SPRI_TM_EX_AC) ? 1 : 0); + (type_mask & SPRI_TM_EX_AC) ? 1 : 0); fprintf(stdout, " Write Exclusive (WR_EX): %d\n", - (cap->type_mask[0] & SPRI_TM_WR_EX) ? 1 : 0); + (type_mask & SPRI_TM_WR_EX) ? 1 : 0); fprintf(stdout, " Exclusive Access - All Registrants " "(EX_AC_AR): %d\n", - (cap->type_mask[1] & SPRI_TM_EX_AC_AR) ? 1 : 0); + (type_mask & SPRI_TM_EX_AC_AR) ? 1 : 0); } else { fprintf(stdout, "Persistent Reservation Type Mask is NOT " "valid\n"); Modified: stable/11/sbin/camcontrol/timestamp.c ============================================================================== --- stable/11/sbin/camcontrol/timestamp.c Mon Apr 24 15:29:17 2017 (r317373) +++ stable/11/sbin/camcontrol/timestamp.c Mon Apr 24 16:07:30 2017 (r317374) @@ -40,6 +40,7 @@ __FBSDID("$FreeBSD$"); #include +#include #include #include #include @@ -139,6 +140,8 @@ set_restore_flags(struct cam_device *dev * Create the control page at the correct point in the mode_buf, it * starts after the header and the blk description. */ + assert(hdr_and_blk_length <= + sizeof(mode_buf) - sizeof(struct scsi_control_ext_page)); control_page = (struct scsi_control_ext_page *)&mode_buf [hdr_and_blk_length]; if (set_flag != 0) { @@ -241,6 +244,7 @@ report_timestamp(struct cam_device *devi bailout: if (ccb != NULL) cam_freeccb(ccb); + free(report_buf); return error; } From owner-svn-src-stable@freebsd.org Mon Apr 24 16:31:29 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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@freebsd.org Mon Apr 24 16:49:31 2017 Return-Path: Delivered-To: svn-src-stable@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 A6775D4EEA1; Mon, 24 Apr 2017 16:49:31 +0000 (UTC) (envelope-from andrew@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 81CE823E; Mon, 24 Apr 2017 16:49:31 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3OGnUol067667; Mon, 24 Apr 2017 16:49:30 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OGnUIN067665; Mon, 24 Apr 2017 16:49:30 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201704241649.v3OGnUIN067665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Mon, 24 Apr 2017 16:49:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317377 - stable/11/usr.sbin/acpi/acpidump X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 16:49:31 -0000 Author: andrew Date: Mon Apr 24 16:49:30 2017 New Revision: 317377 URL: https://svnweb.freebsd.org/changeset/base/317377 Log: MFC r302788, r303026, r305471 r302788: Fix the type used to hold the value returned from getopt. On arm64 char is unsigned so will never be -1. r303026: Add missing flags from acpidump. These are defined in the header, but not printed. The HW_REDUCED flag is useful as it should be set on arm64 to comply with the ARM Server Base Boot Requirements. r305471: Teach acpidump how to parse ACPI 5.1 tables found on the development ThunderX units in the netperf cluster. Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c stable/11/usr.sbin/acpi/acpidump/acpidump.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.sbin/acpi/acpidump/acpi.c ============================================================================== --- stable/11/usr.sbin/acpi/acpidump/acpi.c Mon Apr 24 16:37:25 2017 (r317376) +++ stable/11/usr.sbin/acpi/acpidump/acpi.c Mon Apr 24 16:49:30 2017 (r317377) @@ -356,6 +356,23 @@ acpi_print_mps_flags(uint16_t flags) } static void +acpi_print_gicc_flags(uint32_t flags) +{ + + printf("\tFlags={Performance intr="); + if (flags & ACPI_MADT_PERFORMANCE_IRQ_MODE) + printf("edge"); + else + printf("level"); + printf(", VGIC intr="); + if (flags & ACPI_MADT_VGIC_IRQ_MODE) + printf("edge"); + else + printf("level"); + printf("}\n"); +} + +static void acpi_print_intr(uint32_t intr, uint16_t mps_flags) { @@ -375,7 +392,12 @@ static const char *apic_types[] = { "Loc "NMI", "Local APIC NMI", "Local APIC Override", "IO SAPIC", "Local SAPIC", "Platform Interrupt", - "Local X2APIC", "Local X2APIC NMI" }; + "Local X2APIC", "Local X2APIC NMI", + "GIC CPU Interface Structure", + "GIC Distributor Structure", + "GICv2m MSI Frame", + "GIC Redistributor Structure", + "GIC ITS Structure" }; static const char *platform_int_types[] = { "0 (unknown)", "PMI", "INIT", "Corrected Platform Error" }; @@ -393,6 +415,10 @@ acpi_print_madt(ACPI_SUBTABLE_HEADER *mp ACPI_MADT_INTERRUPT_SOURCE *isrc; ACPI_MADT_LOCAL_X2APIC *x2apic; ACPI_MADT_LOCAL_X2APIC_NMI *x2apic_nmi; + ACPI_MADT_GENERIC_INTERRUPT *gicc; + ACPI_MADT_GENERIC_DISTRIBUTOR *gicd; + ACPI_MADT_GENERIC_REDISTRIBUTOR *gicr; + ACPI_MADT_GENERIC_TRANSLATOR *gict; if (mp->Type < nitems(apic_types)) printf("\tType=%s\n", apic_types[mp->Type]); @@ -463,6 +489,41 @@ acpi_print_madt(ACPI_SUBTABLE_HEADER *mp acpi_print_cpu_uid(x2apic_nmi->Uid, NULL); acpi_print_local_nmi(x2apic_nmi->Lint, x2apic_nmi->IntiFlags); break; + case ACPI_MADT_TYPE_GENERIC_INTERRUPT: + gicc = (ACPI_MADT_GENERIC_INTERRUPT *)mp; + acpi_print_cpu_uid(gicc->Uid, NULL); + printf("\tCPU INTERFACE=%x\n", gicc->CpuInterfaceNumber); + acpi_print_gicc_flags(gicc->Flags); + printf("\tParking Protocol Version=%x\n", gicc->ParkingVersion); + printf("\tPERF INTR=%d\n", gicc->PerformanceInterrupt); + printf("\tParked ADDR=%016jx\n", + (uintmax_t)gicc->ParkedAddress); + printf("\tBase ADDR=%016jx\n", (uintmax_t)gicc->BaseAddress); + printf("\tGICV=%016jx\n", (uintmax_t)gicc->GicvBaseAddress); + printf("\tGICH=%016jx\n", (uintmax_t)gicc->GichBaseAddress); + printf("\tVGIC INTR=%d\n", gicc->VgicInterrupt); + printf("\tGICR ADDR=%016jx\n", + (uintmax_t)gicc->GicrBaseAddress); + printf("\tMPIDR=%jx\n", (uintmax_t)gicc->ArmMpidr); + printf("\tEfficency Class=%d\n", (u_int)gicc->EfficiencyClass); + break; + case ACPI_MADT_TYPE_GENERIC_DISTRIBUTOR: + gicd = (ACPI_MADT_GENERIC_DISTRIBUTOR *)mp; + printf("\tGIC ID=%d\n", (u_int)gicd->GicId); + printf("\tBase ADDR=%016jx\n", (uintmax_t)gicd->BaseAddress); + printf("\tVector Base=%d\n", gicd->GlobalIrqBase); + printf("\tGIC VERSION=%d\n", (u_int)gicd->Version); + break; + case ACPI_MADT_TYPE_GENERIC_REDISTRIBUTOR: + gicr = (ACPI_MADT_GENERIC_REDISTRIBUTOR *)mp; + printf("\tBase ADDR=%016jx\n", (uintmax_t)gicr->BaseAddress); + printf("\tLength=%08x\n", gicr->Length); + break; + case ACPI_MADT_TYPE_GENERIC_TRANSLATOR: + gict = (ACPI_MADT_GENERIC_TRANSLATOR *)mp; + printf("\tGIC ITS ID=%d\n", gict->TranslationId); + printf("\tBase ADDR=%016jx\n", (uintmax_t)gict->BaseAddress); + break; } } @@ -1011,13 +1072,14 @@ acpi_print_srat_memory(ACPI_SRAT_MEM_AFF printf("\tProximity Domain=%d\n", mp->ProximityDomain); } -static const char *srat_types[] = { "CPU", "Memory", "X2APIC" }; +static const char *srat_types[] = { "CPU", "Memory", "X2APIC", "GICC" }; static void acpi_print_srat(ACPI_SUBTABLE_HEADER *srat) { ACPI_SRAT_CPU_AFFINITY *cpu; ACPI_SRAT_X2APIC_CPU_AFFINITY *x2apic; + ACPI_SRAT_GICC_AFFINITY *gic; if (srat->Type < nitems(srat_types)) printf("\tType=%s\n", srat_types[srat->Type]); @@ -1040,6 +1102,11 @@ acpi_print_srat(ACPI_SUBTABLE_HEADER *sr acpi_print_srat_cpu(x2apic->ApicId, x2apic->ProximityDomain, x2apic->Flags); break; + case ACPI_SRAT_TYPE_GICC_AFFINITY: + gic = (ACPI_SRAT_GICC_AFFINITY *)srat; + acpi_print_srat_cpu(gic->AcpiProcessorUid, gic->ProximityDomain, + gic->Flags); + break; } } @@ -1176,6 +1243,7 @@ acpi_print_fadt(ACPI_TABLE_HEADER *sdp) PRINTFLAG(fadt->BootFlags, NO_VGA); PRINTFLAG(fadt->BootFlags, NO_MSI); PRINTFLAG(fadt->BootFlags, NO_ASPM); + PRINTFLAG(fadt->BootFlags, NO_CMOS_RTC); PRINTFLAG_END(); printf("\tFlags="); @@ -1199,6 +1267,8 @@ acpi_print_fadt(ACPI_TABLE_HEADER *sdp) PRINTFLAG(fadt->Flags, REMOTE_POWER_ON); PRINTFLAG(fadt->Flags, APIC_CLUSTER); PRINTFLAG(fadt->Flags, APIC_PHYSICAL); + PRINTFLAG(fadt->Flags, HW_REDUCED); + PRINTFLAG(fadt->Flags, LOW_POWER_S0); PRINTFLAG_END(); #undef PRINTFLAG Modified: stable/11/usr.sbin/acpi/acpidump/acpidump.c ============================================================================== --- stable/11/usr.sbin/acpi/acpidump/acpidump.c Mon Apr 24 16:37:25 2017 (r317376) +++ stable/11/usr.sbin/acpi/acpidump/acpidump.c Mon Apr 24 16:49:30 2017 (r317377) @@ -55,7 +55,8 @@ int main(int argc, char *argv[]) { ACPI_TABLE_HEADER *rsdt, *sdt; - char c, *progname; + int c; + char *progname; char *dsdt_input_file, *dsdt_output_file; dsdt_input_file = dsdt_output_file = NULL; From owner-svn-src-stable@freebsd.org Mon Apr 24 21:35:04 2017 Return-Path: Delivered-To: svn-src-stable@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 02D84D4EE8C; Mon, 24 Apr 2017 21:35:04 +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 BE1B11AC3; Mon, 24 Apr 2017 21:35:03 +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 v3OLZ2gs087663; Mon, 24 Apr 2017 21:35:02 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OLZ2sD087662; Mon, 24 Apr 2017 21:35:02 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704242135.v3OLZ2sD087662@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:35:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317386 - stable/11/lib/libutil X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 21:35:04 -0000 Author: brooks Date: Mon Apr 24 21:35:02 2017 New Revision: 317386 URL: https://svnweb.freebsd.org/changeset/base/317386 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/11/lib/libutil/humanize_number.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libutil/humanize_number.c ============================================================================== --- stable/11/lib/libutil/humanize_number.c Mon Apr 24 21:31:27 2017 (r317385) +++ stable/11/lib/libutil/humanize_number.c Mon Apr 24 21:35:02 2017 (r317386) @@ -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@freebsd.org Mon Apr 24 21:41:06 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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@freebsd.org Mon Apr 24 22:37:55 2017 Return-Path: Delivered-To: svn-src-stable@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 65648D4E292; Mon, 24 Apr 2017 22:37:55 +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 34C951904; Mon, 24 Apr 2017 22:37:55 +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 v3OMbsBL012051; Mon, 24 Apr 2017 22:37:54 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3OMbsbC012050; Mon, 24 Apr 2017 22:37:54 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201704242237.v3OMbsbC012050@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:37:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317391 - stable/11/lib/libc/gen X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 22:37:55 -0000 Author: brooks Date: Mon Apr 24 22:37:54 2017 New Revision: 317391 URL: https://svnweb.freebsd.org/changeset/base/317391 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/11/lib/libc/gen/ttyname.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libc/gen/ttyname.c ============================================================================== --- stable/11/lib/libc/gen/ttyname.c Mon Apr 24 22:35:00 2017 (r317390) +++ stable/11/lib/libc/gen/ttyname.c Mon Apr 24 22:37:54 2017 (r317391) @@ -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@freebsd.org Mon Apr 24 22:45:01 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 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@freebsd.org Mon Apr 24 23:47:15 2017 Return-Path: Delivered-To: svn-src-stable@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 16F8CD4E8B1; Mon, 24 Apr 2017 23:47: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 D4405319; Mon, 24 Apr 2017 23:47: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 v3ONlDs1040581; Mon, 24 Apr 2017 23:47:13 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3ONlD5h040571; Mon, 24 Apr 2017 23:47:13 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704242347.v3ONlD5h040571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Mon, 24 Apr 2017 23:47:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317393 - in stable/11/sys/fs: nfs nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Apr 2017 23:47:15 -0000 Author: rmacklem Date: Mon Apr 24 23:47:12 2017 New Revision: 317393 URL: https://svnweb.freebsd.org/changeset/base/317393 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/11/sys/fs/nfs/nfs.h stable/11/sys/fs/nfs/nfs_commonkrpc.c stable/11/sys/fs/nfs/nfs_commonport.c stable/11/sys/fs/nfs/nfs_commonsubs.c stable/11/sys/fs/nfs/nfsclstate.h stable/11/sys/fs/nfsclient/nfs_clcomsubs.c stable/11/sys/fs/nfsclient/nfs_clport.c stable/11/sys/fs/nfsclient/nfs_clrpcops.c stable/11/sys/fs/nfsclient/nfs_clstate.c stable/11/sys/fs/nfsclient/nfs_clvfsops.c stable/11/sys/fs/nfsclient/nfsmount.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs.h ============================================================================== --- stable/11/sys/fs/nfs/nfs.h Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfs/nfs.h Mon Apr 24 23:47:12 2017 (r317393) @@ -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/11/sys/fs/nfs/nfs_commonkrpc.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonkrpc.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfs/nfs_commonkrpc.c Mon Apr 24 23:47:12 2017 (r317393) @@ -89,6 +89,7 @@ uint32_t nfscl_nfs4_done_probes[NFSV41_N NFSSTATESPINLOCK; NFSREQSPINLOCK; NFSDLOCKMUTEX; +NFSCLSTATEMUTEX; extern struct nfsstatsv1 nfsstatsv1; extern struct nfsreqhead nfsd_reqq; extern int nfscl_ticks; @@ -473,13 +474,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; @@ -491,7 +492,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. */ @@ -803,7 +807,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. */ @@ -847,18 +851,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. */ @@ -871,6 +882,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/11/sys/fs/nfs/nfs_commonport.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonport.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfs/nfs_commonport.c Mon Apr 24 23:47:12 2017 (r317393) @@ -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 *); @@ -647,6 +648,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); } /* @@ -712,6 +714,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/11/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonsubs.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfs/nfs_commonsubs.c Mon Apr 24 23:47:12 2017 (r317393) @@ -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 */ @@ -4134,22 +4134,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; } @@ -4165,6 +4178,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/11/sys/fs/nfs/nfsclstate.h ============================================================================== --- stable/11/sys/fs/nfs/nfsclstate.h Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfs/nfsclstate.h Mon Apr 24 23:47:12 2017 (r317393) @@ -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/11/sys/fs/nfsclient/nfs_clcomsubs.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clcomsubs.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfsclient/nfs_clcomsubs.c Mon Apr 24 23:47:12 2017 (r317393) @@ -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/11/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clport.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfsclient/nfs_clport.c Mon Apr 24 23:47:12 2017 (r317393) @@ -82,7 +82,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; @@ -1381,8 +1380,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(); @@ -1406,7 +1403,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/11/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clrpcops.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfsclient/nfs_clrpcops.c Mon Apr 24 23:47:12 2017 (r317393) @@ -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); @@ -557,7 +559,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) @@ -604,7 +606,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); @@ -762,7 +764,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); @@ -803,7 +805,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); @@ -828,33 +830,53 @@ 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 in6_addr a6; + 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); @@ -875,6 +897,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); @@ -936,8 +959,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); @@ -949,8 +972,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; @@ -1111,7 +1134,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); @@ -1368,7 +1391,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); @@ -1538,7 +1561,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); @@ -1964,6 +1987,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); @@ -1983,8 +2007,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); @@ -2178,7 +2203,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) @@ -3840,6 +3865,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); @@ -3852,8 +3878,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], @@ -3893,8 +3920,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); @@ -3944,8 +3970,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); @@ -3964,6 +3989,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); @@ -3989,8 +4015,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); @@ -4031,8 +4058,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); @@ -4232,25 +4258,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; @@ -4269,6 +4306,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. */ @@ -4279,8 +4317,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); @@ -4518,7 +4557,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; @@ -4661,10 +4700,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); @@ -4686,11 +4727,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); @@ -5158,6 +5201,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; /* @@ -5172,7 +5216,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; @@ -5269,7 +5314,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"); @@ -5309,7 +5355,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); @@ -5862,7 +5909,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/11/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clstate.c Mon Apr 24 22:44:59 2017 (r317392) +++ stable/11/sys/fs/nfsclient/nfs_clstate.c Mon Apr 24 23:47:12 2017 (r317393) @@ -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(); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-stable@freebsd.org Tue Apr 25 00:00:35 2017 Return-Path: Delivered-To: svn-src-stable@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 798A3D4EF97; Tue, 25 Apr 2017 00:00:35 +0000 (UTC) (envelope-from markj@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 4B34FD55; Tue, 25 Apr 2017 00:00:35 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3P00Ygi044666; Tue, 25 Apr 2017 00:00:34 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3P00YKI044665; Tue, 25 Apr 2017 00:00:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201704250000.v3P00YKI044665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 25 Apr 2017 00:00:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317394 - stable/11/sys/fs/fuse X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 00:00:35 -0000 Author: markj Date: Tue Apr 25 00:00:34 2017 New Revision: 317394 URL: https://svnweb.freebsd.org/changeset/base/317394 Log: MFC r317273 (by cem): fuse: Implement FOPEN_KEEP_CACHE flag Modified: stable/11/sys/fs/fuse/fuse_node.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/fuse/fuse_node.c ============================================================================== --- stable/11/sys/fs/fuse/fuse_node.c Mon Apr 24 23:47:12 2017 (r317393) +++ stable/11/sys/fs/fuse/fuse_node.c Tue Apr 25 00:00:34 2017 (r317394) @@ -272,8 +272,6 @@ fuse_vnode_open(struct vnode *vp, int32_ /* * Funcation is called for every vnode open. * Merge fuse_open_flags it may be 0 - * - * XXXIP: Handle FOPEN_KEEP_CACHE */ /* * Ideally speaking, direct io should be enabled on @@ -293,6 +291,8 @@ fuse_vnode_open(struct vnode *vp, int32_ VTOFUD(vp)->flag |= FN_DIRECTIO; fuse_io_invalbuf(vp, td); } else { + if ((fuse_open_flags & FOPEN_KEEP_CACHE) == 0) + fuse_io_invalbuf(vp, td); VTOFUD(vp)->flag &= ~FN_DIRECTIO; } From owner-svn-src-stable@freebsd.org Tue Apr 25 11:19:24 2017 Return-Path: Delivered-To: svn-src-stable@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 37AD0D4F8E2; Tue, 25 Apr 2017 11:19:24 +0000 (UTC) (envelope-from ae@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 0C626B75; Tue, 25 Apr 2017 11:19:23 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3PBJM9L037356; Tue, 25 Apr 2017 11:19:22 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PBJMeZ037353; Tue, 25 Apr 2017 11:19:22 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201704251119.v3PBJMeZ037353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Tue, 25 Apr 2017 11:19:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317403 - stable/11/sys/net X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 11:19:24 -0000 Author: ae Date: Tue Apr 25 11:19:22 2017 New Revision: 317403 URL: https://svnweb.freebsd.org/changeset/base/317403 Log: MFC r316699: Do not adjust interface MTU automatically. Leave this task to the system administrator. Before r274246 interface MTU was adjusted only when GRE key is configured. The r274246 has changed this behavior to automatically adjust MTU when any option, that changes the size of GRE header is configured. This patch removes automatic MTU adjustment from if_gre(4) and if_me(4), and restores the behavior that was prior to r274246. Differential Revision: https://reviews.freebsd.org/D10215 Modified: stable/11/sys/net/if_gre.c stable/11/sys/net/if_gre.h stable/11/sys/net/if_me.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/net/if_gre.c ============================================================================== --- stable/11/sys/net/if_gre.c Tue Apr 25 10:29:08 2017 (r317402) +++ stable/11/sys/net/if_gre.c Tue Apr 25 11:19:22 2017 (r317403) @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); #include #include -#define GREMTU 1500 +#define GREMTU 1476 static const char grename[] = "gre"; static MALLOC_DEFINE(M_GRE, grename, "Generic Routing Encapsulation"); static VNET_DEFINE(struct mtx, gre_mtx); @@ -173,7 +173,7 @@ gre_clone_create(struct if_clone *ifc, i GRE2IFP(sc)->if_softc = sc; if_initname(GRE2IFP(sc), grename, unit); - GRE2IFP(sc)->if_mtu = sc->gre_mtu = GREMTU; + GRE2IFP(sc)->if_mtu = GREMTU; GRE2IFP(sc)->if_flags = IFF_POINTOPOINT|IFF_MULTICAST; GRE2IFP(sc)->if_output = gre_output; GRE2IFP(sc)->if_ioctl = gre_ioctl; @@ -231,7 +231,8 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, /* XXX: */ if (ifr->ifr_mtu < 576) return (EINVAL); - break; + ifp->if_mtu = ifr->ifr_mtu; + return (0); case SIOCSIFADDR: ifp->if_flags |= IFF_UP; case SIOCSIFFLAGS: @@ -255,12 +256,6 @@ gre_ioctl(struct ifnet *ifp, u_long cmd, } error = 0; switch (cmd) { - case SIOCSIFMTU: - GRE_WLOCK(sc); - sc->gre_mtu = ifr->ifr_mtu; - gre_updatehdr(sc); - GRE_WUNLOCK(sc); - goto end; case SIOCSIFPHYADDR: #ifdef INET6 case SIOCSIFPHYADDR_IN6: @@ -549,7 +544,6 @@ gre_updatehdr(struct gre_softc *sc) } else sc->gre_oseq = 0; gh->gre_flags = htons(flags); - GRE2IFP(sc)->if_mtu = sc->gre_mtu - sc->gre_hlen; } static void Modified: stable/11/sys/net/if_gre.h ============================================================================== --- stable/11/sys/net/if_gre.h Tue Apr 25 10:29:08 2017 (r317402) +++ stable/11/sys/net/if_gre.h Tue Apr 25 11:19:22 2017 (r317403) @@ -69,7 +69,6 @@ struct gre_softc { uint32_t gre_oseq; uint32_t gre_key; uint32_t gre_options; - uint32_t gre_mtu; u_int gre_fibnum; u_int gre_hlen; /* header size */ union { Modified: stable/11/sys/net/if_me.c ============================================================================== --- stable/11/sys/net/if_me.c Tue Apr 25 10:29:08 2017 (r317402) +++ stable/11/sys/net/if_me.c Tue Apr 25 11:19:22 2017 (r317403) @@ -66,7 +66,7 @@ __FBSDID("$FreeBSD$"); #include #include -#define MEMTU 1500 +#define MEMTU (1500 - sizeof(struct mobhdr)) static const char mename[] = "me"; static MALLOC_DEFINE(M_IFME, mename, "Minimal Encapsulation for IP"); static VNET_DEFINE(struct mtx, me_mtx); @@ -186,7 +186,7 @@ me_clone_create(struct if_clone *ifc, in ME2IFP(sc)->if_softc = sc; if_initname(ME2IFP(sc), mename, unit); - ME2IFP(sc)->if_mtu = MEMTU - sizeof(struct mobhdr); + ME2IFP(sc)->if_mtu = MEMTU;; ME2IFP(sc)->if_flags = IFF_POINTOPOINT|IFF_MULTICAST; ME2IFP(sc)->if_output = me_output; ME2IFP(sc)->if_ioctl = me_ioctl; @@ -236,7 +236,7 @@ me_ioctl(struct ifnet *ifp, u_long cmd, case SIOCSIFMTU: if (ifr->ifr_mtu < 576) return (EINVAL); - ifp->if_mtu = ifr->ifr_mtu - sizeof(struct mobhdr); + ifp->if_mtu = ifr->ifr_mtu; return (0); case SIOCSIFADDR: ifp->if_flags |= IFF_UP; From owner-svn-src-stable@freebsd.org Tue Apr 25 11:36:27 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Apr 25 11:59:25 2017 Return-Path: Delivered-To: svn-src-stable@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 11B16D4F981; Tue, 25 Apr 2017 11:59:25 +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 D575D6B7; Tue, 25 Apr 2017 11:59:24 +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 v3PBxN38053916; Tue, 25 Apr 2017 11:59:23 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PBxNVk053915; Tue, 25 Apr 2017 11:59:23 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251159.v3PBxNVk053915@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:59:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317405 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 11:59:25 -0000 Author: rmacklem Date: Tue Apr 25 11:59:23 2017 New Revision: 317405 URL: https://svnweb.freebsd.org/changeset/base/317405 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/11/sys/fs/nfsclient/nfs_clrpcops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 25 11:36:25 2017 (r317404) +++ stable/11/sys/fs/nfsclient/nfs_clrpcops.c Tue Apr 25 11:59:23 2017 (r317405) @@ -1190,7 +1190,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@freebsd.org Tue Apr 25 12:07:05 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Apr 25 13:07:07 2017 Return-Path: Delivered-To: svn-src-stable@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 B2742D50164; Tue, 25 Apr 2017 13:07:07 +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 809339D4; Tue, 25 Apr 2017 13:07:07 +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 v3PD76xV082618; Tue, 25 Apr 2017 13:07:06 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PD76u4082617; Tue, 25 Apr 2017 13:07:06 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704251307.v3PD76u4082617@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:07:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317407 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 13:07:07 -0000 Author: kib Date: Tue Apr 25 13:07:06 2017 New Revision: 317407 URL: https://svnweb.freebsd.org/changeset/base/317407 Log: MFC r316698: Remove debugging printf. Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvnops.c Tue Apr 25 12:07:04 2017 (r317406) +++ stable/11/sys/fs/nfsclient/nfs_clvnops.c Tue Apr 25 13:07:06 2017 (r317407) @@ -2971,14 +2971,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@freebsd.org Tue Apr 25 13:17:35 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Apr 25 19:02:36 2017 Return-Path: Delivered-To: svn-src-stable@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 4E82ED50AA2; Tue, 25 Apr 2017 19:02:36 +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 1D1306B7; Tue, 25 Apr 2017 19:02:36 +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 v3PJ2ZrJ030875; Tue, 25 Apr 2017 19:02:35 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PJ2ZgM030874; Tue, 25 Apr 2017 19:02:35 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251902.v3PJ2ZgM030874@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:02:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317417 - stable/11/sys/fs/nfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 19:02:36 -0000 Author: rmacklem Date: Tue Apr 25 19:02:34 2017 New Revision: 317417 URL: https://svnweb.freebsd.org/changeset/base/317417 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/11/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 18:08:56 2017 (r317416) +++ stable/11/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 19:02:34 2017 (r317417) @@ -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@freebsd.org Tue Apr 25 19:14:32 2017 Return-Path: Delivered-To: svn-src-stable@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 E0665D501A8; Tue, 25 Apr 2017 19:14:32 +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 B02FC2D8; Tue, 25 Apr 2017 19:14:32 +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 v3PJEVbB035848; Tue, 25 Apr 2017 19:14:31 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PJEVQP035847; Tue, 25 Apr 2017 19:14:31 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704251914.v3PJEVQP035847@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:14:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317418 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 19:14:33 -0000 Author: rmacklem Date: Tue Apr 25 19:14:31 2017 New Revision: 317418 URL: https://svnweb.freebsd.org/changeset/base/317418 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/11/sys/fs/nfsclient/nfs_clport.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clport.c Tue Apr 25 19:02:34 2017 (r317417) +++ stable/11/sys/fs/nfsclient/nfs_clport.c Tue Apr 25 19:14:31 2017 (r317418) @@ -1196,7 +1196,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@freebsd.org Tue Apr 25 19:35:15 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Apr 25 19:48:27 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Apr 25 20:24:01 2017 Return-Path: Delivered-To: svn-src-stable@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 E5967D50DD9; Tue, 25 Apr 2017 20:24:01 +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 B547888A; Tue, 25 Apr 2017 20:24:01 +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 v3PKO0Ok064277; Tue, 25 Apr 2017 20:24:00 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PKO0rf064276; Tue, 25 Apr 2017 20:24:00 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704252024.v3PKO0rf064276@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:24:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317422 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 20:24:02 -0000 Author: rmacklem Date: Tue Apr 25 20:24:00 2017 New Revision: 317422 URL: https://svnweb.freebsd.org/changeset/base/317422 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/11/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clstate.c Tue Apr 25 19:54:34 2017 (r317421) +++ stable/11/sys/fs/nfsclient/nfs_clstate.c Tue Apr 25 20:24:00 2017 (r317422) @@ -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@freebsd.org Tue Apr 25 20:34:57 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 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@freebsd.org Tue Apr 25 23:43:38 2017 Return-Path: Delivered-To: svn-src-stable@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 7434DD504CE; Tue, 25 Apr 2017 23:43:38 +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 43E3B16E9; Tue, 25 Apr 2017 23:43:38 +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 v3PNhbnA044973; Tue, 25 Apr 2017 23:43:37 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3PNhbTm044972; Tue, 25 Apr 2017 23:43:37 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704252343.v3PNhbTm044972@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 23:43:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317427 - stable/11/sys/fs/nfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Apr 2017 23:43:38 -0000 Author: rmacklem Date: Tue Apr 25 23:43:37 2017 New Revision: 317427 URL: https://svnweb.freebsd.org/changeset/base/317427 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/11/sys/fs/nfs/nfs_commonsubs.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs_commonsubs.c ============================================================================== --- stable/11/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 23:29:41 2017 (r317426) +++ stable/11/sys/fs/nfs/nfs_commonsubs.c Tue Apr 25 23:43:37 2017 (r317427) @@ -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@freebsd.org Wed Apr 26 00:03:04 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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@freebsd.org Wed Apr 26 02:37:27 2017 Return-Path: Delivered-To: svn-src-stable@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 7ED40D5002B; Wed, 26 Apr 2017 02:37:27 +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 5B6C4E53; 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 v3Q2bQxG013865; 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 v3Q2bQSP013862; Wed, 26 Apr 2017 02:37:26 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201704260237.v3Q2bQSP013862@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-11@freebsd.org Subject: svn commit: r317434 - in stable: 10 10/sys/contrib/ipfilter/netinet 11 11/sys/contrib/ipfilter/netinet X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 02:37:27 -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/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) Changes in other areas also in this revision: 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) Modified: stable/11/UPDATING ============================================================================== --- stable/11/UPDATING Wed Apr 26 01:08:25 2017 (r317433) +++ stable/11/UPDATING Wed Apr 26 02:37:25 2017 (r317434) @@ -21,6 +21,15 @@ from older version of current across the use any explicitly assigned loopback address available in the jail instead of using the first assigned address of the jail. +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). + 20170402: Clang, llvm, lldb, compiler-rt and libc++ have been upgraded to 4.0.0. Please see the 20141231 entry below for information about prerequisites Modified: stable/11/sys/contrib/ipfilter/netinet/fil.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/fil.c Wed Apr 26 01:08:25 2017 (r317433) +++ stable/11/sys/contrib/ipfilter/netinet/fil.c Wed Apr 26 02:37:25 2017 (r317434) @@ -2786,7 +2786,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/11/sys/contrib/ipfilter/netinet/ip_state.c ============================================================================== --- stable/11/sys/contrib/ipfilter/netinet/ip_state.c Wed Apr 26 01:08:25 2017 (r317433) +++ stable/11/sys/contrib/ipfilter/netinet/ip_state.c Wed Apr 26 02:37:25 2017 (r317434) @@ -3414,7 +3414,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@freebsd.org Wed Apr 26 02:37:28 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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@freebsd.org Wed Apr 26 14:43:23 2017 Return-Path: Delivered-To: svn-src-stable@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 9BEA5D501C4; Wed, 26 Apr 2017 14:43:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 59F62A40; Wed, 26 Apr 2017 14:43:23 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QEhM2F013727; Wed, 26 Apr 2017 14:43:22 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QEhMsI013723; Wed, 26 Apr 2017 14:43:22 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704261443.v3QEhMsI013723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 26 Apr 2017 14:43:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317438 - in stable/11/usr.bin: banner fortune/strfile limits rpcinfo X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 14:43:23 -0000 Author: asomers Date: Wed Apr 26 14:43:21 2017 New Revision: 317438 URL: https://svnweb.freebsd.org/changeset/base/317438 Log: MFC r316500: strcpy => strlcpy, strcat => strlcat Reported by: Coverity CID: 1006703 978863 1006745 1347163 Reviewed by: cem Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D10192 Modified: stable/11/usr.bin/banner/banner.c stable/11/usr.bin/fortune/strfile/strfile.c stable/11/usr.bin/limits/limits.c stable/11/usr.bin/rpcinfo/rpcinfo.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/banner/banner.c ============================================================================== --- stable/11/usr.bin/banner/banner.c Wed Apr 26 14:28:27 2017 (r317437) +++ stable/11/usr.bin/banner/banner.c Wed Apr 26 14:43:21 2017 (r317438) @@ -1064,8 +1064,8 @@ main(int argc, char *argv[]) err(1, "malloc"); strcpy(message, *argv); while (*++argv) { - strcat(message, " "); - strcat(message, *argv); + strlcat(message, " ", j); + strlcat(message, *argv, j); } nchars = strlen(message); } else { Modified: stable/11/usr.bin/fortune/strfile/strfile.c ============================================================================== --- stable/11/usr.bin/fortune/strfile/strfile.c Wed Apr 26 14:28:27 2017 (r317437) +++ stable/11/usr.bin/fortune/strfile/strfile.c Wed Apr 26 14:43:21 2017 (r317438) @@ -303,8 +303,8 @@ getargs(int argc, char **argv) usage(); } if (*Outfile == '\0') { - strcpy(Outfile, Infile); - strcat(Outfile, ".dat"); + strlcpy(Outfile, Infile, sizeof(Outfile)); + strlcat(Outfile, ".dat", sizeof(Outfile)); } } Modified: stable/11/usr.bin/limits/limits.c ============================================================================== --- stable/11/usr.bin/limits/limits.c Wed Apr 26 14:28:27 2017 (r317437) +++ stable/11/usr.bin/limits/limits.c Wed Apr 26 14:43:21 2017 (r317438) @@ -561,7 +561,7 @@ print_limit(rlim_t limit, unsigned divis char numbr[64]; if (limit == RLIM_INFINITY) - strcpy(numbr, inf); + strlcpy(numbr, inf, sizeof(numbr)); else sprintf(numbr, "%jd", (intmax_t)((limit + divisor/2) / divisor)); printf(pfx, which, numbr); Modified: stable/11/usr.bin/rpcinfo/rpcinfo.c ============================================================================== --- stable/11/usr.bin/rpcinfo/rpcinfo.c Wed Apr 26 14:28:27 2017 (r317437) +++ stable/11/usr.bin/rpcinfo/rpcinfo.c Wed Apr 26 14:43:21 2017 (r317438) @@ -856,9 +856,9 @@ failed: printf("%-10s", buf); buf[0] = '\0'; for (nl = rs->nlist; nl; nl = nl->next) { - strcat(buf, nl->netid); + strlcat(buf, nl->netid, sizeof(buf)); if (nl->next) - strcat(buf, ","); + strlcat(buf, ",", sizeof(buf)); } printf("%-32s", buf); rpc = getrpcbynumber(rs->prog); From owner-svn-src-stable@freebsd.org Wed Apr 26 14:44:41 2017 Return-Path: Delivered-To: svn-src-stable@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 93FECD50289; Wed, 26 Apr 2017 14:44:41 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 54B8AC86; Wed, 26 Apr 2017 14:44:41 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QEier9013850; Wed, 26 Apr 2017 14:44:40 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QEieeF013847; Wed, 26 Apr 2017 14:44:40 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704261444.v3QEieeF013847@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 26 Apr 2017 14:44:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317439 - in stable/11: etc/mtree usr.bin/pr usr.bin/pr/tests X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 14:44:41 -0000 Author: asomers Date: Wed Apr 26 14:44:39 2017 New Revision: 317439 URL: https://svnweb.freebsd.org/changeset/base/317439 Log: MFC r316501, r316523 r316501: Fix file descriptor and memory leaks in pr(1) Also, hook NetBSD's pr test into the build, and add three more test cases. Reported by: Coverity, Valgrind CID: 271650 271651 271652 271653 271654 271655 271656 271656 CID: 271657 271658 271659 1006939 1006940 1006941 1006942 1009098 Reviewed by: ngie Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D9137 r316523: Remove a duplicate fclose() that snuck into r316501 Reported by: Coverity CID: 1373338 X-MFC-With: 316501 Sponsored by: Spectra Logic Corp Added: stable/11/usr.bin/pr/tests/ - copied from r316501, head/usr.bin/pr/tests/ Modified: stable/11/etc/mtree/BSD.tests.dist stable/11/usr.bin/pr/Makefile stable/11/usr.bin/pr/pr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/mtree/BSD.tests.dist ============================================================================== --- stable/11/etc/mtree/BSD.tests.dist Wed Apr 26 14:43:21 2017 (r317438) +++ stable/11/etc/mtree/BSD.tests.dist Wed Apr 26 14:44:39 2017 (r317439) @@ -626,6 +626,8 @@ .. opensm .. + pr + .. printf .. sdiff Modified: stable/11/usr.bin/pr/Makefile ============================================================================== --- stable/11/usr.bin/pr/Makefile Wed Apr 26 14:43:21 2017 (r317438) +++ stable/11/usr.bin/pr/Makefile Wed Apr 26 14:44:39 2017 (r317439) @@ -1,7 +1,13 @@ # @(#)Makefile 8.1 (Berkeley) 6/6/93 # $FreeBSD$ +.include + PROG= pr SRCS= pr.c egetopt.c +.if ${MK_TESTS} != "no" +SUBDIR+= tests +.endif + .include Modified: stable/11/usr.bin/pr/pr.c ============================================================================== --- stable/11/usr.bin/pr/pr.c Wed Apr 26 14:43:21 2017 (r317438) +++ stable/11/usr.bin/pr/pr.c Wed Apr 26 14:44:39 2017 (r317439) @@ -103,7 +103,7 @@ static char schar; /* text column separ static int sflag; /* -s option for multiple columns */ static int nohead; /* do not write head and trailer */ static int pgwd; /* page width with multiple col output */ -static const char *timefrmt; /* time conversion string */ +static char *timefrmt; /* time conversion string */ /* * misc globals @@ -135,6 +135,7 @@ main(int argc, char *argv[]) ret_val = horzcol(argc, argv); else ret_val = vertcol(argc, argv); + free(timefrmt); } else usage(); flsh_errs(); @@ -207,6 +208,7 @@ onecol(int argc, char *argv[]) * allocate header buffer */ if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) { + free(obuf); mfail(); return(1); } @@ -259,7 +261,7 @@ onecol(int argc, char *argv[]) break; if (!linecnt && !nohead && prhead(hbuf, fname, pagecnt)) - return(1); + goto err; /* * start of new line. @@ -268,9 +270,9 @@ onecol(int argc, char *argv[]) if (num) addnum(nbuf, num, ++lncnt); if (otln(obuf,cnt+off, &ips, &ops, mor)) - return(1); + goto err; } else if (otln(lbuf, cnt, &ips, &ops, mor)) - return(1); + goto err; /* * if line bigger than buffer, get more @@ -293,7 +295,7 @@ onecol(int argc, char *argv[]) * fill to end of page */ if (linecnt && prtail(lines-linecnt-lrgln, lrgln)) - return(1); + goto err; /* * On EOF go to next file @@ -306,8 +308,14 @@ onecol(int argc, char *argv[]) (void)fclose(inf); } if (eoptind < argc) - return(1); + goto err; + free(hbuf); + free(obuf); return(0); +err: + free(hbuf); + free(obuf); + return(1); } /* @@ -317,27 +325,27 @@ int vertcol(int argc, char *argv[]) { char *ptbf; - char **lstdat; + char **lstdat = NULL; int i; int j; int cnt = -1; int pln; - int *indy; + int *indy = NULL; int cvc; - int *lindy; + int *lindy = NULL; int lncnt; int stp; int pagecnt; int col = colwd + 1; int mxlen = pgwd + offst + 1; int mclcnt = clcnt - 1; - struct vcol *vc; + struct vcol *vc = NULL; int mvc; int tvc; int cw = nmwd + 1; int fullcol; - char *buf; - char *hbuf; + char *buf = NULL; + char *hbuf = NULL; char *ohbuf; const char *fname; FILE *inf; @@ -345,6 +353,7 @@ vertcol(int argc, char *argv[]) int cps = 0; int ops = 0; int mor = 0; + int retval = 1; /* * allocate page buffer @@ -359,7 +368,7 @@ vertcol(int argc, char *argv[]) */ if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) { mfail(); - return(1); + goto out; } ohbuf = hbuf + offst; if (offst) @@ -372,7 +381,7 @@ vertcol(int argc, char *argv[]) if ((vc = (struct vcol *)malloc((unsigned)mvc*sizeof(struct vcol))) == NULL) { mfail(); - return(1); + goto out; } /* @@ -380,7 +389,7 @@ vertcol(int argc, char *argv[]) */ if ((lstdat = (char **)malloc((unsigned)lines*sizeof(char *))) == NULL){ mfail(); - return(1); + goto out; } /* @@ -388,11 +397,11 @@ vertcol(int argc, char *argv[]) */ if ((indy = (int *)malloc((unsigned)lines*sizeof(int))) == NULL) { mfail(); - return(1); + goto out; } if ((lindy = (int *)malloc((unsigned)lines*sizeof(int))) == NULL) { mfail(); - return(1); + goto out; } if (nmwd) @@ -533,12 +542,13 @@ vertcol(int argc, char *argv[]) * print header */ if (!nohead && prhead(hbuf, fname, pagecnt)) - return(1); + goto out; for (i = 0; i < pln; ++i) { ips = 0; ops = 0; - if (offst&& otln(buf,offst,&ips,&ops,1)) - return(1); + if (offst && + otln(buf,offst,&ips,&ops,1)) + goto out; tvc = i; for (j = 0; j < clcnt; ++j) { @@ -563,7 +573,7 @@ vertcol(int argc, char *argv[]) cnt = fullcol; if (otln(vc[tvc].pt, cnt, &ips, &ops, 1)) - return(1); + goto out; tvc += pln; if (tvc >= cvc) break; @@ -572,13 +582,13 @@ vertcol(int argc, char *argv[]) * terminate line */ if (otln(buf, 0, &ips, &ops, 0)) - return(1); + goto out; } /* * pad to end of page */ if (prtail((lines - pln), 0)) - return(1); + goto out; /* * done with output, go to next file */ @@ -597,7 +607,7 @@ vertcol(int argc, char *argv[]) * print header */ if (pln && !nohead && prhead(hbuf, fname, pagecnt)) - return(1); + goto out; /* * output each line @@ -607,14 +617,14 @@ vertcol(int argc, char *argv[]) if ((j = lstdat[i] - ptbf) <= offst) break; if (otln(ptbf, j, &ips, &ops, 0)) - return(1); + goto out; } /* * pad to end of page */ if (pln && prtail((lines - pln), 0)) - return(1); + goto out; /* * if EOF go to next file @@ -627,8 +637,16 @@ vertcol(int argc, char *argv[]) (void)fclose(inf); } if (eoptind < argc) - return(1); - return(0); + goto out; + retval = 0; +out: + free(lindy); + free(indy); + free(lstdat); + free(vc); + free(hbuf); + free(buf); + return(retval); } /* @@ -665,6 +683,7 @@ horzcol(int argc, char *argv[]) * page header */ if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) { + free(buf); mfail(); return(1); } @@ -744,19 +763,19 @@ horzcol(int argc, char *argv[]) break; if (!i && !nohead && prhead(hbuf, fname, pagecnt)) - return(1); + goto err; /* * output line */ if (otln(buf, j, &ips, &ops, 0)) - return(1); + goto err; } /* * pad to end of page */ if (i && prtail(lines-i, 0)) - return(1); + goto err; /* * if EOF go to next file @@ -769,8 +788,14 @@ horzcol(int argc, char *argv[]) (void)fclose(inf); } if (eoptind < argc) - return(1); + goto err; + free(hbuf); + free(buf); return(0); +err: + free(hbuf); + free(buf); + return(1); } /* @@ -786,27 +811,28 @@ mulfile(int argc, char *argv[]) int cnt; char *lstdat; int i; - FILE **fbuf; + FILE **fbuf = NULL; int actf; int lncnt; int col; int pagecnt; int fproc; - char *buf; - char *hbuf; + char *buf = NULL; + char *hbuf = NULL; char *ohbuf; const char *fname; int ips = 0; int cps = 0; int ops = 0; int mor = 0; + int retval = 1; /* * array of FILE *, one for each operand */ if ((fbuf = (FILE **)malloc((unsigned)clcnt*sizeof(FILE *))) == NULL) { mfail(); - return(1); + goto out; } /* @@ -814,7 +840,7 @@ mulfile(int argc, char *argv[]) */ if ((hbuf = malloc((unsigned)(HDBUF + offst)*sizeof(char))) == NULL) { mfail(); - return(1); + goto out; } ohbuf = hbuf + offst; @@ -838,7 +864,7 @@ mulfile(int argc, char *argv[]) * if no files, exit */ if (!j) - return(1); + goto out; /* * calculate page boundaries based on open file count @@ -854,7 +880,7 @@ mulfile(int argc, char *argv[]) if (colwd < 1) { (void)fprintf(err, "pr: page width too small for %d columns\n", clcnt); - return(1); + goto out; } actf = clcnt; col = colwd + 1; @@ -864,7 +890,7 @@ mulfile(int argc, char *argv[]) */ if ((buf = malloc((unsigned)(pgwd+offst+1)*sizeof(char))) == NULL) { mfail(); - return(1); + goto out; } if (offst) { (void)memset(buf, (int)' ', offst); @@ -951,13 +977,13 @@ mulfile(int argc, char *argv[]) break; if (!i && !nohead && prhead(hbuf, fname, pagecnt)) - return(1); + goto out; /* * output line */ if (otln(buf, j, &ips, &ops, 0)) - return(1); + goto out; /* * if no more active files, done @@ -972,12 +998,17 @@ mulfile(int argc, char *argv[]) * pad to end of page */ if (i && prtail(lines-i, 0)) - return(1); + goto out; ++pagecnt; } if (eoptind < argc) - return(1); - return(0); + goto out; + retval = 0; +out: + free(buf); + free(hbuf); + free(fbuf); + return(retval); } /* @@ -1344,6 +1375,7 @@ nxtfile(int argc, char **argv, const cha (void)fprintf(err, "pr: cannot get time of day, %s\n", strerror(errno)); + fclose(inf); return(NULL); } timeptr = localtime(&tv_sec); @@ -1725,7 +1757,9 @@ setup(int argc, char *argv[]) break; case 'w': ++wflag; - if (!isdigit((unsigned char)*eoptarg) || ((pgwd = atoi(eoptarg)) < 1)){ + if ((eoptarg == NULL ) || + !isdigit((unsigned char)*eoptarg) || + ((pgwd = atoi(eoptarg)) < 1)){ (void)fputs( "pr: -w width must be 1 or more \n",err); return(1); From owner-svn-src-stable@freebsd.org Wed Apr 26 14:50:08 2017 Return-Path: Delivered-To: svn-src-stable@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 2C9B6D5043B; Wed, 26 Apr 2017 14:50:08 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D8E16F14; Wed, 26 Apr 2017 14:50:07 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3QEo6JA014162; Wed, 26 Apr 2017 14:50:06 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QEo6A0014160; Wed, 26 Apr 2017 14:50:06 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704261450.v3QEo6A0014160@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 26 Apr 2017 14:50:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317440 - in stable/11/sbin/geom: class/part misc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 14:50:08 -0000 Author: asomers Date: Wed Apr 26 14:50:06 2017 New Revision: 317440 URL: https://svnweb.freebsd.org/changeset/base/317440 Log: MFC r316530, r316535 r316530: Fix clearing geom metadata if DIOCGSECTORSIZE fails An unhandled error case would result in passing SIZE_MAX to malloc. While I'm here, remove an unnecessary NULL check before free Reported by: Coverity CID: 1017793 Sponsored by: Spectra Logic Corp r316535: Fix memory leak in "gpart bootcode" Also, annotate that gpart_issue never returns Reported by: Coverity CID: 1007105 Sponsored by: Spectra Logic Corp Modified: stable/11/sbin/geom/class/part/geom_part.c stable/11/sbin/geom/misc/subr.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/geom/class/part/geom_part.c ============================================================================== --- stable/11/sbin/geom/class/part/geom_part.c Wed Apr 26 14:44:39 2017 (r317439) +++ stable/11/sbin/geom/class/part/geom_part.c Wed Apr 26 14:50:06 2017 (r317440) @@ -81,7 +81,7 @@ static int gpart_autofill(struct gctl_re static int gpart_autofill_resize(struct gctl_req *); static void gpart_bootcode(struct gctl_req *, unsigned int); static void *gpart_bootfile_read(const char *, ssize_t *); -static void gpart_issue(struct gctl_req *, unsigned int); +static _Noreturn void gpart_issue(struct gctl_req *, unsigned int); static void gpart_show(struct gctl_req *, unsigned int); static void gpart_show_geom(struct ggeom *, const char *, int); static int gpart_show_hasopt(struct gctl_req *, const char *, const char *); @@ -1270,6 +1270,7 @@ gpart_bootcode(struct gctl_req *req, uns gpart_issue(req, fl); geom_deletetree(&mesh); + free(partcode); } static void @@ -1290,7 +1291,7 @@ gpart_print_error(const char *errstr) warnx("%s", errmsg); } -static void +static _Noreturn void gpart_issue(struct gctl_req *req, unsigned int fl __unused) { char buf[4096]; Modified: stable/11/sbin/geom/misc/subr.c ============================================================================== --- stable/11/sbin/geom/misc/subr.c Wed Apr 26 14:44:39 2017 (r317439) +++ stable/11/sbin/geom/misc/subr.c Wed Apr 26 14:50:06 2017 (r317440) @@ -336,7 +336,7 @@ g_metadata_clear(const char *name, const goto out; } sectorsize = g_sectorsize(fd); - if (sectorsize == 0) { + if (sectorsize <= 0) { error = errno; goto out; } @@ -365,8 +365,7 @@ g_metadata_clear(const char *name, const } (void)g_flush(fd); out: - if (sector != NULL) - free(sector); + free(sector); g_close(fd); return (error); } From owner-svn-src-stable@freebsd.org Wed Apr 26 16:27:21 2017 Return-Path: Delivered-To: svn-src-stable@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 9B752D515B8; 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 6CF54278; 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 v3QGRKke054862; 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 v3QGRKQQ054861; Wed, 26 Apr 2017 16:27:20 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201704261627.v3QGRKQQ054861@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-11@freebsd.org Subject: svn commit: r317442 - in stable: 10/release/tools 11/release/tools X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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/11/release/tools/vmimage.subr Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/release/tools/vmimage.subr Directory Properties: stable/10/ (props changed) Modified: stable/11/release/tools/vmimage.subr ============================================================================== --- stable/11/release/tools/vmimage.subr Wed Apr 26 16:13:22 2017 (r317441) +++ stable/11/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@freebsd.org Wed Apr 26 16:27:21 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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@freebsd.org Wed Apr 26 22:04:57 2017 Return-Path: Delivered-To: svn-src-stable@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 05E46D51F83; Wed, 26 Apr 2017 22:04: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 AC8F1D27; Wed, 26 Apr 2017 22:04:56 +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 v3QM4t9v096404; Wed, 26 Apr 2017 22:04:55 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QM4tc9096401; Wed, 26 Apr 2017 22:04:55 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704262204.v3QM4tc9096401@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:04:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317466 - stable/11/sys/rpc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 22:04:57 -0000 Author: rmacklem Date: Wed Apr 26 22:04:55 2017 New Revision: 317466 URL: https://svnweb.freebsd.org/changeset/base/317466 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/11/sys/rpc/clnt_rc.c stable/11/sys/rpc/clnt_vc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/rpc/clnt_rc.c ============================================================================== --- stable/11/sys/rpc/clnt_rc.c Wed Apr 26 21:54:53 2017 (r317465) +++ stable/11/sys/rpc/clnt_rc.c Wed Apr 26 22:04:55 2017 (r317466) @@ -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/11/sys/rpc/clnt_vc.c ============================================================================== --- stable/11/sys/rpc/clnt_vc.c Wed Apr 26 21:54:53 2017 (r317465) +++ stable/11/sys/rpc/clnt_vc.c Wed Apr 26 22:04:55 2017 (r317466) @@ -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@freebsd.org Wed Apr 26 22:11:45 2017 Return-Path: Delivered-To: svn-src-stable@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 D23DED510B0; Wed, 26 Apr 2017 22:11:45 +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 9566218A; Wed, 26 Apr 2017 22:11:45 +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 v3QMBiKj098805; Wed, 26 Apr 2017 22:11:44 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QMBiPY098804; Wed, 26 Apr 2017 22:11:44 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704262211.v3QMBiPY098804@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:11:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317467 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 22:11:45 -0000 Author: rmacklem Date: Wed Apr 26 22:11:44 2017 New Revision: 317467 URL: https://svnweb.freebsd.org/changeset/base/317467 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/11/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clstate.c Wed Apr 26 22:04:55 2017 (r317466) +++ stable/11/sys/fs/nfsclient/nfs_clstate.c Wed Apr 26 22:11:44 2017 (r317467) @@ -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@freebsd.org Wed Apr 26 22:17:56 2017 Return-Path: Delivered-To: svn-src-stable@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 12A57D513D2; Wed, 26 Apr 2017 22:17:56 +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 B928583F; Wed, 26 Apr 2017 22:17:55 +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 v3QMHsFl000656; Wed, 26 Apr 2017 22:17:54 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QMHsnO000655; Wed, 26 Apr 2017 22:17:54 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704262217.v3QMHsnO000655@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:17:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317468 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 22:17:56 -0000 Author: rmacklem Date: Wed Apr 26 22:17:54 2017 New Revision: 317468 URL: https://svnweb.freebsd.org/changeset/base/317468 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/11/sys/fs/nfsclient/nfs_clstate.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clstate.c Wed Apr 26 22:11:44 2017 (r317467) +++ stable/11/sys/fs/nfsclient/nfs_clstate.c Wed Apr 26 22:17:54 2017 (r317468) @@ -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@freebsd.org Wed Apr 26 22:23:44 2017 Return-Path: Delivered-To: svn-src-stable@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 5DBD7D515DB; Wed, 26 Apr 2017 22:23:44 +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 10A4BC79; Wed, 26 Apr 2017 22:23:43 +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 v3QMNhRF004449; Wed, 26 Apr 2017 22:23:43 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QMNht7004448; Wed, 26 Apr 2017 22:23:43 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201704262223.v3QMNht7004448@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Wed, 26 Apr 2017 22:23:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317469 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 22:23:44 -0000 Author: smh Date: Wed Apr 26 22:23:42 2017 New Revision: 317469 URL: https://svnweb.freebsd.org/changeset/base/317469 Log: MFC r316460: Fix expandsz 16.0E vals and vdev_min_asize of RAIDZ children Sponsored by: Multiplay Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Apr 26 22:17:54 2017 (r317468) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c Wed Apr 26 22:23:42 2017 (r317469) @@ -228,7 +228,8 @@ vdev_get_min_asize(vdev_t *vd) * so each child must provide at least 1/Nth of its asize. */ if (pvd->vdev_ops == &vdev_raidz_ops) - return (pvd->vdev_min_asize / pvd->vdev_children); + return ((pvd->vdev_min_asize + pvd->vdev_children - 1) / + pvd->vdev_children); return (pvd->vdev_min_asize); } @@ -1376,7 +1377,7 @@ vdev_open(vdev_t *vd) vd->vdev_psize = psize; /* - * Make sure the allocatable size hasn't shrunk. + * Make sure the allocatable size hasn't shrunk too much. */ if (asize < vd->vdev_min_asize) { vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN, @@ -1416,12 +1417,21 @@ vdev_open(vdev_t *vd) } /* - * If all children are healthy and the asize has increased, - * then we've experienced dynamic LUN growth. If automatic - * expansion is enabled then use the additional space. - */ - if (vd->vdev_state == VDEV_STATE_HEALTHY && asize > vd->vdev_asize && - (vd->vdev_expanding || spa->spa_autoexpand)) + * If all children are healthy we update asize if either: + * The asize has increased, due to a device expansion caused by dynamic + * LUN growth or vdev replacement, and automatic expansion is enabled; + * making the additional space available. + * + * The asize has decreased, due to a device shrink usually caused by a + * vdev replace with a smaller device. This ensures that calculations + * based of max_asize and asize e.g. esize are always valid. It's safe + * to do this as we've already validated that asize is greater than + * vdev_min_asize. + */ + if (vd->vdev_state == VDEV_STATE_HEALTHY && + ((asize > vd->vdev_asize && + (vd->vdev_expanding || spa->spa_autoexpand)) || + (asize < vd->vdev_asize))) vd->vdev_asize = asize; vdev_set_min_asize(vd); From owner-svn-src-stable@freebsd.org Wed Apr 26 22:25:02 2017 Return-Path: Delivered-To: svn-src-stable@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 D617CD51677; Wed, 26 Apr 2017 22:25:02 +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 A5B74DCA; Wed, 26 Apr 2017 22:25:02 +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 v3QMP1JN004566; Wed, 26 Apr 2017 22:25:01 GMT (envelope-from smh@FreeBSD.org) Received: (from smh@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QMP1Ud004565; Wed, 26 Apr 2017 22:25:01 GMT (envelope-from smh@FreeBSD.org) Message-Id: <201704262225.v3QMP1Ud004565@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: smh set sender to smh@FreeBSD.org using -f From: Steven Hartland Date: Wed, 26 Apr 2017 22:25:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317470 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 22:25:02 -0000 Author: smh Date: Wed Apr 26 22:25:01 2017 New Revision: 317470 URL: https://svnweb.freebsd.org/changeset/base/317470 Log: MFC r315449: Reduce ARC fragmentation threshold Sponsored by: Multiplay Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Apr 26 22:23:42 2017 (r317469) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Wed Apr 26 22:25:01 2017 (r317470) @@ -3978,7 +3978,7 @@ arc_available_memory(void) * Start aggressive reclamation if too little sequential KVA left. */ if (lowest > 0) { - n = (vmem_size(heap_arena, VMEM_MAXFREE) < zfs_max_recordsize) ? + n = (vmem_size(heap_arena, VMEM_MAXFREE) < SPA_MAXBLOCKSIZE) ? -((int64_t)vmem_size(heap_arena, VMEM_ALLOC) >> 4) : INT64_MAX; if (n < lowest) { From owner-svn-src-stable@freebsd.org Wed Apr 26 22:31:45 2017 Return-Path: Delivered-To: svn-src-stable@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 55FF7D518B2; Wed, 26 Apr 2017 22:31:45 +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 190FB108A; Wed, 26 Apr 2017 22:31:45 +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 v3QMViEH008729; Wed, 26 Apr 2017 22:31:44 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QMViUR008728; Wed, 26 Apr 2017 22:31:44 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704262231.v3QMViUR008728@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:31:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317471 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 22:31:45 -0000 Author: rmacklem Date: Wed Apr 26 22:31:43 2017 New Revision: 317471 URL: https://svnweb.freebsd.org/changeset/base/317471 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. Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvnops.c Wed Apr 26 22:25:01 2017 (r317470) +++ stable/11/sys/fs/nfsclient/nfs_clvnops.c Wed Apr 26 22:31:43 2017 (r317471) @@ -140,6 +140,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 @@ -176,6 +177,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 = { @@ -3381,6 +3383,39 @@ 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); + } + + /* Now, flush the buffer cache. */ + ncl_flush(vp, MNT_WAIT, NULL, curthread, 0, 0); + + /* 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@freebsd.org Wed Apr 26 22:40:09 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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@freebsd.org Wed Apr 26 22:53:31 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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@freebsd.org Wed Apr 26 23:01:51 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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@freebsd.org Wed Apr 26 23:24:06 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 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@freebsd.org Wed Apr 26 23:32:58 2017 Return-Path: Delivered-To: svn-src-stable@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 937DFD51A27; Wed, 26 Apr 2017 23:32:58 +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 6307AA7D; Wed, 26 Apr 2017 23:32:58 +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 v3QNWvDs033154; Wed, 26 Apr 2017 23:32:57 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3QNWvZI033153; Wed, 26 Apr 2017 23:32:57 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704262332.v3QNWvZI033153@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:32:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org Subject: svn commit: r317477 - stable/9/sys/fs/nfsclient X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Apr 2017 23:32:58 -0000 Author: rmacklem Date: Wed Apr 26 23:32:57 2017 New Revision: 317477 URL: https://svnweb.freebsd.org/changeset/base/317477 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/9/sys/fs/nfsclient/nfs_clport.c Directory Properties: stable/9/sys/ (props changed) stable/9/sys/fs/ (props changed) Modified: stable/9/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/9/sys/fs/nfsclient/nfs_clport.c Wed Apr 26 23:24:05 2017 (r317476) +++ stable/9/sys/fs/nfsclient/nfs_clport.c Wed Apr 26 23:32:57 2017 (r317477) @@ -1129,7 +1129,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@freebsd.org Thu Apr 27 00:25:26 2017 Return-Path: Delivered-To: svn-src-stable@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 44DD5D51949; Thu, 27 Apr 2017 00:25:26 +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 06667140F; Thu, 27 Apr 2017 00:25:25 +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 v3R0PPuH053783; Thu, 27 Apr 2017 00:25:25 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3R0PPYT053782; Thu, 27 Apr 2017 00:25:25 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201704270025.v3R0PPYT053782@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 00:25:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317478 - stable/11/contrib/elftoolchain/elfcopy X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 00:25:26 -0000 Author: emaste Date: Thu Apr 27 00:25:24 2017 New Revision: 317478 URL: https://svnweb.freebsd.org/changeset/base/317478 Log: MFC r317193: elfcopy: document --strip-symbols=filename in the man page Reported by: bz Sponsored by: The FreeBSD Foundation Modified: stable/11/contrib/elftoolchain/elfcopy/elfcopy.1 Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/elftoolchain/elfcopy/elfcopy.1 ============================================================================== --- stable/11/contrib/elftoolchain/elfcopy/elfcopy.1 Wed Apr 26 23:32:57 2017 (r317477) +++ stable/11/contrib/elftoolchain/elfcopy/elfcopy.1 Thu Apr 27 00:25:24 2017 (r317478) @@ -23,7 +23,7 @@ .\" .\" $Id: elfcopy.1 3426 2016-03-05 13:32:28Z emaste $ .\" -.Dd March 5, 2016 +.Dd April 20, 2017 .Os .Dt ELFCOPY 1 .Sh NAME @@ -83,6 +83,7 @@ .Op Fl -srec-forceS3 .Op Fl -srec-len Ns = Ns Ar val .Op Fl -strip-dwo +.Op Fl -strip-symbols= Ns Ar filename .Op Fl -strip-unneeded .Ar infile .Op Ar outfile @@ -339,6 +340,10 @@ This option is only meaningful when the .Dq srec . .It Fl -strip-dwo Do not copy .dwo debug sections to the output file. +.It Fl -strip-symbols= Ns Ar filename +Do not copy any of the symbols specified by +.Ar filename +to the output. .It Fl -strip-unneeded Do not copy symbols that are not needed for relocation processing. .El From owner-svn-src-stable@freebsd.org Thu Apr 27 01:58:21 2017 Return-Path: Delivered-To: svn-src-stable@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 7DDA9D5220C; Thu, 27 Apr 2017 01:58:21 +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 5AE0B7C6; Thu, 27 Apr 2017 01:58:21 +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 v3R1wKPb092570; Thu, 27 Apr 2017 01:58:20 GMT (envelope-from sephe@FreeBSD.org) Received: (from sephe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3R1wKMb092569; Thu, 27 Apr 2017 01:58:20 GMT (envelope-from sephe@FreeBSD.org) Message-Id: <201704270158.v3R1wKMb092569@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 01:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317481 - stable/11/sys/dev/hyperv/netvsc X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 01:58:21 -0000 Author: sephe Date: Thu Apr 27 01:58:20 2017 New Revision: 317481 URL: https://svnweb.freebsd.org/changeset/base/317481 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/11/sys/dev/hyperv/netvsc/if_hn.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/hyperv/netvsc/if_hn.c ============================================================================== --- stable/11/sys/dev/hyperv/netvsc/if_hn.c Thu Apr 27 00:53:55 2017 (r317480) +++ stable/11/sys/dev/hyperv/netvsc/if_hn.c Thu Apr 27 01:58:20 2017 (r317481) @@ -622,6 +622,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. */ @@ -634,15 +644,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)) @@ -691,8 +692,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 @@ -4369,7 +4427,29 @@ hn_transmit(struct ifnet *ifp, struct mb idx = bid % sc->hn_tx_ring_inuse; else #endif - idx = m->m_pkthdr.flowid % sc->hn_tx_ring_inuse; + { +#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]; From owner-svn-src-stable@freebsd.org Thu Apr 27 02:17:46 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 06:27:41 2017 Return-Path: Delivered-To: svn-src-stable@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 F3DE7D52959; Thu, 27 Apr 2017 06:27:40 +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 C55DF1906; Thu, 27 Apr 2017 06:27:40 +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 v3R6RdRG002224; Thu, 27 Apr 2017 06:27:39 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3R6Rdx9002222; Thu, 27 Apr 2017 06:27:39 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704270627.v3R6Rdx9002222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Apr 2017 06:27:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317484 - stable/11/sys/dev/sound/pci/hda X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 06:27:41 -0000 Author: mav Date: Thu Apr 27 06:27:39 2017 New Revision: 317484 URL: https://svnweb.freebsd.org/changeset/base/317484 Log: MFC r315961: Add ids for ALC233 found on Intel Skull Mountain NUC. Modified: stable/11/sys/dev/sound/pci/hda/hdac.h stable/11/sys/dev/sound/pci/hda/hdacc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- stable/11/sys/dev/sound/pci/hda/hdac.h Thu Apr 27 05:48:52 2017 (r317483) +++ stable/11/sys/dev/sound/pci/hda/hdac.h Thu Apr 27 06:27:39 2017 (r317484) @@ -339,6 +339,7 @@ /* Realtek */ #define REALTEK_VENDORID 0x10ec #define HDA_CODEC_ALC221 HDA_CODEC_CONSTRUCT(REALTEK, 0x0221) +#define HDA_CODEC_ALC233 HDA_CODEC_CONSTRUCT(REALTEK, 0x0233) #define HDA_CODEC_ALC260 HDA_CODEC_CONSTRUCT(REALTEK, 0x0260) #define HDA_CODEC_ALC262 HDA_CODEC_CONSTRUCT(REALTEK, 0x0262) #define HDA_CODEC_ALC267 HDA_CODEC_CONSTRUCT(REALTEK, 0x0267) Modified: stable/11/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- stable/11/sys/dev/sound/pci/hda/hdacc.c Thu Apr 27 05:48:52 2017 (r317483) +++ stable/11/sys/dev/sound/pci/hda/hdacc.c Thu Apr 27 06:27:39 2017 (r317484) @@ -77,6 +77,7 @@ static const struct { { HDA_CODEC_CS4207, 0, "Cirrus Logic CS4207" }, { HDA_CODEC_CS4210, 0, "Cirrus Logic CS4210" }, { HDA_CODEC_ALC221, 0, "Realtek ALC221" }, + { HDA_CODEC_ALC233, 0, "Realtek ALC233" }, { HDA_CODEC_ALC260, 0, "Realtek ALC260" }, { HDA_CODEC_ALC262, 0, "Realtek ALC262" }, { HDA_CODEC_ALC267, 0, "Realtek ALC267" }, From owner-svn-src-stable@freebsd.org Thu Apr 27 06:28:14 2017 Return-Path: Delivered-To: svn-src-stable@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 92621D529FF; Thu, 27 Apr 2017 06:28:14 +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 50D131A76; Thu, 27 Apr 2017 06:28:14 +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 v3R6SDi8002489; Thu, 27 Apr 2017 06:28:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3R6SD5c002487; Thu, 27 Apr 2017 06:28:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704270628.v3R6SD5c002487@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Apr 2017 06:28:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317485 - stable/11/sys/dev/sound/pci/hda X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 06:28:14 -0000 Author: mav Date: Thu Apr 27 06:28:12 2017 New Revision: 317485 URL: https://svnweb.freebsd.org/changeset/base/317485 Log: MFC r316758: Update list of Conexant and Realtek codecs. Modified: stable/11/sys/dev/sound/pci/hda/hdac.h stable/11/sys/dev/sound/pci/hda/hdacc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/sound/pci/hda/hdac.h ============================================================================== --- stable/11/sys/dev/sound/pci/hda/hdac.h Thu Apr 27 06:27:39 2017 (r317484) +++ stable/11/sys/dev/sound/pci/hda/hdac.h Thu Apr 27 06:28:12 2017 (r317485) @@ -339,7 +339,13 @@ /* Realtek */ #define REALTEK_VENDORID 0x10ec #define HDA_CODEC_ALC221 HDA_CODEC_CONSTRUCT(REALTEK, 0x0221) +#define HDA_CODEC_ALC225 HDA_CODEC_CONSTRUCT(REALTEK, 0x0225) +#define HDA_CODEC_ALC231 HDA_CODEC_CONSTRUCT(REALTEK, 0x0231) #define HDA_CODEC_ALC233 HDA_CODEC_CONSTRUCT(REALTEK, 0x0233) +#define HDA_CODEC_ALC234 HDA_CODEC_CONSTRUCT(REALTEK, 0x0234) +#define HDA_CODEC_ALC235 HDA_CODEC_CONSTRUCT(REALTEK, 0x0235) +#define HDA_CODEC_ALC255 HDA_CODEC_CONSTRUCT(REALTEK, 0x0255) +#define HDA_CODEC_ALC256 HDA_CODEC_CONSTRUCT(REALTEK, 0x0256) #define HDA_CODEC_ALC260 HDA_CODEC_CONSTRUCT(REALTEK, 0x0260) #define HDA_CODEC_ALC262 HDA_CODEC_CONSTRUCT(REALTEK, 0x0262) #define HDA_CODEC_ALC267 HDA_CODEC_CONSTRUCT(REALTEK, 0x0267) @@ -348,8 +354,23 @@ #define HDA_CODEC_ALC270 HDA_CODEC_CONSTRUCT(REALTEK, 0x0270) #define HDA_CODEC_ALC272 HDA_CODEC_CONSTRUCT(REALTEK, 0x0272) #define HDA_CODEC_ALC273 HDA_CODEC_CONSTRUCT(REALTEK, 0x0273) +#define HDA_CODEC_ALC274 HDA_CODEC_CONSTRUCT(REALTEK, 0x0274) #define HDA_CODEC_ALC275 HDA_CODEC_CONSTRUCT(REALTEK, 0x0275) #define HDA_CODEC_ALC276 HDA_CODEC_CONSTRUCT(REALTEK, 0x0276) +#define HDA_CODEC_ALC280 HDA_CODEC_CONSTRUCT(REALTEK, 0x0280) +#define HDA_CODEC_ALC282 HDA_CODEC_CONSTRUCT(REALTEK, 0x0282) +#define HDA_CODEC_ALC283 HDA_CODEC_CONSTRUCT(REALTEK, 0x0283) +#define HDA_CODEC_ALC284 HDA_CODEC_CONSTRUCT(REALTEK, 0x0284) +#define HDA_CODEC_ALC285 HDA_CODEC_CONSTRUCT(REALTEK, 0x0285) +#define HDA_CODEC_ALC286 HDA_CODEC_CONSTRUCT(REALTEK, 0x0286) +#define HDA_CODEC_ALC288 HDA_CODEC_CONSTRUCT(REALTEK, 0x0288) +#define HDA_CODEC_ALC290 HDA_CODEC_CONSTRUCT(REALTEK, 0x0290) +#define HDA_CODEC_ALC292 HDA_CODEC_CONSTRUCT(REALTEK, 0x0292) +#define HDA_CODEC_ALC293 HDA_CODEC_CONSTRUCT(REALTEK, 0x0293) +#define HDA_CODEC_ALC294 HDA_CODEC_CONSTRUCT(REALTEK, 0x0294) +#define HDA_CODEC_ALC295 HDA_CODEC_CONSTRUCT(REALTEK, 0x0295) +#define HDA_CODEC_ALC298 HDA_CODEC_CONSTRUCT(REALTEK, 0x0298) +#define HDA_CODEC_ALC299 HDA_CODEC_CONSTRUCT(REALTEK, 0x0299) #define HDA_CODEC_ALC292 HDA_CODEC_CONSTRUCT(REALTEK, 0x0292) #define HDA_CODEC_ALC295 HDA_CODEC_CONSTRUCT(REALTEK, 0x0295) #define HDA_CODEC_ALC660 HDA_CODEC_CONSTRUCT(REALTEK, 0x0660) @@ -357,7 +378,11 @@ #define HDA_CODEC_ALC663 HDA_CODEC_CONSTRUCT(REALTEK, 0x0663) #define HDA_CODEC_ALC665 HDA_CODEC_CONSTRUCT(REALTEK, 0x0665) #define HDA_CODEC_ALC670 HDA_CODEC_CONSTRUCT(REALTEK, 0x0670) +#define HDA_CODEC_ALC671 HDA_CODEC_CONSTRUCT(REALTEK, 0x0671) #define HDA_CODEC_ALC680 HDA_CODEC_CONSTRUCT(REALTEK, 0x0680) +#define HDA_CODEC_ALC700 HDA_CODEC_CONSTRUCT(REALTEK, 0x0700) +#define HDA_CODEC_ALC701 HDA_CODEC_CONSTRUCT(REALTEK, 0x0701) +#define HDA_CODEC_ALC703 HDA_CODEC_CONSTRUCT(REALTEK, 0x0703) #define HDA_CODEC_ALC861 HDA_CODEC_CONSTRUCT(REALTEK, 0x0861) #define HDA_CODEC_ALC861VD HDA_CODEC_CONSTRUCT(REALTEK, 0x0862) #define HDA_CODEC_ALC880 HDA_CODEC_CONSTRUCT(REALTEK, 0x0880) @@ -370,6 +395,7 @@ #define HDA_CODEC_ALC892 HDA_CODEC_CONSTRUCT(REALTEK, 0x0892) #define HDA_CODEC_ALC899 HDA_CODEC_CONSTRUCT(REALTEK, 0x0899) #define HDA_CODEC_ALC1150 HDA_CODEC_CONSTRUCT(REALTEK, 0x0900) +#define HDA_CODEC_ALC1220 HDA_CODEC_CONSTRUCT(REALTEK, 0x1220) #define HDA_CODEC_ALCXXXX HDA_CODEC_CONSTRUCT(REALTEK, 0xffff) /* Motorola */ @@ -546,6 +572,17 @@ #define HDA_CODEC_CX20652 HDA_CODEC_CONSTRUCT(CONEXANT, 0x50ac) #define HDA_CODEC_CX20664 HDA_CODEC_CONSTRUCT(CONEXANT, 0x50b8) #define HDA_CODEC_CX20665 HDA_CODEC_CONSTRUCT(CONEXANT, 0x50b9) +#define HDA_CODEC_CX21722 HDA_CODEC_CONSTRUCT(CONEXANT, 0x50f1) +#define HDA_CODEC_CX20722 HDA_CODEC_CONSTRUCT(CONEXANT, 0x50f2) +#define HDA_CODEC_CX21724 HDA_CODEC_CONSTRUCT(CONEXANT, 0x50f3) +#define HDA_CODEC_CX20724 HDA_CODEC_CONSTRUCT(CONEXANT, 0x50f4) +#define HDA_CODEC_CX20751 HDA_CODEC_CONSTRUCT(CONEXANT, 0x510f) +#define HDA_CODEC_CX20751_2 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5110) +#define HDA_CODEC_CX20753 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5111) +#define HDA_CODEC_CX20755 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5113) +#define HDA_CODEC_CX20756 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5114) +#define HDA_CODEC_CX20757 HDA_CODEC_CONSTRUCT(CONEXANT, 0x5115) +#define HDA_CODEC_CX20952 HDA_CODEC_CONSTRUCT(CONEXANT, 0x51d7) #define HDA_CODEC_CXXXXX HDA_CODEC_CONSTRUCT(CONEXANT, 0xffff) /* VIA */ Modified: stable/11/sys/dev/sound/pci/hda/hdacc.c ============================================================================== --- stable/11/sys/dev/sound/pci/hda/hdacc.c Thu Apr 27 06:27:39 2017 (r317484) +++ stable/11/sys/dev/sound/pci/hda/hdacc.c Thu Apr 27 06:28:12 2017 (r317485) @@ -77,7 +77,13 @@ static const struct { { HDA_CODEC_CS4207, 0, "Cirrus Logic CS4207" }, { HDA_CODEC_CS4210, 0, "Cirrus Logic CS4210" }, { HDA_CODEC_ALC221, 0, "Realtek ALC221" }, + { HDA_CODEC_ALC225, 0, "Realtek ALC225" }, + { HDA_CODEC_ALC231, 0, "Realtek ALC231" }, { HDA_CODEC_ALC233, 0, "Realtek ALC233" }, + { HDA_CODEC_ALC234, 0, "Realtek ALC234" }, + { HDA_CODEC_ALC235, 0, "Realtek ALC235" }, + { HDA_CODEC_ALC255, 0, "Realtek ALC255" }, + { HDA_CODEC_ALC256, 0, "Realtek ALC256" }, { HDA_CODEC_ALC260, 0, "Realtek ALC260" }, { HDA_CODEC_ALC262, 0, "Realtek ALC262" }, { HDA_CODEC_ALC267, 0, "Realtek ALC267" }, @@ -86,17 +92,36 @@ static const struct { { HDA_CODEC_ALC270, 0, "Realtek ALC270" }, { HDA_CODEC_ALC272, 0, "Realtek ALC272" }, { HDA_CODEC_ALC273, 0, "Realtek ALC273" }, + { HDA_CODEC_ALC274, 0, "Realtek ALC274" }, { HDA_CODEC_ALC275, 0, "Realtek ALC275" }, { HDA_CODEC_ALC276, 0, "Realtek ALC276" }, { HDA_CODEC_ALC292, 0, "Realtek ALC292" }, { HDA_CODEC_ALC295, 0, "Realtek ALC295" }, + { HDA_CODEC_ALC280, 0, "Realtek ALC280" }, + { HDA_CODEC_ALC282, 0, "Realtek ALC282" }, + { HDA_CODEC_ALC283, 0, "Realtek ALC283" }, + { HDA_CODEC_ALC284, 0, "Realtek ALC284" }, + { HDA_CODEC_ALC285, 0, "Realtek ALC285" }, + { HDA_CODEC_ALC286, 0, "Realtek ALC286" }, + { HDA_CODEC_ALC288, 0, "Realtek ALC288" }, + { HDA_CODEC_ALC290, 0, "Realtek ALC290" }, + { HDA_CODEC_ALC292, 0, "Realtek ALC292" }, + { HDA_CODEC_ALC293, 0, "Realtek ALC293" }, + { HDA_CODEC_ALC294, 0, "Realtek ALC294" }, + { HDA_CODEC_ALC295, 0, "Realtek ALC295" }, + { HDA_CODEC_ALC298, 0, "Realtek ALC298" }, + { HDA_CODEC_ALC299, 0, "Realtek ALC299" }, { HDA_CODEC_ALC660, 0, "Realtek ALC660-VD" }, { HDA_CODEC_ALC662, 0x0002, "Realtek ALC662 rev2" }, { HDA_CODEC_ALC662, 0, "Realtek ALC662" }, { HDA_CODEC_ALC663, 0, "Realtek ALC663" }, { HDA_CODEC_ALC665, 0, "Realtek ALC665" }, { HDA_CODEC_ALC670, 0, "Realtek ALC670" }, + { HDA_CODEC_ALC671, 0, "Realtek ALC671" }, { HDA_CODEC_ALC680, 0, "Realtek ALC680" }, + { HDA_CODEC_ALC700, 0, "Realtek ALC700" }, + { HDA_CODEC_ALC701, 0, "Realtek ALC701" }, + { HDA_CODEC_ALC703, 0, "Realtek ALC703" }, { HDA_CODEC_ALC861, 0x0340, "Realtek ALC660" }, { HDA_CODEC_ALC861, 0, "Realtek ALC861" }, { HDA_CODEC_ALC861VD, 0, "Realtek ALC861-VD" }, @@ -113,6 +138,7 @@ static const struct { { HDA_CODEC_ALC892, 0, "Realtek ALC892" }, { HDA_CODEC_ALC899, 0, "Realtek ALC899" }, { HDA_CODEC_ALC1150, 0, "Realtek ALC1150" }, + { HDA_CODEC_ALC1220, 0, "Realtek ALC1220" }, { HDA_CODEC_AD1882, 0, "Analog Devices AD1882" }, { HDA_CODEC_AD1882A, 0, "Analog Devices AD1882A" }, { HDA_CODEC_AD1883, 0, "Analog Devices AD1883" }, @@ -248,6 +274,17 @@ static const struct { { HDA_CODEC_CX20652, 0, "Conexant CX20652" }, { HDA_CODEC_CX20664, 0, "Conexant CX20664" }, { HDA_CODEC_CX20665, 0, "Conexant CX20665" }, + { HDA_CODEC_CX21722, 0, "Conexant CX21722" }, + { HDA_CODEC_CX20722, 0, "Conexant CX20722" }, + { HDA_CODEC_CX21724, 0, "Conexant CX21724" }, + { HDA_CODEC_CX20724, 0, "Conexant CX20724" }, + { HDA_CODEC_CX20751, 0, "Conexant CX20751/2" }, + { HDA_CODEC_CX20751_2, 0, "Conexant CX20751/2" }, + { HDA_CODEC_CX20753, 0, "Conexant CX20753/4" }, + { HDA_CODEC_CX20755, 0, "Conexant CX20755" }, + { HDA_CODEC_CX20756, 0, "Conexant CX20756" }, + { HDA_CODEC_CX20757, 0, "Conexant CX20757" }, + { HDA_CODEC_CX20952, 0, "Conexant CX20952" }, { HDA_CODEC_VT1708_8, 0, "VIA VT1708_8" }, { HDA_CODEC_VT1708_9, 0, "VIA VT1708_9" }, { HDA_CODEC_VT1708_A, 0, "VIA VT1708_A" }, From owner-svn-src-stable@freebsd.org Thu Apr 27 06:29:03 2017 Return-Path: Delivered-To: svn-src-stable@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 C146BD52ADD; Thu, 27 Apr 2017 06:29:03 +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 8E7781CCC; Thu, 27 Apr 2017 06:29:03 +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 v3R6T2Zh002733; Thu, 27 Apr 2017 06:29:02 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3R6T2NM002732; Thu, 27 Apr 2017 06:29:02 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201704270629.v3R6T2NM002732@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 27 Apr 2017 06:29:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317486 - stable/11/sys/dev/watchdog X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 06:29:03 -0000 Author: mav Date: Thu Apr 27 06:29:02 2017 New Revision: 317486 URL: https://svnweb.freebsd.org/changeset/base/317486 Log: MFC r317185: Some cosmetic polishing for pre-timeouts. Modified: stable/11/sys/dev/watchdog/watchdog.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/watchdog/watchdog.c ============================================================================== --- stable/11/sys/dev/watchdog/watchdog.c Thu Apr 27 06:28:12 2017 (r317485) +++ stable/11/sys/dev/watchdog/watchdog.c Thu Apr 27 06:29:02 2017 (r317486) @@ -229,13 +229,13 @@ wd_timeout_cb(void *arg) #ifdef DDB if ((wd_pretimeout_act & WD_SOFT_DDB)) { char kdb_why[80]; - snprintf(kdb_why, sizeof(kdb_why), "watchdog %s timeout", type); + snprintf(kdb_why, sizeof(kdb_why), "watchdog %s-timeout", type); kdb_backtrace(); kdb_enter(KDB_WHY_WATCHDOG, kdb_why); } #endif if ((wd_pretimeout_act & WD_SOFT_LOG)) - log(LOG_EMERG, "watchdog %s-timeout, WD_SOFT_LOG", type); + log(LOG_EMERG, "watchdog %s-timeout, WD_SOFT_LOG\n", type); if ((wd_pretimeout_act & WD_SOFT_PRINTF)) printf("watchdog %s-timeout, WD_SOFT_PRINTF\n", type); if ((wd_pretimeout_act & WD_SOFT_PANIC)) @@ -292,8 +292,7 @@ wd_set_pretimeout(int newtimeout, int di /* We determined the value is sane, so reset the callout */ (void) callout_reset(&wd_pretimeo_handle, - timeout_ticks, - wd_timeout_cb, "pre-timeout"); + timeout_ticks, wd_timeout_cb, "pre"); wd_pretimeout = newtimeout; return 0; } From owner-svn-src-stable@freebsd.org Thu Apr 27 07:30:50 2017 Return-Path: Delivered-To: svn-src-stable@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 430F4D52BEA; Thu, 27 Apr 2017 07:30:50 +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 ED579262; Thu, 27 Apr 2017 07:30:49 +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 v3R7UmJD030065; Thu, 27 Apr 2017 07:30:48 GMT (envelope-from truckman@FreeBSD.org) Received: (from truckman@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3R7UmDX030063; Thu, 27 Apr 2017 07:30:48 GMT (envelope-from truckman@FreeBSD.org) Message-Id: <201704270730.v3R7UmDX030063@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:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317488 - stable/11/sys/netpfil/ipfw X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 07:30:50 -0000 Author: truckman Date: Thu Apr 27 07:30:48 2017 New Revision: 317488 URL: https://svnweb.freebsd.org/changeset/base/317488 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/11/sys/netpfil/ipfw/dn_aqm_codel.c stable/11/sys/netpfil/ipfw/dn_aqm_pie.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/netpfil/ipfw/dn_aqm_codel.c ============================================================================== --- stable/11/sys/netpfil/ipfw/dn_aqm_codel.c Thu Apr 27 06:52:30 2017 (r317487) +++ stable/11/sys/netpfil/ipfw/dn_aqm_codel.c Thu Apr 27 07:30:48 2017 (r317488) @@ -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/11/sys/netpfil/ipfw/dn_aqm_pie.c ============================================================================== --- stable/11/sys/netpfil/ipfw/dn_aqm_pie.c Thu Apr 27 06:52:30 2017 (r317487) +++ stable/11/sys/netpfil/ipfw/dn_aqm_pie.c Thu Apr 27 07:30:48 2017 (r317488) @@ -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@freebsd.org Thu Apr 27 07:32:09 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 12:12:35 2017 Return-Path: Delivered-To: svn-src-stable@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 61243D50A50; Thu, 27 Apr 2017 12:12: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 2D22CA2A; Thu, 27 Apr 2017 12:12: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 v3RCCYt4047218; Thu, 27 Apr 2017 12:12:34 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3RCCYZY047217; Thu, 27 Apr 2017 12:12:34 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201704271212.v3RCCYZY047217@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:12:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317500 - stable/11/sys/dev/fb X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 12:12:35 -0000 Author: kib Date: Thu Apr 27 12:12:33 2017 New Revision: 317500 URL: https://svnweb.freebsd.org/changeset/base/317500 Log: MFC r317196: Write-combine framebuffer writes through user-space mappings, if possible. Modified: stable/11/sys/dev/fb/vesa.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/fb/vesa.c ============================================================================== --- stable/11/sys/dev/fb/vesa.c Thu Apr 27 12:09:03 2017 (r317499) +++ stable/11/sys/dev/fb/vesa.c Thu Apr 27 12:12:33 2017 (r317500) @@ -1635,6 +1635,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@freebsd.org Thu Apr 27 12:15:17 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 12:17:00 2017 Return-Path: Delivered-To: svn-src-stable@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 00193D50D40; Thu, 27 Apr 2017 12:16:59 +0000 (UTC) (envelope-from ae@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 CF584FE9; Thu, 27 Apr 2017 12:16:59 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3RCGwgK047871; Thu, 27 Apr 2017 12:16:58 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3RCGwB9047867; Thu, 27 Apr 2017 12:16:58 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201704271216.v3RCGwB9047867@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 27 Apr 2017 12:16:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317502 - in stable/11: lib/libipsec sbin/setkey sys/netipsec X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 12:17:00 -0000 Author: ae Date: Thu Apr 27 12:16:58 2017 New Revision: 317502 URL: https://svnweb.freebsd.org/changeset/base/317502 Log: MFC r316759: Add large replay widow support to setkey(8) and libipsec. When the replay window size is large than UINT8_MAX, add to the request the SADB_X_EXT_SA_REPLAY extension header that was added in r309144. Also add support of SADB_X_EXT_NAT_T_TYPE, SADB_X_EXT_NAT_T_SPORT, SADB_X_EXT_NAT_T_DPORT, SADB_X_EXT_NAT_T_OAI, SADB_X_EXT_NAT_T_OAR, SADB_X_EXT_SA_REPLAY, SADB_X_EXT_NEW_ADDRESS_SRC, SADB_X_EXT_NEW_ADDRESS_DST extension headers to the key_debug that is used by `setkey -x`. Modify kdebug_sockaddr() to use inet_ntop() for IP addresses formatting. And modify kdebug_sadb_x_policy() to show policy scope and priority. Reviewed by: gnn, Emeric Poupon Differential Revision: https://reviews.freebsd.org/D10375 Modified: stable/11/lib/libipsec/pfkey.c stable/11/sbin/setkey/Makefile stable/11/sbin/setkey/parse.y stable/11/sys/netipsec/key_debug.c Directory Properties: stable/11/ (props changed) Modified: stable/11/lib/libipsec/pfkey.c ============================================================================== --- stable/11/lib/libipsec/pfkey.c Thu Apr 27 12:15:15 2017 (r317501) +++ stable/11/lib/libipsec/pfkey.c Thu Apr 27 12:16:58 2017 (r317502) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -69,6 +70,7 @@ static caddr_t pfkey_setsadbmsg(caddr_t, u_int, u_int32_t, pid_t); static caddr_t pfkey_setsadbsa(caddr_t, caddr_t, u_int32_t, u_int, u_int, u_int, u_int32_t); +static caddr_t pfkey_setsadbxreplay(caddr_t, caddr_t, uint32_t); static caddr_t pfkey_setsadbaddr(caddr_t, caddr_t, u_int, struct sockaddr *, u_int, u_int); static caddr_t pfkey_setsadbkey(caddr_t, caddr_t, u_int, caddr_t, u_int); @@ -1196,6 +1198,13 @@ pfkey_send_x1(so, type, satype, mode, sr + sizeof(struct sadb_lifetime) + sizeof(struct sadb_lifetime); + if (wsize > UINT8_MAX) { + if (wsize > (UINT32_MAX - 32) >> 3) { + __ipsec_errcode = EIPSEC_INVAL_ARGUMENT; + return (-1); + } + len += sizeof(struct sadb_x_sa_replay); + } if (e_type != SADB_EALG_NONE) len += (sizeof(struct sadb_key) + PFKEY_ALIGN8(e_keylen)); if (a_type != SADB_AALG_NONE) @@ -1223,6 +1232,13 @@ pfkey_send_x1(so, type, satype, mode, sr free(newmsg); return -1; } + if (wsize > UINT8_MAX) { + p = pfkey_setsadbxreplay(p, ep, wsize); + if (!p) { + free(newmsg); + return (-1); + } + } p = pfkey_setsadbaddr(p, ep, SADB_EXT_ADDRESS_SRC, src, plen, IPSEC_ULPROTO_ANY); if (!p) { @@ -1982,7 +1998,7 @@ pfkey_setsadbsa(buf, lim, spi, wsize, au p->sadb_sa_len = PFKEY_UNIT64(len); p->sadb_sa_exttype = SADB_EXT_SA; p->sadb_sa_spi = spi; - p->sadb_sa_replay = wsize; + p->sadb_sa_replay = wsize > UINT8_MAX ? UINT8_MAX: wsize; p->sadb_sa_state = SADB_SASTATE_LARVAL; p->sadb_sa_auth = auth; p->sadb_sa_encrypt = enc; @@ -1992,6 +2008,31 @@ pfkey_setsadbsa(buf, lim, spi, wsize, au } /* + * Set data into sadb_x_sa_replay. + * `buf' must has been allocated sufficiently. + */ +static caddr_t +pfkey_setsadbxreplay(caddr_t buf, caddr_t lim, uint32_t wsize) +{ + struct sadb_x_sa_replay *p; + u_int len; + + p = (struct sadb_x_sa_replay *)buf; + len = sizeof(struct sadb_x_sa_replay); + + if (buf + len > lim) + return (NULL); + + memset(p, 0, len); + p->sadb_x_sa_replay_len = PFKEY_UNIT64(len); + p->sadb_x_sa_replay_exttype = SADB_X_EXT_SA_REPLAY; + /* Convert wsize from bytes to number of packets. */ + p->sadb_x_sa_replay_replay = wsize << 3; + + return (buf + len); +} + +/* * set data into sadb_address. * `buf' must has been allocated sufficiently. * prefixlen is in bits. Modified: stable/11/sbin/setkey/Makefile ============================================================================== --- stable/11/sbin/setkey/Makefile Thu Apr 27 12:15:15 2017 (r317501) +++ stable/11/sbin/setkey/Makefile Thu Apr 27 12:16:58 2017 (r317502) @@ -51,6 +51,9 @@ CFLAGS+= -I${.CURDIR}/../../lib/libipsec SRCS+= y.tab.h y.tab.h: parse.y CFLAGS+= -DIPSEC_DEBUG -DYY_NO_UNPUT +.if ${MK_INET_SUPPORT} != "no" +CFLAGS+= -DINET +.endif .if ${MK_INET6_SUPPORT} != "no" CFLAGS+= -DINET6 .endif Modified: stable/11/sbin/setkey/parse.y ============================================================================== --- stable/11/sbin/setkey/parse.y Thu Apr 27 12:15:15 2017 (r317501) +++ stable/11/sbin/setkey/parse.y Thu Apr 27 12:16:58 2017 (r317502) @@ -45,6 +45,7 @@ #include #include #include +#include #include #include #include @@ -513,6 +514,8 @@ extension return -1; } p_replay = $2; + if (p_replay > (UINT32_MAX - 32) >> 3) + yyerror("replay window is too large"); } | F_LIFETIME_HARD DECSTRING { p_lt_hard = $2; } | F_LIFETIME_SOFT DECSTRING { p_lt_soft = $2; } @@ -899,6 +902,7 @@ setkeymsg_addr(type, satype, srcs, dsts, int l, l0, len; struct sadb_sa m_sa; struct sadb_x_sa2 m_sa2; + struct sadb_x_sa_replay m_replay; struct sadb_address m_addr; struct addrinfo *s, *d; int n; @@ -920,7 +924,8 @@ setkeymsg_addr(type, satype, srcs, dsts, m_sa.sadb_sa_len = PFKEY_UNIT64(len); m_sa.sadb_sa_exttype = SADB_EXT_SA; m_sa.sadb_sa_spi = htonl(p_spi); - m_sa.sadb_sa_replay = p_replay; + m_sa.sadb_sa_replay = p_replay > UINT8_MAX ? UINT8_MAX: + p_replay; m_sa.sadb_sa_state = 0; m_sa.sadb_sa_auth = p_alg_auth; m_sa.sadb_sa_encrypt = p_alg_enc; @@ -937,6 +942,17 @@ setkeymsg_addr(type, satype, srcs, dsts, memcpy(buf + l, &m_sa2, len); l += len; + + if (p_replay > UINT8_MAX) { + len = sizeof(struct sadb_x_sa_replay); + m_replay.sadb_x_sa_replay_len = PFKEY_UNIT64(len); + m_replay.sadb_x_sa_replay_exttype = + SADB_X_EXT_SA_REPLAY; + m_replay.sadb_x_sa_replay_replay = p_replay << 3; + + memcpy(buf + l, &m_replay, len); + l += len; + } } l0 = l; @@ -1017,6 +1033,7 @@ setkeymsg_add(type, satype, srcs, dsts) struct sadb_sa m_sa; struct sadb_x_sa2 m_sa2; struct sadb_address m_addr; + struct sadb_x_sa_replay m_replay; struct addrinfo *s, *d; int n; int plen; @@ -1100,7 +1117,7 @@ setkeymsg_add(type, satype, srcs, dsts) m_sa.sadb_sa_len = PFKEY_UNIT64(len); m_sa.sadb_sa_exttype = SADB_EXT_SA; m_sa.sadb_sa_spi = htonl(p_spi); - m_sa.sadb_sa_replay = p_replay; + m_sa.sadb_sa_replay = p_replay > UINT8_MAX ? UINT8_MAX: p_replay; m_sa.sadb_sa_state = 0; m_sa.sadb_sa_auth = p_alg_auth; m_sa.sadb_sa_encrypt = p_alg_enc; @@ -1118,6 +1135,15 @@ setkeymsg_add(type, satype, srcs, dsts) memcpy(buf + l, &m_sa2, len); l += len; + if (p_replay > UINT8_MAX) { + len = sizeof(struct sadb_x_sa_replay); + m_replay.sadb_x_sa_replay_len = PFKEY_UNIT64(len); + m_replay.sadb_x_sa_replay_exttype = SADB_X_EXT_SA_REPLAY; + m_replay.sadb_x_sa_replay_replay = p_replay << 3; + + memcpy(buf + l, &m_replay, len); + l += len; + } l0 = l; n = 0; Modified: stable/11/sys/netipsec/key_debug.c ============================================================================== --- stable/11/sys/netipsec/key_debug.c Thu Apr 27 12:15:15 2017 (r317501) +++ stable/11/sys/netipsec/key_debug.c Thu Apr 27 12:16:58 2017 (r317502) @@ -63,6 +63,7 @@ #include #include #include +#include #endif /* !_KERNEL */ static void kdebug_sadb_prop(struct sadb_ext *); @@ -73,6 +74,8 @@ static void kdebug_sadb_sa(struct sadb_e static void kdebug_sadb_address(struct sadb_ext *); static void kdebug_sadb_key(struct sadb_ext *); static void kdebug_sadb_x_sa2(struct sadb_ext *); +static void kdebug_sadb_x_sa_replay(struct sadb_ext *); +static void kdebug_sadb_x_natt(struct sadb_ext *); #ifdef _KERNEL static void kdebug_secreplay(struct secreplay *); @@ -131,6 +134,10 @@ kdebug_sadb(struct sadb_msg *base) case SADB_EXT_ADDRESS_SRC: case SADB_EXT_ADDRESS_DST: case SADB_EXT_ADDRESS_PROXY: + case SADB_X_EXT_NAT_T_OAI: + case SADB_X_EXT_NAT_T_OAR: + case SADB_X_EXT_NEW_ADDRESS_SRC: + case SADB_X_EXT_NEW_ADDRESS_DST: kdebug_sadb_address(ext); break; case SADB_EXT_KEY_AUTH: @@ -159,6 +166,14 @@ kdebug_sadb(struct sadb_msg *base) case SADB_X_EXT_SA2: kdebug_sadb_x_sa2(ext); break; + case SADB_X_EXT_SA_REPLAY: + kdebug_sadb_x_sa_replay(ext); + break; + case SADB_X_EXT_NAT_T_TYPE: + case SADB_X_EXT_NAT_T_SPORT: + case SADB_X_EXT_NAT_T_DPORT: + kdebug_sadb_x_natt(ext); + break; default: printf("%s: invalid ext_type %u\n", __func__, ext->sadb_ext_type); @@ -342,8 +357,6 @@ kdebug_sadb_address(struct sadb_ext *ext ((u_char *)&addr->sadb_address_reserved)[1]); kdebug_sockaddr((struct sockaddr *)((caddr_t)ext + sizeof(*addr))); - - return; } static void @@ -392,6 +405,41 @@ kdebug_sadb_x_sa2(struct sadb_ext *ext) return; } +static void +kdebug_sadb_x_sa_replay(struct sadb_ext *ext) +{ + struct sadb_x_sa_replay *replay; + + /* sanity check */ + if (ext == NULL) + panic("%s: NULL pointer was passed.\n", __func__); + + replay = (struct sadb_x_sa_replay *)ext; + printf("sadb_x_sa_replay{ replay=%u }\n", + replay->sadb_x_sa_replay_replay); +} + +static void +kdebug_sadb_x_natt(struct sadb_ext *ext) +{ + struct sadb_x_nat_t_type *type; + struct sadb_x_nat_t_port *port; + + /* sanity check */ + if (ext == NULL) + panic("%s: NULL pointer was passed.\n", __func__); + + if (ext->sadb_ext_type == SADB_X_EXT_NAT_T_TYPE) { + type = (struct sadb_x_nat_t_type *)ext; + printf("sadb_x_nat_t_type{ type=%u }\n", + type->sadb_x_nat_t_type_type); + } else { + port = (struct sadb_x_nat_t_port *)ext; + printf("sadb_x_nat_t_port{ port=%u }\n", + ntohs(port->sadb_x_nat_t_port_port)); + } +} + void kdebug_sadb_x_policy(struct sadb_ext *ext) { @@ -402,9 +450,11 @@ kdebug_sadb_x_policy(struct sadb_ext *ex if (ext == NULL) panic("%s: NULL pointer was passed.\n", __func__); - printf("sadb_x_policy{ type=%u dir=%u id=%x }\n", + printf("sadb_x_policy{ type=%u dir=%u id=%x scope=%u %s=%u }\n", xpl->sadb_x_policy_type, xpl->sadb_x_policy_dir, - xpl->sadb_x_policy_id); + xpl->sadb_x_policy_id, xpl->sadb_x_policy_scope, + xpl->sadb_x_policy_scope == IPSEC_POLICYSCOPE_IFNET ? + "ifindex": "priority", xpl->sadb_x_policy_priority); if (xpl->sadb_x_policy_type == IPSEC_POLICY_IPSEC) { int tlen; @@ -850,39 +900,42 @@ ipsec_sa2str(struct secasvar *sav, char void kdebug_sockaddr(struct sockaddr *addr) { - struct sockaddr_in *sin4; -#ifdef INET6 - struct sockaddr_in6 *sin6; -#endif + char buf[IPSEC_ADDRSTRLEN]; /* sanity check */ if (addr == NULL) panic("%s: NULL pointer was passed.\n", __func__); - /* NOTE: We deal with port number as host byte order. */ - printf("sockaddr{ len=%u family=%u", addr->sa_len, addr->sa_family); - switch (addr->sa_family) { - case AF_INET: - sin4 = (struct sockaddr_in *)addr; - printf(" port=%u\n", ntohs(sin4->sin_port)); - ipsec_hexdump((caddr_t)&sin4->sin_addr, sizeof(sin4->sin_addr)); +#ifdef INET + case AF_INET: { + struct sockaddr_in *sin; + + sin = (struct sockaddr_in *)addr; + inet_ntop(AF_INET, &sin->sin_addr, buf, sizeof(buf)); break; + } +#endif #ifdef INET6 - case AF_INET6: + case AF_INET6: { + struct sockaddr_in6 *sin6; + sin6 = (struct sockaddr_in6 *)addr; - printf(" port=%u\n", ntohs(sin6->sin6_port)); - printf(" flowinfo=0x%08x, scope_id=0x%08x\n", - sin6->sin6_flowinfo, sin6->sin6_scope_id); - ipsec_hexdump((caddr_t)&sin6->sin6_addr, - sizeof(sin6->sin6_addr)); + if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { + snprintf(buf, sizeof(buf), "%s%%%u", + inet_ntop(AF_INET6, &sin6->sin6_addr, buf, + sizeof(buf)), sin6->sin6_scope_id); + } else + inet_ntop(AF_INET6, &sin6->sin6_addr, buf, + sizeof(buf)); break; + } #endif + default: + sprintf(buf, "unknown"); } - - printf(" }\n"); - - return; + printf("sockaddr{ len=%u family=%u addr=%s }\n", addr->sa_len, + addr->sa_family, buf); } void From owner-svn-src-stable@freebsd.org Thu Apr 27 18:21:40 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 20:07:16 2017 Return-Path: Delivered-To: svn-src-stable@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 08B33D4BDDF; Thu, 27 Apr 2017 20:07:16 +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 CC819127D; Thu, 27 Apr 2017 20:07:15 +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 v3RK7EgR041018; Thu, 27 Apr 2017 20:07:14 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3RK7ERp041017; Thu, 27 Apr 2017 20:07:14 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704272007.v3RK7ERp041017@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 20:07:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317519 - stable/11/sys/fs/nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 20:07:16 -0000 Author: rmacklem Date: Thu Apr 27 20:07:14 2017 New Revision: 317519 URL: https://svnweb.freebsd.org/changeset/base/317519 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/11/sys/fs/nfsclient/nfs_clkrpc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfsclient/nfs_clkrpc.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clkrpc.c Thu Apr 27 19:57:18 2017 (r317518) +++ stable/11/sys/fs/nfsclient/nfs_clkrpc.c Thu Apr 27 20:07:14 2017 (r317519) @@ -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@freebsd.org Thu Apr 27 20:08:04 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 20:14:56 2017 Return-Path: Delivered-To: svn-src-stable@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 E63DFD5114A; Thu, 27 Apr 2017 20:14:56 +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 B6CEA198B; Thu, 27 Apr 2017 20:14:56 +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 v3RKEt9l045414; Thu, 27 Apr 2017 20:14:55 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3RKEt24045406; Thu, 27 Apr 2017 20:14:55 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704272014.v3RKEt24045406@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 20:14:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317520 - in stable/11/sys: fs/nfs fs/nfsclient nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 20:14:57 -0000 Author: rmacklem Date: Thu Apr 27 20:14:54 2017 New Revision: 317520 URL: https://svnweb.freebsd.org/changeset/base/317520 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/11/sys/fs/nfs/nfs_var.h stable/11/sys/fs/nfs/nfsport.h stable/11/sys/fs/nfsclient/nfs_clport.c stable/11/sys/fs/nfsclient/nfs_clrpcops.c stable/11/sys/fs/nfsclient/nfs_clstate.c stable/11/sys/fs/nfsclient/nfs_clvfsops.c stable/11/sys/nfsclient/nfsargs.h Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/11/sys/fs/nfs/nfs_var.h Thu Apr 27 20:07:14 2017 (r317519) +++ stable/11/sys/fs/nfs/nfs_var.h Thu Apr 27 20:14:54 2017 (r317520) @@ -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/11/sys/fs/nfs/nfsport.h ============================================================================== --- stable/11/sys/fs/nfs/nfsport.h Thu Apr 27 20:07:14 2017 (r317519) +++ stable/11/sys/fs/nfs/nfsport.h Thu Apr 27 20:14:54 2017 (r317520) @@ -929,6 +929,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/11/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clport.c Thu Apr 27 20:07:14 2017 (r317519) +++ stable/11/sys/fs/nfsclient/nfs_clport.c Thu Apr 27 20:14:54 2017 (r317520) @@ -634,7 +634,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; } @@ -1255,7 +1255,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/11/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clrpcops.c Thu Apr 27 20:07:14 2017 (r317519) +++ stable/11/sys/fs/nfsclient/nfs_clrpcops.c Thu Apr 27 20:14:54 2017 (r317520) @@ -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) { @@ -1893,7 +1893,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) { @@ -2198,7 +2198,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/11/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clstate.c Thu Apr 27 20:07:14 2017 (r317519) +++ stable/11/sys/fs/nfsclient/nfs_clstate.c Thu Apr 27 20:14:54 2017 (r317520) @@ -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/11/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvfsops.c Thu Apr 27 20:07:14 2017 (r317519) +++ stable/11/sys/fs/nfsclient/nfs_clvfsops.c Thu Apr 27 20:14:54 2017 (r317520) @@ -592,6 +592,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); @@ -727,7 +733,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 }; /* @@ -962,6 +968,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"); @@ -1172,8 +1180,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 | @@ -1181,6 +1189,7 @@ nfs_mount(struct mount *mp) NFSMNT_KERB | NFSMNT_INTEGRITY | NFSMNT_PRIVACY | + NFSMNT_ONEOPENOWN | NFSMNT_NOLOCKD /*|NFSMNT_XLATECOOKIE*/)) | (nmp->nm_flag & (NFSMNT_NFSV3 | @@ -1188,6 +1197,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; @@ -1946,6 +1956,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/11/sys/nfsclient/nfsargs.h ============================================================================== --- stable/11/sys/nfsclient/nfsargs.h Thu Apr 27 20:07:14 2017 (r317519) +++ stable/11/sys/nfsclient/nfsargs.h Thu Apr 27 20:14:54 2017 (r317520) @@ -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@freebsd.org Thu Apr 27 20:21:31 2017 Return-Path: Delivered-To: svn-src-stable@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 2DE81D512EB; Thu, 27 Apr 2017 20:21: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 F041C1DCD; Thu, 27 Apr 2017 20:21: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 v3RKLUdl048543; Thu, 27 Apr 2017 20:21:30 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3RKLTGu048542; Thu, 27 Apr 2017 20:21:29 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704272021.v3RKLTGu048542@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 20:21:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317521 - stable/11/sbin/mount_nfs X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 27 Apr 2017 20:21:31 -0000 Author: rmacklem Date: Thu Apr 27 20:21:29 2017 New Revision: 317521 URL: https://svnweb.freebsd.org/changeset/base/317521 Log: MFC: r316793 Document the "oneopenown" option added by r316792. This is a content change. Modified: stable/11/sbin/mount_nfs/mount_nfs.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- stable/11/sbin/mount_nfs/mount_nfs.8 Thu Apr 27 20:14:54 2017 (r317520) +++ stable/11/sbin/mount_nfs/mount_nfs.8 Thu Apr 27 20:21:29 2017 (r317521) @@ -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 @@ -201,6 +201,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@freebsd.org Thu Apr 27 20:52:37 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 21:27:22 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 21:37:41 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 21:45:52 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 22:00:58 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 22:06:38 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 22:10:37 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 22:11:51 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 22:28:51 2017 Return-Path: Delivered-To: svn-src-stable@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 652D8D53789; 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 309AB81C; 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 v3RMSoNJ000675; 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 v3RMSoq0000674; Thu, 27 Apr 2017 22:28:50 GMT (envelope-from badger@FreeBSD.org) Message-Id: <201704272228.v3RMSoq0000674@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-11@freebsd.org Subject: svn commit: r317529 - in stable: 10/sys/sys 11/sys/sys X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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/11/sys/sys/proc.h Changes in other areas also in this revision: Modified: stable/10/sys/sys/proc.h Modified: stable/11/sys/sys/proc.h ============================================================================== --- stable/11/sys/sys/proc.h Thu Apr 27 22:03:08 2017 (r317528) +++ stable/11/sys/sys/proc.h Thu Apr 27 22:28:49 2017 (r317529) @@ -224,8 +224,8 @@ struct thread { struct umtx_q *td_umtxq; /* (c?) Link for when we're blocked. */ struct vm_domain_policy td_vm_dom_policy; /* (c) current numa domain policy */ 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() */ @@ -341,6 +341,8 @@ struct thread { int td_lastcpu; /* (t) Last cpu we were on. */ int td_oncpu; /* (t) Which cpu we are on. */ sbintime_t td_sleeptimo; /* (t) Sleep timeout. */ + sigqueue_t td_sigqueue; /* (c) Sigs arrived, not delivered. */ +#define td_siglist td_sigqueue.sq_signals }; struct thread0_storage { From owner-svn-src-stable@freebsd.org Thu Apr 27 22:28:51 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 22:33:35 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 23:10:35 2017 Return-Path: Delivered-To: svn-src-stable@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 B9E74D53582 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 8B47B1EF3 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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Thu Apr 27 23:14:02 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 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@freebsd.org Fri Apr 28 01:02:29 2017 Return-Path: Delivered-To: svn-src-stable@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 C2943D531BB for ; Fri, 28 Apr 2017 01:02:29 +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 778E86C1 for ; Fri, 28 Apr 2017 01:02:29 +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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 01:02:29 -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@freebsd.org Fri Apr 28 14:43:16 2017 Return-Path: Delivered-To: svn-src-stable@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 F3D02D538F9; Fri, 28 Apr 2017 14:43:15 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id CE4EFB29; Fri, 28 Apr 2017 14:43:15 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3SEhEJx099639; Fri, 28 Apr 2017 14:43:14 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3SEhEWk099636; Fri, 28 Apr 2017 14:43:14 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704281443.v3SEhEWk099636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 28 Apr 2017 14:43:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317554 - in stable/11/etc/periodic: daily monthly weekly X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 14:43:16 -0000 Author: asomers Date: Fri Apr 28 14:43:14 2017 New Revision: 317554 URL: https://svnweb.freebsd.org/changeset/base/317554 Log: MFC r316548: Quiet 450.status-security when *_inline="YES" Previously, 450.status-security would always set rc=3 in inline mode, because it doesn't know whether "periodic security" is going to find anything interesting. But this annoyingly results in daily reports that simply say "Security check: \n\n-- End of daily output --". This change fixes that by testing whether "periodic security" printed anything, and setting 450.status-security's exit status to 3 if it did. An alternative would be to change the exit status of periodic(8) to be the worst of its scripts' exit statuses, but that would be a more intrusive change. Reviewed by: brian Differential Revision: https://reviews.freebsd.org/D10267 Modified: stable/11/etc/periodic/daily/450.status-security stable/11/etc/periodic/monthly/450.status-security stable/11/etc/periodic/weekly/450.status-security Directory Properties: stable/11/ (props changed) Modified: stable/11/etc/periodic/daily/450.status-security ============================================================================== --- stable/11/etc/periodic/daily/450.status-security Fri Apr 28 13:15:41 2017 (r317553) +++ stable/11/etc/periodic/daily/450.status-security Fri Apr 28 14:43:14 2017 (r317554) @@ -22,19 +22,25 @@ case "$daily_status_security_enable" in esac export security_output="${daily_status_security_output}" + rc=0 case "${daily_status_security_output}" in "") - rc=3;; + if tempfile=`mktemp ${TMPDIR:-/tmp}/450.status-security.XXXXXX` + then + periodic security > $tempfile || rc=3 + if [ -s "$tempfile" ]; then + cat "$tempfile" + rc=3 + fi + rm -f "$tempfile" + fi;; /*) echo " (output logged separately)" - rc=0;; + periodic security || rc=3;; *) echo " (output mailed separately)" - rc=0;; - esac - - periodic security || rc=3;; - + periodic security || rc=3;; + esac;; *) rc=0;; esac Modified: stable/11/etc/periodic/monthly/450.status-security ============================================================================== --- stable/11/etc/periodic/monthly/450.status-security Fri Apr 28 13:15:41 2017 (r317553) +++ stable/11/etc/periodic/monthly/450.status-security Fri Apr 28 14:43:14 2017 (r317554) @@ -22,19 +22,25 @@ case "$monthly_status_security_enable" i esac export security_output="${monthly_status_security_output}" + rc=0 case "${monthly_status_security_output}" in "") - rc=3;; + if tempfile=`mktemp ${TMPDIR:-/tmp}/450.status-security.XXXXXX` + then + periodic security > $tempfile || rc=3 + if [ -s "$tempfile" ]; then + cat "$tempfile" + rc=3 + fi + rm -f "$tempfile" + fi;; /*) echo " (output logged separately)" - rc=0;; + periodic security || rc=3;; *) echo " (output mailed separately)" - rc=0;; - esac - - periodic security || rc=3;; - + periodic security || rc=3;; + esac;; *) rc=0;; esac Modified: stable/11/etc/periodic/weekly/450.status-security ============================================================================== --- stable/11/etc/periodic/weekly/450.status-security Fri Apr 28 13:15:41 2017 (r317553) +++ stable/11/etc/periodic/weekly/450.status-security Fri Apr 28 14:43:14 2017 (r317554) @@ -22,19 +22,25 @@ case "$weekly_status_security_enable" in esac export security_output="${weekly_status_security_output}" + rc=0 case "${weekly_status_security_output}" in "") - rc=3;; + if tempfile=`mktemp ${TMPDIR:-/tmp}/450.status-security.XXXXXX` + then + periodic security > $tempfile || rc=3 + if [ -s "$tempfile" ]; then + cat "$tempfile" + rc=3 + fi + rm -f "$tempfile" + fi;; /*) echo " (output logged separately)" - rc=0;; + periodic security || rc=3;; *) echo " (output mailed separately)" - rc=0;; - esac - - periodic security || rc=3;; - + periodic security || rc=3;; + esac;; *) rc=0;; esac From owner-svn-src-stable@freebsd.org Fri Apr 28 14:45:05 2017 Return-Path: Delivered-To: svn-src-stable@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 162E4D53996; Fri, 28 Apr 2017 14:45:05 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id DB8DBCBE; Fri, 28 Apr 2017 14:45:04 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3SEj3mb099782; Fri, 28 Apr 2017 14:45:03 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3SEj3f5099781; Fri, 28 Apr 2017 14:45:03 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704281445.v3SEj3f5099781@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 28 Apr 2017 14:45:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317555 - stable/11/usr.bin/netstat X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 14:45:05 -0000 Author: asomers Date: Fri Apr 28 14:45:03 2017 New Revision: 317555 URL: https://svnweb.freebsd.org/changeset/base/317555 Log: MFC r316610: usr.bin/netstat: strcpy -> strlcpy Reported by: Coverity CID: 1006741, 1006744 Sponsored by: Spectra Logic Corp Modified: stable/11/usr.bin/netstat/inet6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/netstat/inet6.c ============================================================================== --- stable/11/usr.bin/netstat/inet6.c Fri Apr 28 14:43:14 2017 (r317554) +++ stable/11/usr.bin/netstat/inet6.c Fri Apr 28 14:45:03 2017 (r317555) @@ -618,7 +618,7 @@ ip6_ifstats(char *ifname) return; } - strcpy(ifr.ifr_name, ifname); + strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(s, SIOCGIFSTAT_IN6, (char *)&ifr) < 0) { if (errno != EPFNOSUPPORT) xo_warn("Warning: ioctl(SIOCGIFSTAT_IN6)"); @@ -1079,7 +1079,7 @@ icmp6_ifstats(char *ifname) return; } - strcpy(ifr.ifr_name, ifname); + strlcpy(ifr.ifr_name, ifname, sizeof(ifr.ifr_name)); if (ioctl(s, SIOCGIFSTAT_ICMP6, (char *)&ifr) < 0) { if (errno != EPFNOSUPPORT) xo_warn("Warning: ioctl(SIOCGIFSTAT_ICMP6)"); From owner-svn-src-stable@freebsd.org Fri Apr 28 14:48:30 2017 Return-Path: Delivered-To: svn-src-stable@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 9E7B8D53AF4; Fri, 28 Apr 2017 14:48:30 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 6D90BF6E; Fri, 28 Apr 2017 14:48:30 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3SEmTbL000181; Fri, 28 Apr 2017 14:48:29 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3SEmT0N000180; Fri, 28 Apr 2017 14:48:29 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201704281448.v3SEmT0N000180@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Fri, 28 Apr 2017 14:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317556 - stable/11/sbin/mount X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 14:48:30 -0000 Author: asomers Date: Fri Apr 28 14:48:29 2017 New Revision: 317556 URL: https://svnweb.freebsd.org/changeset/base/317556 Log: MFC r316611: sbin/mount: strcpy -> strlcpy Reported by: Coverity CID: 1011173, 1011174 Sponsored by: Spectra Logic Corp Modified: stable/11/sbin/mount/mount.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/mount/mount.c ============================================================================== --- stable/11/sbin/mount/mount.c Fri Apr 28 14:45:03 2017 (r317555) +++ stable/11/sbin/mount/mount.c Fri Apr 28 14:48:29 2017 (r317556) @@ -597,7 +597,7 @@ mountfs(const char *vfstype, const char append_arg(&mnt_argv, execname); mangle(optbuf, &mnt_argv); if (mountprog != NULL) - strcpy(execname, mountprog); + strlcpy(execname, mountprog, sizeof(execname)); append_arg(&mnt_argv, strdup(spec)); append_arg(&mnt_argv, strdup(name)); @@ -905,8 +905,9 @@ putfsent(struct statfs *ent) if (strncmp(ent->f_mntfromname, "", 7) == 0 || strncmp(ent->f_mntfromname, "", 7) == 0) { - strcpy(ent->f_mntfromname, (strnstr(ent->f_mntfromname, ":", 8) - +1)); + strlcpy(ent->f_mntfromname, + (strnstr(ent->f_mntfromname, ":", 8) +1), + sizeof(ent->f_mntfromname)); } l = strlen(ent->f_mntfromname); From owner-svn-src-stable@freebsd.org Fri Apr 28 17:54:46 2017 Return-Path: Delivered-To: svn-src-stable@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 DD544D548C1; Fri, 28 Apr 2017 17:54:46 +0000 (UTC) (envelope-from bdrewery@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 949B51797; Fri, 28 Apr 2017 17:54:46 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3SHsjQB076875; Fri, 28 Apr 2017 17:54:45 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3SHsjT9076872; Fri, 28 Apr 2017 17:54:45 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201704281754.v3SHsjT9076872@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 28 Apr 2017 17:54:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317562 - in stable/11: . share/mk X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 17:54:47 -0000 Author: bdrewery Date: Fri Apr 28 17:54:45 2017 New Revision: 317562 URL: https://svnweb.freebsd.org/changeset/base/317562 Log: MFC r316586: META_MODE: Fix build-tools still sometimes rebuilding during target build. Modified: stable/11/Makefile.inc1 stable/11/Makefile.libcompat stable/11/share/mk/bsd.crunchgen.mk Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Fri Apr 28 16:42:52 2017 (r317561) +++ stable/11/Makefile.inc1 Fri Apr 28 17:54:45 2017 (r317562) @@ -459,7 +459,7 @@ CROSSENV+= MAKEOBJDIRPREFIX=${OBJTREE} \ CPUTYPE=${TARGET_CPUTYPE} .if ${MK_META_MODE} != "no" # Don't rebuild build-tools targets during normal build. -CROSSENV+= BUILD_TOOLS_META=.NOMETA_CMP +CROSSENV+= BUILD_TOOLS_META=.NOMETA .endif .if ${MK_GROFF} != "no" CROSSENV+= GROFF_BIN_PATH=${WORLDTMP}/legacy/usr/bin \ @@ -2496,7 +2496,7 @@ CDMAKE=${CDENV} PATH=${CDTMP}/usr/bin:${ CD2MAKE=${CD2ENV} PATH=${CDTMP}/usr/bin:${XDDESTDIR}/usr/bin:${PATH} ${MAKE} ${NOFUN} .if ${MK_META_MODE} != "no" # Don't rebuild build-tools targets during normal build. -CD2MAKE+= BUILD_TOOLS_META=.NOMETA_CMP +CD2MAKE+= BUILD_TOOLS_META=.NOMETA .endif XDDESTDIR=${DESTDIR}/${XDTP} .if !defined(OSREL) Modified: stable/11/Makefile.libcompat ============================================================================== --- stable/11/Makefile.libcompat Fri Apr 28 16:42:52 2017 (r317561) +++ stable/11/Makefile.libcompat Fri Apr 28 17:54:45 2017 (r317562) @@ -97,7 +97,7 @@ LIBCOMPATWMAKEENV+= MAKEOBJDIRPREFIX=${L DTRACE="${LIB$COMPATDTRACE:U${DTRACE}}" .if ${MK_META_MODE} != "no" # Don't rebuild build-tools targets during normal build. -LIBCOMPATWMAKEENV+= BUILD_TOOLS_META=.NOMETA_CMP +LIBCOMPATWMAKEENV+= BUILD_TOOLS_META=.NOMETA .endif LIBCOMPATWMAKEFLAGS+= CC="${XCC} ${LIBCOMPATCFLAGS}" \ CXX="${XCXX} ${LIBCOMPATCXXFLAGS} ${LIBCOMPATCFLAGS}" \ Modified: stable/11/share/mk/bsd.crunchgen.mk ============================================================================== --- stable/11/share/mk/bsd.crunchgen.mk Fri Apr 28 16:42:52 2017 (r317561) +++ stable/11/share/mk/bsd.crunchgen.mk Fri Apr 28 17:54:45 2017 (r317562) @@ -133,7 +133,7 @@ ${PROG}: ${OUTPUTS} objs .NOMETA .PHONY objs: ${OUTMK} .META ${CRUNCHENV} MAKEOBJDIRPREFIX=${CRUNCHOBJS} \ - ${MAKE} -f ${OUTMK} BUILD_TOOLS_META=.NOMETA_CMP objs + ${MAKE} -f ${OUTMK} BUILD_TOOLS_META=.NOMETA objs # Someone should replace the bin/csh and bin/sh build-tools with # shell scripts so we can remove this nonsense. From owner-svn-src-stable@freebsd.org Fri Apr 28 17:55:28 2017 Return-Path: Delivered-To: svn-src-stable@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 D8081D5492E; Fri, 28 Apr 2017 17:55:28 +0000 (UTC) (envelope-from bdrewery@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 A965918F0; Fri, 28 Apr 2017 17:55:28 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3SHtRha076976; Fri, 28 Apr 2017 17:55:27 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3SHtRWE076975; Fri, 28 Apr 2017 17:55:27 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201704281755.v3SHtRWE076975@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 28 Apr 2017 17:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317563 - stable/11/contrib/ofed/libibverbs/src X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 17:55:29 -0000 Author: bdrewery Date: Fri Apr 28 17:55:27 2017 New Revision: 317563 URL: https://svnweb.freebsd.org/changeset/base/317563 Log: MFC r316690: Fix build with LLD by removing duplicate symbols already in IBVERBS_1.0. Modified: stable/11/contrib/ofed/libibverbs/src/libibverbs.map Directory Properties: stable/11/ (props changed) Modified: stable/11/contrib/ofed/libibverbs/src/libibverbs.map ============================================================================== --- stable/11/contrib/ofed/libibverbs/src/libibverbs.map Fri Apr 28 17:54:45 2017 (r317562) +++ stable/11/contrib/ofed/libibverbs/src/libibverbs.map Fri Apr 28 17:55:27 2017 (r317563) @@ -77,12 +77,6 @@ IBVERBS_1.0 { IBVERBS_1.1 { global: - ibv_get_device_list; - ibv_free_device_list; - ibv_get_device_name; - ibv_get_device_guid; - ibv_open_device; - ibv_close_device; ibv_resolve_eth_gid; ibv_init_ah_from_wc; From owner-svn-src-stable@freebsd.org Fri Apr 28 17:56:10 2017 Return-Path: Delivered-To: svn-src-stable@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 8D128D549BC; Fri, 28 Apr 2017 17:56:10 +0000 (UTC) (envelope-from bdrewery@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 5EC4F1A42; Fri, 28 Apr 2017 17:56:10 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3SHu9Sp077047; Fri, 28 Apr 2017 17:56:09 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3SHu97m077046; Fri, 28 Apr 2017 17:56:09 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201704281756.v3SHu97m077046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 28 Apr 2017 17:56:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317564 - stable/11 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 17:56:10 -0000 Author: bdrewery Date: Fri Apr 28 17:56:09 2017 New Revision: 317564 URL: https://svnweb.freebsd.org/changeset/base/317564 Log: MFC r316780: Pass COMPILER_FEATURES down to submakes for installworld. Modified: stable/11/Makefile.inc1 Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Fri Apr 28 17:55:27 2017 (r317563) +++ stable/11/Makefile.inc1 Fri Apr 28 17:56:09 2017 (r317564) @@ -133,7 +133,8 @@ TEST_SYSTEM_COMPILER_VARS= \ MK_CROSS_COMPILER MK_CLANG_BOOTSTRAP MK_GCC_BOOTSTRAP \ WANT_COMPILER_TYPE WANT_COMPILER_VERSION WANT_COMPILER_VERSION_FILE \ WANT_COMPILER_FREEBSD_VERSION WANT_COMPILER_FREEBSD_VERSION_FILE \ - CC COMPILER_TYPE COMPILER_VERSION COMPILER_FREEBSD_VERSION + CC COMPILER_TYPE COMPILER_FEATURES COMPILER_VERSION \ + COMPILER_FREEBSD_VERSION test-system-compiler: .PHONY .for v in ${TEST_SYSTEM_COMPILER_VARS} ${_+_}@printf "%-35s= %s\n" "${v}" "${${v}}" @@ -151,9 +152,11 @@ test-system-compiler: .PHONY .if !defined(X_COMPILER_TYPE) CROSSENV+= COMPILER_VERSION=${COMPILER_VERSION} \ COMPILER_TYPE=${COMPILER_TYPE} \ + COMPILER_FEATURES=${COMPILER_FEATURES} \ COMPILER_FREEBSD_VERSION=${COMPILER_FREEBSD_VERSION} .else CROSSENV+= COMPILER_VERSION=${X_COMPILER_VERSION} \ + COMPILER_FEATURES=${X_COMPILER_FEATURES} \ COMPILER_TYPE=${X_COMPILER_TYPE} \ COMPILER_FREEBSD_VERSION=${X_COMPILER_FREEBSD_VERSION} .endif From owner-svn-src-stable@freebsd.org Fri Apr 28 17:57:08 2017 Return-Path: Delivered-To: svn-src-stable@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 EEFE6D54A3E; Fri, 28 Apr 2017 17:57:08 +0000 (UTC) (envelope-from bdrewery@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 CBE8C1BD8; Fri, 28 Apr 2017 17:57:08 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3SHv7oa077127; Fri, 28 Apr 2017 17:57:07 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3SHv7SW077125; Fri, 28 Apr 2017 17:57:07 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201704281757.v3SHv7SW077125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Fri, 28 Apr 2017 17:57:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317565 - stable/11 X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 28 Apr 2017 17:57:09 -0000 Author: bdrewery Date: Fri Apr 28 17:57:07 2017 New Revision: 317565 URL: https://svnweb.freebsd.org/changeset/base/317565 Log: MFC r316794: Cache compiler metadata and reuse it at installworld time. Modified: stable/11/Makefile stable/11/Makefile.inc1 Directory Properties: stable/11/ (props changed) Modified: stable/11/Makefile ============================================================================== --- stable/11/Makefile Fri Apr 28 17:56:09 2017 (r317564) +++ stable/11/Makefile Fri Apr 28 17:57:07 2017 (r317565) @@ -127,7 +127,7 @@ TGTS= all all-man buildenv buildenvvars installworld kernel-toolchain libraries lint maninstall \ obj objlink rerelease showconfig tags toolchain update \ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ - _build-tools _cross-tools _includes _libraries \ + _build-tools _compiler-metadata _cross-tools _includes _libraries \ build32 distribute32 install32 buildsoft distributesoft installsoft \ builddtb xdev xdev-build xdev-install \ xdev-links native-xtools stageworld stagekernel stage-packages \ Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Fri Apr 28 17:56:09 2017 (r317564) +++ stable/11/Makefile.inc1 Fri Apr 28 17:57:07 2017 (r317565) @@ -76,6 +76,19 @@ MK_CLANG_BOOTSTRAP= no MK_GCC_BOOTSTRAP= no .endif +MAKEOBJDIRPREFIX?= /usr/obj +.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING) +OBJTREE= ${MAKEOBJDIRPREFIX} +.else +OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} +.endif + +# Pull in compiler metadata from buildworld/toolchain if possible to avoid +# running CC from bsd.compiler.mk. +.if make(installworld) || make(install) +.-include "${OBJTREE}${.CURDIR}/compiler-metadata.mk" +.endif + # Pull in COMPILER_TYPE and COMPILER_FREEBSD_VERSION early. .include .include "share/mk/src.opts.mk" @@ -161,6 +174,20 @@ CROSSENV+= COMPILER_VERSION=${X_COMPILER COMPILER_FREEBSD_VERSION=${X_COMPILER_FREEBSD_VERSION} .endif .endif +# Store some compiler metadata for use in installworld where we don't +# want to invoke CC at all. +_COMPILER_METADATA_VARS= COMPILER_VERSION \ + COMPILER_TYPE \ + COMPILER_FEATURES \ + COMPILER_FREEBSD_VERSION +compiler-metadata.mk: .PHONY .META + @: > ${.TARGET} + @echo ".info Using cached compiler metadata from build at $$(hostname) on $$(date)" \ + > ${.TARGET} +.for v in ${_COMPILER_METADATA_VARS} + @echo "${v}=${${v}}" >> ${.TARGET} +.endfor + @echo ".export ${_COMPILER_METADATA_VARS}" >> ${.TARGET} # Handle external binutils. .if defined(CROSS_TOOLCHAIN_PREFIX) @@ -301,7 +328,6 @@ SVN= ${_P}/${_S} .endif SVNFLAGS?= -r HEAD -MAKEOBJDIRPREFIX?= /usr/obj .if !defined(OSRELDATE) .if exists(/usr/include/osreldate.h) OSRELDATE!= awk '/^\#define[[:space:]]*__FreeBSD_version/ { print $$3 }' \ @@ -393,11 +419,6 @@ BUILD_ARCH!= uname -p .error To cross-build, set TARGET_ARCH. .endif .endif -.if ${MACHINE} == ${TARGET} && ${MACHINE_ARCH} == ${TARGET_ARCH} && !defined(CROSS_BUILD_TESTING) -OBJTREE= ${MAKEOBJDIRPREFIX} -.else -OBJTREE= ${MAKEOBJDIRPREFIX}/${TARGET}.${TARGET_ARCH} -.endif WORLDTMP= ${OBJTREE}${.CURDIR}/tmp BPATH= ${WORLDTMP}/legacy/usr/sbin:${WORLDTMP}/legacy/usr/bin:${WORLDTMP}/legacy/bin XPATH= ${WORLDTMP}/usr/sbin:${WORLDTMP}/usr/bin @@ -744,8 +765,15 @@ _cross-tools: @echo "--------------------------------------------------------------" @echo ">>> stage 3: cross tools" @echo "--------------------------------------------------------------" + @rm -f ${.OBJDIR}/compiler-metadata.mk ${_+_}cd ${.CURDIR}; ${XMAKE} cross-tools ${_+_}cd ${.CURDIR}; ${XMAKE} kernel-tools +_compiler-metadata: + @echo + @echo "--------------------------------------------------------------" + @echo ">>> stage 3.1: recording compiler metadata" + @echo "--------------------------------------------------------------" + ${_+_}cd ${.CURDIR}; ${WMAKE} compiler-metadata.mk _includes: @echo @echo "--------------------------------------------------------------" @@ -779,6 +807,7 @@ WMAKE_TGTS+= _worldtmp _legacy WMAKE_TGTS+= _bootstrap-tools .endif WMAKE_TGTS+= _cleanobj _obj _build-tools _cross-tools +WMAKE_TGTS+= _compiler-metadata WMAKE_TGTS+= _includes _libraries WMAKE_TGTS+= everything .if defined(LIBCOMPAT) && empty(SUBDIR_OVERRIDE) From owner-svn-src-stable@freebsd.org Fri Apr 28 20:40:41 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 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@freebsd.org Sat Apr 29 00:46:52 2017 Return-Path: Delivered-To: svn-src-stable@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 DAE7BD55F37; Sat, 29 Apr 2017 00:46: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 B630E12A6; Sat, 29 Apr 2017 00:46:52 +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 v3T0kpuE053593; Sat, 29 Apr 2017 00:46:51 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3T0kpQO053589; Sat, 29 Apr 2017 00:46:51 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <201704290046.v3T0kpQO053589@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 00:46:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317577 - in stable/11/sys/fs: nfs nfsclient X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Apr 2017 00:46:53 -0000 Author: rmacklem Date: Sat Apr 29 00:46:51 2017 New Revision: 317577 URL: https://svnweb.freebsd.org/changeset/base/317577 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/11/sys/fs/nfs/nfs_var.h stable/11/sys/fs/nfsclient/nfs_clnode.c stable/11/sys/fs/nfsclient/nfs_clstate.c stable/11/sys/fs/nfsclient/nfs_clvnops.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/fs/nfs/nfs_var.h ============================================================================== --- stable/11/sys/fs/nfs/nfs_var.h Sat Apr 29 00:34:53 2017 (r317576) +++ stable/11/sys/fs/nfs/nfs_var.h Sat Apr 29 00:46:51 2017 (r317577) @@ -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/11/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clnode.c Sat Apr 29 00:34:53 2017 (r317576) +++ stable/11/sys/fs/nfsclient/nfs_clnode.c Sat Apr 29 00:46:51 2017 (r317577) @@ -248,7 +248,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/11/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clstate.c Sat Apr 29 00:34:53 2017 (r317576) +++ stable/11/sys/fs/nfsclient/nfs_clstate.c Sat Apr 29 00:46:51 2017 (r317577) @@ -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/11/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- stable/11/sys/fs/nfsclient/nfs_clvnops.c Sat Apr 29 00:34:53 2017 (r317576) +++ stable/11/sys/fs/nfsclient/nfs_clvnops.c Sat Apr 29 00:46:51 2017 (r317577) @@ -709,12 +709,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 @@ -2631,7 +2631,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)); } /* @@ -2643,7 +2643,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); @@ -3024,7 +3024,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 @@ -3404,7 +3404,7 @@ nfs_set_text(struct vop_set_text_args *a } /* Now, flush the buffer cache. */ - ncl_flush(vp, MNT_WAIT, NULL, curthread, 0, 0); + ncl_flush(vp, MNT_WAIT, curthread, 0, 0); /* And, finally, make sure that n_mtime is up to date. */ np = VTONFS(vp); From owner-svn-src-stable@freebsd.org Sat Apr 29 01:04:41 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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@freebsd.org Sat Apr 29 02:03:22 2017 Return-Path: Delivered-To: svn-src-stable@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 7CE0BD5445F; Sat, 29 Apr 2017 02:03:22 +0000 (UTC) (envelope-from glebius@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 337FF1781; Sat, 29 Apr 2017 02:03:22 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3T23LvV085599; Sat, 29 Apr 2017 02:03:21 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3T23L2G085596; Sat, 29 Apr 2017 02:03:21 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201704290203.v3T23L2G085596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Sat, 29 Apr 2017 02:03:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317580 - in stable/11: share/man/man9 tools/tools/umastat X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Apr 2017 02:03:22 -0000 Author: glebius Date: Sat Apr 29 02:03:20 2017 New Revision: 317580 URL: https://svnweb.freebsd.org/changeset/base/317580 Log: Merge r317444, r317445: UMA_ZONE_REFCNT was removed. PR: 209715 PR: 218887 Modified: stable/11/share/man/man9/Makefile stable/11/share/man/man9/zone.9 stable/11/tools/tools/umastat/umastat.c Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man9/Makefile ============================================================================== --- stable/11/share/man/man9/Makefile Sat Apr 29 01:04:39 2017 (r317579) +++ stable/11/share/man/man9/Makefile Sat Apr 29 02:03:20 2017 (r317580) @@ -1932,7 +1932,6 @@ MLINKS+=vrele.9 vput.9 \ vrele.9 vunref.9 MLINKS+=vslock.9 vsunlock.9 MLINKS+=zone.9 uma.9 \ - zone.9 uma_find_refcnt.9 \ zone.9 uma_zalloc.9 \ zone.9 uma_zalloc_arg.9 \ zone.9 uma_zcreate.9 \ Modified: stable/11/share/man/man9/zone.9 ============================================================================== --- stable/11/share/man/man9/zone.9 Sat Apr 29 01:04:39 2017 (r317579) +++ stable/11/share/man/man9/zone.9 Sat Apr 29 02:03:20 2017 (r317580) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 20, 2015 +.Dd April 26, 2017 .Dt ZONE 9 .Os .Sh NAME @@ -34,7 +34,6 @@ .Nm uma_zalloc_arg , .Nm uma_zfree , .Nm uma_zfree_arg , -.Nm uma_find_refcnt , .Nm uma_zdestroy , .Nm uma_zone_set_max, .Nm uma_zone_get_max, @@ -60,8 +59,6 @@ .Fn uma_zfree "uma_zone_t zone" "void *item" .Ft void .Fn uma_zfree_arg "uma_zone_t zone" "void *item" "void *arg" -.Ft "uint32_t *" -.Fn uma_find_refcnt "uma_zone_t zone" "void *item" .Ft void .Fn uma_zdestroy "uma_zone_t zone" .Ft int @@ -155,10 +152,6 @@ is a subset of the following flags: .Bl -tag -width "foo" .It Dv UMA_ZONE_NOFREE Slabs of the zone are never returned back to VM. -.It Dv UMA_ZONE_REFCNT -Each item in the zone would have internal reference counter associated with it. -See -.Fn uma_find_refcnt . .It Dv UMA_ZONE_NODUMP Pages belonging to the zone will not be included into mini-dumps. .It Dv UMA_ZONE_PCPU @@ -257,13 +250,6 @@ and .Dv dtor functions, respectively. .Pp -If zone was created with -.Dv UMA_ZONE_REFCNT -flag, then pointer to reference counter for an item can be retrieved with -help of the -.Fn uma_find_refcnt -function. -.Pp Created zones, which are empty, can be destroyed using Modified: stable/11/tools/tools/umastat/umastat.c ============================================================================== --- stable/11/tools/tools/umastat/umastat.c Sat Apr 29 01:04:39 2017 (r317579) +++ stable/11/tools/tools/umastat/umastat.c Sat Apr 29 02:03:20 2017 (r317580) @@ -133,7 +133,6 @@ static const struct flaginfo { { UMA_ZONE_VM, "vm" }, { UMA_ZONE_HASH, "hash" }, { UMA_ZONE_SECONDARY, "secondary" }, - { UMA_ZONE_REFCNT, "refcnt" }, { UMA_ZONE_MAXBUCKET, "maxbucket" }, { UMA_ZONE_CACHESPREAD, "cachespread" }, { UMA_ZONE_VTOSLAB, "vtoslab" }, From owner-svn-src-stable@freebsd.org Sat Apr 29 09:18:56 2017 Return-Path: Delivered-To: svn-src-stable@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 D94FCD53BBA; Sat, 29 Apr 2017 09:18:56 +0000 (UTC) (envelope-from dchagin@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 8ED736B8; Sat, 29 Apr 2017 09:18:56 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3T9ItNH063698; Sat, 29 Apr 2017 09:18:55 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3T9ItkN063694; Sat, 29 Apr 2017 09:18:55 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201704290918.v3T9ItkN063694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 29 Apr 2017 09:18:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317587 - in stable/11/sys: amd64/linux amd64/linux32 compat/linux i386/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Apr 2017 09:18:57 -0000 Author: dchagin Date: Sat Apr 29 09:18:55 2017 New Revision: 317587 URL: https://svnweb.freebsd.org/changeset/base/317587 Log: MFC r315957: Implement Linux mincore() system call. This is necessary for the upcoming drm-next. Modified: stable/11/sys/amd64/linux/linux_dummy.c stable/11/sys/amd64/linux32/linux32_dummy.c stable/11/sys/compat/linux/linux_misc.c stable/11/sys/i386/linux/linux_dummy.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/amd64/linux/linux_dummy.c ============================================================================== --- stable/11/sys/amd64/linux/linux_dummy.c Sat Apr 29 08:52:07 2017 (r317586) +++ stable/11/sys/amd64/linux/linux_dummy.c Sat Apr 29 09:18:55 2017 (r317587) @@ -59,7 +59,6 @@ UNIMPLEMENTED(tuxcall); UNIMPLEMENTED(uselib); UNIMPLEMENTED(vserver); -DUMMY(mincore); DUMMY(sendfile); DUMMY(syslog); DUMMY(setfsuid); Modified: stable/11/sys/amd64/linux32/linux32_dummy.c ============================================================================== --- stable/11/sys/amd64/linux32/linux32_dummy.c Sat Apr 29 08:52:07 2017 (r317586) +++ stable/11/sys/amd64/linux32/linux32_dummy.c Sat Apr 29 09:18:55 2017 (r317587) @@ -79,7 +79,6 @@ DUMMY(sendfile); DUMMY(setfsuid); DUMMY(setfsgid); DUMMY(pivot_root); -DUMMY(mincore); DUMMY(ptrace); DUMMY(lookup_dcookie); DUMMY(remap_file_pages); Modified: stable/11/sys/compat/linux/linux_misc.c ============================================================================== --- stable/11/sys/compat/linux/linux_misc.c Sat Apr 29 08:52:07 2017 (r317586) +++ stable/11/sys/compat/linux/linux_misc.c Sat Apr 29 09:18:55 2017 (r317587) @@ -2534,3 +2534,17 @@ linux_getrandom(struct thread *td, struc return (read_random_uio(&uio, args->flags & LINUX_GRND_NONBLOCK)); } + +int +linux_mincore(struct thread *td, struct linux_mincore_args *args) +{ + struct mincore_args bsd_args; + + /* Needs to be page-aligned */ + if (args->start & PAGE_MASK) + return (EINVAL); + bsd_args.addr = PTRIN(args->start); + bsd_args.len = args->len; + bsd_args.vec = args->vec; + return (sys_mincore(td, &bsd_args)); +} Modified: stable/11/sys/i386/linux/linux_dummy.c ============================================================================== --- stable/11/sys/i386/linux/linux_dummy.c Sat Apr 29 08:52:07 2017 (r317586) +++ stable/11/sys/i386/linux/linux_dummy.c Sat Apr 29 09:18:55 2017 (r317587) @@ -82,7 +82,6 @@ DUMMY(sendfile); /* different semantics DUMMY(setfsuid); DUMMY(setfsgid); DUMMY(pivot_root); -DUMMY(mincore); DUMMY(lookup_dcookie); DUMMY(remap_file_pages); DUMMY(mbind); From owner-svn-src-stable@freebsd.org Sat Apr 29 09:20:06 2017 Return-Path: Delivered-To: svn-src-stable@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 070C0D53C68; Sat, 29 Apr 2017 09:20:06 +0000 (UTC) (envelope-from dchagin@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 B0451862; Sat, 29 Apr 2017 09:20:05 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3T9K4OO063814; Sat, 29 Apr 2017 09:20:04 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3T9K4Nl063812; Sat, 29 Apr 2017 09:20:04 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201704290920.v3T9K4Nl063812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 29 Apr 2017 09:20:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317588 - in stable/11/sys: sys vm X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Apr 2017 09:20:06 -0000 Author: dchagin Date: Sat Apr 29 09:20:04 2017 New Revision: 317588 URL: https://svnweb.freebsd.org/changeset/base/317588 Log: MFC r316288: Add kern_mincore() helper for mincore() syscall. Modified: stable/11/sys/sys/syscallsubr.h stable/11/sys/vm/vm_mmap.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/sys/syscallsubr.h ============================================================================== --- stable/11/sys/sys/syscallsubr.h Sat Apr 29 09:18:55 2017 (r317587) +++ stable/11/sys/sys/syscallsubr.h Sat Apr 29 09:20:04 2017 (r317588) @@ -151,6 +151,7 @@ int kern_lseek(struct thread *td, int fd int kern_lutimes(struct thread *td, char *path, enum uio_seg pathseg, struct timeval *tptr, enum uio_seg tptrseg); int kern_madvise(struct thread *td, uintptr_t addr, size_t len, int behav); +int kern_mincore(struct thread *td, uintptr_t addr, size_t len, char *vec); int kern_mkdirat(struct thread *td, int fd, char *path, enum uio_seg segflg, int mode); int kern_mkfifoat(struct thread *td, int fd, char *path, Modified: stable/11/sys/vm/vm_mmap.c ============================================================================== --- stable/11/sys/vm/vm_mmap.c Sat Apr 29 09:18:55 2017 (r317587) +++ stable/11/sys/vm/vm_mmap.c Sat Apr 29 09:20:04 2017 (r317588) @@ -711,11 +711,17 @@ struct mincore_args { int sys_mincore(struct thread *td, struct mincore_args *uap) { + + return (kern_mincore(td, (uintptr_t)uap->addr, uap->len, uap->vec)); +} + +int +kern_mincore(struct thread *td, uintptr_t addr0, size_t len, char *vec) +{ vm_offset_t addr, first_addr; vm_offset_t end, cend; pmap_t pmap; vm_map_t map; - char *vec; int error = 0; int vecindex, lastvecindex; vm_map_entry_t current; @@ -732,17 +738,12 @@ sys_mincore(struct thread *td, struct mi * Make sure that the addresses presented are valid for user * mode. */ - first_addr = addr = trunc_page((vm_offset_t) uap->addr); - end = addr + (vm_size_t)round_page(uap->len); + first_addr = addr = trunc_page(addr0); + end = addr + (vm_size_t)round_page(len); map = &td->td_proc->p_vmspace->vm_map; if (end > vm_map_max(map) || end < addr) return (ENOMEM); - /* - * Address of byte vector - */ - vec = uap->vec; - pmap = vmspace_pmap(td->td_proc->p_vmspace); vm_map_lock_read(map); From owner-svn-src-stable@freebsd.org Sat Apr 29 09:21:01 2017 Return-Path: Delivered-To: svn-src-stable@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 A0810D53E6F; Sat, 29 Apr 2017 09:21:01 +0000 (UTC) (envelope-from dchagin@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 6FBDFA55; Sat, 29 Apr 2017 09:21:01 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3T9L06g066724; Sat, 29 Apr 2017 09:21:00 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3T9L0We066723; Sat, 29 Apr 2017 09:21:00 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201704290921.v3T9L0We066723@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 29 Apr 2017 09:21:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317589 - stable/11/sys/compat/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Apr 2017 09:21:01 -0000 Author: dchagin Date: Sat Apr 29 09:21:00 2017 New Revision: 317589 URL: https://svnweb.freebsd.org/changeset/base/317589 Log: MFC r316289: Use kern_mincore() helper instead of abusing syscall entry. Modified: stable/11/sys/compat/linux/linux_misc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_misc.c ============================================================================== --- stable/11/sys/compat/linux/linux_misc.c Sat Apr 29 09:20:04 2017 (r317588) +++ stable/11/sys/compat/linux/linux_misc.c Sat Apr 29 09:21:00 2017 (r317589) @@ -2538,13 +2538,9 @@ linux_getrandom(struct thread *td, struc int linux_mincore(struct thread *td, struct linux_mincore_args *args) { - struct mincore_args bsd_args; /* Needs to be page-aligned */ if (args->start & PAGE_MASK) return (EINVAL); - bsd_args.addr = PTRIN(args->start); - bsd_args.len = args->len; - bsd_args.vec = args->vec; - return (sys_mincore(td, &bsd_args)); + return (kern_mincore(td, args->start, args->len, args->vec)); } From owner-svn-src-stable@freebsd.org Sat Apr 29 09:26:32 2017 Return-Path: Delivered-To: svn-src-stable@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 5E72AD54072; Sat, 29 Apr 2017 09:26:32 +0000 (UTC) (envelope-from dchagin@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 16203F2C; Sat, 29 Apr 2017 09:26:32 +0000 (UTC) (envelope-from dchagin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v3T9QV5N067841; Sat, 29 Apr 2017 09:26:31 GMT (envelope-from dchagin@FreeBSD.org) Received: (from dchagin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v3T9QVdX067840; Sat, 29 Apr 2017 09:26:31 GMT (envelope-from dchagin@FreeBSD.org) Message-Id: <201704290926.v3T9QVdX067840@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dchagin set sender to dchagin@FreeBSD.org using -f From: Dmitry Chagin Date: Sat, 29 Apr 2017 09:26:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r317590 - stable/11/sys/compat/linux X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Apr 2017 09:26:32 -0000 Author: dchagin Date: Sat Apr 29 09:26:30 2017 New Revision: 317590 URL: https://svnweb.freebsd.org/changeset/base/317590 Log: MFC r316776 (by cem@): linux_ioctl: Refactor some v4l2 struct converters According to the C standard, it is invalid to copy beyond the end of an object, even if that object is obviously a member of a larger object (a struct, in this case). Appease the standard and Coverity by refactoring the copy in a straightforward way. No functional change. Modified: stable/11/sys/compat/linux/linux_ioctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/compat/linux/linux_ioctl.c ============================================================================== --- stable/11/sys/compat/linux/linux_ioctl.c Sat Apr 29 09:21:00 2017 (r317589) +++ stable/11/sys/compat/linux/linux_ioctl.c Sat Apr 29 09:26:30 2017 (r317590) @@ -3137,7 +3137,12 @@ linux_to_bsd_v4l2_standard(struct l_v4l2 { vstd->index = lvstd->index; vstd->id = lvstd->id; - memcpy(&vstd->name, &lvstd->name, sizeof(*lvstd) - offsetof(struct l_v4l2_standard, name)); + CTASSERT(sizeof(vstd->name) == sizeof(lvstd->name)); + memcpy(vstd->name, lvstd->name, sizeof(vstd->name)); + vstd->frameperiod = lvstd->frameperiod; + vstd->framelines = lvstd->framelines; + CTASSERT(sizeof(vstd->reserved) == sizeof(lvstd->reserved)); + memcpy(vstd->reserved, lvstd->reserved, sizeof(vstd->reserved)); return (0); } @@ -3146,7 +3151,12 @@ bsd_to_linux_v4l2_standard(struct v4l2_s { lvstd->index = vstd->index; lvstd->id = vstd->id; - memcpy(&lvstd->name, &vstd->name, sizeof(*lvstd) - offsetof(struct l_v4l2_standard, name)); + CTASSERT(sizeof(vstd->name) == sizeof(lvstd->name)); + memcpy(lvstd->name, vstd->name, sizeof(lvstd->name)); + lvstd->frameperiod = vstd->frameperiod; + lvstd->framelines = vstd->framelines; + CTASSERT(sizeof(vstd->reserved) == sizeof(lvstd->reserved)); + memcpy(lvstd->reserved, vstd->reserved, sizeof(lvstd->reserved)); return (0); } From owner-svn-src-stable@freebsd.org Sat Apr 29 23:26:37 2017 Return-Path: Delivered-To: svn-src-stable@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 8E72DD5529F; 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 46A1815D8; 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 v3TNQaVN019578; 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 v3TNQa6F019576; Sat, 29 Apr 2017 23:26:36 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201704292326.v3TNQa6F019576@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-11@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-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 29 Apr 2017 23:26:37 -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/11/lib/clang/include/llvm/Config/config.h stable/11/lib/clang/llvm.build.mk Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/10/lib/clang/clang.build.mk stable/10/lib/clang/include/llvm/Config/config.h Directory Properties: stable/10/ (props changed) Modified: stable/11/lib/clang/include/llvm/Config/config.h ============================================================================== --- stable/11/lib/clang/include/llvm/Config/config.h Sat Apr 29 21:48:11 2017 (r317598) +++ stable/11/lib/clang/include/llvm/Config/config.h Sat Apr 29 23:26:36 2017 (r317599) @@ -12,7 +12,7 @@ #define BUG_REPORT_URL "https://bugs.freebsd.org/submit/" /* Define to 1 to enable backtraces, and to 0 otherwise. */ -#define ENABLE_BACKTRACES 1 +#define ENABLE_BACKTRACES 0 /* Define to 1 to enable crash overrides, and to 0 otherwise. */ #define ENABLE_CRASH_OVERRIDES 1 Modified: stable/11/lib/clang/llvm.build.mk ============================================================================== --- stable/11/lib/clang/llvm.build.mk Sat Apr 29 21:48:11 2017 (r317598) +++ stable/11/lib/clang/llvm.build.mk Sat Apr 29 23:26:36 2017 (r317599) @@ -40,6 +40,10 @@ CFLAGS+= -DLLVM_DEFAULT_TARGET_TRIPLE=\" CFLAGS+= -DLLVM_HOST_TRIPLE=\"${BUILD_TRIPLE}\" CFLAGS+= -DDEFAULT_SYSROOT=\"${TOOLS_PREFIX}\" +CFLAGS+= -ffunction-sections +CFLAGS+= -fdata-sections +LDFLAGS+= -Wl,--gc-sections + CXXFLAGS+= -std=c++11 CXXFLAGS+= -fno-exceptions CXXFLAGS+= -fno-rtti From owner-svn-src-stable@freebsd.org Sat Apr 29 23:26:37 2017 Return-Path: Delivered-To: svn-src-stable@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@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 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