]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/log
FreeBSD/stable/9.git
10 years agoMFC r250574, r250812, r253725;
pfg [Wed, 2 Oct 2013 18:51:48 +0000 (18:51 +0000)]
MFC r250574, r250812, r253725;

DTrace: option for time-ordered output

Merge changes from illumos:

3021 option for time-ordered output from dtrace(1M)
3022 DTrace: keys should not affect the sort order when sorting by value
3023 it should be possible to dereference dynamic variables
3024 D integer narrowing needs some work
3025 register leak in D code generation

This brings yet another feature implemented in upstream DTrace.
A complete description is available here:
http://dtrace.org/blogs/ahl/2012/07/28/my-new-dtrace-favorite/

This change bumps the DT_VERS_* number to 1.9.1 in
accordance to what is done in illumos.

Special thanks to Mark Johnston for fixes and testing.

Illumos Revisions: 13758:23432da34147

Reference:
https://www.illumos.org/issues/3021
https://www.illumos.org/issues/3022
https://www.illumos.org/issues/3023
https://www.illumos.org/issues/3024
https://www.illumos.org/issues/3025
https://www.illumos.org/issues/1694

Obtained from: Illumos

git-svn-id: svn://svn.freebsd.org/base/stable/9@256002 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC 236768,252209,253047:
jhb [Wed, 2 Oct 2013 18:45:37 +0000 (18:45 +0000)]
MFC 236768,252209,253047:
Several improvements to rmlock(9).  Many of these are based on patches
provided by Isilon.
- Add an rm_assert() supporting various lock assertions similar to other
  locking primitives.  Because rmlocks track readers the assertions are
  always fully accurate unlike rw_assert() and sx_assert().
- Flesh out the lock class methods for rmlocks to support sleeping via
  condvars and rm_sleep() (but only while holding write locks), rmlock
  details in 'show lock' in DDB, and the lc_owner method used by
  dtrace.
- Add an internal destroyed cookie so that API functions can assert
  that an rmlock is not destroyed.
- Make use of rm_assert() to add various assertions to the API (e.g.
  to assert locks are held when an unlock routine is called).
- Give RM_SLEEPABLE locks their own lock class and always use the
  rmlock's own lock_object with WITNESS.
- Various updates to the manpage.

git-svn-id: svn://svn.freebsd.org/base/stable/9@256001 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC revisions 255908, 255925, and 255925:
dteske [Wed, 2 Oct 2013 16:32:07 +0000 (16:32 +0000)]
MFC revisions 255908, 255925, and 255925:

SVN r255908:
Fix a bug in HTTP checking/fetching. Add Main Site to HTTP menu. Add new
example script browse_packages_http.sh and move existing example script
browse_packages.sh -> browse_packages_ftp.sh

SVN r255925:
Remove the is (Iceland) mirror per mail from the admins.

SVN r255925:
Remove ftp5.se.f.o, as per request to -hubs@

git-svn-id: svn://svn.freebsd.org/base/stable/9@255991 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255614,255639:
nwhitehorn [Wed, 2 Oct 2013 15:00:04 +0000 (15:00 +0000)]
MFC r255614,255639:
Fix bug in busdma: if segs is a preexisting buffer, we memcpy it
into the DMA map. The length of the buffer had not yet been
initialized, however, so this would copy gibberish unless it
happened to be right by chance. This bug mostly only affected
systems with IOMMUs.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255990 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255928:
philip [Wed, 2 Oct 2013 12:35:03 +0000 (12:35 +0000)]
MFC r255928:
 Use the correct EtherType for logging IPv6 packets.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255987 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255712:
gjb [Wed, 2 Oct 2013 04:18:00 +0000 (04:18 +0000)]
MFC r255712:
 Remove extra 'MAKE_FLAGS' line.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255984 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255768:
hselasky [Tue, 1 Oct 2013 08:38:47 +0000 (08:38 +0000)]
MFC r255768:
Stability fixes for Intel LynxPoint XHCI controllers. Disable XHCI port
routing if we get certain errors. Poll for command completion upon
command timeouts. The XHCI error events might not generate interrupts.

PR: usb/181159

git-svn-id: svn://svn.freebsd.org/base/stable/9@255965 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255648:
delphij [Tue, 1 Oct 2013 00:49:57 +0000 (00:49 +0000)]
MFC r255648:

Fix a typo when accounting for tx_broadcast statistics.

Submitted by: Paul A. Patience <paul-a patience polymtl ca>

git-svn-id: svn://svn.freebsd.org/base/stable/9@255959 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC: r255866, r255867
jmg [Mon, 30 Sep 2013 17:57:22 +0000 (17:57 +0000)]
MFC: r255866, r255867

  fix a bug where we access a bread buffer after we have brelse'd it...
  The kernel normally didn't unmap/context switch away before we accessed
  the buffer most of the time, but under heavy I/O pressure and lots of
  mount/unmounting this would cause a fault on nofault panic...

  NULL stale pointers (should be a no-op as they should no longer be
  used)...

git-svn-id: svn://svn.freebsd.org/base/stable/9@255952 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255804:
dim [Sun, 29 Sep 2013 20:35:38 +0000 (20:35 +0000)]
MFC r255804:

Pull in r191165 from upstream llvm trunk:

  ISelDAG: spot chain cycles involving MachineNodes

  Previously, the DAGISel function WalkChainUsers was spotting that it
  had entered already-selected territory by whether a node was a
  MachineNode (amongst other things). Since it's fairly common practice
  to insert MachineNodes during ISelLowering, this was not the correct
  check.

  Looking around, it seems that other nodes get their NodeId set to -1
  upon selection, so this makes sure the same thing happens to all
  MachineNodes and uses that characteristic to determine whether we
  should stop looking for a loop during selection.

  This should fix PR15840.

