Commit Graph

618 Commits

Author SHA1 Message Date
hannken
44e38a6483 Always set "cn_namelen" in addition to "cn_nameptr".
Fix vnode locking for REMOVE, RMDIR and RENAME.
2019-02-22 09:01:32 +00:00
hannken
583a153e11 Move fstrans_unmount() to vfs_rele(), just before it would free the mount.
Don't take a mount reference for fstrans as it gets notified about the release.

Defer the final free of the mount to fstrans_mount_dtor() when fstrans
has released all references to this mount.  Prevents the mount's memory
to be reused as a new mount before fstrans released all references.

Address PR kern/53928 modules/t_builtin:disable test case randomly fails.
2019-02-20 10:08:37 +00:00
rin
d7e5ad524a Fix DIAGNOSTIC build; replace FreeBSD-specific function with ours. 2019-02-13 08:46:40 +00:00
rin
1f6814c121 Fix build with DIAGNOSTIC:
ASSERT() is enabled ifdef DEBUG, not DIAGNOSTIC.
2019-02-12 14:31:45 +00:00
tnn
7d56d81472 -Wno-format-truncation is only needed when using GCC 2019-02-11 17:49:37 +00:00
christos
a27520238a use sizeof() properly (gcc-7) 2019-02-06 17:56:57 +00:00
christos
d5c5b6e7a1 uses the idiom len = snprintf(&tmp, 1, ...) to compute length.
needs -Wno-format-truncation
2019-02-06 04:23:16 +00:00
hannken
bd6f3d517a Implement the ZFS control directory ".zfs" and its subdirectory 'snapshot".
Automatically mount snapshots on access of ".zfs/snapshot/<snapname>".
2019-02-05 09:55:48 +00:00
hannken
930703cbc3 Prepare the implementation of the ZFS control directory ".zfs".
- Move the stub routines from zfs_stub.c to zfs_ctldir.c and
  remove now empty file zfs_stub.c

- Add stub routines for zfsctl_loadvnode() to initialize control
  nodes and zfsctl_snapshot() to retrieve ".zfs/snapshot".

- Add an initial vnode operations vector for control nodes.

- Implement lookup into ".zfs" and lookup ".." from ".zfs/snapshot/<snap>".

- Change nodeid of mounted snapshots to the snapshot object id.

- Respect "-u" flag to "zfs rename <snapshot> ...".
2019-02-05 09:54:36 +00:00
hannken
2b2eb8edaf zfs_netbsd_reclaim(): validate "z_log" before zil_commit(). 2019-02-05 09:50:18 +00:00
pgoyette
d91f98a871 Merge the [pgoyette-compat] branch 2019-01-27 02:08:33 +00:00
hannken
cbfd7da2fc Allow zfs_vn_rdwr() with "rw == UIO_READ" too. 2019-01-12 10:44:36 +00:00
hannken
8027df3b0b Pass unmount flags down to syscall, "zfs unmount -f" now works. 2019-01-12 10:44:05 +00:00
hannken
1917967c61 The ZFS onexit routines expect opening ZFS_DEV with O_EXCL to return
a cloned device with an unique minor number.

Use fd_clone() on this condition to return a cloned device descriptor.
2019-01-12 10:43:33 +00:00
hannken
256b65dcc0 Disable valid assertion "!(flags & TQ_NOQUEUE)" as "zfs send" triggers it. 2019-01-12 10:42:40 +00:00
hannken
b7f32ae1de Need FOF_UPDATE_OFFSET to update the offset on plain files.
Running "zfs send" to plain files no longer writes garbage.
2019-01-12 10:42:09 +00:00
hannken
ddb2d27412 There is no such function read_rflags(), probably meant x86_read_flags(). 2019-01-12 10:41:31 +00:00
hannken
f62cfdb432 Even though zfs_netbsd_putpages() cannot use ZFS_ENTER() it has
to respect the teardown lock.

Enter z_teardown_lock as reader and ZFS_EXIT().

Instead of ZFS_VERIFY_ZP() return without writing and without
error from zfs_putapage() if "z_sa_hdl == NULL".
2019-01-05 09:20:29 +00:00
hannken
467c245f51 Cannot use ZFS_ENTER() / ZFS_EXIT() as zfs_netbsd_putpages() is used
during vnode reclaim.

Add missing protection with fstrans.
2019-01-01 10:09:26 +00:00
hannken
c28128baab As already noted in XXX comment do a zil_commit() on reclaim. 2019-01-01 10:08:42 +00:00
hannken
5836607404 Cannot hold zfs object across call to vcache_get() as it might
deadlock with another reclaim.

Add vfs operation zfs_newvnode() to create a new zfs node and
hold the zfs object in zfs_loadvnode() and zfs_newvnode() only.
2019-01-01 10:08:00 +00:00
hannken
2595f06922 Drop v_interlock for zfs_range_lock(), another thread might hold part
of this range and wait for v_interlock.
2018-12-13 10:20:51 +00:00
hannken
398893d51c Operation zfs_range_lock() needs range as (offset,length), not as (low,high). 2018-12-13 10:20:20 +00:00
hannken
0b243f3ebe Don't allow module to init before mp_online. 2018-12-13 10:19:47 +00:00
sevan
a8174c34c4 Describe how unaccounted changes are detected without Star Trek references, for
everyone in 2018.

