196247 Commits

Author SHA1 Message Date
kib
efd262c8d0 MFC r269244:
Remove one-time use macros which check for the vnode lifecycle.
2014-08-05 05:00:22 +00:00
markj
f50ec1f79f MFC r267759, r267761
r267759:
Fix a couple of bugs on amd64 when fetching probe arguments beyond the
first five for probes entered through a UD fault (i.e. FBT probes).

Specifically, handle the fact that dtrace_invop_callsite must be
16 byte-aligned and thus may not immediately follow the call to
dtrace_invop() in dtrace_invop_start(). Also fetch register arguments and
the stack pointer through a struct trapframe instead of a struct reg.

r267761:
Fix some bugs when fetching probe arguments in i386. Firstly ensure that
the 4 byte-aligned dtrace_invop_callsite can be found and that it
immediately follows the call to dtrace_invop(). Secondly, fix some pointer
arithmetic to account for differences between struct i386_frame and illumos'
struct frame. Finally, ensure that dtrace_getarg() isn't inlined. It works
by following a fixed number of frame pointers to the probe site, so inlining
breaks it.

PR:		191260
2014-08-05 01:53:15 +00:00
markj
7e5599557d MFC r268584:
Add a headphone redirection quirk for the Lenovo G580.
2014-08-05 01:03:10 +00:00
markj
92ee24a486 MFC r267706:
Allow creation of SDT probes from a module in which no providers are
defined. This ensures that the sdt:zfs:: probes appear despite the fact
the sdt provider is defined in the kernel rather than in zfs.ko.
2014-08-05 00:25:46 +00:00
markj
a14261c089 MFC r256822:
When fetching function arguments out of a frame on amd64, explicitly select
the register based on the argument index rather than relying on the fields
in struct reg to be in the right order. This assumption is incorrect on
FreeBSD and generally led to bogus argument values for the sixth argument
of PID and USDT probes; the first five are passed directly to dtrace_probe()
via the fasttrap trap handler and so were correctly handled.
2014-08-04 21:41:00 +00:00
markj
2fd28e2373 MFC r256571:
Add a function, memstr, which can be used to convert a buffer of
null-separated strings to a single string. This can be used to print the
full arguments of a process using execsnoop (from the DTrace toolkit) or
with the following one-liner:

dtrace -n 'syscall::execve:return {trace(curpsinfo->pr_psargs);}'

Note that this relies on the process arguments being cached via the struct
proc, which means that it will not work for argvs longer than
kern.ps_arg_cache_limit. However, the following rather non-portable
script can be used to extract any argv at exec time:

fbt::kern_execve:entry
{
    printf("%s", memstr(args[1]->begin_argv, ' ',
        args[1]->begin_envv - args[1]->begin_argv));
}

The debug.dtrace.memstr_max sysctl limits the maximum argument size to
memstr().
2014-08-04 15:36:22 +00:00
dim
bde3467611 MFC r269125:
In r232153, libarchive 3.0.3 was imported, replacing the archive_hash.h
header with archive_crypto_private.h, and its ARCHIVE_HASH_xxx macros
were renamed to ARCHIVE_CRYPTO_xxx.

Rename these macros in lib/libarchive/config_freebsd.h, to re-enable the
hashes for libarchive again.  This affects the mtree format writer, and
the xar format reader and writer modules.

This also requires changes in the library order for statically linking
rescue, otherwise ld would complain about redefined symbols.  Thanks to
jkim for pointing out the solution.

Reviewed by:	kientzle
2014-08-04 14:56:49 +00:00
gjb
1cf6163349 MFC r269289, r269290, r269291, r269292, r269293:
r269289:
  sort(1): Remove trailing '.' from See Also section.

r269290:
  acpi_wmi(4): Remove trailing comma from standalone Xref.

r269291:
  hptiop(4): Remove trailing comma from ending Xref.

r269292:
  pf.conf(5): Remove trailing comma from ending Xref.

r269293:
  kernel_mount(9): Remove trailing comma from ending Xref.