Specifically, this fixes the long-standing assertion failure when
compiling the multimedia/gstreamer port on i386.  Thanks to Tijl
Coosemans for his help in getting upstream to fix it.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255946 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255891:
delphij [Sun, 29 Sep 2013 07:42:25 +0000 (07:42 +0000)]
MFC r255891:

Import NetBSD readline.c,v 1.104: do not crash with add_history(NULL).

git-svn-id: svn://svn.freebsd.org/base/stable/9@255934 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255566:
kib [Sat, 28 Sep 2013 07:43:36 +0000 (07:43 +0000)]
MFC r255566:
If the last page of the file is partially full and whole valid
portion is invalidated, invalidate the whole page.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255924 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC 244015:
ken [Sat, 28 Sep 2013 05:56:37 +0000 (05:56 +0000)]
MFC 244015:
  ------------------------------------------------------------------------
  r244015 | ken | 2012-12-07 21:16:07 -0700 (Fri, 07 Dec 2012) | 17 lines

  Fix the CTL OOA queue dumping code so that it does not hold a mutex
  while doing a copyout.  That can cause a panic, because copyout
  can trigger VM faults, and we can't handle VM faults while holding
  a mutex.

  The solution here is to malloc a separate buffer to hold the OOA
  queue entries, so that we don't risk a VM fault while filling up
  the buffer and we don't have to drop the lock.  The other solution
  would be to wire the user's memory while filling their buffer with
  copyout, but that would have been a little more complex.

  Also fix a debugging parenthesis issue in ctl_abort_task() pointed
  out by Chuck Tuffli.

  Sponsored by:   Spectra Logic Corporation

git-svn-id: svn://svn.freebsd.org/base/stable/9@255922 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255844:
kib [Fri, 27 Sep 2013 06:56:58 +0000 (06:56 +0000)]
MFC r255844:
Ensure that the ERESTART return from the syscall reloads the registers,
to make the restarted syscall instruction pass the correct arguments.

PR: kern/182161

git-svn-id: svn://svn.freebsd.org/base/stable/9@255905 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC 249028:
ken [Thu, 26 Sep 2013 19:42:58 +0000 (19:42 +0000)]
MFC 249028:

The CTL block backend is broken without this.

  Fix sending virtual scatter/gather lists from the CTL CAM frontend
  peripheral.

  Sponsored by: Spectra Logic

git-svn-id: svn://svn.freebsd.org/base/stable/9@255901 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoUpdate for when we hope to have 9.2-RELEASE ready.
gjb [Thu, 26 Sep 2013 18:32:51 +0000 (18:32 +0000)]
Update for when we hope to have 9.2-RELEASE ready.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255900 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agorelease/9.2.0 has been created; call stable/9 'STABLE' again.
gjb [Thu, 26 Sep 2013 18:30:57 +0000 (18:30 +0000)]
release/9.2.0 has been created; call stable/9 'STABLE' again.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255899 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255273,255282:
nwhitehorn [Thu, 26 Sep 2013 18:18:51 +0000 (18:18 +0000)]
MFC r255273,255282:

Align stacks of kernel threads correctly at 16-byte boundaries rather than
making sure they are all misaligned at +8 bytes. This fixes clang builds
of powerpc64 kernels (aside from a required increase in KSTACK_PAGES which
will come later).

git-svn-id: svn://svn.freebsd.org/base/stable/9@255897 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC: r254005
marius [Thu, 26 Sep 2013 09:16:57 +0000 (09:16 +0000)]
MFC: r254005

- Fix a bug in the MSI allocation logic so an MSI is also employed if a
  controller supports only a single message. I haven't seen such an adapter
  out in the wild, though, so this change likely is a NOP.
  While at it, further simplify the MSI allocation logic; there's no need
  to check the number of available messages on our own as pci_alloc_msi(9)
  will just fail if it can't provide us with the single message we want.
- Nuke the unused softc of aacch(4).

git-svn-id: svn://svn.freebsd.org/base/stable/9@255876 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC 240424,244582:
jhb [Tue, 24 Sep 2013 20:38:55 +0000 (20:38 +0000)]
MFC 240424,244582:
Improve check coverage about idle threads.

Idle threads are not allowed to acquire any lock but spinlocks.
Deny any attempt to do so by panicing at the locking operation
when INVARIANTS is on. Then, remove the check on blocking on a
turnstile.
The check in sleepqueues is left because they are not allowed to use
tsleep() either which could happen still.

On entering KDB backends, the hijacked thread to run
interrupt context can still be idlethread. At that point, without the
panic condition, it can still happen that idlethread then will try to
acquire some locks to carry on some operations.

Skip the idlethread check on block/sleep lock operations when KDB is
active.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255862 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r250706: A library function shall not set errno to 0.
jh [Tue, 24 Sep 2013 17:09:28 +0000 (17:09 +0000)]
MFC r250706: A library function shall not set errno to 0.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255856 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254215:
trasz [Tue, 24 Sep 2013 12:50:04 +0000 (12:50 +0000)]
MFC r254215:

In su(1), fix option ordering and clarify that the login class specified
must be defined in login.conf.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255847 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254135:
trasz [Tue, 24 Sep 2013 12:48:02 +0000 (12:48 +0000)]
MFC r254135:

Don't dereference null pointer should acl_alloc() be passed M_NOWAIT
and allocation failed.  Nothing in the tree passed M_NOWAIT.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255846 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoAdd missing mergeinfo that should have gone in revision 255830, which was a
ken [Mon, 23 Sep 2013 22:04:20 +0000 (22:04 +0000)]
Add missing mergeinfo that should have gone in revision 255830, which was a
MFC of 255501.

This was caused by committing from sys/dev/mps instead of sys.

Pointy hat to: ken

git-svn-id: svn://svn.freebsd.org/base/stable/9@255831 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255501
ken [Mon, 23 Sep 2013 21:52:07 +0000 (21:52 +0000)]
MFC r255501

This is slightly modified from the FreeBSD/head version, to include
version checks for the scanning changes for not only FreeBSD/head
(1000039 and higher) but also stable/9 (902502 and higher).

  ------------------------------------------------------------------------
  r255501 | ken | 2013-09-12 16:06:12 -0600 (Thu, 12 Sep 2013) | 18 lines

  Fix an issue that caused Integrated RAID volumes on LSI mps(4) controllers
  to not get scanned on boot.

  The problem originated in change 253549.  With the change to the mps(4)
  driver to scan only targets that it knows it has (as opposed to scanning
  the entire bus), scanning RAID volumes on boot was omitted.

  So, for versions of FreeBSD that have the scanning changes
  (__FreeBSD_version 1000039 and higher), scan RAID volumes that are added
  whether or not we're booting.

  PR:             kern/181784
  Reported by:    Xiguang Wang <kurapica@gmail.com>
  Tested by:      Dennis Glatting <dg@pki2.com>
  Sponsored by:   Spectra Logic

PR: kern/181784

git-svn-id: svn://svn.freebsd.org/base/stable/9@255830 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255607:
kib [Mon, 23 Sep 2013 07:53:58 +0000 (07:53 +0000)]
MFC r255607:
In pmap_copy(), when the copied region is mapped with superpage but does
not cover entire superpage, avoid copying.

MFC r255620:
Merge the change r255607 from amd64 to i386.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255811 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255174:
mav [Sun, 22 Sep 2013 20:22:08 +0000 (20:22 +0000)]
MFC r255174:
Add missing opt_* header dependencies.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255799 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC: r255333
rmacklem [Sat, 21 Sep 2013 22:13:17 +0000 (22:13 +0000)]
MFC: r255333
Intermittent crashes in the NLM (rpc.lockd) code during system
shutdown was reporetd via email. The crashes occurred because the
client side NLM would attempt to use its socket after it had been
destroyed. Looking at the code, it would soclose() once the reference
count on the socket handling structure went to 0. Unfortunately,
nlm_host_get_rpc() will simply allocate a new socket handling structure
when none exists and use the now soclose()d socket. Since there doesn't
seem to be a safe way to determine when the socket is no longer needed,
this patch modifies the code so that it never soclose()es the socket.
Since there is only one socket ever created, this does not introduce a
leak when the rpc.lockd is stopped/restarted. The patch also disables
unloading of the nfslockd module, since it is not safe to do so (and
has never been safe to do so, from what I can see).

git-svn-id: svn://svn.freebsd.org/base/stable/9@255773 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC: r255284
rmacklem [Sat, 21 Sep 2013 22:10:02 +0000 (22:10 +0000)]
MFC: r255284
It was reported via email that the cu_sent field used by the
krpc client side UDP was observed as way out of range and
caused the rpc.lockd daemon to hang trying to do an RPC.
Inspection of the code found two places where the RPC request
is re-queued, but the value of cu_sent was not incremented.
Since cu_sent is always decremented when the RPC request is
dequeued, I think this could have caused cu_sent to go out of
range. This patch adds lines to increment cu_sent for these
two cases.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255770 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC: r255216
rmacklem [Sat, 21 Sep 2013 22:07:24 +0000 (22:07 +0000)]
MFC: r255216
Crashes have been observed for NFSv4.1 mounts when the system
is being shut down which were caused by the nfscbd_pool being
destroyed before the backchannel is disabled. This patch is
believed to fix the problem, by simply avoiding ever destroying
the nfscbd_pool. Since the NFS client module cannot be unloaded,
this should not cause a memory leak.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255769 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r252894:
markj [Sat, 21 Sep 2013 16:46:34 +0000 (16:46 +0000)]
MFC r252894:
Add SDT_PROBE_DEFINE0 for consistency with SDT_PROBE0.

MFC r253022:
Also define SDT_PROBE_DEFINE0 for the !KDTRACE_HOOKS case.

MFC r254266:
Add event handlers for module load and unload events. The load handlers are
called after the module has been loaded, and the unload handlers are called
before the module is unloaded. Moreover, the module unload handlers may
return an error to prevent the unload from proceeding.

MFC r254267:
Remove some unused fields from struct linker_file. They were added in
r172862 for use by the DTrace SDT framework but don't seem to have ever
been used.

MFC r254268:
FreeBSD's DTrace implementation has a few problems with respect to handling
probes declared in a kernel module when that module is unloaded. In
particular,

* Unloading a module with active SDT probes will cause a panic. [1]
* A module's (FBT/SDT) probes aren't destroyed when the module is unloaded;
  trying to use them after the fact will generally cause a panic.

This change fixes both problems by porting the DTrace module load/unload
handlers from illumos and registering them with the corresponding
EVENTHANDLER(9) handlers. This allows the DTrace framework to destroy all
probes defined in a module when that module is unloaded, and to prevent a
module unload from proceeding if some of its probes are active. The latter
problem has already been fixed for FBT probes by checking lf->nenabled in
kern_kldunload(), but moving the check into the DTrace framework generalizes
it to all kernel providers and also fixes a race in the current
implementation (since a probe may be activated between the check and the
call to linker_file_unload()).

