]> CyberLeo.Net >> Repos - FreeBSD/stable/9.git/log
FreeBSD/stable/9.git
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

10 years agoMFC r245428:
dim [Fri, 6 Sep 2013 15:17:25 +0000 (15:17 +0000)]
MFC r245428:

Add CLOCK_PROCESS_CPUTIME_ID to <time.h>, to synchronize the CLOCK_*
values with those in <sys/time.h>.  Otherwise, if a program includes
<time.h> before <sys/time.h>, the CLOCK_PROCESS_CPUTIME_ID macro never
gets defined.

Reviewed by: davidxu

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

10 years agoPartial MFC of r248534: Implement SOCK_CLOEXEC and SOCK_NONBLOCK in kernel.
jilles [Fri, 6 Sep 2013 12:45:08 +0000 (12:45 +0000)]
Partial MFC of r248534: Implement SOCK_CLOEXEC and SOCK_NONBLOCK in kernel.

SOCK_CLOEXEC and SOCK_NONBLOCK can be OR'ed in socket() and socketpair()'s
type parameter.

The numerical values for SOCK_CLOEXEC and SOCK_NONBLOCK are as in NetBSD.

The SOCK_* flags are not passed to MAC because this may cause incorrect
failures and can be done later via fcntl() anyway. On the other hand, audit
is expected to cope with the new flags.

This commit does not add the constants to <sys/socket.h> as in r248534
because this would lead to various newly compiled software not working on
old kernels. It only serves to help 10.x binaries and prepare for a possible
full MFC (if third-party software starts to insist on SOCK_CLOEXEC and
SOCK_NONBLOCK).

MSG_CMSG_CLOEXEC from r248534 is not merged here because it changes a
KPI/KBI.

No mergeinfo because the rest of r248534 is missing.

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

10 years agoMerge r254809 and r254937 from head:
joerg [Thu, 5 Sep 2013 19:25:36 +0000 (19:25 +0000)]
Merge r254809 and r254937 from head:

. Fix the "2step" feature (i.e. 360 KiB floppies in 1200 MiB drives)
. Fix the FDOPT_NOERROR option

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

10 years agoMFC r254326:
pfg [Thu, 5 Sep 2013 15:50:34 +0000 (15:50 +0000)]
MFC r254326:

Add support for the GCC binary integer constants extension.

This is required to build the i965 backend with newer versions of mesa.

Original patch from Joerg Wunsch in GCC Bug 23479, under the GPLv2;
also taken from there in OpenBSD.

Obtained from: gcc 4.3 (rev. 125346; GPLv2)

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

10 years agoMFC r255056
erwin [Thu, 5 Sep 2013 06:58:49 +0000 (06:58 +0000)]
MFC r255056
  Reduce WARNS to 0 for dig, host, and nslookup to make them
  compile with the optional WITH_BIND_SIGCHASE.

  Submitted by: Andre Albsmeier <Andre.Albsmeier@siemens.com>
  Approved by:  delphij (mentor, implicit)
  Sponsored by: DK Hostmaster A/S

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

10 years agoMFC r254018:
markj [Tue, 3 Sep 2013 23:17:18 +0000 (23:17 +0000)]
MFC r254018:
Pass variables prefixed with both LD_ and LD_32_ to the run-time linker.
This prevents unintentional execution of programs when running ldd(1) on
32-bit Linux binaries.

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

10 years agoAdd read-only support for extents in ext2fs.
pfg [Tue, 3 Sep 2013 18:46:11 +0000 (18:46 +0000)]
Add read-only support for extents in ext2fs.

Basic support for extents was implemented by Zheng Liu as part
of his Google Summer of Code in 2010. This support is read-only
at this time.

In addition to extents we also support the huge_file extension
for read-only purposes. This works nicely with the additional
support for birthtime/nanosec timestamps and dir_index that
have been added lately.

The implementation may not work for all ext4 filesystems as
it doesn't support some features that are being enabled by
default on recent linux like flex_bg. Nevertheless, the feature
should be very useful for migration or simple access in
filesystems that have been converted from ext2/3 or don't use
incompatible features.

Special thanks to Zheng Liu for his dedication and continued
work to support ext2 in FreeBSD.

