Commit Graph

448 Commits

Author SHA1 Message Date
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
Martin Matuska
82378711f9 Generalize ffs_pages_remove() into vn_pages_remove().
Remove mapped pages for all dataset vnodes in zfs_rezget() using
new vn_pages_remove() to fix mmapped files changed by
zfs rollback or zfs receive -F.

PR:		kern/160035, kern/156933
Reviewed by:	kib, pjd
Approved by:	re (kib)
MFC after:	1 week
2011-08-25 08:17:39 +00:00
Pawel Jakub Dawidek
4969b96e57 We need to unlock and destroy vnode attached to znode which we are freeing.
Reviewed by:	kib
Approved by:	re (bz)
MFC after:	1 week
2011-08-24 22:07:38 +00:00
Martin Matuska
6e1f1d4690 zfs_ioctl.c: improve code readability in zfs_ioc_dataset_list_next()
zvol.c: fix calling of dmu_objset_prefetch() in zvol_create_minors()
by passing full instead of relative dataset name and prefetching all
visible datasets to be processed later instead of just the pool name

Reviewed by:	pjd
Approved by:	re (kib)
MFC after:	1 week
> Reviewed by:   If someone else reviewed your modification.
> Approved by:   If you needed approval for this commit.
> Obtained from: If the change is from a third party.
> MFC after:     N [day[s]|week[s]|month[s]].  Request a reminder email.
> Security:      Vulnerability reference (one per line) or description.
> Empty fields above will be automatically removed.

M    opensolaris/uts/common/fs/zfs/zfs_ioctl.c
M    opensolaris/uts/common/fs/zfs/zvol.c
2011-08-13 21:35:22 +00:00
Martin Matuska
cc82ff1c96 Fix race between dmu_objset_prefetch() invoked from
zfs_ioc_dataset_list_next() and dsl_dir_destroy_check() indirectly
invoked from dmu_recv_existing_end() via dsl_dataset_destroy() by not
prefetching temporary clones, as these count as always inconsistent.
In addition, do not prefetch hidden datasets at all as we are not
going to process these later.

Filed as Illumos Bug #1346

PR:		kern/157728
Tested by:	Borja Marcos <borjam@sarenet.es>, mm
Reviewed by:	pjd
Approved by:	re (kib)
MFC after:	1 week
2011-08-13 10:58:53 +00:00
Pawel Jakub Dawidek
7b1085ba55 Eliminate the zfsdev_state_lock entirely and replace it with the
spa_namespace_lock. This fixes LOR between the spa_namespace_lock and
spa_config lock. LOR can cause deadlock on vdevs removal/insertion.

Reported by:	gibbs, delphij
Tested by:	delphij
Approved by:	re (kib)
MFC after:	1 week
2011-08-12 07:04:16 +00:00
Martin Matuska
d32cac295c Fix panic in zfs_read() if IO_SYNC flag supplied by checking for
zfsvfs->z_log before calling zil_commit(). [1]
Do not call zfs_read() from zfs_getextattr() with the IO_SYNC flag.

Submitted by:	Alexander Zagrebin <alex@zagrebin.ru> [1]
Reviewed by:	pjd@
Approved by:	re (kib)
MFC after:	3 days
2011-08-02 11:28:33 +00:00
Martin Matuska
ad4887a72a Fix integer overflow in txg_delay() by initializing
the variable "timeout" as clock_t.

Filed as Illumos Bug #1313

Reviewed by:	avg
Approved by:	re (kib)
MFC after:	3 days
2011-08-01 14:50:31 +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
Xin LI
101b7b5daa Bring the code more in-line with OpenSolaris source to
ease future port.

Reviewed by:	pjd, mm
Approved by:	re (kib)
2011-07-21 20:02:22 +00:00
Xin LI
b447d101fa A different implementation of r224231 proposed by pjd@,
which does not require change in the znode structure.
Specifically, it queries rdev from the znode in the
same sa_bulk_lookup already done in zfs_getattr().

Submitted by:	pjd (with some revisions)
Reviewed by:	pjd, mm
Approved by:	re (kib)
2011-07-21 20:01:51 +00:00
Xin LI
b1ad061e42 Add a new field to in-core znode, z_rdev, to represent device nodes.
PR:		kern/159010
Reviewed by:	mm@
Approved by:	re (kib)
MFC after:	2 weeks
2011-07-20 16:53:32 +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
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
85a418012f Disable vdev cache (readahead) by default.
The vdev cache is very underutilized (hit ratio 30%-70%) and may consume
excessive memory on systems with many vdevs.

Illumos-gate revision:	13346