Additionally, the SDT implementation has been reworked to define SDT
providers/probes/argtypes in linker sets rather than using SYSINIT/SYSUNINIT
to create and destroy SDT probes when a module is loaded or unloaded. This
simplifies things quite a bit since it means that pretty much all of the SDT
code can live in sdt.ko, and since it becomes easier to integrate SDT with
the DTrace framework. Furthermore, this allows FreeBSD to be quite flexible
in that SDT providers spanning multiple modules can be created on the fly
when a module is loaded; at the moment it looks like illumos' SDT
implementation requires all SDT probes to be statically defined in a single
kernel table.

MFC r254309:
Use kld_{load,unload} instead of mod_{load,unload} for the linker file load
and unload event handlers added in r254266.

MFC r254350:
Specify SDT probe argument types in the probe definition itself rather than
using SDT_PROBE_ARGTYPE(). This will make it easy to extend the SDT(9) API
to allow probes with dynamically-translated types.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255763 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r250953:
markj [Fri, 20 Sep 2013 23:50:14 +0000 (23:50 +0000)]
MFC r250953:
The fasttrap provider cleans up probes asynchronously when a process with
USDT probes exits. This was previously done with a callout; however, it is
possible to sleep while holding the DTrace mutexes, so a panic will occur
on INVARIANTS kernels if the callout handler can't immediately acquire one
of these mutexes. This panic will be frequently triggered on systems where
a USDT-enabled program (perl, for instance) is often run.

This revision changes the fasttrap cleanup mechanism so that a dedicated
thread is used instead of a callout. The old behaviour is otherwise
preserved.

MFC r252493:
Be sure to destory the fasttrap cleanup mutex when unloading the fasttrap
module. This should be MFCed with r250953.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255749 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254467:
markj [Fri, 20 Sep 2013 22:00:07 +0000 (22:00 +0000)]
MFC r254467:
Remove a couple of unused macros.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255743 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254742:
markj [Fri, 20 Sep 2013 21:51:38 +0000 (21:51 +0000)]
MFC r254742:
Hold mfi_io_lock across calls to xpt_rescan() and xpt_alloc_ccb_nowait().
xpt_rescan() expects the SIM lock to be held, and we trip a mtx_assert if
the driver initiates multiple rescans in quick succession.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255740 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255527:
kib [Fri, 20 Sep 2013 07:45:37 +0000 (07:45 +0000)]
MFC r255527:
Use TAILQ instead of STAILQ for kqeueue filedescriptors to ensure constant
time removal on kqueue close.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255729 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255510:
kib [Fri, 20 Sep 2013 07:35:08 +0000 (07:35 +0000)]
MFC r255510:
When opening or closing fifo, ensure that the vnode is locked exclusively.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255728 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255509:
kib [Fri, 20 Sep 2013 07:31:32 +0000 (07:31 +0000)]
MFC r255509:
Reduce the scope of the proctree_lock.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255727 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255340:
dteske [Thu, 19 Sep 2013 22:06:28 +0000 (22:06 +0000)]
MFC r255340:

Long URLs don't always appear even with autosizing and other tricks. So,
add some whitespace to put the URL on a line by itself, maximizing view.

MFC r255341:

Remove unnecessary mediaClose (FTP operations are done with either ftp(1)
or fetch(1), neither of which are stateful, compared to how sysinstall(8)
did FTP operations, maintaining an open session until mediaClose).

git-svn-id: svn://svn.freebsd.org/base/stable/9@255719 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMerge from r245741 from head:
glebius [Thu, 19 Sep 2013 19:43:29 +0000 (19:43 +0000)]
Merge from r245741 from head:

  If lagg(4) can't forward a packet due to underlying port problems,
  return much more meaningful ENETDOWN to the stack, instead of EBUSY.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255710 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255488:
hselasky [Thu, 19 Sep 2013 05:40:49 +0000 (05:40 +0000)]
MFC r255488:
Don't issue USB resume signalling in USB device mode, if the USB power
mode is ON and suspend is detected. This confuses iPads running in USB
host mode at least.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255693 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r248114 (by melifaro):
pluknet [Wed, 18 Sep 2013 11:07:32 +0000 (11:07 +0000)]
MFC r248114 (by melifaro):

Add forgotten .El

git-svn-id: svn://svn.freebsd.org/base/stable/9@255666 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255472:
hselasky [Wed, 18 Sep 2013 06:38:40 +0000 (06:38 +0000)]
MFC r255472:
Clear correct data structure.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255663 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255235:
ae [Tue, 17 Sep 2013 18:47:31 +0000 (18:47 +0000)]
MFC r255235:
  Remove unused code and sort variables declarations.

PR: kern/181822

git-svn-id: svn://svn.freebsd.org/base/stable/9@255649 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254572:
hselasky [Tue, 17 Sep 2013 12:53:09 +0000 (12:53 +0000)]
MFC r254572:
Force keyboards which don't have the required
HID fields to use the USB BOOT protocol for now.

PR: usb/181425

git-svn-id: svn://svn.freebsd.org/base/stable/9@255631 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r248246:
hselasky [Tue, 17 Sep 2013 12:50:57 +0000 (12:50 +0000)]
MFC r248246:

- Make quirk for reading device descriptor from broken USB devices.
Else they won't enumerate at all:
hw.usb.full_ddesc=1
- Reduce the USB descriptor read timeout from 1000ms to
500ms. Typical value for LOW speed devices is 50-100ms.
- Enumerate USB device a maximum of 3 times when a port
connection change event is detected, before giving up.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255630 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255483:
delphij [Mon, 16 Sep 2013 16:43:57 +0000 (16:43 +0000)]
MFC r255483:

Do not emit size for non-regular files.  There is nothing that
mtree(1) can do in this situation and would cause confusion.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255616 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255356:
hselasky [Mon, 16 Sep 2013 10:04:19 +0000 (10:04 +0000)]
MFC r255356:

Revert parts of r245132 and r245175. We don't need to write to the
IMAN register to clear the pending interrupt status bits. This patch
tries to solve problems seen on the MacBook Air, as reported by
Johannes Lundberg <johannes@brilliantservice.co.jp>

git-svn-id: svn://svn.freebsd.org/base/stable/9@255609 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255505:
gjb [Mon, 16 Sep 2013 02:01:36 +0000 (02:01 +0000)]
MFC r255505:
  Do not install freebsd-update.conf.5 manual if WITHOUT_FREEBSD_UPDATE
  is set.

Sponsored by: The FreeBSD Foundation

git-svn-id: svn://svn.freebsd.org/base/stable/9@255606 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoTemporary revert r255541 since there is no CPU_FFS in stable/9 yet. Sorry.
mav [Sat, 14 Sep 2013 13:12:13 +0000 (13:12 +0000)]
Temporary revert r255541 since there is no CPU_FFS in stable/9 yet.  Sorry.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255569 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255144:
mav [Sat, 14 Sep 2013 10:14:09 +0000 (10:14 +0000)]
MFC r255144:
Make ELI destruction (including orphanization) less aggressive, making it
always wait for provider close.  Old algorithm was reported to cause NULL
dereference panic on attempt to close provider after softc destruction.
If not global workaroung in GEOM, that could even cause destruction with
requests still in flight.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255568 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254936:
mav [Sat, 14 Sep 2013 10:12:28 +0000 (10:12 +0000)]
MFC r254936:
Add unmapped BIO support to GEOM ZERO if kern.geom.zero.clear is cleared.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255567 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254275:
mav [Sat, 14 Sep 2013 10:11:09 +0000 (10:11 +0000)]
MFC r254275:
Return error when opening read-only volumes (like RAID4/5/...) for writing.
Previously opens succeeded, but actual write operations returned errors.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255565 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254269, r254271:
mav [Sat, 14 Sep 2013 10:10:01 +0000 (10:10 +0000)]
MFC r254269, r254271:
Fix reasonable but safe Clang warnings.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255564 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253706:
mav [Sat, 14 Sep 2013 10:08:09 +0000 (10:08 +0000)]
MFC r253706:
Introduce 3 seconds timeout on `graid stop` command (mostly with -f flag).
Since completion waiting goes in g_event thread, it may cause GEOM deadlock
if consumer on top (for example, ZFS) uses g_event thread for closing.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255563 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255120:
mav [Sat, 14 Sep 2013 10:00:20 +0000 (10:00 +0000)]
MFC r255120:
Bring legacy CAM target implementation back into API/KPI-coherent and even
functional state.  While CTL is much more superior target from all points,
there is no reason why this code should not work.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255562 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255118:
mav [Sat, 14 Sep 2013 09:52:30 +0000 (09:52 +0000)]
MFC r255118:
Fix targbh crash on XPT_IMMED_NOTIFY error during attach.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255559 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255117:
mav [Sat, 14 Sep 2013 09:50:44 +0000 (09:50 +0000)]
MFC r255117:
Fix the build with CTLFEDEBUG, broken by unmapped I/O support changes.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255557 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254766:
mav [Sat, 14 Sep 2013 09:49:18 +0000 (09:49 +0000)]
MFC r254766:
Add new attribute lunname to report only textual LUN-specific device IDs.
While lunid attribute prefers to report numeric ones, having both may be
useful in some situations.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255556 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253752:
mav [Sat, 14 Sep 2013 09:42:01 +0000 (09:42 +0000)]
MFC r253752:
Fix returning incorrect bio_resid value with failed BIO_DELETE requests.
Neither residual length reported for ATA/SCSI command nor one from another
BIO_DELETE request are in any way related to the value to be returned.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255555 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r250557:
mav [Sat, 14 Sep 2013 09:40:24 +0000 (09:40 +0000)]
MFC r250557:
Suppress error printing for "PREVENT ALLOW MEDIUM REMOVAL" on da open.
Change at r250208 exposed more errors here, hidden before.  The same flag
is used in cd driver.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255554 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r250208:
mav [Sat, 14 Sep 2013 09:37:21 +0000 (09:37 +0000)]
MFC r250208:
Tune support for removable media in da driver:
 - remove DA_FLAG_SAW_MEDIA flag, almost opposite to DA_FLAG_PACK_INVALID,
using the last instead.
 - allow opening device with no media present, reporting zero media size
and non-zero sector size, as geom/notes suggests.  That allow to read
device attributes and potentially do other things, not related to media.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255553 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r249981:
mav [Sat, 14 Sep 2013 09:34:25 +0000 (09:34 +0000)]
MFC r249981:
Remove ADA_FLAG_PACK_INVALID flag. Since ATA disks have no concept of media
change it only duplicates CAM_PERIPH_INVALID flag, so we can use last one.

