Commit Graph

214963 Commits

Author SHA1 Message Date
Konstantin Belousov
2da4bcb82b On unwind after failed block allocation in ffs_balloc_ufs{1,2}, assert
that recorded allocated blocks numbers match the physical block
numbers of dandling buffers which are released.

When finally freeing the blocks during unwind, assert that dandling
buffers where not re-allocated.  They shouldn't, because the vnode lock
is owned exclusive.

Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-16 17:18:38 +00:00
Kirk McKusick
65d3199746 Add two new macros, SLIST_CONCAT and LIST_CONCAT. Note in both the
queue.h header file and in the queue.3 manual page that they are O(n)
so should be used only in low-usage paths with short lists (otherwise
an STAILQ or TAILQ should be used).

Reviewed by: kib
2016-08-16 17:07:48 +00:00
Konstantin Belousov
39f7cbe9ab When looking up dandling buffers for unwing after failing block
allocation in UFS_BALLOC(), there is no need to map them.

Reviewed by:	mckusick
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-16 17:05:15 +00:00
Konstantin Belousov
554248587e When block allocation fails in UFS_BALLOC(), and the volume does not
have SU enabled, there is no point in calling softdep_request_cleanup().

The call cannot produce free blocks, but we unecessarily lock ufsmount
and do inode block write.  Usual point of not doing optimizations for
the corner case of the full volume is not applicable there, the work
is easily avoidable, and the addition CPU and disk io load do not lead
to succeeding retry.

Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-16 16:50:48 +00:00
Konstantin Belousov
f1503c5a49 In ffs_balloc_ufs{1,2} routines, assert that unwind records do not
overflow local arrays.  This is not immediately obvious from the
static code inspection, due to retry logic.

Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-16 16:49:56 +00:00
Marcelo Araujo
4b61b26b28 Use nitems() from sys/param.h.
MFC after:	2 weeks.
2016-08-16 15:53:05 +00:00
Marcelo Araujo
4c59a8860a Use nitems() from sys/param.h.
MFC after:	2 weeks.
2016-08-16 15:52:10 +00:00
Randall Stewart
eadd00f81a A few more wording tweaks as suggested (with some modifications
as well) by Ravi Pokala. Thanks for the comments :-)
Sponsored by: Netflix Inc.
2016-08-16 15:17:36 +00:00
Randall Stewart
587d67c008 Here we update the modular tcp to be able to switch to an
alternate TCP stack in other then the closed state (pre-listen/connect).
The idea is that *if* that is supported by the alternate stack, it
is asked if its ok to switch. If it approves the "handoff" then we
allow the switch to happen. Also the fini() function now gets a flag
to tell if you are switching away *or* the tcb is destroyed. The
init() call into the alternate stack is moved to the end so the
tcb is more fully formed before the init transpires.

Sponsored by:	Netflix Inc.
Differential Revision:	D6790
2016-08-16 15:11:46 +00:00
Emmanuel Vadot
858a3f496f Only use WaitForKeys event if it exists, this is not the case in u-boot efi implementation.
Reviewed by:	jhb, emaste
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D6781
2016-08-16 14:33:25 +00:00
Emmanuel Vadot
5f306327fe Use %ju modifier for u_int64_t and %jd modifier for off_t.
off_t is long long on arm32 and long on amd64

MFC after:	1 week
2016-08-16 14:23:35 +00:00
Sofian Brabez
80a2905883 tty: Use proper definition of exit status code and stdin macro
Reviewed by:	bapt, bdrewery
Differential Revision:	https://reviews.freebsd.org/D6828
2016-08-16 14:15:09 +00:00
Randall Stewart
0fa047b98c Comments describing how to properly use the new lock_add functions
and its respective companion.

Sponsored by:	Netflix Inc.
2016-08-16 13:08:03 +00:00
Randall Stewart
b07fef500b This cleans up the timer code in TCP and also makes it so we do not
take the INFO lock *unless* we are really going to delete the TCB.