Sponsored by:	The FreeBSD Foundation
2014-08-04 03:59:48 +00:00
kib
db3e0174c3 MFC r269190:
For md(4), posix shm(3) and tmpfs(5), free swap space used by paged in
dirty page, which is written by the process.
2014-08-04 01:14:27 +00:00
kib
00b893a599 MFC r269189:
Initialize zfs vnode v_hash when the vnode is allocated.
2014-08-04 01:12:49 +00:00
kib
cec08c7294 MFC r269187:
Assert that nullfs vnode has VV_ROOT set whenever lower vnode has.
Assert that dotdot lookup on the root vnode is not performed.
2014-08-04 01:10:47 +00:00
pfg
503271002c MFC r268945:
Fix hdestroy() compliance issue.

The hcreate(3) implementation and related functions we inherited
from NetBSD used to free() the key value, something that is not
supported by the standard implementation.

This would cause a segmentation fault when attempting to run
the examples from the opengroup and linux manpages.

There is no need to bump the __FreeBSD_version as we have
always claimed XPG4.2 compliance but if some reference is
required, the bump for r269484 can be used.

Reference:
http://bugs.dragonflybsd.org/issues/1398
2014-08-04 00:51:57 +00:00
peter
5cebaadbe0 Insta-MFC r269489: partial revert of r262867 which was MFC'ed as r263820.
Don't ignore sndbuf/rcvbuf limits for SOCK_DGRAM sockets.  This appears
to be an edit error or patch fuzz mismatch.
2014-08-03 22:59:47 +00:00
pfg
1ae0bcf0e8 MFC r268066:
regex(3): Add support for \< and \> word delimiters

Solaris and other OSs have support for \< and \> as word
delimiters in utilities like sed(1). These are useful to
have for general compatiblity with Solaris but should be
avoided for portability with other systems, including the
traditional BSDs.

Bump __FreeBSD_version as this is likely to affect some
userland utilities.

Reference:
https://www.illumos.org/issues/516

PR:		bin/153257
Obtained from:	Illumos
2014-08-03 18:39:11 +00:00
pfg
4edbce8b34 MFC r269124:
strftime() xlocale cleanups.

Replace fprintf_l with fputs when output is unformatted.
Use locale_t in _conv() since it was using sprintf (now sprintf_l)
Use locale_t on _yconv() since it calls _conv()

Obtained from:	Apple Inc. (Libc 997.90.3)
CR:		D482
Reviewed by:	theraven
2014-08-03 18:31:52 +00:00
pfg
5c8726d1b2 MFC r268926, r268930, r268983:
Use a correct errno in freopen.
Use EBADF instead of EINVAL when working around incorrect O_ACCMODE.

Adjust errno on failed prepwrite.

rewind: always clear error indicator as required by POSIX.

Obtained from:	Apple Inc. (Libc 997.90.3)
Phabric:	D442
2014-08-03 18:28:10 +00:00
pfg
eabfc5bd75 MFC r268867, r268878:
Use more consistent type for optlen in getsourcefilter()

Proposed by:	bde
2014-08-03 18:03:00 +00:00
marcel
250620f917 MFC 268986; fix file system corruption by creating as many BIOs as needed
to satisfy the original request -- in other words: no short reads.

Obtained from:	Juniper Networks, Inc.
2014-08-03 03:06:00 +00:00
marcel
adf874323a MFC 264164: Convert while copying in control messages.
Obtained from:	Juniper Networks, Inc.
2014-08-03 02:37:33 +00:00
marcel
aef52ec818 MFC 264162: Accept RFC 2292 option values so that RFC 2292 compliant
programs that are unaware of RFC 3542 can construct control messages.

Obtained from:	Juniper Networks, Inc.
2014-08-03 02:24:52 +00:00
marcel
b37299ed78 MFC 264161: Handle the fact that the getlogin_basic() function can return
a 0 status with a NULL pointer for the login name (result).

