summaryrefslogtreecommitdiffstats
path: root/sys/cddl
Commit message (Collapse)AuthorAgeFilesLines
* Fix a bug in sa_find_sizes() which could lead to panic:delphij2011-10-171-2/+2
| | | | | | | | | | | | | | | | 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
* Define dtrace_cmpset_long in terms of atomic_cmpset_longmarcel2011-10-161-43/+3
| | | | | and not by virtue of inline assembly. Now this file compiles on all supported architectures.
* In order to maximize the re-usability of kernel code in user space thiskmacy2011-09-162-4/+4
| | | | | | | | | | | | | 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)
* zfs boot subroutines: correctly specify type of an integer literalavg2011-09-131-1/+1
| | | | | | | Found by adding more warning flags to zfs boot blocks build. Approved by: re (kib) MFC after: 1 week
* Split the vm_page flags PG_WRITEABLE and PG_REFERENCED into atomickib2011-09-061-2/+1
| | | | | | | | | | | | | | | | | 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)
* Generalize ffs_pages_remove() into vn_pages_remove().mm2011-08-251-4/+9
| | | | | | | | | | | 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
* We need to unlock and destroy vnode attached to znode which we are freeing.pjd2011-08-241-0/+14
| | | | | | Reviewed by: kib Approved by: re (bz) MFC after: 1 week
* zfs_ioctl.c: improve code readability in zfs_ioc_dataset_list_next()mm2011-08-132-7/+8
| | | | | | | | | | | | | | | | | | | 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
* Fix race between dmu_objset_prefetch() invoked frommm2011-08-131-1/+2
| | | | | | | | | | | | | | | | 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
* Eliminate the zfsdev_state_lock entirely and replace it with thepjd2011-08-124-70/+54
| | | | | | | | | | 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
* Second-to-last commit implementing Capsicum capabilities in the FreeBSDrwatson2011-08-111-2/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | kernel for FreeBSD 9.0: Add a new capability mask argument to fget(9) and friends, allowing system call code to declare what capabilities are required when an integer file descriptor is converted into an in-kernel struct file *. With options CAPABILITIES compiled into the kernel, this enforces capability protection; without, this change is effectively a no-op. Some cases require special handling, such as mmap(2), which must preserve information about the maximum rights at the time of mapping in the memory map so that they can later be enforced in mprotect(2) -- this is done by narrowing the rights in the existing max_protection field used for similar purposes with file permissions. In namei(9), we assert that the code is not reached from within capability mode, as we're not yet ready to enforce namespace capabilities there. This will follow in a later commit. Update two capability names: CAP_EVENT and CAP_KEVENT become CAP_POST_KEVENT and CAP_POLL_KEVENT to more accurately indicate what they represent. Approved by: re (bz) Submitted by: jonathan Sponsored by: Google Inc
* Fix panic in zfs_read() if IO_SYNC flag supplied by checking formm2011-08-021-2/+3
| | | | | | | | | | 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
* Fix integer overflow in txg_delay() by initializingmm2011-08-011-1/+1
| | | | | | | | | | the variable "timeout" as clock_t. Filed as Illumos Bug #1313 Reviewed by: avg Approved by: re (kib) MFC after: 3 days
* Fix serious bug in ZIL that can lead to pool corruptionmm2011-07-301-17/+24
| | | | | | | | | | | | | | 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
* Bring the code more in-line with OpenSolaris source todelphij2011-07-212-2/+21
| | | | | | | ease future port. Reviewed by: pjd, mm Approved by: re (kib)
* A different implementation of r224231 proposed by pjd@,delphij2011-07-213-5/+10
| | | | | | | | | | 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)
* Add a new field to in-core znode, z_rdev, to represent device nodes.delphij2011-07-203-1/+12
| | | | | | | PR: kern/159010 Reviewed by: mm@ Approved by: re (kib) MFC after: 2 weeks
* ZFS tries to allocate blocks evenly across all devices. This means whenmm2011-07-187-28/+130
| | | | | | | | | | | | | 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
* Resurrect the ZFS "aclmode" propertymm2011-07-189-177/+156
| | | | | | | | | Change default of "aclmode" to "discard". Illumos-gate changeset: 13370:8c04143bd318 Obtained from: Illumos (Feature #742) MFC after: 2 weeks
* With retirement of cpumask_t and usage of cpuset_t for representing aattilio2011-07-042-4/+4
| | | | | | | | | | | | | | | mask of CPUs, pc_other_cpus and pc_cpumask become highly inefficient. Remove them and replace their usage with custom pc_cpuid magic (as, atm, pc_cpumask can be easilly represented by (1 << pc_cpuid) and pc_other_cpus by (all_cpus & ~(1 << pc_cpuid))). This change is not targeted for MFC because of struct pcpu members removal and dependency by cpumask_t retirement. MD review by: marcel, marius, alc Tested by: pluknet MD testing by: marcel, marius, gonzo, andreast
* Add a new "REFCOMPRESSRATIO" property.mm2011-06-283-5/+14
| | | | | | | | | | | | | | 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
* Disable vdev cache (readahead) by default.mm2011-06-281-1/+8
| | | | | | | | | | 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
* Fix clang warnings.benl2011-06-181-1/+1
| | | | Approved by: philip (mentor)
* Remove C constructs that are incompatible with C++ from variousgibbs2011-06-107-100/+117
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* Silence notice on pool creation, import and access.mm2011-06-071-0/+2
| | | | | | Suggested by: Jeremy Chadwick (freebsd-stable@) Discussed with: pjd MFC after: 1 week
* MFCattilio2011-06-061-2/+0
|\
| * Remove empty #ifndefmm2011-06-061-2/+0
| | | | | | | | MFC after: 3 days
* | MFCattilio2011-06-042-2/+18
|\ \ | |/
| * opensolaris compat / zfs: avoid early overflow in ddi_get_lbolt*avg2011-06-042-2/+18
| | | | | | | | | | | | | | | | Reported by: David P. Discher <dpd@bitgravity.com> Tested by: will Reviewed by: art Discussed with: dwhite MFC after: 2 weeks
* | MFCattilio2011-05-311-0/+5
|\ \ | |/
| * Imagine situation where a security problem is found in setuid binary.pjd2011-05-311-0/+5
| | | | | | | | | | | | | | | | | | | | User upgrades his system to fix the problem, but if he has any ZFS snapshots for the file system which contains problematic binary, any user can mount the snapshot and execute vulnerable binary. Prevent this from happening by always mounting snapshots with setuid turned off. MFC after: 2 weeks
* | MFCattilio2011-05-271-0/+4
|\ \ | |/
| * Silence warnings about unsupoorted value types.pjd2011-05-271-0/+4
| | | | | | | | MFC after: 2 weeks
* | MFCattilio2011-05-265-40/+14
|\ \ | |/
| * Don't pass pointer to name buffer which is on the stack to another thread,pjd2011-05-241-20/+11
| | | | | | | | | | | | | | because the stack might be paged out once the other thread tries to use the data. Instead, just allocate memory. MFC after: 2 weeks
| * Don't access task structure once we call task function.pjd2011-05-244-20/+3
| | | | | | | | | | | | | | | | 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
| * Fix the zfs file system so that it uses the lockrmacklem2011-05-221-2/+2
| | | | | | | | | | | | flags argument added to VFS_FHTOVP() by r222167. Reviewed by: pjd
* | MFCattilio2011-05-221-2/+2
| |
* | MFCattilio2011-05-221-2/+2
|\ \ | |/
| * Add a lock flags argument to the VFS_FHTOVP() file systemrmacklem2011-05-221-2/+2
| | | | | | | | | | | | | | | | | | | | | | 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
| * Restore old (v15) behaviour for a recursive snapshot destroy.mm2011-05-181-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | (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
| * Revert accidentally committed local change in r221990avg2011-05-161-1/+1
| | | | | | | | Pointyhat to: avg
| * better integrate cyclic module with clocksource/eventtimer subsystemavg2011-05-163-22/+34
| | | | | | | | | | | | | | | | | | | | Now in the case when one-shot timers are used cyclic events should fire closer to theier scheduled times. As the cyclic is currently used only to drive DTrace profile provider, this is the area where the change makes a difference. Reviewed by: mav (earlier version, a while ago) X-MFC after: clocksource/eventtimer subsystem
* | MFCattilio2011-05-181-0/+6
| |
* | MFCattilio2011-05-162-20/+32
| |
* | MFCattilio2011-05-102-42/+2
|\ \ | |/
| * dtrace: remove unused codeavg2011-05-102-42/+2
| | | | | | | | | | | | Which is also useless, IMO. MFC after: 5 days
* | Commit the support for removing cpumask_t and replacing it directly withattilio2011-05-053-9/+14
|/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cpuset_t objects. That is going to offer the underlying support for a simple bump of MAXCPU and then support for number of cpus > 32 (as it is today). Right now, cpumask_t is an int, 32 bits on all our supported architecture. cpumask_t on the other side is implemented as an array of longs, and easilly extendible by definition. The architectures touched by this commit are the following: - amd64 - i386 - pc98 - arm - ia64 - XEN while the others are still missing. Userland is believed to be fully converted with the changes contained here. Some technical notes: - This commit may be considered an ABI nop for all the architectures different from amd64 and ia64 (and sparc64 in the future) - per-cpu members, which are now converted to cpuset_t, needs to be accessed avoiding migration, because the size of cpuset_t should be considered unknown - size of cpuset_t objects is different from kernel and userland (this is primirally done in order to leave some more space in userland to cope with KBI extensions). If you need to access kernel cpuset_t from the userland please refer to example in this patch on how to do that correctly (kgdb may be a good source, for example). - Support for other architectures is going to be added soon - Only MAXCPU for amd64 is bumped now The patch has been tested by sbruno and Nicholas Esborn on opteron 4 x 12 pack CPUs. More testing on big SMP is expected to came soon. pluknet tested the patch with his 8-ways on both amd64 and i386. Tested by: pluknet, sbruno, gianni, Nicholas Esborn Reviewed by: jeff, jhb, sbruno
* Convert the last use of xcopyout() to ddi_copyout() and remove the nowmarius2011-05-032-5/+2
| | | | | | | unused xcopyin() as well as xcopyout(). MFC together with r219089. Approved by: mm
* Fix deduplicated zfs receivemm2011-04-302-58/+37
| | | | | | | | | | (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)
OpenPOWER on IntegriCloud