Differential Revision:	D7136
2016-08-16 12:40:56 +00:00
Bryan Drewery
0295d98c14 Trim unneeded bootstrap after r301470 made 9.1 the minimum supported release.
MFC after:	3 days
Sponsored by:	EMC / Isilon Storage Division
2016-08-16 12:13:12 +00:00
Brooks Davis
3bb0c17d3e Don't conflate enum nss_status return values values with int (NS_SUCCESS,
NS_RETURN) values.

Sponsored by:	DARPA, AFRL
Differential Revision:	https://reviews.freebsd.org/D6046
2016-08-16 11:38:45 +00:00
Konstantin Belousov
1c1cc89580 The fdatasync(2) call must be cancellation point.
Sponsored by:	The FreeBSD Foundation
MFC after:	13 days
2016-08-16 08:27:03 +00:00
Adrian Chadd
b0754a31cf [mips] fix use-before-initialised.
Found by: gcc-5.3
2016-08-16 07:51:05 +00:00
Sepherosa Ziehau
de56155fe0 hyperv/hn: Simplify RNDIS message checks on RX path.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7502
2016-08-16 07:45:35 +00:00
Sepherosa Ziehau
62c4e6e992 hyperv/hn: Simplify RNDIS NVS message sending.
MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7501
2016-08-16 07:37:02 +00:00
Sepherosa Ziehau
5ac4acb202 hyperv/hn: Factor out hn_nvs_send/hn_nvs_send_sglist
Avoid unnecessary message type setting and centralize the send context
to transaction id cast.

MFC after:	1 week
Sponsored by:	Microsoft
Differential Revision:	https://reviews.freebsd.org/D7500
2016-08-16 07:26:53 +00:00
Sepherosa Ziehau
8452c1b345 tcp/lro: Make # of LRO entries tunable
Reviewed by:	hps, gallatin
Obtained from:	rrs, gallatin
MFC after:	2 weeks
Sponsored by:	Netflix (rrs, gallatin), Microsoft (sephe)
Differential Revision:	https://reviews.freebsd.org/D7499
2016-08-16 06:40:27 +00:00
Mark Johnston
5968c00154 Regenerate DTrace tests. 2016-08-16 02:34:25 +00:00
Mark Johnston
650f66ac9a MFV r304057:
7085 add support for "if" and "else" statements in dtrace

illumos/illumos-gate@c3bd3abd88

Add syntactic sugar to dtrace: "if" and "else" statements. The sugar is
baked down to standard dtrace features by adding additional clauses with
the appropriate predicates.

Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Matthew Ahrens <mahrens@delphix.com>

MFC after:	2 weeks
Relnotes:	yes
2016-08-16 02:30:19 +00:00
Mark Johnston
59ceeddecf MFV r301526:
7035 string-related subroutines should validate input earlier

Reviewed by: Alex Wilson <alex.wilson@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Patrick Mooney <pmooney@pfmooney.com>

illumos/illumos-gate@771e39c3b1

MFC after:	2 weeks
2016-08-16 02:25:19 +00:00
Mark Johnston
f66200ee22 MFV r301525:
7033 ustack helper should fault on bad return values

Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Alex Wilson <alex.wilson@joyent.com>

illumos/illumos-gate@a2f72b65eb

MFC after:	2 weeks
2016-08-16 02:20:02 +00:00
Mark Johnston
4aea8f31b1 MFV r301524:
7034 negative record sizes should be rejected

Reviewed by: Patrick Mooney <patrick.mooney@joyent.com>
Reviewed by: Bryan Cantrill <bryan@joyent.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Alex Wilson <alex.wilson@joyent.com>

illumos/illumos-gate@0b8049bfb0

MFC after:	2 weeks
2016-08-16 02:18:34 +00:00
Mark Johnston
b7125fa9cd MFV r296989:
6734 dtrace_canstore_statvar() fails for some valid static variables

Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bryan Cantrill <bryan@joyent.com>

illumos/illumos-gate@d65f2bb4e5

