svn commit: r317931 - head/sbin/mount_nfs
Author: rmacklem Date: Mon May 8 00:45:05 2017 New Revision: 317931 URL: https://svnweb.freebsd.org/changeset/base/317931 Log: Fix mount_nfs so that it doesn't create mounttab entries for NFSv4 mounts. The NFSv4 protocol doesn't use the Mount protocol, so it doesn't make sense to add an entry for an NFSv4 mount to /var/db/mounttab. Also, r308871 modified umount so that it doesn't remove any entry created by mount_nfs. Reported on freebsd-current@. Reported by: clbuis...@orange.fr MFC after:2 weeks Modified: head/sbin/mount_nfs/mount_nfs.c Modified: head/sbin/mount_nfs/mount_nfs.c == --- head/sbin/mount_nfs/mount_nfs.c Sun May 7 22:18:05 2017 (r317930) +++ head/sbin/mount_nfs/mount_nfs.c Mon May 8 00:45:05 2017 (r317931) @@ -636,7 +636,7 @@ getnfsargs(char *spec, struct iovec **io build_iovec(iov, iovlen, "hostname", nam, (size_t)-1); /* Add mounted file system to PATH_MOUNTTAB */ - if (!add_mtab(hostp, spec)) + if (mountmode != V4 && !add_mtab(hostp, spec)) warnx("can't update %s for %s:%s", PATH_MOUNTTAB, hostp, spec); return (1); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317928 - head/sys/contrib/octeon-sdk
Author: jhibbits Date: Sun May 7 22:04:12 2017 New Revision: 317928 URL: https://svnweb.freebsd.org/changeset/base/317928 Log: Add necessary bits to get FreeBSD booting on the Unifi Security Gateway Summary: The Ubiquiti Unifi Security Gateway is virtually identical to the EdgeRouter Lite, with a smaller PCB and apparently a different board identifier. Simply adding the new board identifier alongside the ERL identifier, FreeBSD boots successfully, and can access the needed peripherals (tested with USB booting, and basic pings on one ethernet interface) Reviewed By: adrian MFC after:2 weeks Differential Revision:https://reviews.freebsd.org/D10639 Modified: head/sys/contrib/octeon-sdk/cvmx-app-init.h head/sys/contrib/octeon-sdk/cvmx-helper-board.c Modified: head/sys/contrib/octeon-sdk/cvmx-app-init.h == --- head/sys/contrib/octeon-sdk/cvmx-app-init.h Sun May 7 21:57:46 2017 (r317927) +++ head/sys/contrib/octeon-sdk/cvmx-app-init.h Sun May 7 22:04:12 2017 (r317928) @@ -311,6 +311,7 @@ enum cvmx_board_types_enum { #endif #if defined(OCTEON_VENDOR_UBIQUITI) CVMX_BOARD_TYPE_CUST_UBIQUITI_E100=20002, +CVMX_BOARD_TYPE_CUST_UBIQUITI_USG= 20004, #endif #if defined(OCTEON_VENDOR_RADISYS) CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE=20002, @@ -457,6 +458,7 @@ static inline const char *cvmx_board_typ #endif #if defined(OCTEON_VENDOR_UBIQUITI) ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_UBIQUITI_E100) + ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_UBIQUITI_USG) #endif #if defined(OCTEON_VENDOR_RADISYS) ENUM_BRD_TYPE_CASE(CVMX_BOARD_TYPE_CUST_RADISYS_RSYS4GBE) Modified: head/sys/contrib/octeon-sdk/cvmx-helper-board.c == --- head/sys/contrib/octeon-sdk/cvmx-helper-board.c Sun May 7 21:57:46 2017(r317927) +++ head/sys/contrib/octeon-sdk/cvmx-helper-board.c Sun May 7 22:04:12 2017(r317928) @@ -598,6 +598,7 @@ int cvmx_helper_board_get_mii_address(in #endif #if defined(OCTEON_VENDOR_UBIQUITI) case CVMX_BOARD_TYPE_CUST_UBIQUITI_E100: + case CVMX_BOARD_TYPE_CUST_UBIQUITI_USG: if (ipd_port > 2) return -1; return (7 - ipd_port); @@ -1499,7 +1500,8 @@ int __cvmx_helper_board_hardware_enable( } } #if defined(OCTEON_VENDOR_UBIQUITI) -else if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_CUST_UBIQUITI_E100) +else if (cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_CUST_UBIQUITI_E100 || +cvmx_sysinfo_get()->board_type == CVMX_BOARD_TYPE_CUST_UBIQUITI_USG) { /* Configure ASX cloks for all ports on interface 0. */ if (interface == 0) @@ -1590,6 +1592,7 @@ cvmx_helper_board_usb_clock_types_t __cv #endif #if defined(OCTEON_VENDOR_UBIQUITI) case CVMX_BOARD_TYPE_CUST_UBIQUITI_E100: +case CVMX_BOARD_TYPE_CUST_UBIQUITI_USG: #endif #if defined(OCTEON_BOARD_CAPK_0100ND) case CVMX_BOARD_TYPE_CN3010_EVB_HS5: ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317923 - head/sbin/dhclient
Author: n_hibma Date: Sun May 7 21:11:28 2017 New Revision: 317923 URL: https://svnweb.freebsd.org/changeset/base/317923 Log: Fix the output of very large rebind, renew and lease time options in lease file. Some routers set very large values for rebind time (Netgear) and these are erroneously reported as negative in the leasefile. This was due to a wrong printf format specification of %ld for an unsigned long on 32-bit platforms. Modified: head/sbin/dhclient/options.c Modified: head/sbin/dhclient/options.c == --- head/sbin/dhclient/options.cSun May 7 21:06:23 2017 (r317922) +++ head/sbin/dhclient/options.cSun May 7 21:11:28 2017 (r317923) @@ -783,7 +783,7 @@ pretty_print_option(unsigned int code, u dp += 4; break; case 'L': - opcount = snprintf(op, opleft, "%ld", + opcount = snprintf(op, opleft, "%lu", (unsigned long)getULong(dp)); if (opcount >= opleft || opcount == -1) goto toobig; @@ -799,7 +799,7 @@ pretty_print_option(unsigned int code, u dp += 2; break; case 'S': - opcount = snprintf(op, opleft, "%d", + opcount = snprintf(op, opleft, "%u", getUShort(dp)); if (opcount >= opleft || opcount == -1) goto toobig; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317915 - head/sbin/dhclient
Author: n_hibma Date: Sun May 7 19:59:37 2017 New Revision: 317915 URL: https://svnweb.freebsd.org/changeset/base/317915 Log: Fix handling of large DHCP expiry values. They would overflow a signed 32-bit time_t on 32 bit architectures. This was taken care of, but a compiler optimisation makes this behave erratically. This could be resolved by adding a -fwrapv flag, but instead we can check the value before adding the current timestamp to it. In the lease file values are still wrong though: option dhcp-rebinding-time -644245096; PR: 218980 Reported by: Bob Eager MFC after:2 weeks Modified: head/sbin/dhclient/dhclient.c Modified: head/sbin/dhclient/dhclient.c == --- head/sbin/dhclient/dhclient.c Sun May 7 19:57:45 2017 (r317914) +++ head/sbin/dhclient/dhclient.c Sun May 7 19:59:37 2017 (r317915) @@ -108,7 +108,11 @@ struct pidfh *pidfile; */ #define ASSERT_STATE(state_is, state_shouldbe) {} -#define TIME_MAX 2147483647 +/* + * We need to check that the expiry, renewal and rebind times are not beyond + * the end of time (~2038 when a 32-bit time_t is being used). + */ +#define TIME_MAXtime_t) 1 << (sizeof(time_t) * CHAR_BIT - 2)) - 1) * 2 + 1) intlog_priority; intno_daemon; @@ -766,15 +770,17 @@ dhcpack(struct packet *packet) else ip->client->new->expiry = default_lease_time; /* A number that looks negative here is really just very large, - because the lease expiry offset is unsigned. */ - if (ip->client->new->expiry < 0) - ip->client->new->expiry = TIME_MAX; + because the lease expiry offset is unsigned. Also make sure that + the addition of cur_time below does not overflow (a 32 bit) time_t. */ + if (ip->client->new->expiry < 0 || +ip->client->new->expiry > TIME_MAX - cur_time) + ip->client->new->expiry = TIME_MAX - cur_time; /* XXX should be fixed by resetting the client state */ if (ip->client->new->expiry < 60) ip->client->new->expiry = 60; /* Unless overridden in the config, take the server-provided renewal - * time if there is one; otherwise figure it out according to the spec. + * time if there is one. Otherwise figure it out according to the spec. * Also make sure the renewal time does not exceed the expiry time. */ if (ip->client->config->default_actions[DHO_DHCP_RENEWAL_TIME] == @@ -786,7 +792,8 @@ dhcpack(struct packet *packet) ip->client->new->options[DHO_DHCP_RENEWAL_TIME].data); else ip->client->new->renewal = ip->client->new->expiry / 2; -if (ip->client->new->renewal > ip->client->new->expiry / 2) +if (ip->client->new->renewal < 0 || +ip->client->new->renewal > ip->client->new->expiry / 2) ip->client->new->renewal = ip->client->new->expiry / 2; /* Same deal with the rebind time. */ @@ -798,20 +805,15 @@ dhcpack(struct packet *packet) ip->client->new->rebind = getULong( ip->client->new->options[DHO_DHCP_REBINDING_TIME].data); else - ip->client->new->rebind = ip->client->new->renewal * 7 / 4; -if (ip->client->new->rebind > ip->client->new->renewal * 7 / 4) -ip->client->new->rebind = ip->client->new->renewal * 7 / 4; - - ip->client->new->expiry += cur_time; - /* Lease lengths can never be negative. */ - if (ip->client->new->expiry < cur_time) - ip->client->new->expiry = TIME_MAX; - ip->client->new->renewal += cur_time; - if (ip->client->new->renewal < cur_time) - ip->client->new->renewal = TIME_MAX; - ip->client->new->rebind += cur_time; - if (ip->client->new->rebind < cur_time) - ip->client->new->rebind = TIME_MAX; + ip->client->new->rebind = ip->client->new->renewal / 4 * 7; + if (ip->client->new->rebind < 0 || +ip->client->new->rebind > ip->client->new->renewal / 4 * 7) +ip->client->new->rebind = ip->client->new->renewal / 4 * 7; + +/* Convert the time offsets into seconds-since-the-epoch */ +ip->client->new->expiry += cur_time; +ip->client->new->renewal += cur_time; +ip->client->new->rebind += cur_time; bind_lease(ip); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317913 - head/lib/libc/gen
Author: jilles Date: Sun May 7 19:52:56 2017 New Revision: 317913 URL: https://svnweb.freebsd.org/changeset/base/317913 Log: glob: Fix comment about collapsing asterisks after r317749. After r317749, collapsing adjacent asterisks is still required, but for a different reason. Modified: head/lib/libc/gen/glob.c Modified: head/lib/libc/gen/glob.c == --- head/lib/libc/gen/glob.cSun May 7 19:49:46 2017(r317912) +++ head/lib/libc/gen/glob.cSun May 7 19:52:56 2017(r317913) @@ -581,7 +581,8 @@ glob0(const Char *pattern, glob_t *pglob case STAR: pglob->gl_flags |= GLOB_MAGCHAR; /* collapse adjacent stars to one, -* to avoid exponential behavior +* to ensure "**" at the end continues to match the +* empty string */ if (bufnext == patbuf || bufnext[-1] != M_ALL) *bufnext++ = M_ALL; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317912 - in head/bin/sh: . tests/builtins
Author: jilles Date: Sun May 7 19:49:46 2017 New Revision: 317912 URL: https://svnweb.freebsd.org/changeset/base/317912 Log: sh: Fix INTOFF leak after a builtin with different locale settings. After executing a builtin with different locale settings such as LC_ALL=C true SIGINT handling was left disabled indefinitely. MFC after:1 week Added: head/bin/sh/tests/builtins/locale2.0 (contents, props changed) Modified: head/bin/sh/tests/builtins/Makefile head/bin/sh/var.c Modified: head/bin/sh/tests/builtins/Makefile == --- head/bin/sh/tests/builtins/Makefile Sun May 7 19:47:50 2017 (r317911) +++ head/bin/sh/tests/builtins/Makefile Sun May 7 19:49:46 2017 (r317912) @@ -120,6 +120,7 @@ ${PACKAGE}FILES+= local7.0 .if ${MK_NLS} != "no" ${PACKAGE}FILES+= locale1.0 .endif +${PACKAGE}FILES+= locale2.0 ${PACKAGE}FILES+= printf1.0 ${PACKAGE}FILES+= printf2.0 ${PACKAGE}FILES+= printf3.0 Added: head/bin/sh/tests/builtins/locale2.0 == --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/bin/sh/tests/builtins/locale2.0Sun May 7 19:49:46 2017 (r317912) @@ -0,0 +1,5 @@ +# $FreeBSD$ + +$SH -c 'LC_ALL=C true; kill -INT $$; echo continued' +r=$? +[ "$r" -gt 128 ] && [ "$(kill -l "$r")" = INT ] Modified: head/bin/sh/var.c == --- head/bin/sh/var.c Sun May 7 19:47:50 2017(r317911) +++ head/bin/sh/var.c Sun May 7 19:49:46 2017(r317912) @@ -513,7 +513,7 @@ bltinunsetlocale(void) if (localevar(cmdenviron->args[i])) { setlocale(LC_ALL, ""); updatecharset(); - return; + break; } } INTON; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317910 - head/share/man/man9
Author: bjk (doc committer) Date: Sun May 7 19:01:08 2017 New Revision: 317910 URL: https://svnweb.freebsd.org/changeset/base/317910 Log: Bring VOP_GETPAGES.9 more up-to-date Attempt to catch up to the KPI changes from r292373, and perform some other tidying while in the area. Reviewed by: kib Differential Revision:https://reviews.freebsd.org/D10579 Modified: head/share/man/man9/VOP_GETPAGES.9 Modified: head/share/man/man9/VOP_GETPAGES.9 == --- head/share/man/man9/VOP_GETPAGES.9 Sun May 7 17:21:22 2017 (r317909) +++ head/share/man/man9/VOP_GETPAGES.9 Sun May 7 19:01:08 2017 (r317910) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd December 16, 2015 +.Dd May 7, 2017 .Dt VOP_GETPAGES 9 .Os .Sh NAME @@ -41,9 +41,21 @@ .In sys/vnode.h .In vm/vm.h .Ft int -.Fn VOP_GETPAGES "struct vnode *vp" "vm_page_t *ma" "int count" "int *rbehind" "int *rahead" +.Fo VOP_GETPAGES +.Fa "struct vnode *vp" +.Fa "vm_page_t *ma" +.Fa "int count" +.Fa "int *rbehind" +.Fa "int *rahead" +.Fc .Ft int -.Fn VOP_PUTPAGES "struct vnode *vp" "vm_page_t *ma" "int count" "int sync" "int *rtvals" +.Fo VOP_PUTPAGES +.Fa "struct vnode *vp" +.Fa "vm_page_t *ma" +.Fa "int bytecount" +.Fa "int flags" +.Fa "int *rtvals" +.Fc .Sh DESCRIPTION The .Fn VOP_GETPAGES @@ -70,10 +82,32 @@ The file to access. Pointer to the first element of an array of pages representing a contiguous region of the file to be read or written. .It Fa count -The number of bytes that should be read into the pages of the array. -.It Fa sync +The length of the +.Fa ma +array. +.It Fa bytecount +The number of bytes that should be written from the pages of the array. +.It Fa flags +A bitfield of flags affecting the function operation. +If .Dv VM_PAGER_PUT_SYNC -if the write should be synchronous. +is set, the write should be synchronous; control must not be returned +to the caller until after the write is finished. +If +.Dv VM_PAGER_PUT_INVAL +is set, the pages are to be invalidated after being written. +If +.Dv VM_PAGER_PUT_NOREUSE +is set, the I/O performed should set the IO_NOREUSE flag, to indicate +to the filesystem that pages should be marked for fast reuse if needed. +This could occur via a call to +.Xr vm_page_deactivate_noreuse 9 , +which puts such pages onto the head of the inactive queue. +If +.Dv VM_PAGER_CLUSTER_OK +is set, writes may be performed asynchronously, so that related writes +can be coalesced for efficiency, e.g., +using the clustering mechanism of the buffer cache. .It Fa rtvals An array of VM system result codes indicating the status of each page written by @@ -127,32 +161,33 @@ The page was not handled by this request .Pp The .Fn VOP_GETPAGES -method is expected to release any pages in +method must populate and validate all requested pages in order to +return success. +It is expected to release any pages in .Fa ma that it does not successfully handle, by calling .Xr vm_page_free 9 . When it succeeds, .Fn VOP_GETPAGES must set the valid bits appropriately. +Upon entry to +.Fn VOP_GETPAGES , +all pages in +.Fa ma +are busied exclusively. +Upon successful return, the pages must all be busied exclusively +as well, but pages may be unbusied during processing. +The filesystem is responsible for activating paged-out pages, but this +does not necessarily need to be done within .Fn VOP_GETPAGES -must keep -.Fa reqpage -busy. -It must unbusy all other successfully handled pages and put them -on appropriate page queue(s). -For example, -.Fn VOP_GETPAGES -may either activate a page (if its wanted bit is set) -or deactivate it (otherwise), and finally call -.Xr vm_page_xunbusy 9 -to arouse any threads currently waiting for the page to be faulted in. +depending on the architecture of the particular filesystem. .Sh RETURN VALUES -If it successfully reads -.Fa ma[reqpage] , +If it successfully reads all pages in +.Fa ma , .Fn VOP_GETPAGES returns .Dv VM_PAGER_OK ; -otherwise, +otherwise, it returns .Dv VM_PAGER_ERROR . By convention, the return value of .Fn VOP_PUTPAGES ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r317909 - head/usr.bin/resizewin
On Sun, May 07, 2017 at 09:01:43PM +0300, Konstantin Belousov wrote: > On Sun, May 07, 2017 at 05:21:23PM +, Edward Tomasz Napierala wrote: > > Author: trasz > > Date: Sun May 7 17:21:22 2017 > > New Revision: 317909 > > URL: https://svnweb.freebsd.org/changeset/base/317909 > > Log: > > Make resizewin(1) discard the terminal queues, to lower the chance > > for "unable to parse response" error which happens when youre typing > > too fast for the machine you're running it on. > > Reviewed by: cem, Daniel O'Connor > > MFC after:2 weeks > > Sponsored by: DARPA, AFRL > > Differential Revision:https://reviews.freebsd.org/D10624 > > Modified: > > head/usr.bin/resizewin/resizewin.c > > > > Modified: head/usr.bin/resizewin/resizewin.c > > == > > --- head/usr.bin/resizewin/resizewin.c Sun May 7 14:59:45 2017 > > (r317908) > > +++ head/usr.bin/resizewin/resizewin.c Sun May 7 17:21:22 2017 > > (r317909) > > @@ -52,7 +52,7 @@ main(__unused int argc, __unused char ** > > { > > struct termios old, new; > > struct winsize w; > > - int ret, fd, cnt, error; > > + int ret, fd, cnt, error, what; > > char data[20]; > > struct timeval then, now; > > > > @@ -71,6 +71,12 @@ main(__unused int argc, __unused char ** > > if (tcsetattr(fd, TCSANOW, &new) == -1) > > exit(1); > > > > + /* Discard input received so far */ > > + what = FREAD | FWRITE; > > + error = ioctl(fd, TIOCFLUSH, &what); > This is correctly spelled tcflush(fd, TCIOFLUSH); Alternatively, the above TCSANOW could be changed to TCSAFLUSH. The effect is slightly different in that pending output is drained instead of discarded. In any case, the TIOCFLUSH ioctl is non-standard and should not be used directly. -- Jilles Tjoelker ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r317909 - head/usr.bin/resizewin
On Sun, May 07, 2017 at 05:21:23PM +, Edward Tomasz Napierala wrote: > Author: trasz > Date: Sun May 7 17:21:22 2017 > New Revision: 317909 > URL: https://svnweb.freebsd.org/changeset/base/317909 > > Log: > Make resizewin(1) discard the terminal queues, to lower the chance > for "unable to parse response" error which happens when youre typing > too fast for the machine you're running it on. > > Reviewed by:cem, Daniel O'Connor > MFC after: 2 weeks > Sponsored by: DARPA, AFRL > Differential Revision: https://reviews.freebsd.org/D10624 > > Modified: > head/usr.bin/resizewin/resizewin.c > > Modified: head/usr.bin/resizewin/resizewin.c > == > --- head/usr.bin/resizewin/resizewin.cSun May 7 14:59:45 2017 > (r317908) > +++ head/usr.bin/resizewin/resizewin.cSun May 7 17:21:22 2017 > (r317909) > @@ -52,7 +52,7 @@ main(__unused int argc, __unused char ** > { > struct termios old, new; > struct winsize w; > - int ret, fd, cnt, error; > + int ret, fd, cnt, error, what; > char data[20]; > struct timeval then, now; > > @@ -71,6 +71,12 @@ main(__unused int argc, __unused char ** > if (tcsetattr(fd, TCSANOW, &new) == -1) > exit(1); > > + /* Discard input received so far */ > + what = FREAD | FWRITE; > + error = ioctl(fd, TIOCFLUSH, &what); This is correctly spelled tcflush(fd, TCIOFLUSH); > + if (error != 0) > + warn("ioctl"); > + > if (write(fd, query, sizeof(query)) != sizeof(query)) { > error = 1; > goto out; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317909 - head/usr.bin/resizewin
Author: trasz Date: Sun May 7 17:21:22 2017 New Revision: 317909 URL: https://svnweb.freebsd.org/changeset/base/317909 Log: Make resizewin(1) discard the terminal queues, to lower the chance for "unable to parse response" error which happens when youre typing too fast for the machine you're running it on. Reviewed by: cem, Daniel O'Connor MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D10624 Modified: head/usr.bin/resizewin/resizewin.c Modified: head/usr.bin/resizewin/resizewin.c == --- head/usr.bin/resizewin/resizewin.c Sun May 7 14:59:45 2017 (r317908) +++ head/usr.bin/resizewin/resizewin.c Sun May 7 17:21:22 2017 (r317909) @@ -52,7 +52,7 @@ main(__unused int argc, __unused char ** { struct termios old, new; struct winsize w; - int ret, fd, cnt, error; + int ret, fd, cnt, error, what; char data[20]; struct timeval then, now; @@ -71,6 +71,12 @@ main(__unused int argc, __unused char ** if (tcsetattr(fd, TCSANOW, &new) == -1) exit(1); + /* Discard input received so far */ + what = FREAD | FWRITE; + error = ioctl(fd, TIOCFLUSH, &what); + if (error != 0) + warn("ioctl"); + if (write(fd, query, sizeof(query)) != sizeof(query)) { error = 1; goto out; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r317901 - head/usr.bin/resizewin
On Sun, May 7, 2017 at 2:19 AM, Edward Tomasz Napierala wrote: > Author: trasz > Date: Sun May 7 09:19:42 2017 > New Revision: 317901 > URL: https://svnweb.freebsd.org/changeset/base/317901 > > Log: > Improve error reporting in resizewin(1). > > Reviewed by: cem (earlier version) Also reviewed by: Daniel O'Connor (the original author) :-). Best, Conrad ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
Re: svn commit: r317884 - head/sys/compat/linprocfs
> On May 6, 2017, at 11:43, Mahdi Mokhtari wrote: > > Also I think it worths saying, I've tested this running on a X86. > It was not panic'd and printed data as expected. > So you mean it's possible to panic on "some" cases because of CPUID support? You'll get a hardware trap if/when the CPU doesn't support the instruction, which will result in a panic. Cheers, -Ngie ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317908 - head/sys/ufs/ffs
Author: kib Date: Sun May 7 14:59:45 2017 New Revision: 317908 URL: https://svnweb.freebsd.org/changeset/base/317908 Log: Remove spl() calls from UFS code. Sponsored by: The FreeBSD Foundation MFC after:1 week Modified: head/sys/ufs/ffs/ffs_rawread.c Modified: head/sys/ufs/ffs/ffs_rawread.c == --- head/sys/ufs/ffs/ffs_rawread.c Sun May 7 14:33:58 2017 (r317907) +++ head/sys/ufs/ffs/ffs_rawread.c Sun May 7 14:59:45 2017 (r317908) @@ -270,7 +270,6 @@ ffs_rawread_main(struct vnode *vp, int error, nerror; struct buf *bp, *nbp, *tbp; u_int iolen; - int spl; caddr_t udata; long resid; off_t offset; @@ -330,10 +329,7 @@ ffs_rawread_main(struct vnode *vp, } } - spl = splbio(); bwait(bp, PRIBIO, "rawrd"); - splx(spl); - vunmapbuf(bp); iolen = bp->b_bcount - bp->b_resid; @@ -400,9 +396,7 @@ ffs_rawread_main(struct vnode *vp, relpbuf(bp, &ffsrawbufcnt); } if (nbp != NULL) { /* Run down readahead buffer */ - spl = splbio(); bwait(nbp, PRIBIO, "rawrd"); - splx(spl); vunmapbuf(nbp); pbrelvp(nbp); relpbuf(nbp, &ffsrawbufcnt); ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317907 - head/sys/netpfil/pf
Author: kp Date: Sun May 7 14:33:58 2017 New Revision: 317907 URL: https://svnweb.freebsd.org/changeset/base/317907 Log: pf: Fix vnet initialisation When running the vnet init code (pf_load_vnet()) we used to iterate over all vnets, marking them as unhooked. This is incorrect and leads to panics if pf is unloaded, as the unload code does not unregister the pfil hooks (because the vnet is marked as unhooked). There's no need or reason to touch other vnets during initialisation. Their pf_load_vnet() function will be triggered, which handles all required initialisation. Reviewed by: zec, gnn Differential Revision:https://reviews.freebsd.org/D10592 Modified: head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/netpfil/pf/pf_ioctl.c == --- head/sys/netpfil/pf/pf_ioctl.c Sun May 7 12:12:45 2017 (r317906) +++ head/sys/netpfil/pf/pf_ioctl.c Sun May 7 14:33:58 2017 (r317907) @@ -3712,17 +3712,8 @@ dehook_pf(void) static void pf_load_vnet(void) { - VNET_ITERATOR_DECL(vnet_iter); - - VNET_LIST_RLOCK(); - VNET_FOREACH(vnet_iter) { - CURVNET_SET(vnet_iter); - V_pf_pfil_hooked = 0; - TAILQ_INIT(&V_pf_tags); - TAILQ_INIT(&V_pf_qids); - CURVNET_RESTORE(); - } - VNET_LIST_RUNLOCK(); + TAILQ_INIT(&V_pf_tags); + TAILQ_INIT(&V_pf_qids); pfattach_vnet(); V_pf_vnet_active = 1; ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317906 - head/sys/rpc
Author: rmacklem Date: Sun May 7 12:12:45 2017 New Revision: 317906 URL: https://svnweb.freebsd.org/changeset/base/317906 Log: Fix the client side krpc from doing TCP reconnects for ERESTART from sosend(). When sosend() replies ERESTART in the client side krpc, it indicates that the RPC message hasn't yet been sent and that the send queue is full or locked while a signal is posted for the process. Without this patch, this would result in a RPC_CANTSEND reply from clnt_vc_call(), which would cause clnt_reconnect_call() to create a new TCP transport connection. For most NFS servers, this wasn't a serious problem, although it did imply retries of outstanding RPCs, which could possibly have missed the DRC. For an NFSv4.1 mount to AmazonEFS, this caused a serious problem, since AmazonEFS often didn't retain the NFSv4.1 session and would reply with NFS4ERR_BAD_SESSION. This implies to the client a crash/reboot which requires open/lock state recovery. Three options were considered to fix this: - Return the ERESTART all the way up to the system call boundary and then have the system call redone. This is fraught with risk, due to convoluted code paths, asynchronous I/O RPCs etc. cperciva@ worked on this, but it is still a work in prgress and may not be feasible. - Set SB_NOINTR for the socket buffer. This fixes the problem, but makes the sosend() completely non interruptible, which kib@ considered inappropriate. It also would break forced dismount when a thread was blocked in sosend(). - Modify the retry loop in clnt_vc_call(), so that it loops for this case for up to 15sec. Testing showed that the sosend() usually succeeded by the 2nd retry. The extreme case observed was 111 loop iterations, or about 100msec of delay. This third alternative is what is implemented in this patch, since the change is: - localized - straightforward - forced dismount is not broken by it. This patch has been tested by cperciva@ extensively against AmazonEFS. Reported by: cperciva Tested by:cperciva MFC after:2 weeks Modified: head/sys/rpc/clnt_vc.c Modified: head/sys/rpc/clnt_vc.c == --- head/sys/rpc/clnt_vc.c Sun May 7 12:08:41 2017(r317905) +++ head/sys/rpc/clnt_vc.c Sun May 7 12:12:45 2017(r317906) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -107,6 +108,8 @@ static struct clnt_ops clnt_vc_ops = { static void clnt_vc_upcallsdone(struct ct_data *); +static int fake_wchan; + /* * Create a client handle for a connection. * Default options are set, which the user can change using clnt_control()'s. @@ -298,7 +301,7 @@ clnt_vc_call( uint32_t xid; struct mbuf *mreq = NULL, *results; struct ct_request *cr; - int error; + int error, trycnt; cr = malloc(sizeof(struct ct_request), M_RPC, M_WAITOK); @@ -328,8 +331,20 @@ clnt_vc_call( timeout = ct->ct_wait; /* use default timeout */ } + /* +* After 15sec of looping, allow it to return RPC_CANTSEND, which will +* cause the clnt_reconnect layer to create a new TCP connection. +*/ + trycnt = 15 * hz; call_again: mtx_assert(&ct->ct_lock, MA_OWNED); + if (ct->ct_closing || ct->ct_closed) { + ct->ct_threads--; + wakeup(ct); + mtx_unlock(&ct->ct_lock); + free(cr, M_RPC); + return (RPC_CANTSEND); + } ct->ct_xid++; xid = ct->ct_xid; @@ -397,13 +412,16 @@ call_again: */ error = sosend(ct->ct_socket, NULL, NULL, mreq, NULL, 0, curthread); mreq = NULL; - if (error == EMSGSIZE) { + if (error == EMSGSIZE || (error == ERESTART && + (ct->ct_waitflag & PCATCH) == 0 && trycnt-- > 0)) { SOCKBUF_LOCK(&ct->ct_socket->so_snd); sbwait(&ct->ct_socket->so_snd); SOCKBUF_UNLOCK(&ct->ct_socket->so_snd); AUTH_VALIDATE(auth, xid, NULL, NULL); mtx_lock(&ct->ct_lock); TAILQ_REMOVE(&ct->ct_pending, cr, cr_link); + /* Sleep for 1 clock tick before trying the sosend() again. */ + msleep(&fake_wchan, &ct->ct_lock, 0, "rpclpsnd", 1); goto call_again; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317905 - head/usr.bin/resizewin
Author: trasz Date: Sun May 7 12:08:41 2017 New Revision: 317905 URL: https://svnweb.freebsd.org/changeset/base/317905 Log: Rename a variable, hopefully fixing build after r317901. MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/usr.bin/resizewin/resizewin.c Modified: head/usr.bin/resizewin/resizewin.c == --- head/usr.bin/resizewin/resizewin.c Sun May 7 11:44:25 2017 (r317904) +++ head/usr.bin/resizewin/resizewin.c Sun May 7 12:08:41 2017 (r317905) @@ -52,11 +52,11 @@ main(__unused int argc, __unused char ** { struct termios old, new; struct winsize w; - int ret, fd, cnt, err; + int ret, fd, cnt, error; char data[20]; struct timeval then, now; - err = 0; + error = 0; if ((fd = open("/dev/tty", O_RDWR | O_NONBLOCK)) == -1) exit(1); @@ -72,7 +72,7 @@ main(__unused int argc, __unused char ** exit(1); if (write(fd, query, sizeof(query)) != sizeof(query)) { - err = 1; + error = 1; goto out; } @@ -89,14 +89,14 @@ main(__unused int argc, __unused char ** timersub(&now, &then, &now); if (now.tv_sec >= 2) { warnx("timeout reading from terminal"); - err = 1; + error = 1; goto out; } usleep(2); continue; } - err = 1; + error = 1; goto out; } if (data[cnt] == 'R') @@ -105,25 +105,25 @@ main(__unused int argc, __unused char ** cnt++; if (cnt == sizeof(data) - 2) { warnx("response too long"); - err = 1; + error = 1; goto out; } } /* Parse */ if (sscanf(data, "\033[%hu;%huR", &w.ws_row, &w.ws_col) != 2) { - err = 1; + error = 1; warnx("unable to parse response"); goto out; } /* Finally, what we want */ if (ioctl(fd, TIOCSWINSZ, &w) == -1) - err = 1; + error = 1; out: /* Restore echo */ tcsetattr(fd, TCSANOW, &old); close(fd); - exit(err); + exit(error); } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317904 - head/bin/stty
Author: trasz Date: Sun May 7 11:44:25 2017 New Revision: 317904 URL: https://svnweb.freebsd.org/changeset/base/317904 Log: .Xr resizewin from stty(1) man page. MFC after:2 weeks Sponsored by: DARPA, AFRL Modified: head/bin/stty/stty.1 Modified: head/bin/stty/stty.1 == --- head/bin/stty/stty.1Sun May 7 11:11:51 2017(r317903) +++ head/bin/stty/stty.1Sun May 7 11:44:25 2017(r317904) @@ -588,6 +588,7 @@ Same as the control character .Sh EXIT STATUS .Ex -std .Sh SEE ALSO +.Xr resizewin 1 , .Xr termios 4 .Sh STANDARDS The ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"
svn commit: r317901 - head/usr.bin/resizewin
Author: trasz Date: Sun May 7 09:19:42 2017 New Revision: 317901 URL: https://svnweb.freebsd.org/changeset/base/317901 Log: Improve error reporting in resizewin(1). Reviewed by: cem (earlier version) MFC after:2 weeks Sponsored by: DARPA, AFRL Differential Revision:https://reviews.freebsd.org/D10624 Modified: head/usr.bin/resizewin/resizewin.c Modified: head/usr.bin/resizewin/resizewin.c == --- head/usr.bin/resizewin/resizewin.c Sun May 7 08:02:28 2017 (r317900) +++ head/usr.bin/resizewin/resizewin.c Sun May 7 09:19:42 2017 (r317901) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -87,8 +88,7 @@ main(__unused int argc, __unused char ** gettimeofday(&now, NULL); timersub(&now, &then, &now); if (now.tv_sec >= 2) { - fprintf(stderr, "\n\n\nTimeout reading from terminal\n"); - fprintf(stderr, "Read %d bytes, %s\n", cnt, data); + warnx("timeout reading from terminal"); err = 1; goto out; } @@ -104,7 +104,7 @@ main(__unused int argc, __unused char ** cnt++; if (cnt == sizeof(data) - 2) { - fprintf(stderr, "Response too long\n"); + warnx("response too long"); err = 1; goto out; } @@ -113,7 +113,7 @@ main(__unused int argc, __unused char ** /* Parse */ if (sscanf(data, "\033[%hu;%huR", &w.ws_row, &w.ws_col) != 2) { err = 1; - fprintf(stderr, "Unable to parse response\n"); + warnx("unable to parse response"); goto out; } ___ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"