Slightly cleanup DA_FLAG_PACK_INVALID use.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255552 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r249194 (by trasz):
mav [Sat, 14 Sep 2013 09:24:40 +0000 (09:24 +0000)]
MFC r249194 (by trasz):
Make SYNCHRONIZE CACHE work with LUNs backed by device files (as opposed
to regular files, which already worked fine).  With this change, it's no
longer neccessary to use "ctladm realsync off" workaround.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255551 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r249008 (by trasz):
mav [Sat, 14 Sep 2013 09:19:27 +0000 (09:19 +0000)]
MFC r249008 (by trasz):
Fix panic in the error path caused by recursive acquisition of XPT topology
lock.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255550 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254052:
mav [Sat, 14 Sep 2013 09:11:31 +0000 (09:11 +0000)]
MFC r254052:
Improve r253721 by reporting detected lack of BIO_FLUSH support to GEOM.
That prevents more of such requests from coming and errors from logging.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255549 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253803:
mav [Sat, 14 Sep 2013 09:10:01 +0000 (09:10 +0000)]
MFC r253803:
Add NO_RC16 quirk to make da driver avoid using READ CAPACITY(16) command
if possible.  Use it for Kingston JetFlash USB sticks, that are known to
return garbage in response to that command.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255548 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253724:
mav [Sat, 14 Sep 2013 09:06:32 +0000 (09:06 +0000)]
MFC r253724:
Synchronize device cache on close only if there were some write operations.
While these operations are not really needed otherwise, at least for SCSI
they may cause extra errors if some other initiator holds write exclusive
reservation on the LUN (SYNCHRONIZE CACHE handled as "write" operation).

git-svn-id: svn://svn.freebsd.org/base/stable/9@255547 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253721, r253722:
mav [Sat, 14 Sep 2013 09:05:03 +0000 (09:05 +0000)]
MFC r253721, r253722:
Detect unsupported PREVENT ALLOW MEDIUM REMOVAL and SYNCHRONIZE CACHE(10)
to not spam devices with useless commands and logs with errors.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255546 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253323:
mav [Sat, 14 Sep 2013 09:03:21 +0000 (09:03 +0000)]
MFC r253323:
When printing opcode description, map T_NODEVICE to Direct Access Device to
handle REPORT LUNS, etc.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255545 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253322, r253370:
mav [Sat, 14 Sep 2013 09:01:42 +0000 (09:01 +0000)]
MFC r253322, r253370:
Improve handling of 0x3F/0x0E "Reported LUNs data has changed" and 0x25/0x00
"Logical unit not supported" errors.  First initiates specific target rescan,
second -- destroys specific LUN.  That allows to automatically detect changes
in list of device LUNs.  This mechanism doesn't work when target is completely
idle, but probably that is all what can be done without active polling.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255544 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253228, r253307 (by scottl):
mav [Sat, 14 Sep 2013 08:58:28 +0000 (08:58 +0000)]
MFC  r253228, r253307 (by scottl):
Refactor the various delete methods out of dastart().  Cleans up a bunch
of style and adds more modularity and clarity.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255543 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r252382 (by scottl), r252684 (by jkim):
mav [Sat, 14 Sep 2013 08:55:48 +0000 (08:55 +0000)]
MFC r252382 (by scottl), r252684 (by jkim):
Introduce accessors for the ccb status word.  Convert one (of many more)
modules to use it, will convert the others once the appropriate shed
color is selected by consensus.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255542 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255363:
mav [Sat, 14 Sep 2013 08:45:15 +0000 (08:45 +0000)]
MFC r255363:
Micro-optimize cpu_search(), allowing compiler to use more efficient inline
ffsl() implementation, when it is available, instead of homegrown iteration.

On dual-E5645 amd64 system (2x6x2 cores) under heavy I/O load that reduces
time spent inside cpu_search() from 19% to 13%, while IOPS increased by 5%.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255541 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253993:
mav [Sat, 14 Sep 2013 08:37:49 +0000 (08:37 +0000)]
MFC r253993:
Block reporting of ZFS features for suspended pools.

Before executing any subcommand, zpool tool fetches pools configuration from
the kernel.  Before features support was added, kernel was regenerating that
configuration based on data always present in memory.  Unfortunately, pool
features list and activity counters are not such. They are stored in ZAP,
that normally resides in ARC, but under heavy memory pressure may be swapped
out.  If pool is suspended at this point, there is no way to recover it back
since any zpool command will stuck.

This change has one predictable flaw: `zpool upgrade` always wish to upgrade
suspended pools, but fortunately it can't do it due to the suspension.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255540 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253991:
mav [Sat, 14 Sep 2013 08:35:20 +0000 (08:35 +0000)]
MFC r253991:
Make `zpool clear` to reopen also reconnected cache and spare devices.
Since `zpool status` reports about such kinds of errors, it is strange
that they are not cleared by `zpool clear`.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255539 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253990:
mav [Sat, 14 Sep 2013 08:33:58 +0000 (08:33 +0000)]
MFC r253990:
Make ZFS to use separate thread to handle SPA_ASYNC_REMOVE async events.
Existing async thread is running only on successfull spa_sync() completion,
that is impossible in case of pool loosing required (last) disk(s).  That
indefinite delay of SPA_ASYNC_REMOVE processing made ZFS to not close the
lost disks, preventing GEOM/CAM from destroying devices and reusing names
on later disk reattach.

In earlier version of the patch I've tried to just run existing thread
immediately, unrelated to spa_sync() completion, but that exposed number
of situations where it could stuck due to locks held by stuck spa_sync(),
that are required for other kinds of async events.

Experiments with OpenIndiana snapshot confirmed that they also have this
issue with lost disks reattach.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255538 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253806:
mav [Sat, 14 Sep 2013 08:32:17 +0000 (08:32 +0000)]
MFC r253806:
Allow three IOCTLs to be used on suspended pool, restoring state that
existed before IOCTL code refactoring merged change 4445fffb from illumos
at r248571.

