Commit graph

238696 commits

Author SHA1 Message Date
Pedro F. Giffuni a5dabd6c3c Fix mismatch from r342379. 2018-12-23 20:51:13 +00:00
Konstantin Belousov cbbdd28318 nvdimm SPA geom: Update bio fields needed for devstat_end_transaction_bio().
Reported by:	bde
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2018-12-23 19:14:31 +00:00
Konstantin Belousov 8690d4dea3 Allocate v_object for the new snapshot vnode.
The vnode is not opened, so it ends up with the malloced buffers otherwise.

Reported and tested by:	pho
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2018-12-23 18:54:09 +00:00
Konstantin Belousov 6c59824b31 Properly test for vmio buffer in bnoreuselist().
The presence of allocated v_object does not imply that the buffer is
necessary VMIO kind.  Buffer might has been allocated before the
object created, then the buffer is malloced.  Although we try to avoid
such situation, it seems to be still legitimate.

Reported and tested by:	pho
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2018-12-23 18:52:02 +00:00
Pedro F. Giffuni 09ed804717 gai_strerror() - Update string error messages according to RFC 3493.
Error messages in gai_strerror(3) vary largely among OSs.

For new software we largely replaced the obsoleted EAI_NONAME and
with EAI_NODATA but we never updated the corresponding message to better
match the intended use. We also have references to ai_flags and ai_family
which are not very descriptive for non-developer end users.

Bring new new error messages based on informational RFC 3493, which has
obsoleted RFC 2553, and make them consistent among the header adn
manpage.

MFC after:	1 month
Differentical Revision:	D18630
2018-12-23 18:15:48 +00:00
Cy Schubert 2686f69ed4 Remove NETBSD_PF. NETBSD_PF is a flag that defines whether the pfil(9)
framework is available. pfil(9) has been in FreeBSD since FreeBSD 5
and according to svn log was first committed to HEAD in 2000, therefore
it is safe to say the check is no longer needed in FreeBSD.

pfil(9) first appeared in NetBSD 1.3 (hence the name NETBSD_PF).
Therefore it is safe to say that it is supported by every NetBSD system
today. The framework also exists in illumos.

As ipfilter code is shared and exchanged between FreeBSD and NetBSD, and
at some point in the future illumos too, and as all three platforms have
pfil(9), the redundant NETBSD_PF #defines and #ifdefs are removed.

MFC after:	1 week
2018-12-23 05:10:36 +00:00
Simon J. Gerraty dfd669ab38 Merge bmake-20181221 2018-12-23 01:05:52 +00:00
Bruce Evans c907940bf9 Fix devstat on md devices, second attempt. r341765 depends on
g_io_deliver() finishing initialization of the bio, but g_io_deliver()
actually destroys the bio.  INVARIANTS makes the bug obvious by
overwriting the bio with garbage.

Restore the old order for calling devstat (except don't restore not calling
it for the error case), and translate to the devstat KPI so that this order
works.

Reviewed by:	kib
2018-12-22 22:59:11 +00:00
Cy Schubert 1e3ecb57e0 Remove the last vestiges of HP/UX from a FreeBSD-only ipfilter
source file.

MFC after:	1 week
2018-12-22 21:49:25 +00:00
Simon J. Gerraty 4e6c593faa Import bmake-20181221
o parse.c: ParseVErrorInternal use .PARSEDIR
  and apply if relative, and then use .PARSEFILE
  for consistent result.
o var.c: avoid SEGFAULT in .unexport-env
  when MAKELEVEL is not set
2018-12-22 21:32:17 +00:00
Vincenzo Maffione 58e185425a netmap: fix txsync check in netmap poll
To check if txsync can be skipped, it is necessary to look for
unseen TX space. However, this means comparing ring->cur
against ring->tail, rather than ring->head against ring->tail
(like nm_ring_empty() does).
This change also adds some more comments to explain the optimization
performed at the beginning of netmap_poll().

