Commit Graph

668 Commits

Author SHA1 Message Date
hannken
97faa474a9 Add missing "defined(__NetBSD__)" to make "zfs promote" work. 2019-08-13 08:03:25 +00:00
maya
b214c01f05 validate the length of args (like other filesystems)
ok riastradh
2019-08-07 20:45:53 +00:00
hannken
706360a664 Handle automatic module loading on device open more like FreeBSD does.
Where FreeBSD uses a module "dtraceall" that depends on all dtrace
modules we now load the basic set "dtrace sdt fbt syscall" on open.
2019-07-24 16:57:45 +00:00
hannken
67361e01b4 Remove unneeded includes. 2019-07-24 16:54:37 +00:00
hannken
d233d0f45b Create "dtrace_taskq" here like FreeBSD does.
PR kern/54397: Panic when loading a DTrace module whilst DTrace is running
2019-07-23 09:06:12 +00:00
hannken
b83fa74ac8 Move local changes to files below "external/cddl/osnet/dist/" and
remove now unneeded files from "external/cddl/osnet/sys/sys/".

- sys/sys/bitmap.h -> dist/uts/common/sys/bitmap.h
- sys/sys/callb.h -> dist/uts/common/sys/callb.h

Stop including "cpupart.h", not needed for build.
2019-07-23 07:46:22 +00:00
hannken
c7790bc1b7 Always use "netbsd" as kernel name, dt_module_update() already takes
care to load data from the booted kernel image.
2019-07-21 15:38:06 +00:00
hannken
f705610493 Try to load module "dtrace" before opening "/dev/dtrace/dtrace".
Fixes PR kern/54387: DTrace Kernel module does not autoload on first use ...
2019-07-21 15:37:27 +00:00
hannken
bb86f86314 XXX: A crude hack to bring down the number of types for a
GENRIC kernel below 2**15-1 (from ~34000 to ~29800).

Remove the type attributes "volatile", "const" and "restrict",
for DTRACE these attributes are of little value.
2019-07-16 07:27:35 +00:00
hannken
9112aa41cd Add fixup operation to remove private mutex types for x86.
For GENERIC the number of types goes down from 47351 to 33981.
2019-07-16 07:26:41 +00:00
hannken
fcc1d7b138 Always exclude "fbt_*" from the list of FBT probes. 2019-07-16 07:26:00 +00:00
hannken
19f44db6df Change dtrace toxic range to "0 .. VM_MIN_KERNEL_ADDRESS_DEFAULT",
the direct map may be mapped below "VM_MIN_KERNEL_ADDRESS".
2019-07-05 08:29:18 +00:00
hannken
30c4137c4d Change module type to "MODULE_CLASS_MISC" to allow preloading.
Change "dtrace_nullop()" to return zero, it gets casted to "int (*)(...)".
2019-07-05 08:28:52 +00:00
sevan
168837a76f Add rcsid 2019-06-29 20:50:01 +00:00
hannken
544f1cdcc6 import new CDDL dtrace and ZFS code from FreeBSD svn r315983
Add files missing from the initial import.
2019-06-26 11:47:53 +00:00
hannken
f3f87b32db Sync with upstream r315983.
Move files originating from upstream below "dist/":

  OPENSOLARIS.LICENSE -> dist/OPENSOLARIS.LICENSE
  usr.sbin/zdb/zdb.8 -> dist/cmd/zdb/zdb.8
  sbin/zfs/zfs.8 -> dist/cmd/zfs/zfs.8
  sbin/zpool/zpool-features.7 -> dist/cmd/zpool/zpool-features.7
  sbin/zpool/zpool.8 -> dist/cmd/zpool/zpool.8
  include/libintl.h -> dist/head/libintl.h
  include/stdio_ext.h -> dist/head/stdio_ext.h
  include/thread.h -> dist/head/thread.h
  sys/kern/callb.c -> dist/uts/common/os/callb.c
  sys/kern/fm.c -> dist/uts/common/os/fm.c
  sys/sys/extdirent.h -> dist/uts/common/sys/extdirent.h
  sys/sys/isa_defs.h -> dist/uts/common/sys/isa_defs.h
  sys/sys/procset.h -> dist/uts/common/sys/procset.h
  sys/sys/sysmacros.h -> dist/uts/common/sys/sysmacros.h