This change allows `zpool clear` to be used again to recover suspended pool.
It seems the only was supposed by the code to restore pool operation after
reconnecting lost disks that were required for data completeness.  There
are still cases where `zpool clear` command can just safely stuck due to
deadlocks inside ZFS kernel part, but probably that is better then having
no chances to recover at all.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255537 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253643:
mav [Sat, 14 Sep 2013 08:29:11 +0000 (08:29 +0000)]
MFC r253643:
Following r222950, revert unintentional change cls -> class in argument name
in r245264.  Aside from non-uniformity, that again confused C++ compilers.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255536 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255534:
mav [Sat, 14 Sep 2013 08:24:34 +0000 (08:24 +0000)]
MFC r255534:
Add more references.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255535 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255119:
mav [Sat, 14 Sep 2013 08:22:57 +0000 (08:22 +0000)]
MFC r255119:
Fix SES_ENABLE_PASSTHROUGH kernel option, unexpectedly broken during driver
overhaul.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255534 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC: r254337
rmacklem [Fri, 13 Sep 2013 23:10:53 +0000 (23:10 +0000)]
MFC: r254337
Fix several performance related issues in the new NFS server's
DRC for NFS over TCP.
- Increase the size of the hash tables.
- Create a separate mutex for each hash list of the TCP hash table.
- Single thread the code that deletes stale cache entries.
- Add a tunable called vfs.nfsd.tcphighwater, which can be increased
  to allow the cache to grow larger, avoiding the overhead of frequent
  scans to delete stale cache entries.
  (The default value will result in frequent scans to delete stale cache
   entries, analagous to what the pre-patched code does.)
- Add a tunable called vfs.nfsd.cachetcp that can be used to disable
  DRC caching for NFS over TCP, since the old NFS server didn't DRC cache TCP.
It also adjusts the size of nfsrc_floodlevel dynamically, so that it is
always greater than vfs.nfsd.tcphighwater.

For UDP the algorithm remains the same as the pre-patched code, but the
tunable vfs.nfsd.udphighwater can be used to allow the cache to grow
larger and reduce the overhead caused by frequent scans for stale entries.
UDP also uses a larger hash table size than the pre-patched code.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255532 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255261: watch: Do not mess up the tty modes on early error.
jilles [Fri, 13 Sep 2013 20:56:42 +0000 (20:56 +0000)]
MFC r255261: watch: Do not mess up the tty modes on early error.

Record the initial state earlier, so it is always safe to restore it.

One way this happens is if watch(8) is started by a user that does not have
access to /dev/snp. The result is "staircase effect" during later commands.

PR: bin/153052

git-svn-id: svn://svn.freebsd.org/base/stable/9@255529 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254714: zfs: do not reject any operations on a pool just because
avg [Fri, 13 Sep 2013 14:15:38 +0000 (14:15 +0000)]
MFC r254714: zfs: do not reject any operations on a pool just because
it's a boot pool

git-svn-id: svn://svn.freebsd.org/base/stable/9@255519 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254445,254711: zfs: inline and remove zfs_vnode_lock
avg [Fri, 13 Sep 2013 14:03:39 +0000 (14:03 +0000)]
MFC r254445,254711: zfs: inline and remove zfs_vnode_lock

git-svn-id: svn://svn.freebsd.org/base/stable/9@255517 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254713: fbt: drop a local write-only variable
avg [Fri, 13 Sep 2013 13:53:21 +0000 (13:53 +0000)]
MFC r254713: fbt: drop a local write-only variable

git-svn-id: svn://svn.freebsd.org/base/stable/9@255515 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255048:
bdrewery [Fri, 13 Sep 2013 11:57:52 +0000 (11:57 +0000)]
MFC r255048:

  - Fix LOCAL_MTREE so it properly handles multiple files and quotes
    its value into submakes

PR: conf/179466
Submitted by: Garrett Cooper <yaneurabeya@gmail.com>
Sponsored by: EMC / Isilon Storage Division

git-svn-id: svn://svn.freebsd.org/base/stable/9@255514 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255439:
kib [Fri, 13 Sep 2013 06:07:25 +0000 (06:07 +0000)]
MFC r255439:
Call free() on the pointer returned from malloc().

git-svn-id: svn://svn.freebsd.org/base/stable/9@255507 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255459:
cperciva [Fri, 13 Sep 2013 00:51:37 +0000 (00:51 +0000)]
MFC r255459:
  Remove documentation describing functionality which geom(4) does not,
  in fact, provide.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255502 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC of 254995:
mckusick [Thu, 12 Sep 2013 19:36:04 +0000 (19:36 +0000)]
MFC of 254995:

A performance problem was reported in PR kern/181226:

    I have 25TB Dell PERC 6 RAID5 array. When it becomes almost
    full (10-20GB free), processes which write data to it start
    eating 100% CPU and write speed drops below 1MB/sec (normally
    to gives 400MB/sec). The revision at which it first became
    apparent was http://svnweb.freebsd.org/changeset/base/249782.

The offending change reserved an area in each cylinder group to
store metadata. The new algorithm attempts to save this area for
metadata and allows its use for non-metadata only after all the
data areas have been exhausted. The size of the reserved area
defaults to half of minfree, so the filesystem reports full before
the data area can completely fill. However, in this report, the
filesystem has had minfree reduced to 1% thus forcing the metadata
area to be used for data. As the filesystem approached full, it
had only metadata areas left to allocate. The result was that
every block allocation had to scan summary data for 30,000 cylinder
groups before falling back to searching up to 30,000 metadata areas.

The fix is to give up on saving the metadata areas once the free
space reserve drops below 2%. The effect of this change is to use
the old algorithm of just accepting the first available block that
we find. Since most filesystems use the default 5% minfree, this
will have no effect on their operation. For those that want to push
to the limit, they will get their crappy block placements quickly.