MFC after:	3 days
Sponsored by:	Sunny Valley Networks
2018-12-22 16:23:42 +00:00
Vincenzo Maffione e1ed1fbdea netmap: fix bug in netmap_poll() optimization
The bug was introduced by r339639, although it is present in the upstream
netmap code since 2015. It is due to resetting the want_rx variable to
POLLIN, rather than resetting it to POLLIN|POLLRDNORM.
It only affects select(), which uses POLLRDNORM. poll() is not affected,
because it uses POLLIN.
Also, it only affects FreeBSD, because Linux skips the optimization
implemented by the piece of code where the bug occurs.

MFC after:	3 days
Sponsored by:	Sunny Valley Networks
2018-12-22 15:15:45 +00:00
Eugene Grosbein 8ebaf58450 ifconfig.4, lagg.4: fix documentation bug: -use_flowid needs to be used
to force local hash computation and disable usage of RSS hash
provided by driver.

PR:		234242
MFC after:	1 week
2018-12-22 11:38:54 +00:00
Bruce Evans 5ef4f86d7a Oops, rounddown() for the start was misspelled roundup() in r342295,
so only aligned starts worked.  This broke releasing caches in most
cases where the i/o size is smaller than the fs block size.
2018-12-22 09:31:55 +00:00
Kyle Evans ac0a7e2a3c config(8): Remove all instances of an option when opting out
Quick follow-up to r342362: options can appear multiple times now, so
clean up all of them as needed. For non-OPTIONS options, this has no effect
since they're already de-duplicated.

MFC after:	1 week
X-MFC-With:	r342362
2018-12-22 06:08:06 +00:00
Kyle Evans 993e5c4fd2 config(8): Allow duplicate options to be specified
config(8)'s option handling has been written to allow duplicate options; if
the value changes, then the latest value is used and an informative message
is printed to stderr like so:

/usr/src/sys/amd64/conf/TEST: option "VERBOSE_SYSINIT" redefined from 0 to 1

Currently, this is only a possibility for cpu types, MAXUSERS, and
MACHINE_ARCH. Anything else duplicated in a config file will use the first
value set and error about duplicated options on subsequent appearances,
which is arguably unfriendly since one could specify:

include GENERIC
nooptions VERBOSE_SYSINIT
options VERBOSE_SYSINIT

to redefine the value later anyways.

Reported by:	mmacy
MFC after:	1 week
2018-12-22 06:02:34 +00:00
Warner Losh 9d0e9f8ef5 Try the first 256 units with nvmecontrol devlist.
The nvmecontrol code that did the devlist assumed that we had a
tightly-packed allocation of units. Since pci writing exists, this
isn't the case. Loop over the first 256 units, which is a reasonable
number of possible units.

Sponsored by: Netflix
2018-12-21 23:22:37 +00:00
Bruce Evans 416e232cc6 Fix clobbering of the fatchain cache for clustered i/o's when full
clustering is not done.  The bug caused extreme slowness for large
files in some cases.

There is no way to tell VOP_BMAP() how many blocks are wanted, so for
all file systems it has to waste time in some cases by searching for
more contiguous blocks than will be accessed.  For msdosfs, it also
clobbered the fatchain cache in these cases by advancing the cache to
point to the chain entry for block that won't be read.  This makes
the cache useless for the next sequential i/o (or VOP_BMAP()), so the
fat chain is searched from the beginning.  The cache only has 1 relevant
entry, so it is similarly useless for random i/o.

Fix this by only advancing the cache to point to the chain entry for
the first block that will be read.  Clustering uses results from
VOP_BMAP(), so when more than 1 block is read by clustering, the cache
is not advanced as optimally as before, but it is at most 1 cluster
size behind and searching the chain through the blocks for this cluster
doesn't take too long.
2018-12-21 21:17:45 +00:00
Navdeep Parhar 6c5c0137a9 Remove unused macros from t4_tom.h. 2018-12-21 20:46:45 +00:00
Conrad Meyer 86312e466c mps(4), mpr(4): remove SATA ID command cancellation hack
Add a generic mechanism to override mp?_wait_command's timeout behavior,
which continues to invoke reinit by default.  Invokers who set
cm_timeout_handler may avoid automatic reinit and do their own handling.

Adapt mp?sas_get_sata_identify to this mechanism and remove its callout
hack.

