Commit Graph

515 Commits

Author SHA1 Message Date
Martin Matuska
876a84e867 MFC @248461 2013-03-18 09:39:51 +00:00
Martin Matuska
6f4accc2de Move common zfs ioctl compatibility functions (userland) into libzfs_compat.c
Introduce additional constants for zfs ioctl versions
2013-03-18 09:32:29 +00:00
Martin Matuska
d97b41582d Fix working with zfs_ioctl_version in libzfs_compat.h and include mirror
lzc_ioctl_version in libzfs_core
2013-03-17 22:24:08 +00:00
Martin Matuska
67ebc12d49 Add forwards compatibility for libzfs_core
Unsupported: creation of multiple snapshots including "zfs snapshot -r"
2013-03-17 18:33:06 +00:00
Martin Matuska
e2b4467975 libzfs_core:
- provide complete backwards compatibility (old utility, new kernel)
  - add zfs_cmd_t compatibility mapping in both directions
  - determine ioctl address in zfs_ioctl_compat.c
2013-03-17 10:57:04 +00:00
Martin Matuska
0afa556b1b MFV r248266:
Import minor ZFS changes from vendor

Illumos ZFS issues:
  3604 zdb should print bpobjs more verbosely (fix zdb hang)
  3606 zpool status -x shouldn't warn about old on-disk format

MFC after:	3 days
2013-03-14 10:02:59 +00:00
Martin Matuska
1a5160106d Update zfs.8 manpage date (missing in r247585)
MFC:	together with r247585
2013-03-14 08:18:40 +00:00
Martin Matuska
a03fbc7ecf MFC @248093 2013-03-09 11:57:51 +00:00
Dimitry Andric
e86b103cc6 Fix error in r247960: actually assign the basename to match.iim_file.
Pointed out by:	avg
Pointy hat to:	dim
MFC after:	1 week
X-MFC-With:	r247960
2013-03-07 22:43:50 +00:00
Dimitry Andric
8b0d8e9f2f Make ctfconvert work correctly on clang-compiled object files. Clang
puts the full original source filename in the STT_FILE entry of the ELF
symbol table, while gcc saves only the basename.

Since the DWARF DW_AT_name attribute contains the full source filename,
both for clang and gcc, ctfconvert takes just the basename of it, for
matching with the STT_FILE entry.  So when attempting to match with such
an entry, use its basename, if necessary.

Reported by:	avg
MFC after:	1 week
2013-03-07 22:16:35 +00:00
Martin Matuska
db49d41d8a Move libzfs compat functions to libzfs_compat.h
This header is used by both libzfs_core and libzfs libraries
2013-03-06 10:40:50 +00:00
Martin Matuska
400c4069a5 MFV r247845:
Import ZFS bpobj bugfix from vendor.

Illumos ZFS issues:
  3603 panic from bpobj_enqueue_subobj()
  3604 zdb should print bpobjs more verbosely

References:
  https://www.illumos.org/issues/3603
  https://www.illumos.org/issues/3604

MFC after:	1 week
2013-03-05 18:54:41 +00:00
Martin Matuska
dce1a726f2 WiP merge of libzfs_core (MFV r238590, r238592)
not yet working, ioctl handling needs to be changed
2013-03-05 08:09:53 +00:00
Martin Matuska
4abd59512a MFV r247316:
Merge new read-only zfs properties from vendor (illumos)

Illumos ZFS issues:
  3588 provide zfs properties for logical (uncompressed) space used and
       referenced

References:
  https://www.illumos.org/issues/3588

MFC after:	2 weeks
2013-03-01 21:58:51 +00:00
Martin Matuska
bb508e7732 Fix the zfs_ioctl compat layer to support zfs_cmd size change introduced
in r247265 (ZFS deadman thread). Both new utilities now support the old
kernel and new kernel properly detects old utilities.

For future backwards compatibility, the vfs.zfs.version.ioctl read-only
sysctl has been introduced. With this sysctl zfs utilities will be able
to detect the ioctl interface version of the currently loaded zfs module.

As a side effect, the zfs utilities between r247265 and this revision don't
support the old kernel module. If you are using HEAD newer or equal than
r247265, install the new kernel module (or whole kernel) first.

MFC after:	10 days
2013-03-01 09:42:58 +00:00
Martin Matuska
24245e76ea MFV 247176, 247178, 247315:
Import metaslab_sync() speedup from vendor (illumos).

Illumos ZFS issues:
  3552 condensing one space map burns 3 seconds of CPU in spa_sync() thread
  3564 spa_sync() spends 5-10% of its time in metaslab_sync() (when not
       condensing)
  3578 transferring the freed map to the defer map should be constant time
  3579 ztest trips assertion in metaslab_weight()

References:
  https://www.illumos.org/issues/3552
  https://www.illumos.org/issues/3564
  https://www.illumos.org/issues/3578
  https://www.illumos.org/issues/3579

MFC after:	2 weeks
2013-02-27 14:45:23 +00:00
Martin Matuska
e70664bafc MFV v242732:
Merge the ZFS I/O deadman thread from vendor (illumos).
This feature panics the system on hanging ZFS I/O, helps debugging
and resumes failed service.

The panic behavior can be controlled with the loader-only tunables:
vfs.zfs.deadman_enabled (enable or disable panic on stalled ZFS I/O)
vfs.zfs.deadman_synctime (expiration time for stalled ZFS I/O)

By default, ZFS I/O deadman is enabled by default on amd64 and i386
excluding virtual guest machines.

Illumos ZFS issues:
  3246 ZFS I/O deadman thread

References:
  https://www.illumos.org/issues/3246

MFC after:	2 weeks
2013-02-25 12:33:31 +00:00
Justin T. Gibbs
cf4e0cc15e Orphaned processes that are being traced are killed by the
kernel.  Properly restore, continue, and detach from processes
being DTraced when DTrace exits with an error so the program
being inspected is not terminated.