Adapt "usr.sbin/fstyp/Makefile".
2019-06-24 08:27:19 +00:00
hannken
1a12b22735 Sync with upstream r315983.
FreeBSD splits "zfs_context.h" into:
  "lib/libzpool/common/sys/zfs_context.h" for user space
  "uts/common/fs/zfs/sys/zfs_context.h" for kernel space

Do the same here, move and sync "sys/sys/zfs_context.h" to
"dist/lib/libzpool/common/sys/zfs_context.h" and
"dist/uts/common/fs/zfs/sys/zfs_context.h".

Change "Makefile.zfs" to search includes from "dist/lib"
before "dist/uts" so we get the right include file.

Adapt "usr.sbin/fstyp/Makefile" to get the right include file.
2019-06-22 09:48:39 +00:00
hannken
9c87a63a8c Disable assertion: illumos 7793 ztest fails assertion in dmu_tx_willuse_space 2019-06-21 10:59:50 +00:00
skrll
ebc5b22cbe Toolify 2019-06-20 14:33:04 +00:00
hannken
1c4272293a Sync with upstream r315983. 2019-06-19 08:18:01 +00:00
kamil
3c0a7f49e5 Drop unused retval pointer from do_sys_mknod{,at}()
No functional change intended.
2019-06-18 22:34:25 +00:00
hannken
490062b29c Add native vfs_suspend()/vfs_resume() before and after
zfs_suspend_fs()/zfs_resume_fs() and get rid of dead "z_sa_hdl == NULL"
znodes before vfs_resume() to keep the vnode cache consistent.

Live rollback should work now.

PR port-xen/54273 ("zpool create pool xbd2" panics DOMU kernel)
2019-06-17 08:09:57 +00:00
hannken
77431910a1 Unmap pages when zfs_rezget() re-establishes a znode with its dbufs. 2019-06-17 08:08:50 +00:00
hannken
566111e6f4 Add fstrans_start()/fstrans_done() and bounds check to zfs_netbsd_getpages(). 2019-06-17 08:08:21 +00:00
hannken
3202242d92 Skip atime update on dead "z_sa_hdl == NULL" znodes. 2019-06-17 08:07:56 +00:00
kamil
2b1dd5795a Fix build with -Wgnu-designator in the ZFS code
struct buf buf = { b_bcount: MAXPHYS }; is a legacy style designator
extension and this raised a compiler error reported by a.rin@mix.
2019-06-12 04:20:18 +00:00
hannken
cfba2bba58 There is no 1:1 relation between cv_signal() and cv_timedwait() as
the latter implicitly calls cv_signal() on error.

This leads to "tq_waiting > 0" with "tq_running == 0" and the
taskq stalls.

Change task_executor() to increment and decrement "tq_waiting"
and always check and run the queue after cv_timedwait().

Use mstohz(), fix timeout and sort includes.

Addresses PR port-xen/54273: "zpool create pool xbd2" panics DOMU kernel
2019-06-11 09:05:33 +00:00
hannken
94984370e5 Try to retrieve the per-disk maximum transfer size and use it instead
of MAXPHYS.  Eagerly waiting for the merge of tls-maxphys.

Addresses PR port-xen/54273: "zpool create pool xbd2" panics DOMU kernel
2019-06-11 09:04:37 +00:00
hannken
ed2fdc797c Sync with upstream r315983. 2019-06-07 10:31:21 +00:00
hannken
f96d3fedeb Remove "dist/cmd/stat" containing only one left over and unneeded file. 2019-06-06 15:59:23 +00:00
hannken
f1690374af Handle files not present upstream:
dist/lib/libshare/common/libshare.h -> sys/libshare.h
dist/uts/common/sys/systeminfo.h    -> sys/sys/systeminfo.h
dist/uts/common/sys/taskq_impl.h    -> TRASH