Reviewed by:	scottl
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D18614
2018-12-21 20:30:52 +00:00
Conrad Meyer 8277ce2b78 mps(4), mpr(4): Fix lifetime of command buffer for mp?sas_get_sata_identify
In the event that the ID command timed out, mps(4)/mpr(4) did not free the
command until it could be cancelled.  However, it freed the associated
buffer (cm_data).  Fix the lifetime issue by freeing the associated buffer
only after Abort Task or controller reset.

Reviewed by:	scottl
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D18612
2018-12-21 20:29:16 +00:00
Bruce Evans 8ec22c4d65 Quick fix for initialization of mnt_iosize_max. (This limit controls
mainly clustering and read-ahead.)  Copy the initialization from ffs,
and also copy a couple of lines of ffs's nearby style for initialization
order and whitespace.

A correct fix would de-duplicate the initialization and fix bitrot in it
instead of adding another instance of the duplication.  Complications to
use the size preferred by the device have been reduced to hard-coding
slightly pessimal and/or inconsistent defaults, using large code that was
almost needed to support the complications.

For msdosfs, the result was that mnt_iosize_max was DFTLPHYS (64K) but is
now MAXPHYS (128K).
2018-12-21 20:12:43 +00:00
Alexander Motin 1f03d0bae1 Fix passing wrong variables to nvlist_destroy() after r333446.
Reported by:	Alexander Fedorov (IT-Grad.ru)
MFC after:	5 days
2018-12-21 17:22:15 +00:00
Vincenzo Maffione c2231fb0f8 netmap: update nmreplay(8)
Small modifications to the nmreplay man page.
Used igor and mandoc tools to fix warnings and errors.

Reviewed by:	bcr
MFC after:	3 days
Differential Revision:	https://reviews.freebsd.org/D18629
2018-12-21 14:45:10 +00:00
Vincenzo Maffione 4b45250941 netmap: nmreplay: import various fixes from upstream (2704a51839906)
Changelist:
    - General reformatting
    - Fix packet duplication in cons(). Whenever cons() reached the
      burst limit it would send all pending packets without advancing
      head. This caused the last injected packet to be sent again in
      the next round.
    - Fix full-speed transmissions after first loop.

MFC after:	3 days
2018-12-21 13:56:57 +00:00
Vincenzo Maffione 77a2baf551 netmap: move buf_size validation code to its own function
This code validates the netmap buf_size against the interface MTU
and maximum descriptor size, to make sure the values are consistent.
Moving this functionality to its own function is needed because this
function is also called by Linux-specific code.

MFC after:	3 days
2018-12-21 11:50:14 +00:00
Vincenzo Maffione c52382bd40 netmap: pipes: make sure both ends use the same number of slots 2018-12-21 11:32:55 +00:00
Andrey V. Elsukov a5178bca19 Allow use underscores and dots in service names without escaping.
PR:		234237
MFC after:	1 week
2018-12-21 10:41:45 +00:00
Bruce Evans 9e5ed8593f Use VOP_ADVISE() with POSIX_FADV_DONTNEED instead of IO_DIRECT to
implement not double-caching for reads from vnode-backed md devices.
Use VOP_ADVISE() similarly instead of !IO_DIRECT unsimilarly for writes.
Add a "cache" option to mdconfig to allow changing the default of not
caching.

This depends on a recent commit to fix VOP_ADVISE().  A previous version
had optimizations for sequential i/o's (merge the i/o's and only uncache
for discontiguous i/o's and for full blocks), but optimizations and
knowledge of block boundaries belong in VOP_ADVISE().  Read-ahead should
also be handled better, by supporting it in md and discarding it in
VOP_ADVISE().

POSIX_FADV_DONTNEED is ignored by zfs, but so is IO_DIRECT.

POSIX_FADV_DONTNEED works better than IO_DIRECT if it is not ignored,
since it only discards from the buffer cache immediately, while
IO_DIRECT also discards from the page cache immediately.

IO_DIRECT was not used for writes since it was claimed to be too slow,
but most of the slowness for writes is from doing them synchronously by
default.  Non-synchronous writes still deadlock in many cases.

