Commit Graph

159 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
Pawel Jakub Dawidek
0b88730662 When upgrading a pool which contain root file system, give user a hint that
he should update boot code.

MFC after:	2 weeks
2010-08-31 10:41:53 +00:00
Pawel Jakub Dawidek
d448e183aa Give user a hint what to do when /usr/lib/zfs/pyzfs.py is missing.
MFC after:	2 weeks
2010-08-29 20:25:25 +00:00
Pawel Jakub Dawidek
083b49f0dc Print errors on stderr.
MFC after:	2 weeks
2010-08-29 20:21:10 +00:00
Pawel Jakub Dawidek
4f1f4356f3 Fix 'zfs allow' (maybe not only) returning:
cannot access dataset system/usr/home: Operation not supported

by including libzfs_impl.h. What libzfs_impl.h does is to redefine ioctl() to
be compatible with OpenSolaris. More specifically OpenSolaris returns ENOMEM
when buffer is too small and sets field zc_nvlist_dst_size to the size that
will be big enough for the data. In FreeBSD case ioctl() doesn't copy data
structure back in case of a failure. We work-around it in kernel and libzfs by
returning 0 from ioctl() and always checking if zc_nvlist_dst_size hasn't
changed. For this work-around to work in pyzfs we need this compatible ioctl()
which is implemented in libzfs_impl.h.

MFC after:	2 weeks
2010-08-29 20:18:06 +00:00
Martin Matuska
abe5837f7c Update ZFS metaslab code from OpenSolaris.
This provides a noticeable write speedup, especially on pools with
less than 30% of free space.

Detailed information (OpenSolaris onnv changesets and Bug IDs):

11146:7e58f40bcb1c
6826241	Sync write IOPS drops dramatically during TXG sync
6869229	zfs should switch to shiny new metaslabs more frequently

11728:59fdb3b856f6
6918420	zdb -m has issues printing metaslab statistics

12047:7c1fcc8419ca
6917066	zfs block picking can be improved

Approved by:	delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6826241, 6869229, 6918420, 6917066)
MFC after:	2 weeks
2010-08-28 08:59:55 +00:00
Rui Paulo
482c9aa14d Port dtruss to FreeBSD.
Sponsored by:	The FreeBSD Foundation
2010-08-24 23:24:43 +00:00
Rui Paulo
025f9d5b15 Merge dtracetoolkit/dtruss from the vendor.
Sponsored by:	The FreeBSD Foundation
2010-08-24 23:17:30 +00:00
Rui Paulo
6544c91941 Port plockstat to FreeBSD. This will be connected to the build later.
Sponsored by:	The FreeBSD Foundation
2010-08-21 13:54:33 +00:00
Rui Paulo
0f2bd1e89d Add libdtrace support for tracing userland programs.
Summary of changes:
* Implement a compatibility shim between Solaris libproc and our
libproc and remove several ifdefs because of this.
* Port the drti to FreeBSD.
* Implement the missing DOODAD sections
* Link with libproc and librtld_db
* Support for ustack, jstack and uregs (by sson@)
* Misc bugfixing

When writing the SUWN_dof section, we had to resort to building the ELF
file layout by "hand". This is the job of libelf, but our libelf doesn't
support this yet. When libelf is fixed, we can remove the code under
#ifdef BROKEN_LIBELF.

Sponsored by:	The FreeBSD Foundation
2010-08-21 11:50:53 +00:00
Rui Paulo
b2db760808 Port most of the DTrace tests to FreeBSD.
Sponsored by:	The FreeBSD Foundation
2010-08-21 11:04:38 +00:00
Rui Paulo
afba0b6e9e Fix another mismerge: bring back the definition of DT_MUTEX_HELD(). 2010-08-02 17:31:48 +00:00
Rui Paulo
31a396ad47 Fix the result of a mismerge. MUTEX_HELD should be DT_MUTEX_HELD() and
Plmid() is not supposed to be called.
2010-08-02 17:20:59 +00:00
Rui Paulo
1670a1c2a4 MFV OpenSolaris DTrace userland bits. 2010-08-02 13:40:53 +00:00
Rui Paulo
1e634b7b65 proc_wait() was replaced by proc_wstatus(). Right now this call is
useless because userland support is not working on HEAD, but this makes
libdtrace compile again.

Sponsored by:	The FreeBSD Foundation
2010-07-31 17:23:37 +00:00