No functional change intended.
2019-06-06 14:58:50 +00:00
hannken
58fcc332f4 Switch module solaris to native XDR. 2019-06-05 16:28:06 +00:00
hannken
e8ace0777f Use native XDR for libnvpair in userland. 2019-06-04 08:45:17 +00:00
hannken
a26bd2a865 upport wedges as vdevs, use DIOCGWEDGEINFO before DIOCGPARTINFO.
PR kern/54219 zpool create pool dk5 causes kernel panic
2019-05-26 10:22:59 +00:00
hannken
0d3564d150 Add missing part of kmem_cache cleanup. Use Solaris argument order for
kmem_cache destructors, umem_cache_alloc() and umem_cache_free() too.
2019-05-26 10:21:00 +00:00
hannken
a4a3cea66e Update the kmem_cache emulation to run its callbacks with
Solaris argument order.

No functional change intended.
2019-05-23 08:32:30 +00:00
hannken
c54265e62b Implement disk_rename()/iostat_rename() to rename a disk.
Use it from zvol_rename_minor() when renaming a ZVOL.
2019-05-22 08:47:02 +00:00
hannken
72cdecc56a Add missing zvol_close() to zfsdev_close().
Change zvol_size_changed() to initialize "zv->zv_volsize"
and initialize only "dg_secsize" and "dg_secperunit".
Calling disk_set_info() will initialize the remaining
parts of the geometry.

Set "doread" in zvol_strategy() to make reading from
device possible.

Reorganize/add disk_busy()/disk_unbusy() instrumentation.

Redo zvol_ioctl() to implement DIOCGWEDGEINFO and let
disk_ioctl() process the remaining ioctls.
2019-05-22 08:46:27 +00:00
hannken
da01880b38 Enable the zvol minor management to create and remove device nodes. 2019-05-22 08:45:32 +00:00
hannken
146ae763fd Update ddi environment:
- Put device major numbers into "dev_info_t".
- Fix an off-by-one in zvol_create_minor().
- When creating a node handle existing nodes
  and add owner read/write permission.
- When removing nodes remove now empty directories.
2019-05-22 08:44:48 +00:00
hannken
572f68cd17 Implement the needed part of Solaris lookupname().
Remove unneeded protoype lookupnameat().
2019-05-22 08:42:57 +00:00
hannken
8c4b1be312 Cleanup modules "solaris" and "zfs":
- Defer spa_config_load() until root is mounted.
- Restore the config path to "/etc/zfs/zpool.cache".
- Module "zfs" is type MODULE_CLASS_VFS and no longer depends on "rootvnode".
- Module "solaris" no longer depends on "mp_online".
- Fix rump component registration to not detach "/dev/zfs" if
  it didn't attach it.
2019-05-07 08:51:09 +00:00
hannken
db54d209c2 This implementation of Solaris taskq API is incomplete and doesn't track
Solaris upstream.  FreeBSD already replaced it with a glue to their
taskqueue API.

Replace it with a glue component that queues Solaris taskq requests to
threadpool jobs.
2019-05-07 08:49:59 +00:00
hannken
d609d7d444 Add support for fifos, character and block devices. 2019-04-15 12:59:38 +00:00
hannken
b75299830a Make ZFS exportable by NFS, implement zfsctl_vptofh(),
zfs_netbsd_vptofh() and zfs_netbsd_fhtovp().

Undo changes to now completely unused zfs_fhtovp().
2019-03-18 09:22:14 +00:00
hannken
adb2c81d25 Implement zfsctl_lookup_objset() to look up "zfsvfs" of an mounted snapshot. 2019-03-18 09:21:31 +00:00
hannken
a9b5e877b6 Set "mnt_stat.f_fsid" and "mnt_stat.f_fsidx" from the objset guid
like FreeBSD and Illumos do.

Use "f_fsid" for "va_fsid" and cheat NFSD to export snapshots under
".zfs" by setting these snaphots "f_fsidx" to the parents "f_fsidx".
2019-03-18 09:20:58 +00:00
hannken
80fc19ea39 As zfs_netbsd_getpages() ignores "a_count" and processes exactly one page
return an error if "a_count != 1".
2019-03-18 09:20:15 +00:00
hannken
94e5a2a219 Change zfs_readdir() to use malloc() instead of kmem_alloc() to
allocate cookies.  Required by protocol, caller uses free().
2019-03-18 09:19:39 +00:00
kamil
e7e18034ff Reserve DTrace sdt and fdt major numbers
Register cmajor 252 for fbt and 253 for sdt.

Previously the major number was picked randomly and it causes conflicts
with preallocated values for different devices.
2019-03-09 18:53:52 +00:00