Obtained from:	Juniper Networks, Inc.
2014-08-03 01:51:48 +00:00
rmacklem
672efbb4a9 MFC: r268273
The new NFSv3 server did not generate directory postop attributes for
the reply to ReaddirPlus when the server failed within the loop
that calls VFS_VGET(). This failure is most likely an error
return from VFS_VGET() caused by a bogus d_fileno that was
truncated to 32bits.
This patch fixes the server so that it will return directory postop
attributes for the failure. It does not fix the underlying issue caused
by d_fileno being uint32_t when a file system like ZFS generates
a fileno that is greater than 32bits.
2014-08-03 00:35:10 +00:00
marcel
b0acb5134f MFC 259910, 260023, 260028, 260600 & 260701:
o   Fix "kptdir is itself virtual" error, caused by having the kptdir in PBVM.
o   Allow building a cross libkvm for ia64.
o   Add support for virtual cores (aka minidumps).
o   We don't have to worry about page sizes when working on virtual cores.
o   Handle truncation of the size returned by _kvm_kvatop().
2014-08-02 22:25:24 +00:00
hselasky
b766e5260f MFC r269139:
Split the XHCI TRB allocations into smaller parts, so that we don't
end up allocating contiguous busdma buffers above PAGE_SIZE bytes.
2014-08-02 21:01:58 +00:00
hselasky
ad96ca7b3d Partial MFC of r267961, r267973, r267985, r267992, r267993 and r268005:
Backport some macro definitions to make backporting code from FreeBSD
current easier.
2014-08-02 20:58:46 +00:00
rmacklem
647be50edb MFC: r268866
r243637 changed the default number of nfsd threads created,
but the man page did not reflect this.
This is a content change.
2014-08-02 20:06:36 +00:00
marcel
fe5f8b1c18 Define both ttyu0 and ttyu1 as onifconsole. This is ideal for ia64
where the console can be on either, depending on the platform.
2014-08-02 15:05:23 +00:00
mav
c1cec10724 MFC r269123:
Implement separate I/O dispatch method for ZVOLs in "dev" mode.

Unlike disk devices ZVOLs process all requests synchronously.  That makes
impossible sending multiple requests to them from single thread.  From the
other side ZVOLs have real d_read/d_write methods, which unlike d_strategy
can handle uio scatter/gather and have no strict I/O size limitations.

So, if ZVOL in "dev" mode is detected, use of d_read/d_write methods instead
of d_strategy allows to avoid pointless splitting of large requests into
MAXPHYS (128K) sized chunks.
2014-08-02 06:56:00 +00:00
delphij
fc1b233fa4 MFC r268865: MFV r268852:
Reduce lock contention on the z_teardown_lock under heavily cached
read workload by splitting the single teardown rrw lock into
RRM_NUM_LOCKS (17) of them.

Read acquisitions are randomly distributed among these locks based
on curthread pointer.  Write acquisitions are going to all the
locks, which for the usage of this type of lock should be rare.

Illumos issue:
    5008 lock contention (rrw_exit) while running a read only load
2014-08-02 04:06:35 +00:00
delphij
2f2875361e MFC r268859: MFV r268851:
When a sync task is waiting for a txg to complete, we should hurry it along
by increasing the number of outstanding async writes (i.e. make
vdev_queue_max_async_writes() return a larger number).

Illumos issue:
    4753 increase number of outstanding async writes when sync task is waiting
2014-08-02 04:01:44 +00:00
delphij
b798cd9bfe MFC r268858: MFV r268850:
Change the interaction between the DMU and ARC so that when the DMU is
shutting down an objset, we do not evict the data from the ARC.  Instead
we simply coordinate the destruction of the DMU's data with the ARC.

The only case where we actually need to explicitly evict from the ARC is
when dbuf_rele_and_unlock() determines that the administrator has requested
that it not be kept in memory, via the primarycache/secondarycache properties.
In this case, we evict the data from the ARC by its blkptr_t, the same way
as when a block is freed we explicitly evict it from the ARC.

Illumos issue:
    4631 zvol_get_stats triggering too many reads