IO_DIRECT only has a special implementation for ffs reads with DIRECTIO
configured.  Otherwise, if it is not ignored than it uses the buffer and
page caches normally except for discarding everything after each i/o,
and then it has much the same overheads as POSIX_FADV_DONTNEED.  The
overheads for reading with ffs and DIRECTIO were similar in tests of md.

Reviewed by:	kib
2018-12-21 08:15:31 +00:00
Bruce Evans e6f6d8853c Fix missing (sub)options in usage message to prepare for adding a new one.
Reviewed by:	kib
2018-12-21 06:38:13 +00:00
Bruce Evans 2c0434acb0 Fix rounding in vop_stdadvise() for POSIX_FADV_NOREUSE (really
POSIX_FADV_DONTNEED).  The most broken case was for applications that
advise for the whole file and then do block-aligned i/o's 1 block at
a time.  Then advice is sent to VOP_ADVISE() 1 block at a time, but
in vop_stdadvise() the 1-block advice was turned into 0-block advice
for the buffer cache part.

The bugs were caused partly by callers representing the region as
(a_start, a_end), where a_end is actually the maximum, and everything
else representing the region as (start, end) where 'end' is actually
the end (1 after the maximum).  The maximum a_end must be rounded up,
but was rounded down.  Also, rounding to page boundaries was inconsistent.

The bugs and fixes have no effect for zfs and other file systems that
don't use the buffer cache or the page cache.  Most or all file systems
currently use the default VOP_FADVISE(), but it finds a null buffer cache
and a null page cache for file systems that don't use normal methods.

Reviewed by:	kib
2018-12-21 04:57:59 +00:00
Kirk McKusick 13c31c29ca Some filesystems (like cd9660 and ext3) require that VFS_STATFS()
be called before VFS_ROOT() is called. Move the call for VFS_STATFS()
so that it is done after VFS_MOUNT(), but before VFS_ROOT().
This change actually improves the robustness of the mount system
call because it returns an error rather than failing silently
when VFS_STATFS() returns failure.

Reported by:  Rebecca Cran <rebecca@bluestop.org>
Sponsored by: Netflix
2018-12-21 01:09:25 +00:00
Navdeep Parhar ad025209ba cxgbe/iw_cxgbe: Remove redundant CTRs from c4iw_alloc/c4iw_rdev_open.
This information is readily available elsewhere.

Sponsored by:	Chelsio Communications
2018-12-20 22:39:58 +00:00
Navdeep Parhar 6bb034658d cxgbe/iw_cxgbe: Do not terminate CTRx messages with \n. 2018-12-20 22:31:07 +00:00
Rick Macklem d493fe42f9 Add an UPDATING message for r342286. 2018-12-20 22:26:54 +00:00
Rick Macklem 23114c6c2a Fix the NFSv4 server to obey vfs.nfsd.nfs_privport.
When the NFSv4 server was coded, I believed that the specification authors
did not want NFSv4 servers to require a client to use a reserved port#.
However, recently it has been noted that the Linux NFSv4 server does support
a check for a reserved port#.
Since both the FreeBSD and Linux NFSv4 clients use a reserved port# by
default, enabling vfs.nfsd.nfs_privport to require a reserved port# for
NFSv4 the same as it does for NFSv2, 3 seems reasonable.
The only case where this could cause a POLA violation is a FreeBSD NFSv4
server with vfs.nfsd.nfs_privport set, but with NFSv4 clients doing mounts
without using a reserved port# (< 1024).

Tested by:	chaz.newton58@gmail.com
PR:		234106
MFC after:	1 week
2018-12-20 22:21:41 +00:00
Conrad Meyer 0c3bbec309 tpm(4): Fix GCC build after r342084 (TPM 2.0 driver commit)
Move static variable definition (cdevsw) to a more conventional location
(the C file it is used in), rather than a header.

This fixes the GCC warning, -Wunused-variable ("defined but not used") when
the tpm20.h header is included in files other than tpm20.c (e.g.,
tpm_tis.c).

X-MFC-with:	r342084
Sponsored by:	Dell EMC Isilon
2018-12-20 20:55:33 +00:00
Navdeep Parhar 9877f73541 cxgbe(4): Make sure the rx queues start off with the correct timestamp
settings on initialization.