Obtained from:	Illumos (Bug #175)
MFC after:	1 week
2011-06-28 06:32:35 +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
Martin Matuska
baa256da8c Silence notice on pool creation, import and access.
Suggested by:	Jeremy Chadwick (freebsd-stable@)
Discussed with:	pjd
MFC after:	1 week
2011-06-07 20:46:31 +00:00
Pawel Jakub Dawidek
b5a060dd8b Don't pass pointer to name buffer which is on the stack to another thread,
because the stack might be paged out once the other thread tries to use the
data. Instead, just allocate memory.

MFC after:	2 weeks
2011-05-24 20:10:12 +00:00
Pawel Jakub Dawidek
541c60d988 Don't access task structure once we call task function.
The task structure might be no longer available.
This also allows to eliminates the need for two tasks in the zio structure.

Submitted by:	anonymous
MFC after:	2 weeks
2011-05-24 20:07:15 +00:00
Rick Macklem
965e561750 Fix the zfs file system so that it uses the lock
flags argument added to VFS_FHTOVP() by r222167.

Reviewed by:	pjd
2011-05-22 21:04:32 +00:00
Rick Macklem
694a586a43 Add a lock flags argument to the VFS_FHTOVP() file system
method, so that callers can indicate the minimum vnode
locking requirement. This will allow some file systems to choose
to return a LK_SHARED locked vnode when LK_SHARED is specified
for the flags argument. This patch only adds the flag. It
does not change any file system to use it and all callers
specify LK_EXCLUSIVE, so file system semantics are not changed.

Reviewed by:	kib
2011-05-22 01:07:54 +00:00
Martin Matuska
a5c44f92bf Restore old (v15) behaviour for a recursive snapshot destroy.
(zfs destroy -r pool/dataset@snapshot)

To destroy all descendent snapshots with the same name the top level
snapshot was not required to exist. So if the top level snapshot does
not exist, check permissions of the parent dataset instead.

Filed as Illumos Bug #1043

Reviewed by:	delphij
Approved by:	pjd
MFC after:	together with v28
2011-05-18 07:37:02 +00:00
Marius Strobl
edd870e447 Convert the last use of xcopyout() to ddi_copyout() and remove the now
unused xcopyin() as well as xcopyout().
MFC together with r219089.

Approved by:	mm
2011-05-03 20:13:27 +00:00
Martin Matuska
29bf94b8d8 Fix deduplicated zfs receive
(dmu_recv_stream builds incomplete guid_to_ds_map)

Illumos-gate changeset:	13329:c48b8bf84ab7
MFC together with v28

Approved by:	pjd
Obtained from:	Illumos (Bug #755)
2011-04-30 14:52:49 +00:00
Marcel Moolenaar
8d098dc0c4 Fix copy-paste bug. 2011-04-27 04:03:04 +00:00
Martin Matuska
8b2aa22d8f Partially fix ZFS compat code for sparc64.
Some endianess bugs still need to be resolved.

Submitted by:	marius (parts of the fix)
MFC after:	1 month
2011-04-08 11:08:26 +00:00
Pawel Jakub Dawidek
65612637e8 Checking file access on size change is bogus. The checks are done earlier by
VFS where we know if this is truncate(2) or ftruncate(2). If this is the
latter we should depend on the mode the file was opened and not on the current
permission.

PR:		standards/154873
Reported by:	Mark Martinec <Mark.Martinec@ijs.si>
Discussed with:	Eric Schrock <eric.schrock@delphix.com>
Discussed with:	Mark Maybee <Mark.Maybee@Oracle.COM>
MFC after:	1 month
2011-03-24 20:28:09 +00:00
Pawel Jakub Dawidek
d7d23301ae Fix potential panic in dbuf_sync_list() relate to spill blocks handling.
Obtained from:	IllumOS
MFC after:	1 month
2011-03-14 11:07:12 +00:00
Pawel Jakub Dawidek
cae905e5d0 Correct readdir over ZFS handling.
Reported by:	Pierre Beyssac <pb@fasterix.frmug.org>
MFC after:	1 month
2011-03-08 18:39:41 +00:00
Pawel Jakub Dawidek
a96e8e86f0 Fix libzpool build.
MFC after:	1 month
2011-03-06 01:22:14 +00:00
Pawel Jakub Dawidek
2348f1110e Make renaming of a ZVOL, ZVOL's parent directory and ZVOL snapshot work.
Reported by:	avg
MFC after:	1 month
2011-03-05 22:31:03 +00:00
Pawel Jakub Dawidek
5bf0660559 Simplify zvol_remove_minors() a bit.
MFC after:	1 month
2011-03-05 22:24:31 +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
Konstantin Belousov
ca67168159 For UIO_NOCOPY case of reading request on zfs vnode, which has vm object
attached, activate the page after the successful read, and free the page
if read was unsuccessfull.

Freshly allocated page is not on any queue yet, and not activating (or
deactivating) the page leaves it on no queue, excluding the page from
pagedaemon scans and making the memory disappeared until the vnode
reclaimed.

Reviewed by:	avg
MFC after:	1 week
2011-02-11 10:46:15 +00:00
Edward Tomasz Napierala
dc7a965673 Make it impossible to clear the MNT_NFS4ACLS flag on ZFS filesystem
by using "mount -uw".

Reviewed by:	pjd
MFC after:	2 weeks
2011-02-06 23:34:09 +00:00