Commit Graph

470 Commits

Author SHA1 Message Date
Pawel Jakub Dawidek
837a617728 Eliminate 'where' argument, we don't use it.
MFC after:	3 days
2012-05-29 18:09:14 +00:00
Pawel Jakub Dawidek
8ac2669cc8 Remove unused variable.
MFC after:	3 days
2012-05-29 18:05:24 +00:00
Pawel Jakub Dawidek
e21c77d804 Remove unused sysctl.
MFC after:	3 days
2012-05-29 17:53:11 +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
Edward Tomasz Napierala
9280affe16 Fix enforcement of file size limit with O_APPEND on ZFS.
vn_rlimit_fsize takes uio->uio_offset and uio->uio_resid into account
when determining whether given write would exceed RLIMIT_FSIZE.

When APPEND flag is specified, ZFS updates uio->uio_offset to point to the
end of file.

But this happens after a call to vn_rlimit_fsize, so vn_rlimit_fsize check
can be rendered ineffective by thread that opens some file with O_APPEND
and lseeks below RLIMIT_FSIZE before calling write.

Submitted by:	Mateusz Guzik <mjguzik at gmail dot com>
MFC after:	2 weeks
2012-05-22 10:54:42 +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
Marius Strobl
35225ae651 Partially revert r232938; ZFS only requires nfs4 but not posix1e.
Submitted by:	jhb
2012-04-29 16:21:47 +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
Edward Tomasz Napierala
af6e6b87ad Remove unused thread argument to vrecycle().
Reviewed by:	kib
2012-04-23 14:10:34 +00:00
Attilio Rao
a0f2c37b6f - Introduce a cache-miss optimization for consistency with other
accesses of the cache member of vm_object objects.
- Use novel vm_page_is_cached() for checks outside of the vm subsystem.

Reviewed by:	alc
MFC after:	2 weeks
X-MFC:		r234039
2012-04-09 17:05:18 +00:00
Andriy Gapon
70542ee01f zfs_ioctl: no need for ddi_copyin/out here because sys_ioctl handles that
On FreeBSD the direct ioctl argument is automatically copied in/out
as necesary by the kernel ioctl entry point.

PR:		kern/164445
Submitted by:	Luis Garces-Erice <lge@ieee.org>
Tested by:	Attila Nagy <bra@fsn.hu>
MFC after:	5 days
2012-04-05 07:59:59 +00:00
Oleksandr Tymoshenko
5083ce5c09 Add MIPS support to cddl/contrib part:
- header and stub .c file for fasttrap module. It's not supported on
    MIPS yet, but there is no way to disable support completely
- Do as amd64 trying to limit allocated memory
2012-03-24 04:52:18 +00:00
Adrian Chadd
368a79ddd0 Add dependencies onto acl_posix1e and acl_nfs4. 2012-03-13 20:29:04 +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
4ee8a13704 Revert r230913 and r230914.
The initialization was correct, the problem needs deeper analysis.
2012-02-03 13:40:51 +00:00
Martin Matuska
8b152ded1c Add copyright information on last commits to comply with CDDL.
Discussed with:	pluknet@
MFC after:	3 days
2012-02-02 16:33:58 +00:00
Martin Matuska
3ce26884ba Fix out of bounds write causing random panics,
uncovered by the change in r230256

Reviewed by:	pluknet@
MFC after:	3 days
2012-02-02 16:18:40 +00:00
Kip Macy
ad69d4e266 always exclude data bufs regardless of debug settings 2012-01-29 00:19:19 +00:00
Kip Macy
cc0021eb34 add tunable for developers working on areas outside of ZFS
to further reduce core size by excluding ARC metadata buffers
from core dumps
2012-01-28 17:41:42 +00:00
Kip Macy
263811f724 exclude kmem_alloc'ed ARC data buffers from kernel minidumps on amd64
excluding other allocations including UMA now entails the addition of
a single flag to kmem_alloc or uma zone create

Reviewed by:	alc, avg
MFC after:	2 weeks
2012-01-27 20:18:31 +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
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
Pawel Jakub Dawidek
b636ebaa6a By default turn off prefetch when listing snapshots.
In my tests it makes listing snapshots 19% faster with cold cache and
47% faster with warm cache.

MFC after:	1 week
2012-01-20 22:04:59 +00:00
Sergey Kandaurov
37c2842272 Fix the "lock &zrl->zr_mtx already initialized" assertion by initializing
the allocated memory before calling mtx_init(9) on mtx pointing to it.
Otherwize, random contents of uninitialized memory might occasionally
trigger the assertion.