Sponsored by:	Chelsio Communications
2018-12-20 20:34:21 +00:00
Rebecca Cran db8b561345 Rework UEFI ESP generation
Currently, the installer uses pre-created 800KB FAT12 filesystems that
it dd's onto the ESP partition.
This changeset improves that by having the installer generate a FAT32
filesystem directly onto the ESP using newfs_msdos and then copying
loader.efi into /EFI/freebsd.
For live installs it then runs efibootmgr to add a FreeBSD boot entry
in the BIOS.

Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D17947
2018-12-20 19:39:37 +00:00
Rebecca Cran d5cee48f3e Wait a maximum of 300 seconds for network send/recv in libsa
The reason for this change is that currently, a send/recv
takes many hours to time out.
This is suboptimal in the bootloader because it means for example
that NFS will take hours to fail before allowing subsequent access
methods such as gzip to be tried.

Setting MAXWAIT to 300 seconds (5 minutes) still allows slow
connections of 1Mb to be used to download a 30MB kernel file.

Sponsored by:	Netflix
Differential Revision:	https://reviews.freebsd.org/D18544
2018-12-20 19:27:46 +00:00
Michael Tuexen 09423f72fd Fix a regression in the TCP handling of received segments.
When receiving TCP segments the stack protects itself by limiting
the resources allocated for a TCP connections. This patch adds
an exception to these limitations for the TCP segement which is the next
expected in-sequence segment. Without this patch, TCP connections
may stall and finally fail in some cases of packet loss.

Reported by:		jhb@
Reviewed by:		jtl@, rrs@
MFC after:		3 days
Sponsored by:		Netflix, Inc.
Differential Revision:	https://reviews.freebsd.org/D18580
2018-12-20 16:05:30 +00:00
Ed Maste eacff37a61 Remove setting of long-unused MK_NCP option
NCP was removed from the tree in 2013 (r248097) and disconnected some
time before.

Reported by:	bz
Sponsored by:	The FreeBSD Foundation
2018-12-20 15:53:27 +00:00
Warner Losh 9cd5259d97 Fix panic message when we can't create thread for one wire temperature
reading.
2018-12-20 05:46:56 +00:00
Navdeep Parhar 8953e80f5e cxgbe/iw_cxgbe: Use -ve errno when interfacing with linuxkpi/OFED.
Submitted by:	Krishnamraju Eraparaju @ Chelsio
Sponsored by:	Chelsio Communications
2018-12-20 01:35:45 +00:00
Marcin Wojtas efa9b503c6 Fix obtaining RSP address in TPM CRB for non-amd64 platforms
On amd64 the RSP address can be read in single 8-byte transaction,
which is obviously not possible on 32-bit platforms. Fix that
by performing 2 4-byte read on them.

Obtained from: Semihalf
Sponsored by: Stormshield
2018-12-20 01:05:09 +00:00
Navdeep Parhar b562884d63 cxgbe/iw_cxgbe: Add a knob for testing that lets iWARP connections cycle
through 4-tuples quickly.

Submitted by:	Krishnamraju Eraparaju @ Chelsio
Sponsored by:	Chelsio Communications
2018-12-20 01:00:21 +00:00
Navdeep Parhar 121684b714 cxgbe/iw_cxgbe: Use DSGLs to write to card's memory when appropriate.
Submitted by:	Krishnamraju Eraparaju @ Chelsio
Sponsored by:	Chelsio Communications
2018-12-19 23:29:01 +00:00
Yuri Pankov e2a87ae3af regcomp: revert part of r341838 which turned out to be unrelated
and caused issues with search in less.

PR:		234066
Reviewed by:	pfg
Differential revision:	https://reviews.freebsd.org/D18611
2018-12-19 23:28:56 +00:00
Mateusz Guzik 3e0178fb94 Check for probes enabled in priv_check_cred before evaluting the error.
Sponsored by:	The FreeBSD Foundation
2018-12-19 23:28:29 +00:00
Warner Losh c3efee6ed9 Add note to 32-bit mips smp config files documenting the status 2018-12-19 23:22:14 +00:00