cddl/contrib/opensolaris/cmd/dtrace/dtrace.c:
	In fatal(), the generic error handler, close the DTrace
	handle as is done in the "probe/script" error handler
	dfatal().  fatal() can be invoked after DTrace attaches
	to processes (e.g. a script specified by command line
	argument can't be found) and closing the handle will
	release them.

Submitted by:	Spectra Logic Corporation
Reviewed by:	rpaulo, gnn
2013-02-20 17:46:38 +00:00
Xin LI
f667ff300d Use the right year.
Noticed by:	Denis Ahrens <denis h3q com>
2013-02-11 18:22:26 +00:00
Martin Matuska
ff20578569 MFV r246392:
Import vendor ZFS bugfix fixing a possible deadlock in arc_read().

Illumos ZFS issues:
  3498 panic in arc_read(): !refcount_is_zero(&pbuf->b_hdr->b_refcnt)

References:
  https://www.illumos.org/issues/3498

MFC after:	2 weeks
2013-02-11 12:42:11 +00:00
Martin Matuska
fd9778c236 MFV r246388:
Import vendor bugfixes

Illumos ZFS issues:
  3422 zpool create/syseventd race yield non-importable pool
  3425 first write to a new zvol can fail with EFBIG

References:
  https://www.illumos.org/issues/3422
  https://www.illumos.org/issues/3425

MFC after:	2 weeks
2013-02-10 19:32:55 +00:00
Martin Matuska
1af420e000 Backport vendor changes in zfs(8) manual page (MFV r246389)
Illumos ZFS issues:
  3380 zfs man page: documentation for zfs allow is confusing

References:
  https://www.illumos.org/issues/3380

MFC after:	2 weeks
2013-02-10 17:10:07 +00:00
Gavin Atkinson
9a71ddccd0 Correct spelling of "daemon". No .Dd bump.
Noticed by:	Nathan Rich <Nathan.Rich dynastysystems com>
MFC after:	3 days
2013-02-10 14:28:07 +00:00
Joel Dahl
1848dd2aec mdoc: Remove EOL whitespace. 2013-02-09 07:01:05 +00:00
Xin LI
ef17620fc8 MFV r245512:
* Illumos zfs issue #3035 [1] LZ4 compression support in ZFS.

LZ4 is a new high-speed BSD-licensed compression algorithm created
by Yann Collet that delivers very high compression and decompression
performance compared to lzjb (>50% faster on compression, >80% faster
on decompression and around 3x faster on compression of incompressible
data), while giving better compression ratio [1].

This version of LZ4 corresponds to upstream's [2] revision 85.

Please note that for obvious reasons this is not backward read
compatible.  This means once a pool have LZ4 compressed data, these
data can no longer be read by older ZFS implementations.

Local changes:

 - On-stack hash table disabled and using kernel slab allocator
   instead, at this time.  This requires larger kernel thread stack
   for zio workers.  This may change in the future should we adjusted
   the zio workers' thread stack size.
 - likely and unlikely will be undefined if they are already defined,
   this is required for i386 XEN build.
 - Removed De Bruijn sequence based __builtin_ctz family of builtins
   in favor of the latter.  Both GCC and clang supports these builtins.
 - Changed the way the LZ4 code detects endianness.
 - Manual pages modifications to mention the feature based on Illumos
   counterpart.
 - Boot loader changes to make it support LZ4 decompression.

[1] https://www.illumos.org/issues/3035
[2] http://code.google.com/p/lz4/source/list

Obtained from:	Illumos (13921:9d721847e469)
Tested on:	FreeBSD/amd64
MFC after:	1 month
2013-02-09 06:39:28 +00:00
Brooks Davis
afd9b4631f Add a new LIBRARIES_ONLY make variable to disable the build and install
of files other than the actual libraries.

Use LIBRARIES_ONLY to supress the inclusion of files in the lib32
distribution that are duplicates of files in base.

Sponsored by:	DARPA, AFRL
Reviewed by:	emaste
2013-01-17 17:27:10 +00:00
Steven Hartland
0e8f70b4bc Reports pools which have a removed l2cache disk under -x as this is what
happens when a cache device is dropped for any reason.

Reviewed by:	pjd
Approved by:	pjd (mentor)
MFC after:	2 weeks
2013-01-15 23:34:24 +00:00
Xin LI
290a1ba9a4 The current ZFS code expects ddt_zap_count to always succeed by asserting
the underlying zap_count() to return no errors.  However, it is possible
that the pool reaches to such a state where zap_count would return error,
leading to panics when a pool is imported.

This commit changes the ddt_zap_count to return error returned from
zap_count and handle the error appropriately.  With this change, it's now
possible to let zpool rollback damaged transaction groups and import the
pool.

Obtained from:	ZFS on Linux github (e8fd45a0f9)
MFC after:	1 month
2013-01-10 19:26:56 +00:00
Pawel Jakub Dawidek
1bba6bdf13 Allow to create pool even if mount point directory is not empty if -f is given.
Obtained from:	WHEEL Systems
2012-12-30 13:47:40 +00:00
Martin Matuska
4d50603f6b MFV r244245:
Merge two zdb bugfixes from vendor (illumos)

illumos-gate 13894:f4af77f6bbd2
3397 zdb <pool> <objnum> output is too verbose
3398 zdb can't dump feature flags zap objects

References:
https://www.illumos.org/issues/3397
https://www.illumos.org/issues/3398

MFC after:	1 week
2012-12-15 10:02:11 +00:00
Steven Hartland
425fb6dbaf Fixes zfs receive errors caused by snapshot replication being processed in a
random order instead of creation order.

Eliminates needless filesystem renames caused by removed parent snapshots
which subsequently causes many more errors.

PR:		kern/172259
Submitted by:	Steven Hartland
Reviewed by:	pjd (mentor)
Approved by:	pjd (mentor)
MFC after:	2 weeks
2012-12-13 22:03:07 +00:00
Martin Matuska
6e5bba4ae1 Update manpage dates in zfs.8 and zpool.8
MFC after:	2 weeks
2012-11-26 13:16:55 +00:00
Martin Matuska
7faa32552f MFV r243395:
Introduce a new dataset aclmode setting "restricted" to protect ACL's
being destroyed or corrupted by a drive-by chmod.

illumos-gate 13889:a67716f16746
3254 add support in zfs for aclmode=restricted

References:
https://www.illumos.org/issues/3254

MFC after:	2 weeks
2012-11-26 12:24:39 +00:00
Martin Matuska
dd801aa546 MFV r243013 and r243267:
Import the zio nop-write improvement from Illumos. To reduce I/O,
nop-write omits overwriting data if the checksum (cryptographically
secure) of new data matches the checksum of existing data.
It also saves space if snapshots are in use.

It currently works only on datasets with enabled compression, disabled
deduplication and sha256 checksums.

IllumOS 13887:196932ec9e6a and 13888:7204b3392a58
3236 zio nop-write

References:
https://www.illumos.org/issues/3236

MFC after:	2 weeks
2012-11-25 16:32:07 +00:00
Martin Matuska
64ad6bf196 zfs sha256 checksum is missing in zfs.8 manpage
MFC after:	3 days
2012-11-25 11:26:36 +00:00
Martin Matuska
2f06dfc9a3 MFV r243012:
Illumos 13886:e3261d03efbf

3349 zpool upgrade -V bumps the on disk version number, but leaves
     the in core version

References:
https://www.illumos.org/issues/3349

MFC after:	1 week
2012-11-25 10:53:42 +00:00
Sergey Kandaurov
9098689d87 Sort SEE ALSO xrefs by the manual section number and add a missing comma. 2012-11-15 20:50:18 +00:00
Martin Matuska
82e5de4d20 Move zpool-features manual page from section 5 to section 7
and fix references

Reported by:	pluknet
MFC after:	1 week
2012-11-14 01:16:29 +00:00
Sergey Kandaurov
0af021e861 Fix an apparent typo in the manual section number in .Dt: it should be 5. 2012-11-13 21:08:49 +00:00
Xin LI
a9b09a3f3c MFV r242729 (mm):
Illumos r13840:97fd5cdf328a:

3145 single-copy arc
3212 ztest: race condition between vdev_online() and spa_vdev_remove()

Illumos r13849:3468a95b27cd:

3258 ztest's use of file descriptors is unstable
2012-11-10 01:52:52 +00:00
Justin Hibbits
c757049235 Implement DTrace for PowerPC. This includes both 32-bit and 64-bit.
There is one known issue:  Some probes will display an error message along the
lines of:  "Invalid address (0)"

I tested this with both a simple dtrace probe and dtruss on a few different
binaries on 32-bit.  I only compiled 64-bit, did not run it, but I don't expect
problems without the modules loaded.  Volunteers are welcome.

MFC after:	1 month
2012-11-07 23:45:09 +00:00
Konstantin Belousov
5050aa86cf Remove the support for using non-mpsafe filesystem modules.
In particular, do not lock Giant conditionally when calling into the
filesystem module, remove the VFS_LOCK_GIANT() and related
macros. Stop handling buffers belonging to non-mpsafe filesystems.

The VFS_VERSION is bumped to indicate the interface change which does
not result in the interface signatures changes.

Conducted and reviewed by:	attilio
Tested by:	pho
2012-10-22 17:50:54 +00:00
Martin Matuska
1048151528 Add missing initialization for do_prefix.
Corrects porting error in r238391

Vendor issue and changeset reference:
2883 changing "canmount" property to "on" should not always remount dataset
https://www.illumos.org/issues/2883
Changeset 13743:95aba6e49b9f

Reported by:	Guido Falsi <mad@madpilot.net>, avg
Obtained from:	illumos (issue #2883)
MFC after:	1 week
2012-10-17 22:14:09 +00:00
Kevin Lo
ba670ce023 Make sure that each va_start has one and only one matching va_end,
especially in error cases.
2012-09-28 07:51:30 +00:00
Martin Matuska
8469b12c2e Merge recent vendor changes in ZFS.
Illumos issued covered:
2811 missing implementation: zfs send -r
3139 zdb dies when it tries to determine path of unlinked file
3189 kernel panic in ZFS test suite during hotspare_onoffline_004_neg
3208 moving zpool cross-endian results in incorrect user/group accounting

References:
  https://www.illumos.org/issues/ + [issue_id]

Obtained from:	illumos (vendor/illumos, vendor/illumos-sys)
MFC after:	2 weeks
2012-09-26 09:37:58 +00:00
Pawel Jakub Dawidek
c622f88dd2 It is possible to recursively destroy snapshots even if the snapshot
doesn't exist on a dataset we are starting from. For example if we
have the following configuration:

	tank
	tank/foo
	tank/foo@snap
	tank/bar
	tank/bar@snap

We can execute:

	# zfs destroy -t tank@snap

eventhough tank@snap doesn't exit.

Unfortunately it is not possible to do the same with recursive rename:

	# zfs rename -r tank@snap tank@pans
	cannot open 'tank@snap': dataset does not exist

...until now. This change allows to recursively rename snapshots even if
snapshot doesn't exist on the starting dataset.

Sponsored by:	rsync.net
MFC after:	2 weeks
2012-09-23 20:12:10 +00:00
Pawel Jakub Dawidek
bcb77be2b7 Add TRIM support.
The code builds a map of regions that were freed. On every write the
code consults the map and eventually removes ranges that were freed
before, but are now overwritten.

Freed blocks are not TRIMed immediately. There is a tunable that defines
how many txg we should wait with TRIMming freed blocks (64 by default).

There is a low priority thread that TRIMs ranges when the time comes.
During TRIM we keep in-flight ranges on a list to detect colliding
writes - we have to delay writes that collide with in-flight TRIMs in
case something will be reordered and write will reached the disk before
the TRIM. We don't have to do the same for in-flight writes, as
colliding writes just remove ranges to TRIM.

Sponsored by:	multiplay.co.uk

This work includes some important fixes and some improvements obtained
from the zfsonlinux project, including TRIMming entire vdevs on pool
create/add/attach and on pool import for spare and cache vdevs.

Obtained from:	zfsonlinux
Submitted by:	Etienne Dechamps <etienne.dechamps@ovh.net>
2012-09-23 19:40:58 +00:00
Baptiste Daroussin
b3da58854b Update usage to show the possiblity to use jail name
Reported by:	bdrewery
MFC after:	1 month
2012-09-19 16:28:38 +00:00
Baptiste Daroussin
ec6ddea1a8 Allow zfs jail and zfs unjail to use both jailnames and jailid
Reviewed by:	pjd
MFC after:	1 month
2012-09-19 16:20:49 +00:00
Martin Matuska
4c5238d576 Merge recent zfs vendor changes, sync code and adjust userland DEBUG.
Illumos issued covered:
1884 Empty "used" field for zfs *space commands
3006 VERIFY[S,U,P] and ASSERT[S,U,P] frequently check if first argument
     is zero
3028 zfs {group,user}space -n prints (null) instead of numeric GID/UID
3048 zfs {user,group}space [-s|-S] is broken
3049 zfs {user,group}space -t doesn't really filter the results
3060 zfs {user,group}space -H output isn't tab-delimited
3061 zfs {user,group}space -o doesn't use specified fields order
3064 usr/src/cmd/zpool/zpool_main.c misspells "successful"
3093 zfs {user,group}space's -i is noop
3098 zfs userspace/groupspace fail without saying why when run as non-root

References:
  https://www.illumos.org/issues/ + [issue_id]

Obtained from:	illumos (vendor/illumos, vendor/illumos-sys)
MFC after:	2 weeks
2012-09-12 18:05:43 +00:00
Joel Dahl
0dbe75e145 Remove trailing whitespace. 2012-09-06 19:26:59 +00:00
Glen Barber
104d19a8c3 Typo fix and minor word swap.
PR:		171356
Submitted by:	bdrewery
MFC After:	3 days
2012-09-05 23:07:02 +00:00
Martin Matuska
4a24a25b2f Merge recent vendor changes and sync code:
1862 incremental zfs receive fails for sparse file > 8PB
3112 ztest does not honor ZFS_DEBUG
3122 zfs destroy filesystem should prefetch blocks
3129 'zpool reopen' restarts resilvers
3130 ztest failure: Assertion failed:
       0 == dmu_objset_destroy(name, B_FALSE) (0x0 == 0x10)

References:
  https://www.illumos.org/issues/1862
  https://www.illumos.org/issues/3112
  https://www.illumos.org/issues/3122
  https://www.illumos.org/issues/3129
  https://www.illumos.org/issues/3130

Obtained from:	illumos (vendor/illumos, vendor/illumos-sys)
MFC after:	2 weeks
2012-09-05 12:02:09 +00:00
Glen Barber
b825120ab7 Add myself to copyright sections, per CDDL license.
Requested by:	mm
2012-09-03 00:05:21 +00:00
Rui Paulo
e04dfc407c Finish porting execsnoop to FreeBSD. This includes replacing the zonename
with a jail ID and removing the project ID from the list of options.
2012-09-01 08:14:21 +00:00
Joel Dahl
b7d683e608 Remove trailing whitespace. 2012-09-01 06:23:13 +00:00
Joel Dahl
86006ccf73 Remove trailing whitespace. 2012-09-01 06:12:14 +00:00
Joel Dahl
6ef6e985ec Mdoc fixes. 2012-09-01 06:07:27 +00:00
Joel Dahl
8508578c7f Minor mdoc fixes. 2012-08-31 21:44:12 +00:00
Joel Dahl
d56b30618d Mdoc fixes. 2012-08-31 17:18:41 +00:00
Martin Matuska
6e767def16 Merge recent vendor changes:
3100 zvol rename fails with EBUSY when dirty
3104 eliminate empty bpobjs
3120 zinject hangs in zfsdev_ioctl() due to uninitialized zc

References:
  https://www.illumos.org/issues/3100
  https://www.illumos.org/issues/3104
  https://www.illumos.org/issues/3120

Obtained from:	illumos (vendor/illumos, vendor/illumos-sys)
MFC after:	2 weeks
2012-08-28 12:25:37 +00:00
Martin Matuska
078f0b3e8d Add missing parts to zpool-features.5 manual page
Obtained from:	vendor/illumos/dist
MFC after:	2 weeks
2012-08-27 19:52:55 +00:00
Martin Matuska
671303c6d5 Merge recent vendor changes:
3086 unnecessarily setting DS_FLAG_INCONSISTENT on async destroyed datasets
3090 vdev_reopen() during reguid causes vdev to be treated as corrupt
3102 vdev_uberblock_load() and vdev_validate() may read the wrong label

Referenes:
  https://www.illumos.org/issues/3086
  https://www.illumos.org/issues/3090
  https://www.illumos.org/issues/3102

PR:		kern/170912, kern/170914
Obtained from:	illumos (changeset #13776, #13777)
MFC after:	2 weeks
2012-08-23 19:32:57 +00:00
Martin Matuska
1e350ef423 Update zfs(8) manpage with illumos version of "zfs diff"
Illumos issue:
  2399 zfs manual page does not document use of "zfs diff"

References:
  https://www.illumos.org/issues/2399

PR:		docs/170764
Obtained from:	ssh://anonhg@hg.illumos.org/illumos-gate
MFC after:	1 week
2012-08-19 10:34:40 +00:00
Glen Barber
e5561269e1 - Fix source dataset snapshot name in Example 15.
- Bump date.

MFC after:	3 days
X-MFC-With:	r239216
2012-08-12 20:30:15 +00:00
Glen Barber
c980404ee4 Remove a leading space that breaks rendering.
MFC after:	3 days
2012-08-12 20:23:59 +00:00
George V. Neville-Neil
26d121f5df When we return with an error we cannot unlock the mutex, because
it's been freed.  Protect against that, hopefully unlikely, case.

Reviewed by:	rpaulo
MFC after: 2 weeks
2012-08-01 19:27:12 +00:00
Martin Matuska
68f76b5452 Fix wrong indent according to style(9)
MFC after:	2 weeks
2012-07-31 17:32:28 +00:00
Martin Matuska
f45b531d72 Fix reporting of root pool upgrade notice.
MFC after:	2 weeks
2012-07-31 17:28:28 +00:00
Martin Matuska
e9832bb1da Partial MFV (illumos-gate 13753:2aba784c276b)
2762 zpool command should have better support for feature flags

References:
https://www.illumos.org/issues/2762

MFC after:	2 weeks
2012-07-30 23:14:24 +00:00
George V. Neville-Neil
96b3267700 Revert previous commit. The bug was actually caused by an issue
in pre 1.8.5 versions of sudo which were sending too many
SIGINTs to processes when the user hit Ctrl-C.

Pointed out by:	avg@, rpaulo@, sbruno@
2012-07-25 17:49:01 +00:00
George V. Neville-Neil
d83f1ab98e Fix a bug in interrupt handling so that we're only considered
impatient if we sent more than 2 INT signals.  This fixes a bug where
we wouldn't see aggregations print on the command line if we Ctrl-C'd
a dtrace script or command line invocation.

MFC after:	2 weeks
2012-07-24 18:01:28 +00:00
Pedro F. Giffuni
694a0093a7 Dtrace: improve handling of library paths.
Merge changes from illumos

906 dtrace depends_on pragma should search all library paths, not just the
current one

949 dtrace should only include the first instance of a library found on
its library path

Illumos Revisions:	13353:936a1e45726c
			13354:2b2c36a81512

Reference:
https://www.illumos.org/issues/906
https://www.illumos.org/issues/949

Tested by:	Fabian Keil
Obtained from:	Illumos
MFC after:	3 weeks
2012-07-17 19:57:34 +00:00
Pedro F. Giffuni
ba73774268 Use libc's strndup() instead of Dtrace's reimplementation.
Corresponds partially to OpenSolaris change:
PSARC 2010/299 GNU/Linux/BSD compatibility functions
6901783 strndup would be nice

MFC after:	2 weeks
2012-07-15 21:20:31 +00:00
Pedro F. Giffuni
b99795d637 Merge illumos commit 13455:7205f7794835
1458 D compiler fails to generate error on sizeof() an undefined struct

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

Tested by:	Fabian Keil
MFC after:	3 weeks
2012-07-14 20:24:00 +00:00
Martin Matuska
bc06fa9281 Merge illumos commit 13749:df4cd82e2b60
1796 "ZFS HOLD" should not be used when doing "ZFS SEND" froma read-only pool
2871 support for __ZFS_POOL_RESTRICT used by ZFS test suite
2903 zfs destroy -d does not work
2957 zfs destroy -R/r sometimes fails when removing defer-destroyed snapshot

References:
https://www.illumos.org/issues/1796
https://www.illumos.org/issues/2871
https://www.illumos.org/issues/2903
https://www.illumos.org/issues/2957

MFC after:	1 week
2012-07-13 12:37:34 +00:00
Martin Matuska
04cb23e3b1 Change behavior introduced in r237119 to vendor solution
References:
https://www.illumos.org/issues/2883

PR:		167905
Obtained from:	illumos (issue #2883)
MFC after:	2 weeks
2012-07-12 06:29:54 +00:00
George V. Neville-Neil
3fac94ba94 Initial commit of an I/O provider for DTrace on FreeBSD.
These probes are most useful when looking into the structures
they provide, which are listed in io.d.  For example:

dtrace -n 'io:genunix::start { printf("%d\n", args[0]->bio_bcount); }'

Note that the I/O systems in FreeBSD and Solaris/Illumos are sufficiently
different that there is not a 1:1 mapping from scripts that work
with one to the other.
MFC after:	1 month
2012-07-11 16:27:02 +00:00
Ed Maste
24d2e21d9b Restore r211786 by rpaulo:
Port dtruss to FreeBSD.

  Sponsored by:   The FreeBSD Foundation

It appears the change was reverted by r235380.
2012-07-05 00:52:23 +00:00
Pawel Jakub Dawidek
a905af7e2d Fix an obvious typo.
MFC after:	3 days
2012-07-04 17:36:26 +00:00
Dimitry Andric
ae88a6d9ac Fix clang warning, introduced in the recent dtrace import.
MFC after:	   3 days
2012-07-03 12:08:55 +00:00
Pedro F. Giffuni
fed980b201 Safer fix for building with Clang.
error: format specifies type 'long long' but the argument
has type 'int64_t' (aka 'long')

Reported by:	Ed Maste
2012-06-28 16:44:29 +00:00
Pedro F. Giffuni
db0cb5be21 Fix build with Clang.
error: format specifies type 'long long' but the argument
has type 'int64_t' (aka 'long')

Reported by:	Ed Maste
2012-06-28 15:38:14 +00:00
Pedro F. Giffuni
675cf9154b Bring llquantize support into Dtrace.
Bryan Cantrill implemented the equivalent of semi-log graph
paper for Dtrace so llquantize will use one logarithmic and
one linear scale.

Special thanks to Mark Peek for providing fix to an
assertion and to Fabian Keill for testing the port.

Illumos Revision:	13355:15b74a2a9a9d

Reference:
https://www.illumos/issues/905

Obtained from:	Illumos
Tested by:	Fabian Keill, mp
MFC after:	4 days
2012-06-27 04:39:30 +00:00
Martin Matuska
153e430149 Do not remount ZFS dataset if changing canmount property to "on" and
dataset is already mounted.

PR:		167905
Submitted by:	Bryan Drewery <bryan@shatow.net>
MFC after:	1 week
2012-06-15 07:38:21 +00:00
Martin Matuska
0ca5e953e7 Document the -v flag for zpool list.
PR:		168970
Suggested by:	Marcelo Araujo <araujo@FreeBSD.org>
MFC after:	3 days
2012-06-12 14:40:19 +00:00
Martin Matuska
2d9cf57e18 Introduce "feature flags" for ZFS pools (bump SPA version to 5000).
Add first feature "com.delphix:async_destroy" (asynchronous destroy
of ZFS datasets).
Implement features support in ZFS boot code.

Illumos revisions merged:
13700:2889e2596bd6
13701:1949b688d5fb
2619 asynchronous destruction of ZFS file systems
2747 SPA versioning with zfs feature flags

References:
https://www.illumos.org/issues/2619
https://www.illumos.org/issues/2747

Obtained from:	illumos (issue #2619, #2747)
MFC after:	1 month
2012-06-11 11:35:22 +00:00
Glen Barber
0f135da354 Clean up trailing whitespace.
MFC after:	3 days
X-MFC-With:	r236776
2012-06-09 03:34:34 +00:00
Glen Barber
a82472f2de Fix a typo: s/deafult/default
MFC after:	3 days
2012-06-09 03:33:06 +00:00
Martin Matuska
923bc36411 Import Illumos revision 13715:351036203e4b
2803 zfs get guid pretty-prints the output

References:
https://www.illumos.org/issues/2803

Obtained from:	illumos (issue #2803)
MFC after:	3 days
2012-06-07 08:32:53 +00:00
George V. Neville-Neil
c5069a4756 Add DTrace's io.d, which handles tranlsations for file, buffer and
device info structures as well as the fds[] array.  This is a raw
version of the file, unmodified, to be used as a baseline.
2012-06-05 18:58:05 +00:00
Martin Matuska
2182d44714 Import illumos changeset 13570:3411fd5f1589
1948 zpool list should show more detailed pool information

Display per-vdev information with "zpool list -v".
The added expandsize property has currently no value on FreeBSD.
This changeset allows adding expansion support to individual vdevs
in the future.

References:
https://www.illumos.org/issues/1948

Obtained from:	illumos (issue #1948)
MFC after:	2 weeks
2012-05-27 16:00:00 +00:00
Martin Matuska
d9727dc29c Import illumos changeset 13605:b5c2b5db80d6 (partial)
763 FMD msg URLs should refer to something visible

Replace sun.com URL's with illumos.org

References:
https://www.illumos.org/issues/763

Obtained from:	illumos (issue #763)
MFC after:	1 week
2012-05-27 12:31:57 +00:00
Martin Matuska
e21ea64ae1 Import illumos changeset 13564:cf89c0c60496
1946 incorrect formatting when listing output of multiple pools with
zpool iostat -v

References:
https://www.illumos.org/issues/1946

Obtained from:	illumos (issue #1946)
MFC after:	1 week
2012-05-27 12:22:15 +00:00
Martin Matuska
6977304500 Import illumos changeset 13571:a5771a96228c
1950 ztest backwards compatibility testing option

References:
https://www.illumos.org/issues/1950

Obtained from:	illumos (issue #1950)
MFC after:	2 weeks
2012-05-27 11:37:24 +00:00
Pawel Jakub Dawidek
ff8dbdbf30 Correct error message.
MFC after:	3 days
2012-05-25 17:19:30 +00:00
Andriy Gapon
5e1ba35cea zpool_find_import_impl: another /dev/dsk -> /dev fix
This seems to fix zdb -e behavior.

PR:		bin/155104
Submitted by:	swell.k@gmail.com
MFC after:	2 weeks
2012-05-15 17:11:00 +00:00
Andriy Gapon
0002b76d93 zpool_do_import: use /dev instead of /dev/dsk as a default
This affects behavior of zpool import without -d option.

Reported by:	Bruce Cran <bruce@cran.org.uk>
Submitted by:	Fabian Keil <freebsd-listen@fabiankeil.de>
MFC after:	2 weeks
2012-05-15 17:07:29 +00:00
George V. Neville-Neil
151ba977e9 Move sh to the correct path for FreeBSD. 2012-05-14 22:02:01 +00:00
George V. Neville-Neil
334aca4e78 Move sh to the correct location for FreeBS (/bin/sh) 2012-05-14 22:00:24 +00:00
George V. Neville-Neil
562490e2da Fix execsnoop by changing exece and exec to be FreeBSD's execve.
Reference sh in the correct location (/bin/sh)
2012-05-14 21:59:47 +00:00
George V. Neville-Neil
44f24c137a Fix opensnoop for FreeBSD by removing probes with 64 at the end as
these are unnecessary.

Reference sh in the correct location (/bin/sh)
2012-05-14 21:58:22 +00:00
George V. Neville-Neil
f2f9999d8b Import dtracetoolkit into cddl/contrib 2012-05-12 21:25:48 +00:00
Martin Matuska
a837775a9e Import illumos changeset 13686:4bc0783f6064
2703 add mechanism to report ZFS send progress

If the zfs send command is used with the -v flag, the amount of bytes
transmitted is reported in per second updates.

References:
https://www.illumos.org/issues/2703

Obtained from:	illumos (issue #2703)
MFC after:	2 weeks
2012-05-10 10:39:45 +00:00
Martin Matuska
a4392ad6af Remove unreachable break in zfs_main.c
Partial import of illumos changeset 13622:e5889df1eaac
2077 lots of unreachable breaks in illumos gate

References:
https://www.illumos.org/issues/2077

PR:		kern/167370
Submitted by:	Marcelo Araujo <araujo@FreeBSD.org>
Obtained from:	illumos (issue #2077)
MFC after:	1 week
2012-05-10 09:10:31 +00:00
Martin Matuska
7538677f35 Add support for force unmounting ZFS filesystems during "zfs rename"
with the -f flag.

Reimplementation of the illumos changeset 13677:a0cbef703c12
2635 'zfs rename -f' to perform force unmount

References:
https://www.illumos.org/issues/2635

PR:		kern/164447
Suggested by:	Marcelo Araujo <araujo@FreeBSD.org>
Obtained from:	illumos (issue #2635)
MFC after:	1 week
2012-05-10 08:57:58 +00:00
Martin Matuska
9846ab4ed2 Import illumos changeset 13618:c6ae14a341e8 [1]:
2088 zdb could use a reasonable manual page

Rewrite new zdb manpage to mdoc(7)

References:
https://www.illumos.org/issues/2088

PR:		kern/167467 [1]
Submitted by:	Marcelo Araujo <araujo@FreeBSD.org> [1]
Reviewed by:	mm
Obtained from:	Illumos (issue #2088)
MFC after:	1 week
2012-05-10 04:11:39 +00:00
Glen Barber
2fccbf04cc General mdoc(7) and typo fixes.
PR:		167696
Submitted by:	Nobuyuki Koganemaru (kogane!jp.freebsd.org)
MFC after:	3 days
2012-05-10 02:07:00 +00:00
Robert Millan
e851fbe3de GNU/kFreeBSD portability fix. This glue <stdlib.h> overrides header protection
in the system-wide version of <stdlib.h> by wrapping the #include_next
<stdlib.h> within the scope of its own header protection. On FreeBSD this has
no effect, since both header protections are equivalent. However the GNU version
of <stdlib.h> implements a special header protection mechanism which allows it
to be included multiple times (in different modes).

Simply by moving the #include_next off the header protection, we allow
system-wide <stdlib.h> to implement its own protection policy, whichever that
may be.
2012-04-30 23:12:16 +00:00
Ryan Stone
c6024848dd Implement the D "cpu" variable, which returns curcpu. I have chosen not
to follow the example of OpenSolaris and its descendants, which implemented
cpu as an inline that took a value out of curthread.  At certain points in
the FreeBSD scheduler curthread->td_oncpu will no longer be valid (in
particukar, just before the thread gets descheduled) so instead I have
implemented this as its own built-in variable.

Sponsored by:	Sandvine Inc.
MFC after:	1 week
2012-04-26 01:07:03 +00:00
Pawel Jakub Dawidek
7aa828debf Add -u option to 'zfs create' that prevents file system from being
automatically mounted. This is similar to the 'zfs receive -u'.

MFC after:	1 week
2012-04-24 13:44:46 +00:00
Xin LI
ba89ae6d5d - Correct a typo which prevents 'lzjb' be displayed;
- Use quotes when tab is used.
2012-04-22 07:50:24 +00:00
Martin Matuska
c277658f24 Fix typo miror -> mirror
Reported by:	Glen Barber <gjb@FreeBSD.org>
MFC after:	3 days
2012-04-16 08:19:43 +00:00
George V. Neville-Neil
72cc304aba Change SIGUSR1 to SIGTHR to properly wake up a process that is being
traced.  The use of SIGUSR1 caused traced processes (those attached to
with dtrace -p) to exit when dtrace exited.

MFC in: 1 week
2012-04-13 20:22:08 +00:00
Oleksandr Tymoshenko
457c7edfbd Enable build of DTrace-related userland parts for MIPS 2012-03-24 05:29:07 +00:00
Oleksandr Tymoshenko
51df478cba Add stub file for pid probe. It's required although pid probe is not supported
on MIPS yet
2012-03-24 05:27:39 +00:00
Oleksandr Tymoshenko
a6425ab52d Maintain target's byte order for multi-byte fields in CTF structures.
CTF format is not cross-platform by design, e.g. it is not guaranteed
that data generated by ctfconvert/ctfmerge on one architecture will
be successfuly read on another. CTF structures are saved/restored
using naive approach. Roughly it looks like:
	write(fd, &ctf_struct, sizeof(ctf_struct))
	read(fd, &ctf_struct, sizeof(ctf_struct))

By sheer luck memory layout of all type-related CTF structures is the same
on amd64/i386/mips32/mips64. It's different on ARM though. sparc, ia64,
powerpc, and powerpc64 were not tested. So in order to get file compatible
with dtrace on ARM it should be compiled on ARM. Alternative solution would
be to have "signatures" for every platform and ctfmerge should convert host's
reperesentation of CTF structure to target's one using "signature" as template.

This patch checks byte order of ELF files used for generating CTF record
and makes sure that byte order of data written to resulting files is the same
as target's byte order.
2012-03-24 01:47:33 +00:00
Martin Matuska
e7af90ab00 Analogous to r232059, add a parameter for the ZFS file system:
allow.mount.zfs:
	allow mounting the zfs filesystem inside a jail

This way the permssions for mounting all current VFCF_JAIL filesystems
inside a jail are controlled wia allow.mount.* jail parameters.

Update sysctl descriptions.
Update jail(8) and zfs(8) manpages.

TODO:	document the connection of allow.mount.* and VFCF_JAIL for kernel
	developers

MFC after:	10 days
2012-02-26 16:30:39 +00:00
Martin Matuska
dd7f80a359 Import illumos changeset 13608 [1]:
add support for "-t <datatype>" argument to zfs get

References:
https://www.illumos.org/issues/1936

Update zfs(8) manpage in respect of [1].
Fix typo in zfs(8) manpage.

Obtained from:	illumos (issue #1936)
MFC after:	1 week
2012-02-23 19:13:19 +00:00
Martin Matuska
ae5458e1fb Merge illumos revision 13594:
uninitialized variables in zfs(8) may make snapshots undestroyable [1]

References:
https://www.illumos.org/issues/2067 [1]

Obtained from:	illumos (issue #2067)
MFC after:	3 days
2012-02-07 18:35:18 +00:00
Pedro F. Giffuni
a3681f9010 Set SVN text/plain property for some shell scripts that
happen to have a .exe extension.

While here fix the shebang of a shell script that
was looking for /bin/bash.

Reviewed by:	gnn
Approved by:	jhb (mentor)
MFC after:	2 weeks
2012-01-28 00:17:17 +00:00
Kip Macy
7dc322fa14 add KM_NODEBUG needed by ARC buffer core dump exclusion change 2012-01-27 22:24:03 +00:00
Martin Matuska
538251bbf6 Merge illumos revisions 13572, 13573, 13574:
Rev. 13572:
disk sync write perf regression when slog is used post oi_148 [1]

Rev. 13573:
crash during reguid causes stale config [2]
allow and unallow missing from zpool history since removal of pyzfs [5]

Rev. 13574:
leaking a vdev when removing an l2cache device [3]
memory leak when adding a file-based l2arc device [4]
leak in ZFS from metaslab_group_create and zfs_ereport_checksum [6]

References:
https://www.illumos.org/issues/1909 [1]
https://www.illumos.org/issues/1949 [2]
https://www.illumos.org/issues/1951 [3]
https://www.illumos.org/issues/1952 [4]
https://www.illumos.org/issues/1953 [5]
https://www.illumos.org/issues/1954 [6]

Obtained from:	illumos (issues #1909, #1949, #1951, #1952, #1953, #1954)
MFC after:	2 weeks
2012-01-24 23:09:54 +00:00
Martin Matuska
3742a70580 Merge illumos revisions 13540, 13562:
illumos rev 13540 [1]:
Removal of pyzfs broke delegation for volumes

illumos rev 13562 [2]:
zfs allow arguments not parsed correctly after pyzfs removal

References:
https://www.illumos.org/issues/1726 [1]
https://www.illumos.org/issues/1977 [2]

Obtained from:	illumos (issues #1726, #1977)
MFC after:	1 week
2012-01-22 08:06:36 +00:00
Pawel Jakub Dawidek
1698a6aec9 Dramatically optimize listing snapshots when user requests only snapshot
names and wants to sort them by name, ie. when executes:

	# zfs list -t snapshot -o name -s name

Because only name is needed we don't have to read all snapshot properties.

Below you can find how long does it take to list 34509 snapshots from a single
disk pool before and after this change with cold and warm cache:

before:

	# time zfs list -t snapshot -o name -s name > /dev/null
	cold cache: 525s
	warm cache: 218s

after:

	# time zfs list -t snapshot -o name -s name > /dev/null
	cold cache: 1.7s
	warm cache: 1.1s

MFC after:	1 week
2012-01-21 21:12:53 +00:00
Martin Matuska
08acd455f3 Add one more copyright line accidentially removed in r228103
MFC after:	3 days
2012-01-20 22:56:57 +00:00
Martin Matuska
f622fcd083 Add accidentially removed copyright lines in r228103
Reported by:	pjd
MFC after:	3 days
2012-01-20 22:55:16 +00:00
Pawel Jakub Dawidek
d8e3baac46 Add missing file permission to open(O_CREAT) call. This doesn't really matter
here, as we open /dev/null for test purposes, but it is useful for consistency
and further grepping for such bugs.
2012-01-04 07:25:10 +00:00
Dimitry Andric
1dcc79e3e8 In cddl/contrib/opensolaris/cmd/dtrace/dtrace.c, fix some obtuse
snprintf tricks.

MFC after:	1 week
2011-12-16 21:48:09 +00:00
Dimitry Andric
1e02cf9b8c In cddl/contrib/opensolaris/tools/ctf/cvt/ctfmerge.c, a size_t is passed
to fprintf as a field width.  It should be an int instead, so cast it.

MFC after:	1 week
2011-12-16 21:29:46 +00:00
Dimitry Andric
edf500a77a In cddl/contrib/opensolaris/lib/libdtrace/common/dt_handle.c, some
uint64_t values are snprintf'd using %llx.  On amd64, uint64_t is
typedef'd as unsigned long, so cast the values to u_longlong_t, as is
done similarly in the rest of the file.

MFC after:	1 week
2011-12-16 15:12:42 +00:00
Dimitry Andric
8ac4e8ebc3 In cddl/contrib/opensolaris/lib/libdtrace/common/dt_consume.c, some
uint64_t values are snprintf'd using %llx.  On amd64, uint64_t is
typedef'd as unsigned long, so cast the values to u_longlong_t, as is
done similarly in the rest of the file.

MFC after:	1 week
2011-12-16 15:04:47 +00:00
Dimitry Andric
6d9bf0940c In cddl/contrib/opensolaris/lib/libdtrace/common/dt_subr.c, the
dt_popc() function assumes that either _ILP32 or _LP64 is defined,
otherwise it has no suitable implementation.

However, the _ILP32 and _LP64 macros come from isa_defs.h, which is not
included in this file.  Add the include now, to get the macros defined.

MFC after:	1 week
2011-12-15 23:06:46 +00:00
Dimitry Andric
8b6b79ce0a In cddl/contrib/opensolaris/lib/libdtrace/common/dt_link.c, use the
correct printf format for a key_t (aka long).

MFC after:	1 week
2011-12-15 22:46:04 +00:00
Dimitry Andric
bb15ca603f In cddl/contrib/opensolaris/lib/libdtrace/i386/dt_isadep.c, use the
correct printf format for an unsigned long.

MFC after:	1 week
2011-12-15 22:37:33 +00:00
Dimitry Andric
a2f16036af Cast away a clang alignment warning in drti.c's fixsymbol() function.
This code only runs on i386 and amd64, so there should be no problems if
buf + sec->dofs_offset is not aligned (which is unlikely anyway).

MFC after:	1 week
2011-12-15 22:10:27 +00:00
Martin Matuska
e98defd763 Some mdoc(7) style and typo fixes to zfs(8).
Submitted by:	Nobuyuki Koganemaru <n-kogane@syd.odn.ne.jp>
MFC after:	3 days
2011-12-08 19:38:42 +00:00
Martin Matuska
53aaf50a19 Remove unnecesary "Ns" macros and add missing command example to zpool(8).
Reported by:	Nobuyuki Koganemaru <kogane@FreeBSD.org>
MFC after:	3 days
2011-12-02 19:56:46 +00:00
Martin Matuska
2f7f0f4112 Merge new ZFS features from illumos:
1644 add ZFS "clones" property
https://www.illumos.org/issues/1644

1645 add ZFS "written" and "written@..." properties
https://www.illumos.org/issues/1645

1646 "zfs send" should estimate size of stream
https://www.illumos.org/issues/1646

1647 "zfs destroy" should determine space reclaimed by destroying multiple
snapshots
https://www.illumos.org/issues/1647

1693 persistent 'comment' field for a zpool
https://www.illumos.org/issues/1693

1708 adjust size of zpool history data
https://www.illumos.org/issues/1708

1748 desire support for reguid in zfs
https://www.illumos.org/issues/1748

Obtained from:	illumos (changesets 13514, 13524, 13525)
MFC after:	1 month
2011-11-28 21:40:00 +00:00
Robert Watson
d04fbf251a Change the Makefile in cddl/lib/drti to use bsd.lib.mk instead of
bsd.prog.mk -- we need to compile PIC, which requires a library build.
With this change, USDT (userspace DTrace probes) work from within
shared libraries.

PR:		kern/159046
Submitted by:	Alex Samorukov <samm at os2.kiev.ua>
Comments by:	Scott Lystig Fritchie <slfritchie at snookles.com>
MFC after:	3 days
2011-11-28 10:01:36 +00:00
Martin Matuska
582b6b0935 Use singular form for zfs destroy snapshot in zfs(8).
MFC after:	6 days
2011-11-28 09:33:13 +00:00
Martin Matuska
4aaac65b91 Add missing warning to zfs(8) for using "zfs destroy" with -r and -R flags.
Obtained from:	illumos
MFC after:	6 days
2011-11-28 09:14:51 +00:00
Martin Matuska
f8aac6c95c Add missing -n flag to "zpool import" description.
MFC after:	1 week
2011-11-27 20:24:07 +00:00
Martin Matuska
3499bfff6e Fix zfs(8) and zpool(8) context help to repport supported flags.
MFC after:	3 days
2011-11-27 11:46:09 +00:00
Martin Matuska
65dc99e43c Update ZFS manual pages to a mdoc(7) reimplementation.
The zfs(8) and zpool(8) manual pages now match the state of the ZFS module
and have been customized for FreeBSD.

The new texts of the "Deduplication" subsection in zfs(8), the zpool "split"
command, the zfs "dedup" property and several other missing parts have been
added from illumos or OpenSolaris snv_134 (CDDL-licensed).

The mdoc(7) reimplementation of whole manual pages, the descriptions of the
zpool "readonly" property, "zfs diff" command and descriptions of several
other missing command flags and/or options were authored by myself.

MFC after:	1 week
2011-11-27 11:44:20 +00:00
Martin Matuska
742bbc55b0 Revert back to revision 227649 because of license uncertainity.
Manual pages from OpenSolaris svn_134 are still properly CDDL licensed
but I have been informed that the parts from s11ex are uncertain even
if they contain a CDDL header.
2011-11-21 20:33:18 +00:00
Martin Matuska
229993893b Fix mismerge in copyright of zpool(8).
MFC after:	4 days
2011-11-21 15:33:37 +00:00
Martin Matuska
13d9e981ad Update zfs(8) and zpool(8) manpages from CDDL-licensed sources [1].
Improved alignment for a maximum width of 80 characters.
Mark unsupported parts as such.

Reported to vendor:	Illumos issue #1801

References:
https://www.illumos.org/issues/1801

Obtained from:	OpenSolaris CDDL manual pages (snv_134, s11express) [1]
MFC after:	4 days
2011-11-21 15:26:20 +00:00
Martin Matuska
fad432004a For now, remove MANFILTER from ZFS manpages (bad effect on html output).
MFC after:	4 days
2011-11-21 14:50:17 +00:00
Martin Matuska
9e134d91bf Update and desolarization of zdb(8) and zstreamdump(1) manual pages:
- synchronized to match new vendor code [1]
- removed ATTRIBUTES sections
- updated SEE ALSO sections
- properly updated copyright information (required by CDDL)
- remove empty lines via MANFILTER

Obtained from:	Illumos [1]
MFC after:	5 days
2011-11-20 13:11:29 +00:00
Martin Matuska
e8ca9d33da More zfs(8) manpage fixes:
- remove shareiscsi property
- mark casesensitivity property as unsupported
- remove reference to Solaris Administration Guide

MFC after:	1 week
2011-11-18 02:25:54 +00:00
Martin Matuska
c4cf7c3d10 Fix reference to fsync(2).
Add more references to SEE ALSO section.

MFC after:	1 week
2011-11-18 02:06:09 +00:00
Martin Matuska
95fe8b4c65 Update and desolarization of zfs(8) and zpool(8) manual pages:
- synchronized to match new vendor code (Illumos rev. 13513) [1]
- removed references to sun commands (replaced with FreeBSD commands)
- removed ATTRIBUTES sections
- updated SEE ALSO sections
- properly updated copyright information (required by CDDL)
- remove empty lines via MANFILTER

zfs(8) only:
- replaced "Zones" section with new "Jails" section
- removed misleading "ZFS Volumes as Swap or Dump Devices" section
- updated shareiscsi and sharesmb option information (not supported on FreeBSD)
- replace zoned property with jailed property

zpool(8) only:
- updated device names in examples

Obtained from:	Illumos (as of rev. 13513:f84d4672fdbd) [1]
MFC after:	1 week
2011-11-18 01:28:52 +00:00
Martin Matuska
3cfcf4ce74 Import upstream changesets for the output of the "zpool" command:
952 separate intent logs should be obvious in 'zpool iostat' output
1337 `zpool status -D' should tell if there are no DDT entries

References:
https://www.illumos.org/issues/952
https://www.illumos.org/issues/1337

Obtained from:	Illumos (issues 952, 1337; changesets 13384, 13432)
MFC after:	1 week
2011-11-14 08:29:49 +00:00
Robert Millan
3536206713 Fix a few gratuitous library dependencies. Some of the ZFS utilities
are linked with libraries they don't use:

 - zinject doesn't use libavl
 - ztest doesn't use libz
 - zdb uses neither libavl nor libz
 - zfs uses neither libbsdxml nor libm, nor libsbuf
 - zpool uses neither libbsdxml nor libm, nor libsbuf

In addition, libzfs needs libm because it uses pow(), however it isn't
linked with -lm.  This went unnoticed because all its users had -lm before.

Reviewed by:	pjd, mm
Approved by:	kib (mentor)
MFC after:	1 week
2011-10-30 16:29:04 +00:00
Pawel Jakub Dawidek
8411337f94 Update copyright to include myself.
MFC after:	2 weeks
2011-10-24 21:22:55 +00:00
Pawel Jakub Dawidek
3ebce5e218 Extend r226676 to allow rename without unmount even for file systems with
non-legacy mountpoints. It is better to be able to rename such file systems and
let them be mounted in old places until next reboot than using live CD, etc. to
rename with remount.

This is implemented by adding -u option to 'zfs rename'. If file system's
mountpoint property is set to 'legacy' or 'none', there is no need to specify -u.

Update zfs(8) manual page to reflect this addition.

MFC after:	2 weeks
2011-10-24 21:14:50 +00:00
Pawel Jakub Dawidek
497b7ef946 Allow to rename file systems without remounting if it is possible.
It is possible for file systems with 'mountpoint' preperty set to 'legacy'
or 'none' - we don't have to change mount directory for them.
Currently such file systems are unmounted on rename and not even mounted back.

This introduces layering violation, as we need to update 'f_mntfromname'
field in statfs structure related to mountpoint (for the dataset we are
renaming and all its children).

In my opinion it is worth it, as it allow to update FreeBSD in even cleaner
way - in ZFS-only configuration root file system is ZFS file system with
'mountpoint' property set to 'legacy'. If root dataset is named system/rootfs,
we can snapshot it (system/rootfs@upgrade), clone it (system/oldrootfs),
update FreeBSD and if it doesn't boot we can boot back from system/oldrootfs
and rename it back to system/rootfs while it is mounted as /. Before it was
not possible, because unmounting / was not possible.

MFC after:	2 weeks
2011-10-24 00:38:09 +00:00
Pawel Jakub Dawidek
2128d22f17 zdb: access dp_free_bpobj only if pool version is >= SPA_VERSION_DEADLISTS
Submitted by:	avg
MFC after:	3 days
2011-10-21 13:56:17 +00:00
Pawel Jakub Dawidek
7149ddc1d3 thr_create: new_thread_ID may be NULL
Submitted by:	avg
MFC after:	3 days
2011-10-21 13:54:58 +00:00
Pawel Jakub Dawidek
7c833ba2d6 libzpool task_alloc: pass only valid flags to kmem_alloc
tqflags may contain other flags besided those that are suitable for
kmem_alloc == umem_alloc

Submitted by:	avg
MFC after:	3 days
2011-10-21 13:53:06 +00:00
Pawel Jakub Dawidek
4b80fe0308 Make all the lines align properly.
MFC after:	3 days
2011-10-20 21:01:50 +00:00
Martin Matuska
91109eb1c8 Remove assertion that prevents zfs rename of datasets with mountpoint=none
or mountpoint=legacy that have children datasets. This also fixes dataset
rename when receiving incremental snapshots as reported on freebsd-fs@

This assertion was made triggerable by opensolaris change #10196.

PR:		bin/160400
Reviewed by:	pjd
MFC after:	1 week
2011-09-28 11:57:10 +00:00
Martin Matuska
4e1407c428 Fix serious bug in ZIL that can lead to pool corruption
in the case of a held dataset during remount.

Detailed description is available at:
https://www.illumos.org/issues/883

illumos-gate revision:	13380:161b964a0e10

Reviewed by:	pjd
Approved by:	re (kib)
Obtained from:	Illumos (Bug #883)
MFC after:	3 days
2011-07-30 19:00:31 +00:00
Martin Matuska
3036062f0c Fix wrong initialization of "cmd" for calling the jail/unjail ioctl.
Reviewed by:	pjd@, delphij@
Approved by:	re (kib)
MFC after:	3 days
2011-07-30 17:44:06 +00:00
Martin Matuska
1bc399c4b1 ZFS tries to allocate blocks evenly across all devices. This means when
devices are imbalanced zfs will lots of CPU searching for space on devices
which tend to be pretty full. It should instead fail quickly on the full
devices and move onto devices which have more availability.

New loader tunable: vfs.zfs.mg_alloc_failures (min = 8)

Illumos-gate changeset:	13379:4df42cc92254

Obtained from:	Illumos (Bug #1051)
MFC after:	2 weeks
2011-07-18 08:29:49 +00:00
Martin Matuska
3ded43e7b7 Resurrect the ZFS "aclmode" property
Change default of "aclmode" to "discard".

Illumos-gate changeset:	13370:8c04143bd318

Obtained from:	Illumos (Feature #742)
MFC after:	2 weeks
2011-07-18 07:16:44 +00:00
Justin T. Gibbs
e96cf39826 cddl/contrib/opensolaris/cmd/zpool/zpool_main.c:
cddl/contrib/opensolaris/cmd/zpool/zpool.8:
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c:
	Add the "zpool labelclear" command.  This command can be
	used to wipe the label data from a drive that is not
	active in a pool.  The optional "-f" argument can be
	used to treat an exported or foreign vdev as "inactive"
	thus allowing its label information to be cleared.
2011-07-18 03:18:06 +00:00
Justin T. Gibbs
d7a00114ea Correct reporting of missing leaf vdevs so that the GUID required to
perform pool actions is always displayed.

cddl/contrib/opensolaris/cmd/zpool/zpool_main.c:
	The "zpool status" command reports the "last seen at"
	device node path when the vdev name is being reported
	by GUID.  Augment this code to assume a GUID is reported
	when a device goes missing after initial boot in addition
	to the previous behavior of doing this for devices that
	aren't seen at boot.

cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c:
	In zpool_vdev_name(), report recently missing devices
	by GUID.  There is no guarantee they will return at
	their previous location.
2011-07-18 03:00:59 +00:00
Justin T. Gibbs
6c1942802d cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h:
cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c:
	o Add zpool_pool_state_to_name() API to libzfs which converts a
	  pool_state_t into a user consumable string.
	o While here, correct constness of make zpool_state_to_name()
	  and zpool_label_disk().

MFD after: 1 week
2011-07-18 02:13:21 +00:00
Martin Matuska
fbfed0cda6 Add a new "REFCOMPRESSRATIO" property.
For snapshots, this is the same as COMPRESSRATIO, but for
filesystems/volumes, the COMPRESSRATIO is based on the data "USED" (ie,
includes blocks in children, but not blocks shared with the origin).

This is needed to figure out how much space a filesystem would use if it
were not compressed (ignoring snapshots).

Illumos-gate revision:	13387

Obtained from:	Illumos (Feature #1092)
MFC after:	2 weeks
2011-06-28 07:52:01 +00:00
Martin Matuska
855c382417 Allow mountpoints as arguments for the 'zfs get' command.
Illumos-gate revision:	13295

Obtained from:	Illumos (Feature #510)
MFC after:	1 week
2011-06-28 06:16:33 +00:00
Simon L. B. Nielsen
86f222bbfe Do not use #warning to warn about missing implementation of dt_popc(),
but just have a comment that this is broken.

This is just a bandaid until somebody can fix this correctly.  The code
is just a broken as it was before r223262 - now buildworld just doesn't
fail.

Tested by:	i386 + amd64 buildworld
With hat:	benl co-mentor
2011-06-19 12:52:50 +00:00
Ben Laurie
5f301949ef Fix clang warnings.
Approved by:	philip (mentor)
2011-06-18 13:56:33 +00:00
Justin T. Gibbs
1c3bf59584 Remove C constructs that are incompatible with C++ from various
OpenSolaris and ZFS header files.  These changes are sufficient
to allow a C++ program to use the libzfs library.

Note: The majority of these files already included 'extern "C"'
      declarations, so the intention of providing C++ compatibility
      already existed even if it wasn't provided.

cddl/compat/opensolaris/include/assert.h:
	Wrap our compatibility assert implementation in
	'extern "C"'.  Since this is a compatibility header
	I matched the Solaris style of doing this explicitly
	rather than rely on FreeBSD's __BEGIN/END_DECLS macro.

sys/cddl/compat/opensolaris/sys/kstat.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/ddt.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h:
sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h:
	Rename parameters in function declarations that conflict
	with C++ keywords.  This was the solution preferred by
	members of the Illumos community.

sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h:
	In C, nested structures are visible in the global namespace,
	but in C++, they take on the namespace of the structure in
	which they are contained.  Flatten nested structure
	definitions within struct zfs_cmd so these structures are
	visible in the global namespace when compiled in both
	languages.

Sponsored by:	 Spectra Logic Corporation
2011-06-10 20:10:30 +00:00
Will Andrews
a194c9f709 Close a race between libzfs and mountd when updating NFS exports.
- Flush the file descriptor for the new ZFS exports file before
  sending a SIGHUP to mountd.

Reviewed by:	pjd
Approved by:	ken
MFC after:	3 days
2011-05-26 16:27:00 +00:00
Jaakko Heinonen
26a8da6632 Don't pass empty mount options to nmount(2).
Reviewed by:	pjd
MFC after:	2 weeks
2011-05-03 16:00:26 +00:00
Pawel Jakub Dawidek
73aab6768c Fix 'zfs list <path>' handling. If the path was found, the 'ret' variable was
uninitialized.

PR:		kern/155940
Submitted by:	KOIE Hidetaka <koie@suri.co.jp>
MFC after:	1 week
2011-04-12 20:31:33 +00:00
Pawel Jakub Dawidek
939f98dd4d Properly print characters larger than 127.
Submitted by:	noordsij <noordsij@cs.helsinki.fi>
Reviewed by:	Eric Schrock <eric.schrock@delphix.com>
MFC after:	1 month
2011-03-24 14:12:41 +00:00
Pawel Jakub Dawidek
10b9d77bf1 Finally... Import the latest open-source ZFS version - (SPA) 28.
Few new things available from now on:

- Data deduplication.
- Triple parity RAIDZ (RAIDZ3).
- zfs diff.
- zpool split.
- Snapshot holds.
- zpool import -F. Allows to rewind corrupted pool to earlier
  transaction group.
- Possibility to import pool in read-only mode.

MFC after:	1 month
2011-02-27 19:41:40 +00:00
Dimitry Andric
38d82872c6 When building libzpool on ia64 or sparc64, don't add the .note.GNU-stack
section.

Submitted by:	kib
2011-02-15 22:28:15 +00:00
Dimitry Andric
152e60f2fe Fix some leftover binaries and shared libraries in the system that still
have an executable stack, due to linking in hand-assembled .S or .s
files, that have no .GNU-stack sections:

RWX --- ---  /lib/libcrypto.so.6
RWX --- ---  /lib/libmd.so.5
RWX --- ---  /lib/libz.so.6
RWX --- ---  /lib/libzpool.so.2
RWX --- ---  /usr/lib/liblzma.so.5

These were found using scanelf, from the sysutils/pax-utils port.

Reviewed by:	kib
2011-02-15 22:03:09 +00:00
Matthew D Fleming
e704482d43 Re-commit the zfs sysctl(9) type-safety changes.
Thanks to dim and pjd for the pointer to zfs_context.h for building
userland.
2011-01-13 18:20:19 +00:00
Martin Matuska
055731ce60 Print message with information about updating the boot code if a new
vdev is attached to a root pool (e.g. when creating a mirrored boot pool).

Reviewed by:	pav
Approved by:	delphij (mentor)
MFC after:	3 days
2010-12-08 13:51:25 +00:00
Martin Matuska
60a7e0c3cb Do not print OpenSolaris hint to use (non-existing) installgrub(1) command
if creating a mirror by attaching a new vdev to a root pool.

Reported by:	James R. Van Artsdalen (on freebsd-fs@freebsd.org)
Approved by:	delphij (mentor)
MFC after:	3 days
2010-12-08 08:57:37 +00:00
Mark Murray
f0a0ad3b58 Do not lint code beyond necessity (with apologies to Wiliam of Ockham).
Don't lint externally maintained CDDL code, or relint the 32-bit libraries
in amd64 mode.
2010-11-18 16:32:52 +00:00
Pawel Jakub Dawidek
adea29ab75 Fix ztest when it is executed by just 'ztest' and not by full path
'/usr/bin/ztest'.
2010-11-01 10:42:14 +00:00
Pawel Jakub Dawidek
1cc1967893 1. Remove invalid assertion.
2. Properly recalculate delta in case pthread_cond_timedwait() is interrupted.
3. Style fix.

Reported by:	[1] App Deb <appdebgr@gmail.com>
2010-11-01 10:41:05 +00:00
Rui Paulo
8399e5f307 Use ${PICFLAG} instead of -fpic. 2010-10-27 18:46:56 +00:00
Martin Matuska
aa007a9f0e Properly handle IO with B_FAILFAST
Retry IO once with ZIO_FLAG_TRYHARD before declaring a pool faulted

OpenSolaris revision and Bug IDs:

9725:0bf7402e8022
6843014 ZFS B_FAILFAST handling is broken

Approved by:	delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6843014)
MFC after:	3 weeks
2010-09-27 09:42:31 +00:00
Martin Matuska
96a1a6a568 Enable offlining of log devices.
OpenSolaris revision and Bug IDs:

9701:cc5b64682e64
6803605	should be able to offline log devices
6726045	vdev_deflate_ratio is not set when offlining a log device
6599442	zpool import has faults in the display

Approved by:	delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6803605, 6726045, 6599442)
MFC after:	3 weeks
2010-09-27 09:05:51 +00:00
Christian Brueffer
bed6f18493 Minor grammar fixes. 2010-09-21 21:07:46 +00:00
Martin Matuska
5ab44ccaf2 Remove duplicate include of <strings.h>
Approved by:	delphij (mentor)
MFC after:	3 days
2010-09-17 14:15:03 +00:00
Rui Paulo
8518caf2a7 Add a man page for plockstat.
Sponsored by:	The FreeBSD Foundation
2010-09-15 10:18:18 +00:00
Rui Paulo
7879263397 Give a chance to the target binary to run the ctors by waiting until it
has reached main(). This allows plockstat to work.

Sponsored by:	The FreeBSD Foundation
2010-09-12 15:59:14 +00:00
Rui Paulo
dba0ac63fb Disable debug by default.
Sponsored by:	The FreeBSD Foundation
2010-09-11 10:16:15 +00:00
Rui Paulo
acac60bbfe Don't try to map the USDT probes. This is necessary because there is no
__SUNW_dof symbol present in FreeBSD binaries.

Sponsored by:	The FreeBSD Foundation
2010-09-10 12:16:24 +00:00
Rui Paulo
37c380fbb5 Don't clobber an existing target object file when doing the DTrace
linking process. This is needed because we change the source object
files and the second this dtrace -G is run, no probes will be found.
This hack allows us to build postgres with DTrace probes enabled. I'll
try to find a way to fix this without needing this hack.

Sponsored by:	The FreeBSD Foundation
2010-09-09 11:10:15 +00:00
Rui Paulo
8f7264f0e3 Include <sys/sdt.h> on a generated header.
Sponsored by:	The FreeBSD Foundation
2010-09-01 11:27:09 +00:00
Pawel Jakub Dawidek
81bbc7f749 Eliminate confusing while () loop. In the first version of the code it was
there to avoid gotos, but in the current version it serves no purpose.

MFC after:	2 weeks
2010-08-31 19:01:46 +00:00