2014-08-02 03:59:35 +00:00
delphij
6a949e106d MFC r268855: MFV r268848:
Instead of asserting all zio's be properly aligned, only assert
on the logical ones.

Cap uberblocks at 8k, otherwise with ashift=17, there would be
only one uberblock.

This fixes a problem that zdb would trip assert on pools with
ashift >= 0xe (8k).

While there, also change the code so it only attempt to condense
space map unless the uncondensed size consumes greater than
zfs_metaslab_condense_block_threshold blocks.

Illumos issue:
  4958 zdb trips assert on pools with ashift >= 0xe
2014-08-02 03:56:06 +00:00
emaste
4b7aa9ea8a MFC r258436: Refactor amd64 startup SMAP parsing
Extracted from the projects/uefi branch, this change is a reasonable
  cleanup and will reduce the diffs to review when bringing in the
  UEFI work.
2014-08-01 21:40:42 +00:00
rmacklem
c9ba10fd16 Add an UPDATING entry for the __FreeBSD_version bump related
to r269398.
2014-08-01 21:28:58 +00:00
rmacklem
85f4adfe90 Bump __FreeBSD_version for r269398, since it changes the
internal interfaces between the NFS related modules.
This is a direct commit to stable/10.
2014-08-01 21:24:19 +00:00
emaste
1ae4f7117e MFC r266902: Add missing libexec/bsdconfig subdirectories 2014-08-01 21:14:02 +00:00
rmacklem
50867d802b MFC: r268115
Merge the NFSv4.1 server code in projects/nfsv4.1-server over
into head. The code is not believed to have any effect
on the semantics of non-NFSv4.1 server behaviour.
It is a rather large merge, but I am hoping that there will
not be any regressions for the NFS server.
2014-08-01 21:10:41 +00:00
jhb
ba879dc5f5 MFC 256657,257423,264837,267559:
Sync vmrun.sh with HEAD:
- Add -e option to vmrun.sh passed to bhyveload(8) to set loader
  environment variables.
- Stop passing unused -I option to bhyve(8).
- Reformat the usage to fit in 80 colums and other cleanups.
- Add -C option to specify the console device.
- Add -H option to pass a host path to bhyveload(8).
- Support for multiple disk and tap devices.
2014-08-01 21:00:18 +00:00
truckman
d1eb948ff0 MFC r268780
Nuke the never-used RF_TIMESHARE feature, reducing the complexity of the
code.  The consensus on arch@ is that this feature might have been useful
in the distant past, but is now just unnecessary bloat.

The int_rman_activate_resource() and int_rman_deactivate_resource()
functions become trivial, so manually inline them.

The special deferred handling of RF_ACTIVE is no longer needed in
reserve_resource_bound(), so eliminate the associated code at the
end of the function.

These changes reduce the object file size by more than 500 bytes on i386.

Update the rman.9 man page to reflect the removal of the RF_TIMESHARE
feature.
2014-08-01 15:04:46 +00:00
kib
270336f678 MFC r269205:
Simplify the expression.
2014-08-01 04:05:13 +00:00
np
d3402f0f62 MFC r269106:
Add a 'raw' parameter to the 'modinfo' subcommand.  This is handy when
trying to figure out why a QSFP+/SFP+ connector or cable wasn't
identified correctly by cxgbe(4).  Its output looks like this:

# cxgbetool t5nex0 modinfo 0 raw
00:  03 04 21 00  00 00 00 00  ..!. ....
08:  04 00 00 00  67 00 00 00  .... g...
10:  00 00 05 00  41 6d 70 68  .... Amph
18:  65 6e 6f 6c  20 20 20 20  enol
20:  20 20 20 20  00 41 50 48       .APH
28:  35 37 31 35  34 30 30 30  5715 4000
30:  33 20 20 20  20 20 20 20  3
38:  4b 20 20 20  01 00 00 fa  K    ....
40:  00 00 00 00  41 50 46 31  .... APF1
48:  30 30 34 30  30 33 30 30  0040 0300
50:  30 33 20 20  31 30 30 31  03   1001
58:  33 30 20 20  00 00 00 97  30   ....
2014-07-31 23:09:22 +00:00
np
072ac2f2da MFC r268971 and r269032.
r268971:
Simplify r267600, there's no need to distinguish between allocated and
inlined mbufs.