MFC after:	2 weeks
2016-08-16 02:16:54 +00:00
Mark Johnston
ba69823e5c MFV r304056:
5396 fix longjmp clobbering errors

illumos/illumos-gate@67a4bb8f9a

Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Gary Mills <gary_mills@fastmail.fm>
2016-08-16 02:14:36 +00:00
Rick Macklem
684d18c9ae Fix r304026 so that it builds for gcc.
Reported by:	np
Tested by:	np
MFC after:	1 month
2016-08-16 00:48:13 +00:00
Jung-uk Kim
bb3860fbd0 Fix ko_KR, zh_CN, zh_HK, and zh_TW locales. r304045 did not fully revert
date/time formats for these locales.
2016-08-16 00:15:15 +00:00
Ed Maste
d4a12237eb elfcopy: correct comment typo in r304151 2016-08-15 23:20:55 +00:00
John Baldwin
061ae3c519 Remove the mcd(4) driver for Mitsumi CD-ROM players.
This is a driver for a pre-ATAPI ISA CD-ROM adapter.  As noted in
the manpage, this driver is only useful as a backend to cdcontrol to
play audio CDs since it doesn't use DMA, so its data performance is
"abysmal" (and that was true in the mid 90's).
2016-08-15 20:38:02 +00:00
Bruce Evans
79ef07d4c0 Clean up the new sc cn open and close functions (old sc cn grab and ungrab
functions).  Mainly, spell sc as itself instead of as scp->sc.
2016-08-15 20:17:48 +00:00
Ed Schouten
93d9ebd82e Eliminate use of sys_fsync() and sys_fdatasync().
Make the kern_fsync() function public, so that it can be used by other
parts of the kernel. Fix up existing consumers to make use of it.

Requested by:	kib
2016-08-15 20:11:52 +00:00
Eric Badger
b0f2185bbe sem_post(): wake up the sleeper only after adjusting has_waiters
If the caller of sem_post() wakes up a thread sleeping via sem_wait()
before it clears the has_waiters flag, the caller of sem_wait() has no way of
knowing when it is safe to destroy the semaphore and reuse the memory. This is
because the caller of sem_post() may be interrupted between the wake step and
the clearing of has_waiters. It will then write into the has_waiters flag in
userspace after being preempted for some unknown amount of time.

Reviewed by:	jhb, kib, vangyzen
Approved by:	kib (mentor), vangyzen (mentor)
MFC after:	2 weeks
Sponsored by:	Dell Inc.
Differential Revision:	https://reviews.freebsd.org/D7505
2016-08-15 20:09:09 +00:00
Mark Johnston
ed12504ac7 dtraceUtil/tst.DataModel32.d.ksh passes on amd64. 2016-08-15 19:47:04 +00:00
Ed Schouten
2256eed3eb Let CloudABI use fdatasync() as well.
Now that FreeBSD supports fdatasync() natively, we can tidy up
CloudABI's equivalent system call to use that instead.
2016-08-15 19:42:21 +00:00
Bruce Evans
43e5b7b6b3 Restructure the grabbing functions into mere wrappers of new open and
close functions.  Scattered calls to sc_cnputc() and sc_cngetc() were
broken by turning the semi-reentrant inline context-switching code in
these functions into the grabbing functions.  cncheckc() calls for
panic dumps are the main broken case.  The grabbing functions have
special behaviour (mainly screen switching in sc_cngrab()) which makes
them unsuitable as replacements for the inline code.
2016-08-15 19:37:18 +00:00
Konstantin Belousov
2f514f92cf Implement VOP_FDATASYNC() for UFS.
Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D7471
2016-08-15 19:22:23 +00:00
Konstantin Belousov
47e61f6cc6 Implement VOP_FDATASYNC() for msdosfs.
Standard VOP_FSYNC() implementation just syncs data buffers, and due
to this, is the correct and efficient implementation for msdosfs or
any other filesystem which uses bufer cache trivially.  Provide
globally visible wrapper vop_stdfdatasync_buf() for future consumption
by other filesystems.

Reviewed by:	mckusick
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D7471
2016-08-15 19:17:00 +00:00
Konstantin Belousov
1d2537a26a Regen after r304176, fdatasync(2) addition. 2016-08-15 19:15:46 +00:00
Konstantin Belousov
295af703a0 Add an implementation of fdatasync(2).
The syscall is a trivial wrapper around new VOP_FDATASYNC(), sharing
code with fsync(2).  For all filesystems, this commit provides the
implementation which delegates the work of VOP_FDATASYNC() to
VOP_FSYNC().  This is functionally correct but not efficient.

This is not yet POSIX-compliant implementation, because it does not
ensure that queued AIO requests are completed before returning.

Reviewed by:	mckusick
Discussed with:	avg (ZFS), jhb (AIO part)
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	2 weeks
Differential revision:	https://reviews.freebsd.org/D7471
2016-08-15 19:08:51 +00:00
Ed Schouten
576a9e496f Disable tests for non-standard behaviour of dirname(3)/basename(3).
The NetBSD ATF tests explicitly check that these functions do not modify
their input. These tests are NetBSD-specific. They test for something
that is not part of POSIX.

PR:		211873
Reviewed by:	ngie
Differential Revision:	https://reviews.freebsd.org/D7506
2016-08-15 19:05:41 +00:00
Konstantin Belousov
c73fb33115 VOP_FSYNC() does not take cred as an argument. Correct comment.
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
2016-08-15 18:55:33 +00:00
Bruce Evans
430320729d Fix restoring the kbd_mode part of the keyboard state in grab/ungrab.
Simply change the mode to K_XLATE using a local variable and use the
grab level as a flag to tell screen switches not to change it again,
so that we don't need to switch scp->kbd_mode.  We did the latter,
but didn't have the complications to update the keyboard mode switch
for every screen switch.  sc->kbd_mode remains at its user setting
for all scp's and ungrabbing restores to it.
2016-08-15 18:02:37 +00:00
John Baldwin
8b2246b349 Add support for register dumps on VF devices.
- Add handling of VF register sets to t4_get_regs_len() and t4_get_regs().
- While here, use t4_get_regs_len() in the ioctl handler for regdump
  instead of inlining it.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7484
2016-08-15 17:42:54 +00:00
John Baldwin
e5e9897c5f Update mailbox writes to work with VF devices.
- Use alternate register locations for the data and control registers for
  VFs.
- Do a dummy read to force the writes to the  mailbox data registers to
  post before the write to the control register on VFs.
- Do not check the PCI-e firmware register for errors on VFs.

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7483
2016-08-15 17:41:34 +00:00
John Baldwin
59c1e950b9 Make SGE parameter handling more VF-friendly.
Add fields to hold the SGE control register and free list buffer sizes to
the sge_params structure.  Populate these new fields in
t4_init_sge_params() for PF devices and change t4_read_chip_settings() to
pull these values out of the params structure instead of reading
registers directly.  This will permit t4_read_chip_settings() to be reused
for VF devices which cannot read SGE registers directly.

While here, move the call to t4_init_sge_params() to
get_params__post_init().  The VF driver will populate the SGE parameters
structure via a different method before calling t4_read_chip_settings().

Reviewed by:	np
Sponsored by:	Chelsio Communications
Differential Revision:	https://reviews.freebsd.org/D7476
2016-08-15 17:40:05 +00:00
Bruce Evans
1388e8b13e [Oops, the previous commit was missing the update to syscons.h.]
Like scr_lock, the grab count needs to be per-physical-device to work.

This bug corrupted the grab count on both vtys if the ungrabbed vty is
different from the console, and failed to restore the keyboard state
on the ungrabbed vty, but not restoring it usually left the keyboard
mode part of the keyboard state uncorrupted at 1 (K_XLATE), while
after this fix the keyboard mode part is usually corrupted to 0 (K_RAW).

While here, rename the grab count from grabbed to grab_level.
2016-08-15 17:11:05 +00:00