Thanks to maya & gdt
2018-12-10 03:58:30 +00:00
christos
ddcb7de5af fix printf warnings. 2018-12-09 18:01:01 +00:00
sevan
861b7e9a71 Spelling 2018-12-08 14:55:53 +00:00
wiz
e1f1a9870c Improve man page. 2018-12-08 12:18:37 +00:00
sevan
23472bf8b1 Include ztest(1) in builds. 2018-12-08 01:47:21 +00:00
sevan
ee544a8d7f Add a draft manual for ztest(1), based on the comments from zfstest.c (WIP). 2018-12-08 01:28:27 +00:00
hannken
e9166d7318 We have component names as counted strings (cn_nameptr, cn_namelen) but
ZFS expects a null-terminated name.

Always create a copy with PNBUF_GET()/strlcpy()/PNBUF_PUT().

For LOOKUP use a small buffer on stack and allocate/free compomnent names
longer than 30 chars.
2018-12-06 10:00:40 +00:00
hannken
b4b8646326 Add missing ZFS_OBJ_HOLD_ENTER() / ZFS_OBJ_HOLD_EXIT() to zfs_zget_cleaner(). 2018-12-06 09:58:52 +00:00
hannken
02397a5780 Zfs_write() may hide write errors if uiomove() succeeds but a
further dmu_tx_assign() fails because over quota or no space.

Use the emulated uiocopy() and uioskip() like illumos does.

Fix the uiocopy() emulation to not clobber the iovecs.
2018-11-30 09:53:40 +00:00
hannken
6ac427e315 Redo the access check for setting va_flags in zfs_netbsd_setattr().
Use user flag UF_NODUMP instead of UF_IMMUTABLE for the test as it
is the only user flag supported by all tested file systems.

PR kern/47656 test zfs_flags.
2018-11-28 10:01:28 +00:00
hannken
e4ec60fc8e Add missing access check for REMOVE into zfs_netbsd_lookup().
PR kern/47656 test zfs_dirperms.
2018-11-28 09:58:58 +00:00
hannken
5cbc5ce853 Add missing access check for setting va_Xtime into zfs_netbsd_setattr().
PR kern/47656 test zfs_times.
2018-11-28 09:57:59 +00:00
hannken
1d96c4a33f We expect VOP_ACCESS() to return EACCESS as general error.
Change zfs_netbsd_access() to translate the common EPERM to EACCES.
2018-11-28 09:57:16 +00:00
hannken
bc6110ce9c Don't try to release a NULL vnode in zfs_netbsd_rename(). 2018-11-28 09:56:40 +00:00
hannken
29da203472 Remove an early test for "source and target are equal" from zfs_rename()
that broke BSD semantics.
2018-11-28 09:56:09 +00:00
hannken
6d68550383 Add missing sa_buf_rele() into zfs_zget_cleaner(). 2018-11-28 09:55:36 +00:00
hannken
1f58a7d1b1 Always unbusy pages in zfs_putapage() after the data has been written
into the DMU.  Running fsx no longer hangs the kernel.
2018-11-28 09:55:06 +00:00
riastradh
fe26b32950 Use callout_halt, not callout_stop, for FreeBSD callout_drain shim.
Callers expect callout_drain will wait for it to complete if it has
fired.
2018-11-15 05:43:57 +00:00
riastradh
c3426bd36f Need <dev/mm.h> for mm_md_direct_mapped_phys.
It turns out this code always sees __HAVE_MM_MD_DIRECT_MAPPED_PHYS as
disabled on amd64, for reasons that I shall address forthwith, but it
is enabled on aarch64 and so the MKZFS=yes build breaks.
2018-11-15 04:55:49 +00:00
riastradh
6af8fc2044 Be consistent about _KERNEL vs _HARDKERNEL in zfs.
As it happens, on x86 both _HARDKERNEL and _KERNEL get defined; see
the conditional in sys/rump/Makefile.rump that _refrains_ from
defining _RUMPKERNEL on x86.

So the only version of this code that has been tested is the one with
all of it included.  But on, e.g., aarch64, we do not get _HARDKERNEL
here, and the code fails to build because some things use the field
struct spa::spa_deadman_cycid under _KERNEL when it is declared only
under _HARDKERNEL.

If there's a reason _not_ to use this in rump -- and it's not obvious
to me why -- then all access to the field needs to agree to use
_HARDKERNEL.
2018-11-15 04:55:38 +00:00
riastradh
3c01401a94 Omit unused definition with broken cpp conditional. 2018-11-15 04:55:26 +00:00
riastradh
ec4edf7a44 Omit conflicting definition that breaks build on aarch64. 2018-11-15 04:55:17 +00:00
riastradh
30279c00db "PRIu64", not llu, to print uint64_t. 2018-11-15 04:55:06 +00:00
riastradh
44773f2a69 Define _LP64 or _ILP32 for all architectures.
Rather than write out a table for each architecture, rely on the C
compiler to define _LP64 for 64-bit ones, on the assumption that
anything not LP64 is ILP32, and on CTASSERTs to verify this
assumption so that if it's wrong it'll fail safely with a noisy build
failure.

Gives zfs half a chance of building on, e.g., powerpc.
2018-11-14 17:09:08 +00:00
christos
550eae4327 Avoid conflicts with "our" (the FreeBSD) nvpair/nvlist implementation by
prefixing all symbols with "opensolaris_".
2018-10-23 22:26:14 +00:00
christos
b87aa2b0b0 prefix all nv* symbols with opensolaris_ 2018-10-23 22:25:21 +00:00