Reported by:	Pavel Polyakov <bsd kobyla org>
Reviewed by:	pjd
MFC after:	1 week
2012-01-17 06:23:25 +00:00
Pawel Jakub Dawidek
62859c9061 - Allow to change vfs.zfs.arc_meta_limit at runtime.
- Change vfs.zfs.arc_meta_used from CTLFLAG_RDTUN to CTLFLAG_RD, as it is
  not a tunable.

MFC after:	3 days
2012-01-05 22:16:41 +00:00
Dimitry Andric
a5988eb997 In sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c, check the
the number of links against LINK_MAX (which is INT16_MAX), not against
UINT32_MAX.  Otherwise, the constant would implicitly be converted to
-1.

Reviewed by:	pjd
MFC after:	1 week
2012-01-03 20:53:07 +00:00
Pawel Jakub Dawidek
bb265163b2 From time to time people report space map corruption resulting in panic
(ss == NULL) on pool import. I had such a panic recently. With current version
of ZFS it is still possible to import the pool in readonly mode and backup
all the data, but in case it is impossible for some reason add tunable
vfs.zfs.space_map_last_hope, which when set to '1' will tell ZFS to remove
colliding range and retry. This seems to have worked for me, but I consider
it highly risky to use.

MFC after:	1 week
2011-12-18 12:27:45 +00:00
Pawel Jakub Dawidek
efe17e5a28 Implement replying of ACLs updates. ACL changes should go to ZIL only
if the 'sync' property is set to 'always', so replying them is not common.

MFC after:	1 month
2011-12-18 12:19:03 +00:00
Attilio Rao
77befd1d23 Revert the approach for skipping lockstat_probe_func call when doing
lock_success/lock_failure, introduced in r228424, by directly skipping
in dtrace_probe.

This mainly helps in avoiding namespace pollution and thus lockstat.h
dependency by systm.h.

As an added bonus, this also helps in MFC case.
Reviewed by:	avg
MFC after:	3 months (or never)
X-MFC:		r228424
2011-12-12 23:29:32 +00:00
Pawel Jakub Dawidek
75c0e29ff3 Move ru_inblock increment into arc_read_nolock() so we don't account for
cached reads.

Discussed with:		gibbs
No objections from:	avg
Tested by:		Marcus Reid <marcus@blazingdot.com>
MFC after:		1 week
2011-12-10 13:02:52 +00:00
Pawel Jakub Dawidek
381962ee59 The vfs.zfs.txg.timeout sysctl can be safely modified at run time.
MFC after:	1 week
2011-12-09 18:22:57 +00:00
Martin Matuska
62e6ce9a4b Fix typo in copyright notice.
MFC after:	1 month
2011-11-28 21:42:31 +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
Konstantin Belousov
f82360acf2 Existing VOP_VPTOCNP() interface has a fatal flow that is critical for
nullfs.  The problem is that resulting vnode is only required to be
held on return from the successfull call to vop, instead of being
referenced.

Nullfs VOP_INACTIVE() method reclaims the vnode, which in combination
with the VOP_VPTOCNP() interface means that the directory vnode
returned from VOP_VPTOCNP() is reclaimed in advance, causing
vn_fullpath() to error with EBADF or like.

Change the interface for VOP_VPTOCNP(), now the dvp must be
referenced. Convert all in-tree implementations of VOP_VPTOCNP(),
which is trivial, because vhold(9) and vref(9) are similar in the
locking prerequisites. Out-of-tree fs implementation of VOP_VPTOCNP(),
if any, should have no trouble with the fix.

Tested by:	pho
Reviewed by:	mckusick
MFC after:	3 weeks (subject of re approval)
2011-11-19 07:50:49 +00:00
Ryan Stone
add89852d6 Replace fasttrap_copyout() with uwrite(). FreeBSD copyout() is not able to
write to the .text section of a process.

Obtained from:	rpaulo
MFC after:	3 days
2011-11-07 01:55:58 +00:00
Pawel Jakub Dawidek
df663c3dd3 Correct typo in comment.
Reported by:	Fabian Keil <fk@fabiankeil.de>
MFC after:	3 days
2011-11-05 16:44:25 +00:00
Pawel Jakub Dawidek
98dd1c40c4 In zvol_open() if the spa_namespace_lock is already held, it means that
ZFS is trying to open and taste ZVOL as its VDEV. This is not supported,
so return an error instead of panicing on spa_namespace_lock recursion.