r269032:
cxgbe(4):  Keep track of the clusters that have to be freed by the
custom free routine (rxb_free) in the driver.  Fail MOD_UNLOAD with
EBUSY if any such cluster has been handed up to the kernel but hasn't
been freed yet.  This prevents a panic later when the cluster finally
needs to be freed but rxb_free is gone from the kernel.
2014-07-31 23:04:41 +00:00
markj
f850608aee MFC r264434:
DTrace's pid provider works by inserting breakpoint instructions at probe
sites and installing a hook at the kernel's trap handler. The fasttrap code
will emulate the overwritten instruction in some common cases, but otherwise
copies it out into some scratch space in the traced process' address space
and ensures that it's executed after returning from the trap.

In Solaris and illumos, this (per-thread) scratch space comes from some
reserved space in TLS, accessible via the fs segment register. This
approach is somewhat unappealing on FreeBSD since it would require some
modifications to rtld and jemalloc (for static TLS) to ensure that TLS is
executable, and would thus introduce dependencies on their implementation
details. I think it would also be impossible to safely trace static binaries
compiled without these modifications.

This change implements the functionality in a different way, by having
fasttrap map pages into the target process' address space on demand. Each
page is divided into 64-byte chunks for use by individual threads, and
fasttrap's process descriptor struct has been extended to keep track of
any scratch space allocated for the corresponding process.

With this change it's possible to trace all libc functions in a program,
e.g. with

  pid$target:libc.so.*::entry {@[probefunc] = count();}

Previously this would generally cause the victim process to crash, as
tracing memcpy on amd64 requires the functionality described above.
2014-07-31 17:10:03 +00:00
wblock
d357493f14 MFC 268931:
Correct spelling errors in ctld.8.  While here, correct similar errors
in ctl.conf.5 and fix a couple of contractions.
2014-07-31 14:53:07 +00:00
rpaulo
815311c5b9 MFC r268300:
bsd.dep.mk: add support for generating DTrace header files from .d
 files.
2014-07-31 07:27:59 +00:00
mav
375621a9a5 MFC r268808:
Increase maximal number of SCSI ports in CTL from 32 to 128.

After I gave each iSCSI target its own port, the old limit appeared to be
not so big.  This change almost proportionally increases per-LUN memory
use, but it is still three times better then it was before r268807.
2014-07-30 07:21:30 +00:00
mav
16407addf1 MFC r268807:
Reduce per-LUN memory usage from 18MB to 1.8MB.

CTL never had use for CA support code since SPI has gone, and there is no
even frontends supporting that.  But it still was reserving 256 bytes of
memory per LUN per every possible initiator on every possible port.

Wrap unused code with ifdef's in case somebody ever need it.
2014-07-30 07:20:36 +00:00
mav
dd34ac0859 MFC r268767:
Add support for VMWare dialect of EXTENDED COPY command, aka VAAI Clone.

This allows to clone VMs and move them between LUNs inside one storage
host without generating extra network traffic to the initiator and back,
and without being limited by network bandwidth.

LUNs participating in copy operation should have UNIQUE NAA or EUI IDs set.
For LUNs without these IDs VMWare will use traditional copy operations.

Beware: the above LUN IDs explicitly set to values non-unique from the VM
cluster point of view may cause data corruption if wrong LUN is addressed!

Sponsored by:	iXsystems, Inc.
2014-07-30 07:18:32 +00:00
mav
1c2891173e MFC r268581:
Merge several equal serialization indexes.
2014-07-30 07:16:08 +00:00
mav
9418843a93 MFC r269149:
Fix several cases of NULL dereference when INQUIRY sent to absent LUN.
2014-07-30 07:08:59 +00:00