Submitted by: Zheng Liu (lz@)
Reviewed by: Mike Ma, Christoph Mallon (previous version)
Sponsored by: Google Inc.

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

10 years agoAdd read-only support for extents in ext2fs.
pfg [Tue, 3 Sep 2013 16:29:14 +0000 (16:29 +0000)]
Add read-only support for extents in ext2fs.

Basic support for extents was implemented by Zheng Liu as part
of his Google Summer of Code in 2010. This support is read-only
at this time.

In addition to extents we also support the huge_file extension
for read-only purposes. This works nicely with the additional
support for birthtime/nanosec timestamps and dir_index that
have been added lately.

The implementation may not work for all ext4 filesystems as
it doesn't support some features that are being enabled by
default on recent linux like flex_bg. Nevertheless, the feature
should be very useful for migration or simple access in
filesystems that have been converted from ext2/3 or don't use
incompatible features.

Special thanks to Zheng Liu for his dedication and continued
work to support ext2 in FreeBSD.

Submitted by: Zheng Liu (lz@)
Reviewed by: Mike Ma, Christoph Mallon (previous version)
Sponsored by: Google Inc.

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

10 years agoMFC r254945:
kib [Tue, 3 Sep 2013 05:20:42 +0000 (05:20 +0000)]
MFC r254945:
When allocating a pbuf for the cluster write, do not sleep waiting
for the available pbuf when passed vnode is backing md(4). Other i/o
directed to the same md device might already hold pbufs, and then we
could deadlock since only our progress can free a pbuf needed for
wakeup.

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

10 years agoMFC of 253998:
mckusick [Sat, 31 Aug 2013 17:38:49 +0000 (17:38 +0000)]
MFC of 253998:

This bug fix is in a code path in rename taken when there is a
collision between a rename and an open system call for the same
target file. Here, rename releases its vnode references, waits for
the open to finish, and then restarts by reacquiring its needed
vnode locks. In this case, rename was unlocking but failing to
release its reference to one of its held vnodes. The effect was
that even after all the actual references to the vnode had gone,
the vnode still showed active references. For files that had been
removed, their space was not reclaimed until the filesystem was
forcibly unmounted.

This bug manifested itself in the Postgres server which would
leak/lose hundreds of files per day amounting to many gigabytes of
disk space. This bug required shutting down Postgres, forcibly
unmounting its filesystem, remounting its filesystem and restarting
Postgres every few days to recover the lost space.

Reported by: Dan Thomas and Palle Girgensohn
Bug-fix by:  kib
Tested by:   Dan Thomas and Palle Girgensohn

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

10 years agoMFC of 253973:
mckusick [Sat, 31 Aug 2013 17:33:25 +0000 (17:33 +0000)]
MFC of 253973:

To better understand performance problems with journalled soft updates,
we need to collect the highest level of allocation for each of the
different soft update dependency structures. This change collects these
statistics and makes them available using `sysctl debug.softdep.highuse'.

Reviewed by: kib
Tested by:   Peter Holm

MFC of 253974:

With the addition of journalled soft updates, the "newblk" structures
persist much longer than previously. Historically we had at most 100
entries; now the count may reach a million. With the increased count
we spent far too much time looking them up in the grossly undersized
newblk hash table. Configure the newblk hash table to accurately reflect
the number of entries that it must index.

Reviewed by: kib
Tested by:   Peter Holm
MFC after:   2 weeks

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

10 years agoMFC r254231: fnmatch(): Add test for r254353 (pattern with single backslash)
jilles [Fri, 30 Aug 2013 10:10:22 +0000 (10:10 +0000)]
MFC r254231: fnmatch(): Add test for r254353 (pattern with single backslash)

This test cannot be converted to an sh(1) test because the syntax would be
invalid.

r254091 was merged to stable/9 as r254353.

PR: 181129

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

10 years agoMFC r254335: sh: Allow a lone redirection before '|', ';;' or ';&'.
jilles [Fri, 30 Aug 2013 10:07:10 +0000 (10:07 +0000)]
MFC r254335: sh: Allow a lone redirection before '|', ';;' or ';&'.

Example: </dev/null | :

PR: 181240

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

10 years agoMFC r253910: Add a tunable for the default timeout.
marcel [Fri, 30 Aug 2013 05:36:29 +0000 (05:36 +0000)]
MFC r253910: Add a tunable for the default timeout.

Requested by: rodrigc@, delphij@

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

10 years agoMFC r251587 (by marcel):
ae [Thu, 29 Aug 2013 09:33:10 +0000 (09:33 +0000)]
MFC r251587 (by marcel):
  Remove stub implementation.

MFC r251588 (by marcel):
  Change the set and unset ctlreqs by making the index argument optional.
  This allows setting attributes on tables. One simply does not provide
  an index in that case. Otherwise the entry corresponding the index has
  the attribute set or unset.

  Use this change to fix a relatively longstanding bug in our GPT scheme
  that's the result of rev 198097 (relatively harmless) followed by rev
  237057 (damaging). The damaging part being that our GPT scheme always
  has the active flag set on the PMBR slice. This is in violation with
  EFI. Existing EFI implementions for both x86 and ia64 reject the GPT.
  As such, GPT disks created by us aren't usable under EFI because of
  that.

  After this change, GPT disks never have the active flag set on the PMBR
  slice. In order to make the GPT disk bootable under some x86 BIOSes,
  the reason of rev 198097, one must now set the active attribute on the
  gpt table. The kernel will apply this to the PMBR slice For (S)ATA:
   gpart set -a active ada0

  To fix an existing GPT disk that has the active flag set in the PMBR,
  and that does not need the flag, use (again for (S)ATA):
   gpart unset -a active ada0

  The EBR, MBR & PC98 schemes, which also impement at least 1 attribute,
  now check to make sure the entry passed is valid. They do not have
  attributes that apply to the table.

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

10 years agoMFC 254416:
ken [Wed, 28 Aug 2013 19:22:09 +0000 (19:22 +0000)]
MFC 254416:

  ------------------------------------------------------------------------
  r254416 | ken | 2013-08-16 10:14:32 -0600 (Fri, 16 Aug 2013) | 24 lines

  Add unmapped I/O and larger I/O support to the sa(4) driver.

  We now pay attention to the maxio field in the XPT_PATH_INQ CCB,
  and if it is set, propagate it up to physio via the si_iosize_max
  field in the cdev structure.

  We also now pay attention to the PIM_UNMAPPED capability bit in the
  XPT_PATH_INQ CCB, and set the new SI_UNMAPPED cdev flag when the
  underlying SIM supports unmapped I/O.

  scsi_sa.c: Add unmapped I/O support and propagate the SIM's
   maximum I/O size up.

   Adjust scsi_tape_read_write() in the same way that
   scsi_read_write() was changed to support unmapped
   I/O.  We overload the readop parameter with bits
   that tell us whether it's an unmapped I/O, and we
   need to set the CAM_DATA_BIO CCB flag.  This change
   should be backwards compatible in source and
   binary forms.

  Sponsored by: Spectra Logic

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

10 years agoMFC change 254389:
ken [Tue, 27 Aug 2013 23:02:20 +0000 (23:02 +0000)]
MFC change 254389:

There are some slight differences from the version in FreeBSD/head.
__FreeBSD_version has been bumped to 902503 for the availability
of the SI_UNMAPPED cdev flag, and the D_UNMAPPED_IO cdevsw flag
remains in place.  D_UNMAPPED_IO no longer does anything.  Drivers that
use that flag will just wind up having mapped I/O by default.  The
impact will only be on performance, not functionality.

  Change the way that unmapped I/O capability is advertised.

  The previous method was to set the D_UNMAPPED_IO flag in the cdevsw
  for the driver.  The problem with this is that in many cases (e.g.
  sa(4)) there may be some instances of the driver that can handle
  unmapped I/O and some that can't.  The isp(4) driver can handle
  unmapped I/O, but the esp(4) driver currently cannot.  The cdevsw
  is shared among all driver instances.

  So instead of setting a flag on the cdevsw, set a flag on the cdev.
  This allows drivers to indicate support for unmapped I/O on a
  per-instance basis.

  sys/conf.h: Remove the D_UNMAPPED_IO cdevsw flag and replace it
   with an SI_UNMAPPED cdev flag.

  kern_physio.c: Look at the cdev SI_UNMAPPED flag to determine
   whether or not a particular driver can handle
   unmapped I/O.

  geom_dev.c: Set the SI_UNMAPPED flag for all GEOM cdevs.
   Since GEOM will create a temporary mapping when
   needed, setting SI_UNMAPPED unconditionally will
   work.

   Remove the D_UNMAPPED_IO flag.

  nvme_ns.c: Set the SI_UNMAPPED flag on cdevs created here
   if NVME_UNMAPPED_BIO_SUPPORT is enabled.

  vfs_aio.c: In aio_qphysio(), check the SI_UNMAPPED flag on a
   cdev instead of the D_UNMAPPED_IO flag on the cdevsw.

  sys/param.h: Bump __FreeBSD_version to 1000045 for the switch from
   setting the D_UNMAPPED_IO flag in the cdevsw to setting
   SI_UNMAPPED in the cdev.

  Reviewed by: kib, jimharris
  Sponsored by: Spectra Logic

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

10 years agoProperly record mergeinfo for the merge of revision 254372 from head into
ken [Tue, 27 Aug 2013 20:43:27 +0000 (20:43 +0000)]
Properly record mergeinfo for the merge of revision 254372 from head into
stable/9.

This should have been done in change 254971.

Pointy hat to: ken

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

10 years agoMFC 254372:
ken [Tue, 27 Aug 2013 20:34:11 +0000 (20:34 +0000)]
MFC 254372:

Export the maxio field in the CAM XPT_PATH_INQ CCB in the isp(4)
driver.

This tells consumers up the stack the maximum I/O size that the
controller can handle.

The I/O size is bounded by the number of scatter/gather segments
the controller can handle and the page size.  For an amd64 system,
it works out to around 5MB.

Reviewed by: mjacob
Sponsored by: Spectra Logic

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

10 years agoAdd missing mergeinfo from head for stabe/9 revisions: 252995 253168 253169
dteske [Tue, 27 Aug 2013 18:16:50 +0000 (18:16 +0000)]
Add missing mergeinfo from head for stabe/9 revisions: 252995 253168 253169

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

10 years agoMFC revisions 254942 and 254952:
dteske [Tue, 27 Aug 2013 06:31:50 +0000 (06:31 +0000)]
MFC revisions 254942 and 254952:
Make alternate layout ``opt-in'' and add support for named releases.
Minor edit to version.4th(8) manual and stack-leak fixes while here.

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

10 years agoPartial MFC of r253927 (by attilio):
kib [Tue, 27 Aug 2013 03:11:49 +0000 (03:11 +0000)]
Partial MFC of r253927 (by attilio):
Remove unnecessary soft busy of the page before to do vn_rdwr() in
kern_sendfile() which is unnecessary.

MFC note:
NFS implementation of VOP_READ() sometimes upgrades the vnode lock,
which causes drop of the shared lock and sleep for exclusive.  As
result, busying of the page before the call to vn_rdwr() makes NFS
code to wait for vnode lock while page is busy, which contradicts the
proper order of vnode lock -> busy.

The r250027, merged as part of r250907, started calling vm_page_grab()
under the vnode lock.  The page grab waits for the page busy state to
drain, which makes the parallel sendfile(2) invocations on the same
vnode vulnerable to the LOR described above.

Note that r250027 only exposed the problem, which might be caused by
other means as well, e.g. by parallel sendfile(2) and truncate(2).

Sponsored by: The FreeBSD Foundation

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

10 years agoMFC mps(4) driver changes 253460, 253549, 253550 and 254615.
ken [Mon, 26 Aug 2013 21:34:43 +0000 (21:34 +0000)]
MFC mps(4) driver changes 253460, 253549, 253550 and 254615.

There are some slight changes here from the version in head.

__FreeBSD_version has been bumped to 902502 for the inclusion of the
PIM_RESCAN CAM path inquiry flag.  The ifdefs in the mps(4) driver
have been changed accordingly.

In head, the TDP_NOSLEEPING thread flag has been removed but it
still exists in stable/9.

  ------------------------------------------------------------------------
  r253460 | scottl | 2013-07-18 18:12:41 -0600 (Thu, 18 Jul 2013) | 5 lines

  Overhaul error, information, and debug logging.

  Obtained from: Netflix

  ------------------------------------------------------------------------
  r253549 | ken | 2013-07-22 12:37:07 -0600 (Mon, 22 Jul 2013) | 57 lines

  CAM and mps(4) driver scanning changes.

  Add a PIM_NOSCAN flag to the CAM path inquiry CCB.  This tells CAM
  not to perform a rescan on a bus when it is registered.

  We now use this flag in the mps(4) driver.  Since it knows what
  devices it has attached, it is more efficient for it to just issue
  a target rescan on the targets that are attached.

  Also, remove the private rescan thread from the mps(4) driver in
  favor of the rescan thread already built into CAM.  Without this
  change, but with the change above, the MPS scanner could run before
  or during CAM's initial setup, which would cause duplicate device
  reprobes and announcements.

  sys/param.h:
   Bump __FreeBSD_version to 1000039 for the inclusion of the
   PIM_RESCAN CAM path inquiry flag.

  sys/cam/cam_ccb.h:
  sys/cam/cam_xpt.c:
   Added a PIM_NOSCAN flag.  If a SIM sets this in the path
   inquiry ccb, then CAM won't rescan the bus in
   xpt_bus_regsister.

  sys/dev/mps/mps_sas.c
   For versions of FreeBSD that have the PIM_NOSCAN path
   inquiry flag, don't freeze the sim queue during scanning,
   because CAM won't be scanning this bus.  Instead, hold
   up the boot.  Don't call mpssas_rescan_target in
   mpssas_startup_decrement; it's redundant and I don't
   know why it was in there.

   Set PIM_NOSCAN in path inquiry CCBs.

   Remove methods related to the internal rescan daemon.

   Always use async events to trigger a probe for EEDP support.
   In older versions of FreeBSD where AC_ADVINFO_CHANGED is
   not available, use AC_FOUND_DEVICE and issue the
   necessary READ CAPACITY manually.

   Provide a path to xpt_register_async() so that we only
   receive events for our own SCSI domain.

   Improve error reporting in cases where setup for EEDP
   detection fails.

  sys/dev/mps/mps_sas.h:
   Remove softc flags and data related to the scanner thread.

  sys/dev/mps/mps_sas_lsi.c:
   Unconditionally rescan the target whenever a device is added.

  Sponsored by: Spectra Logic

  ------------------------------------------------------------------------
  r253550 | ken | 2013-07-22 12:41:53 -0600 (Mon, 22 Jul 2013) | 93 lines

  Merge in phase 14+ -> 16 mps driver fixes from LSI:

  ---------------------------------------------------------------
  System panics during a Port reset with ouststanding I/O
  ---------------------------------------------------------------
  It is possible to call mps_mapping_free_memory after this
  memory is already freed, causing a panic. Removed this extra
  call to mps_mappiing_free_memory and call mps_mapping_exit
  in place of the mps_mapping_free_memory call so that any
  outstanding mapping items can be flushed before memory is
  freed.

  ---------------------------------------------------------------
  Correct memory leak during a Port reset with ouststanding I/O
  ---------------------------------------------------------------
  In mps_reinit function, the mapping memory was not being
  freed before being re-allocated. Added line to call the
  memory free function for mapping memory.

  ---------------------------------------------------------------
  Use CAM_SIM_QUEUED flag in Driver IO path.
  ---------------------------------------------------------------
  This flag informs the XPT that successful abort of a CCB
  requires an abort ccb to be issued to the SIM.  While
  processing SCSI IO's, set the CAM_SIM_QUEUED flag in the
  status for the IO. When the command completes, clear this
  flag.

  ---------------------------------------------------------------
  Check for CAM_REQ_INPROG in I/O path.
  ---------------------------------------------------------------
  Added a check in mpssas_action_scsiio for the In Progress
  status for the IO. If this flag is set, the IO has already
  been aborted by the upper layer (before CAM_SIM_QUEUED was
  set) and there is no need to send the IO. The request will
  be completed without error.

  ---------------------------------------------------------------
  Improve "doorbell handshake method" for mps_get_iocfacts
  ---------------------------------------------------------------
  Removed call to get Port Facts since this information is
  not used currently.

  Added mps_iocfacts_allocate function to allocate memory
  that is based on IOC Facts data.  Added mps_iocfacts_free
  function to free memory that is based on IOC Facts data.
  Both of the functions are used when a Diag Reset is performed
  or when the driver is attached/detached. This is needed in
  case IOC Facts changes after a Diag Reset, which could
  happen if FW is upgraded.

  Moved call of mps_bases_static_config_pages from the attach
  routine to after the IOC is ready to process accesses based
  on the new memory allocations (instead of polling through
  the Doorbell).

  ---------------------------------------------------------------
  Set TimeStamp in INIT message in millisecond format Set the IOC
  ---------------------------------------------------------------

  ---------------------------------------------------------------
  Prefer mps_wait_command to mps_request_polled
  ---------------------------------------------------------------
  Instead of using mps_request_polled, call mps_wait_command
  whenever possible. Change the mps_wait_command function to
  check the current context and either use interrupt context
  or poll if required by using the pause or DELAY function.
  Added a check after waiting 50mSecs to see if the command
  has timed out. This is only done if polliing, the msleep
  command will automatically timeout if the command has taken
  too long to complete.

  ---------------------------------------------------------------
  Integrated RAID: Volume Activation Failed error message is
  displayed though the volume has been activated.
  ---------------------------------------------------------------
  Instead of failing an IOCTL request that does not have a
  large enough buffer to hold the complete reply, copy as
  much data from the reply as possible into the user's buffer
  and log a message saying that the user's buffer was smaller
  than the returned data.

  ---------------------------------------------------------------
  mapping_add_new_device failure due to persistent table FULL
  ---------------------------------------------------------------
  When a new device is added, if it is determined that the
  device persistent table is being used and is full, instead
  of displaying a message for this condition every time, only
  log a message if the MPS_INFO bit is set in the debug_flags.

  Submitted by: LSI

  ------------------------------------------------------------------------
  r254615 | ken | 2013-08-21 15:30:56 -0600 (Wed, 21 Aug 2013) | 32 lines

  Fix mps(4) driver breakage that came in in change 253550 that
  manifested itself in out of chain frame conditions.

  When the driver ran out of chain frames, the request in question
  would get completed early, and go through mpssas_scsiio_complete().

  In mpssas_scsiio_complete(), the negation of the CAM status values
  (CAM_STATUS_MASK | CAM_SIM_QUEUED) was ORed in instead of being
  ANDed in.  This resulted in a bogus CAM CCB status value.  This
  didn't show up in the non-error case, because the status was reset
  to something valid (e.g. CAM_REQ_CMP) later on in the function.

  But in the error case, such as when the driver ran out of chain
  frames, the CAM_REQUEUE_REQ status was ORed in to the bogus status
  value.  This led to the CAM transport layer repeatedly releasing
  the SIM queue, because it though that the CAM_RELEASE_SIMQ flag had
  been set.  The symptom was messages like this on the console when
  INVARIANTS were enabled:

  xpt_release_simq: requested 1 > present 0
  xpt_release_simq: requested 1 > present 0
  xpt_release_simq: requested 1 > present 0

  mps_sas.c: In mpssas_scsiio_complete(), use &= to take status
   bits out.  |= adds them in.

   In the error case in mpssas_scsiio_complete(), set
   the status to CAM_REQUEUE_REQ, don't OR it in.

  Sponsored by: Spectra Logic

  ------------------------------------------------------------------------

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

10 years agoMFC r254651:
erwin [Mon, 26 Aug 2013 07:17:41 +0000 (07:17 +0000)]
MFC r254651:

Update Bind to 9.9.3-P2

Notable new features:

*  Elliptic Curve Digital Signature Algorithm keys and signatures in
   DNSSEC are now supported per RFC 6605. [RT #21918]

*  Introduces a new tool "dnssec-verify" that validates a signed zone,
   checking for the correctness of signatures and NSEC/NSEC3 chains.
   [RT #23673]

*  BIND now recognizes the TLSA resource record type, created to
   support IETF DANE (DNS-based Authentication of Named Entities)
   [RT #28989]

*  The new "inline-signing" option, in combination with the
   "auto-dnssec" option that was introduced in BIND 9.7, allows
   named to sign zones completely transparently.

Approved by: delphij (mentor)
Sponsored by: DK Hostmaster A/S

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

10 years agoMFC r226840: AESNI-related commit, from a long time ago:
roberto [Sun, 25 Aug 2013 14:29:47 +0000 (14:29 +0000)]
MFC r226840: AESNI-related commit, from a long time ago:

Before this change when GELI detected hardware crypto acceleration it will
start only one worker thread. For software crypto it will start by default
N worker threads where N is the number of available CPUs.

This is not optimal if hardware crypto is AES-NI, which uses CPU for AES
calculations.

Change that to always start one worker thread for every available CPU.
Number of worker threads per GELI provider can be easly reduced with
kern.geom.eli.threads sysctl/tunable and even for software crypto it
should be reduced when using more providers.

While here, when number of threads exceeds number of CPUs avilable don't
reduce this number, assume the user knows what he is doing.

Submitted by: Michael Moll <kvedulv@kvedulv.de>

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

10 years agoMerge r226837 & r226839 from head:
roberto [Sun, 25 Aug 2013 13:10:03 +0000 (13:10 +0000)]
Merge r226837 & r226839 from head:

r226837:
Improve AES-NI performance for AES-XTS:
- Operate on uint64_t types when doing XORing, etc. instead of uint8_t.
- Don't bzero() temporary block for every AES block. Do it once for entire
  data block.
- AES-NI is available only on little endian architectures. Simplify code
  that takes block number from IV.

r226839:
Update Copyright.

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

10 years agoMFC r253651, r253652, r253657;
pfg [Sat, 24 Aug 2013 17:45:42 +0000 (17:45 +0000)]
MFC r253651, r253652, r253657;

ext2fs: Don't assume that on-disk format of a directory is the same
as in <sys/dirent.h>

ext2_readdir() has always been very fs specific and different
with respect to its ufs_ counterpart. Recent changes from UFS
have made it possible to share more closely the implementation.

Always start parsing at DIRBLKSIZ aligned offset, skip first entries if
uio_offset is not DIRBLKSIZ aligned. Return EINVAL if buffer is too
small for single entry.

Preallocate buffer for cookies.

Skip entries with zero inode number.

Reviewed by: gleb, Zheng Liu

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

10 years agoMFC r254465: Correct implementation of atomic_flag_test_and_set
emaste [Sat, 24 Aug 2013 13:49:43 +0000 (13:49 +0000)]
MFC r254465: Correct implementation of atomic_flag_test_and_set

(This is a direct commit to stable/9 as atomic_flag_test_and_set_explicit
is an inline function on HEAD and in a different file.)

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

10 years agoMFC r253282:
trociny [Sat, 24 Aug 2013 12:10:11 +0000 (12:10 +0000)]
MFC r253282:

A complete duplication of binding should be allowed if on both new and
duplicated sockets a multicast address is bound and either
SO_REUSEPORT or SO_REUSEADDR is set.

But actually it works for the following combinations:

  * SO_REUSEPORT is set for the fist socket and SO_REUSEPORT for the new;
  * SO_REUSEADDR is set for the fist socket and SO_REUSEADDR for the new;
  * SO_REUSEPORT is set for the fist socket and SO_REUSEADDR for the new;

and fails for this:

  * SO_REUSEADDR is set for the fist socket and SO_REUSEPORT for the new.

Fix the last case.

PR: 179901

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

10 years agoMFC r254438:
hselasky [Sat, 24 Aug 2013 07:17:28 +0000 (07:17 +0000)]
MFC r254438:
Fix some USB controller names according to pciconf output.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>

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

10 years agoMFC r254582:
dim [Fri, 23 Aug 2013 18:04:13 +0000 (18:04 +0000)]
MFC r254582:

Pull in r182983 from upstream clang trunk:

  Fix handling of braced-init-list as reference initializer within
  aggregate initialization. Previously we would incorrectly require an
  extra set of braces around such initializers.

Pull in r188718 from upstream clang trunk:

  Handle init lists and _Atomic fields.

  Fixes PR16931.

These fixes are needed for the atomic_flag type to work correctly in our
stdatomic.h.

Requested by: theraven

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

10 years agoMFC r254581:
dim [Fri, 23 Aug 2013 18:02:37 +0000 (18:02 +0000)]
MFC r254581:

Pull in r188716 from upstream clang trunk:

  PR16727: don't try to evaluate a potentially value-dependent
  expression when checking for missing parens in &&/|| expressions.

This fixes an assertion encountered when building the lang/sdcc port.

Reported by: kwm

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

10 years agoMFC r253677,253679: make path matching in devfs rules consistent and
avg [Fri, 23 Aug 2013 14:24:46 +0000 (14:24 +0000)]
MFC r253677,253679: make path matching in devfs rules consistent and
sane (and safer)

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

10 years agoMFC r253996,253997: opensolaris code: translate INVARIANTS to DEBUG and ZFS_DEBUG
avg [Fri, 23 Aug 2013 14:17:45 +0000 (14:17 +0000)]
MFC r253996,253997: opensolaris code: translate INVARIANTS to DEBUG and ZFS_DEBUG

Please note that support for compiling ZFS into a kernel is not in this
branch as of now.

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

10 years agoMFC r253772,253773,253989: dtrace disassembler: take the latest/last
avg [Fri, 23 Aug 2013 14:03:08 +0000 (14:03 +0000)]
MFC r253772,253773,253989: dtrace disassembler: take the latest/last
CDDL code from OpenSolaris

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

10 years agoMFC r253606: zfs module: perform cleanup during shutdown in addition to
avg [Fri, 23 Aug 2013 13:29:53 +0000 (13:29 +0000)]
MFC r253606: zfs module: perform cleanup during shutdown in addition to
module unload

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

10 years agoMFC r253603: zfs: move vnode creation from zfs_znode_cache_constructor
avg [Fri, 23 Aug 2013 13:27:13 +0000 (13:27 +0000)]
MFC r253603: zfs: move vnode creation from zfs_znode_cache_constructor
to zfs_znode_alloc

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

10 years agoMFC r253604: rename scheduler->swapper and SI_SUB_RUN_SCHEDULER->SI_SUB_LAST
avg [Fri, 23 Aug 2013 13:20:11 +0000 (13:20 +0000)]
MFC r253604: rename scheduler->swapper and SI_SUB_RUN_SCHEDULER->SI_SUB_LAST

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

10 years agoRevert r254626 to fix the build.
gjb [Thu, 22 Aug 2013 18:41:28 +0000 (18:41 +0000)]
Revert r254626 to fix the build.

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

10 years agoRegenerate.
kib [Thu, 22 Aug 2013 17:33:50 +0000 (17:33 +0000)]
Regenerate.

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

10 years agoMFC r253494:
kib [Thu, 22 Aug 2013 17:30:01 +0000 (17:30 +0000)]
MFC r253494:
id_t is 64bit, provide the compat32 wrapper for clock_getcpuclockid2(2).

Reminded by: Petr Salinger <Petr.Salinger@seznam.cz>

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

10 years agoMFC r254095:
ae [Thu, 22 Aug 2013 06:20:25 +0000 (06:20 +0000)]
MFC r254095:
  gpt_entries is used as limit for the number of partition entries in
  the GEOM_PART. Instead of just using number of entries from the GPT
  header, calculate this limit based on the reserved space between
  GPT header and first available LBA.

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

10 years agoFix an integer overflow in computing the size of a temporary buffer
delphij [Thu, 22 Aug 2013 00:51:37 +0000 (00:51 +0000)]
Fix an integer overflow in computing the size of a temporary buffer
can result in a buffer which is too small for the requested
operation.

Security: CVE-2013-3077
Security: FreeBSD-SA-13:09.ip_multicast

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

10 years agoProvide a prototype for yyparse() so that "-Werror" along with stringent
obrien [Wed, 21 Aug 2013 22:57:29 +0000 (22:57 +0000)]
Provide a prototype for yyparse() so that "-Werror" along with stringent
-W* warnings can be used on byacc's output.

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

10 years agoMFC r241077:
tijl [Wed, 21 Aug 2013 19:02:34 +0000 (19:02 +0000)]
MFC r241077:

- Simplify the implementation of atomic_compare_exchange_strong_explicit.
- Evaluate the memory order argument in atomic_fetch_*_explicit macros.
- Implement atomic_store_explicit using atomic_exchange_explicit instead
  of a plain assignment.

MFC r241190:

Define clang feature test macro __has_extension. It's used in stdatomic.h.

MFC r254497:

Change the return type of the fallback implementation of the
atomic_compare_exchange_* macros in stdatomic.h to _Bool.

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