Submitted by:  Dmitry Sivachenko
Fix Tested by: Dmitry Sivachenko
PR:            kern/181226

MFC of 254996:

In looking at block layouts as part of fixing filesystem block
allocations under low free-space conditions (-r254995), determine
that old block-preference search order used before -r249782 worked
a bit better. This change reverts to that block-preference search order.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255494 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255412:
delphij [Thu, 12 Sep 2013 00:46:32 +0000 (00:46 +0000)]
MFC r255412:

In r243868, the error message buffer errmsg have been changed from
an on-stack array to a pointer and therefore sizeof(errmsg) would
become 4 or 8 bytes depending on the architecture.

Fix this by using ERRMSGL in place of sizeof().

Submitted by: J David <j.david.lists@gmail.com>

git-svn-id: svn://svn.freebsd.org/base/stable/9@255485 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254330 -- allow users to run SYS_PD mode JBOD with a non-default MAXPHYS
sbruno [Wed, 11 Sep 2013 19:20:53 +0000 (19:20 +0000)]
MFC r254330 -- allow users to run SYS_PD mode JBOD with a non-default MAXPHYS

git-svn-id: svn://svn.freebsd.org/base/stable/9@255479 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255428:
delphij [Wed, 11 Sep 2013 17:42:35 +0000 (17:42 +0000)]
MFC r255428:

Pass -n (do not emit comments) when saving mtree information for future
mergemaster(8) runs.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255476 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoFix the length calculation for the final block of a sendfile(2)
des [Tue, 10 Sep 2013 10:07:21 +0000 (10:07 +0000)]
Fix the length calculation for the final block of a sendfile(2)
transmission which could be tricked into rounding up to the nearest
page size, leaking up to a page of kernel memory.  [13:11]

In IPv6 and NetATM, stop SIOCSIFADDR, SIOCSIFBRDADDR, SIOCSIFDSTADDR
and SIOCSIFNETMASK at the socket layer rather than pass them on to the
link layer without validation or credential checks.  [SA-13:12]

Prevent cross-mount hardlinks between different nullfs mounts of the
same underlying filesystem.  [SA-13:13]

Security: CVE-2013-5666
Security: FreeBSD-SA-13:11.sendfile
Security: CVE-2013-5691
Security: FreeBSD-SA-13:12.ifioctl
Security: CVE-2013-5710
Security: FreeBSD-SA-13:13.nullfs
Approved by: so

git-svn-id: svn://svn.freebsd.org/base/stable/9@255443 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255320:
delphij [Tue, 10 Sep 2013 00:40:21 +0000 (00:40 +0000)]
MFC r255320:

Return BUS_PROBE_DEFAULT instead of BUS_PROBE_SPECIFIC.

This change is a 9.2-RELEASE candidate.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255435 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r253980 - new pciids for ciss(4) support
sbruno [Mon, 9 Sep 2013 21:25:34 +0000 (21:25 +0000)]
MFC r253980 - new pciids for ciss(4) support

git-svn-id: svn://svn.freebsd.org/base/stable/9@255432 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254906 -- add SYSPD (real jbod) support to mfiutil
sbruno [Mon, 9 Sep 2013 21:00:03 +0000 (21:00 +0000)]
MFC r254906 -- add SYSPD (real jbod) support to mfiutil

Add support to reconfigure a drive as SYSPD (real JBOD in LSI
terminology).

Adds command "mfiutil syspd <drive#>" to change a drive to SYSPD.  Drive
will then be scanned/reported immediately as /dev/mfisyspdX by the host.

"mfiutil good <drive#>" clears SYSPD mode, remove /dev/mfisyspdX and
sets disk into UNCONFIGURED mode.

Tested on Dell H310 SAS/SATA RAID controller.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255429 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r254776:
trociny [Sun, 8 Sep 2013 17:47:14 +0000 (17:47 +0000)]
MFC r254776:

Make ipfw nat init/unint work correctly for VIMAGE:

* Do per vnet instance cleanup (previously it was only for vnet0 on
  module unload, and led to libalias leaks and possible panics due to
  stale pointer dereferences).

* Instead of protecting ipfw hooks registering/deregistering by only
  vnet0 lock (which does not prevent pointers access from another
  vnets), introduce per vnet ipfw_nat_loaded variable. The variable is
  set after hooks are registered and unset before they are deregistered.

* Devirtualize ifaddr_event_tag as we run only one event handler for
  all vnets.

* It is supposed that ifaddr_change event handler is called in the
  interface vnet context, so add an assertion.

Reviewed by: zec

git-svn-id: svn://svn.freebsd.org/base/stable/9@255395 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFH (r255243): create /var/authpf with correct ownership and permissions.
des [Sun, 8 Sep 2013 17:28:11 +0000 (17:28 +0000)]
MFH (r255243): create /var/authpf with correct ownership and permissions.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255394 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFH (r254684, r254955): fix segfault on reload.
des [Sun, 8 Sep 2013 11:35:56 +0000 (11:35 +0000)]
MFH (r254684, r254955): fix segfault on reload.
MFH (r255156): silence an error message on non-IPv6 interfaces.

git-svn-id: svn://svn.freebsd.org/base/stable/9@255388 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

10 years agoMFC r255090 and r255128:
hselasky [Sat, 7 Sep 2013 06:38:34 +0000 (06:38 +0000)]
MFC r255090 and r255128:

PR: kern/181728

git-svn-id: svn://svn.freebsd.org/base/stable/9@255345 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f