Reported by:	Robert Millan <rmh@debian.org>
PR:		kern/162008
MFC after:	3 days
2011-11-05 16:29:03 +00:00
Martin Matuska
e1d4b72a2e Fix typo in copyright notice introduced in r226724
(missing character in e-mail adress)

Reported by:	pjd
MFC after:	3 days
2011-10-25 13:52:38 +00:00
Martin Matuska
571e19b341 Update copyright information in several ZFS files, as the clause 3.3
of the CDDL licence explicitly requires every Contributor to add
a copyright notice.

This also reflects the copyright notices for the changes recently
added by Illumos.

MFC after:	3 days
2011-10-25 08:35:30 +00:00
Pawel Jakub Dawidek
9782a86c85 - Use better naming now that we allow to rename any mounted file system (not
only legacy).
- Update copyright to include myself.

MFC after:	2 weeks
2011-10-24 21:31:53 +00:00
Pawel Jakub Dawidek
649bbd1cd0 Don't forget to rename mounted snapshots of the file system being renamed.
MFC after:	2 weeks
2011-10-24 20:41:31 +00:00
Pawel Jakub Dawidek
27fbc05657 Include <sys/zfs_vfsops.h> only when compiling kernel module.
MFC after:	2 weeks
2011-10-24 05:26:40 +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
72b880fa83 Update per-thread I/O statistics collection in ZFS.
This allows to see processes I/O activity in 'top -m io' output.

PR		kern/156218
Reported by:	Marcus Reid <marcus@blazingdot.com>
Patch by:	avg
MFC after:	3 days
2011-10-21 21:49:34 +00:00
Pawel Jakub Dawidek
b39ba076ec zfs vdev_file_io_start: validate vdev before using vdev_tsd
vdev_tsd can be NULL for certain vdev states.
At least in userland testing with ztest.

Submitted by:	avg
MFC after:	3 days
2011-10-21 14:00:48 +00:00
Martin Matuska
ceac02f8e6 Import fix for Illumos bug #1475 to reduce diff against upstream.
Panic caused by this bug was already partially fixed by pjd@
in p4 CH 185940 and 185942.

Reference:
1475 zfs spill block hold can access invalid spill blkptr
https://www.illumos.org/issues/1475

Reviewed by:	delphij
Obtained from:	Illumos (issue 1475, changeset 13469:b8e89e5c4167)
MFC after:	1 week
2011-10-18 13:58:22 +00:00
Xin LI
4aadb12e0b Fix a bug in sa_find_sizes() which could lead to panic:
When calculating space needed for SA_BONUS buffers,
hdrsize is always rounded up to next 8-aligned boundary.
However, in two places the round up was done against
sum of 'total' plus hdrsize.  On the other hand,
hdrsize increments by 4 each time, which means in
certain conditions, we would end up returning with
will_spill == 0 and (total + hdrsize) larger than
full_space, leading to a failed assertion because
it's invalid for dmu_set_bonus.

Sponsored by:	iXsystems, Inc.
Reviewed by:	mm
MFC after:	3 days
2011-10-17 22:23:27 +00:00
Kip Macy
8451d0dd78 In order to maximize the re-usability of kernel code in user space this
patch modifies makesyscalls.sh to prefix all of the non-compatibility
calls (e.g. not linux_, freebsd32_) with sys_ and updates the kernel
entry points and all places in the code that use them. It also
fixes an additional name space collision between the kernel function
psignal and the libc function of the same name by renaming the kernel
psignal kern_psignal(). By introducing this change now we will ease future
MFCs that change syscalls.

Reviewed by:	rwatson
Approved by:	re (bz)
2011-09-16 13:58:51 +00:00
Konstantin Belousov
3407fefef6 Split the vm_page flags PG_WRITEABLE and PG_REFERENCED into atomic
flags field. Updates to the atomic flags are performed using the atomic
ops on the containing word, do not require any vm lock to be held, and
are non-blocking. The vm_page_aflag_set(9) and vm_page_aflag_clear(9)
functions are provided to modify afalgs.

Document the changes to flags field to only require the page lock.

Introduce vm_page_reference(9) function to provide a stable KPI and
KBI for filesystems like tmpfs and zfs which need to mark a page as
referenced.

Reviewed by:    alc, attilio
Tested by:      marius, flo (sparc64); andreast (powerpc, powerpc64)
Approved by:	re (bz)
2011-09-06 10:30:11 +00:00