Commit Graph

256 Commits

Author SHA1 Message Date
riastradh 6d6cb07bff Fail lookup of .. in a deleted directory with ENOENT.
Don't try to zget the parent, whose znode id may have been recycled
by now.

It's not clear to me how Solaris avoids this, but maybe I'm just
missing something obvious.
2012-10-15 23:51:11 +00:00
riastradh 1baf22d09c Fix various issues in zfs life cycle, locking, and vop protocol.
- Restore some zfs locking and unlocking that got lost randomly.

- Enable use of the BSD vnode lock.  Lock order: all BSD vnode locks
are taken before all zfs internal locks.  There remains an issue with
O_EXCL, to be solved later (famous last words).  KASSERT the locking
scheme up the wazoo.

- Take our cruft out of zfs_lookup and move it to zfs_netbsd_lookup.
Restore much of the way zfs_lookup looked to make merging future
versions easier.  Disable use of the namecache for now because its
locking dance is too scary to contemplate.

- Implement BSD semantics for rename, to appease our tests.  This is
a provisional kludge; eventually we need VOP_RENAME to take a flag
specifying whether to use BSD semantics or POSIX semantics.

- Simplify zfs_netbsd_reclaim and make it work.  Now that getnewvnode
never tries to vclean anything itself, we need not worry about
recursion of ZFS_OBJ_MUTEX locks.

- Clarify and fix genfs node initialization and destruction.

zfs passes most of our atf vfs tests now, including the rename races.

Still to do:

- fix the impedance mismatch between our permissions model and zfs's;
- fix O_EXCL (nontrivial);
- throw dirconc at it and see how badly it explodes;
- find why zpool sometimes wedges itself during mkfs; and
- find why pool caches sometimes seem to get corrupted.
2012-10-15 23:08:19 +00:00
riastradh 1b44cf7c91 secpolicy_vnode_access must be called with the vnode lock held.
Don't unlock the vnode and then tell the caller about what the world
was like while the vnode was locked.  The world changes fast.
2012-10-15 22:50:25 +00:00
riastradh 2ea30100de Simplify zfs dirlock reference counting.
No need to pass dzp around; dl has a pointer to it.
2012-10-15 22:43:50 +00:00
riastradh b2ba8fafaa Do reference counting for zfs range lock waiters.
Avoid cv_broadcast(&cv); cv_destroy(&cv); which works in Solaris only
by abuse of the condvar abstraction.

There are parts of this code that should be factored into smaller
subroutines, mainly range lock allocation and initialization, but
that would make it harder to merge newer versions of zfs, so for now
I've just expanded those parts further in-line.
2012-10-15 14:15:59 +00:00
riastradh f1e3330bc7 Do reference counting for zfs dirlock waiters.
Solaris relies on cv_broadcast(&cv); cv_destroy(&cv) working, but
that hoses our cv_wait, which needs to continue using cv after it is
woken.  Solaris's idiom is an abuse of the condvar abstraction, but
we can get the same effect with reference counting.
2012-10-15 14:03:06 +00:00
njoly 172b16130f No need to include files more than once. 2012-10-11 08:01:23 +00:00
njoly 6b1609c666 Add _PC_NO_TRUNC support in zfs_netbsd_pathconf(). 2012-10-01 18:19:18 +00:00
riz 91aa9460ce Don't build with debugging (-g) by default. 2012-09-05 23:08:42 +00:00
pooka fa4bf43b79 For now, make vop_islocked more like vop_lock and vop_unlock (i.e. don't
even attempt to do anything).
2012-09-01 16:19:00 +00:00
christos ffd8412325 PR/46660: Henning Petersen: Fix typo in deviceid.c 2012-07-05 13:55:58 +00:00
njoly b813bd15cb Use CTLTYPE_QUAD for uint64_t type in sysctl_createv. 2012-06-19 21:25:26 +00:00
chs 22738551d6 reduce diff to freebsd:
rename "xcpu" back to "cpu" now that the conflicting global variable
has been renamed out of the way.  this also fixes some cases
where references to the local variable "cpu" had not been renamed
and thus were accidentally referring to the former global "cpu".
2012-06-16 17:31:47 +00:00
chs 6e9ead4606 make dtrace work on amd64. 2012-06-11 15:18:05 +00:00
jym 57d7988f76 Now that pool_cache_invalidate() is synchronous and can handle per-CPU
caches, merge together pool_drain_start() and pool_drain_end() into

bool pool_drain(struct pool **ppp);

"bool" value indicates whether reclaiming was fully done (true) or not (false)
"ppp" will contain a pointer to the pool that was drained (optional).

See http://mail-index.netbsd.org/tech-kern/2012/06/04/msg013287.html
2012-06-05 22:51:47 +00:00
dsl f7622c11cc Not sure why this has just started to fail!
But it really isn't a good idea to compare a uint64_t to NULL.
2012-06-03 10:53:51 +00:00
christos 27e3db30d5 Add FREAD for the benefit of kauth! 2012-04-26 23:34:09 +00:00
wiz 2b8cc88a65 Use the correct path in dt_module.c.
From clang via Henning Petersen in PR 46009.
2012-02-13 13:05:36 +00:00
wiz 6ef3ca5393 Use the correct MACHINE_ARCH for amd64.
Remove temporary hack while here.
From Henning Petersen in PR 46001.
2012-02-13 12:52:54 +00:00
para e62ee4d475 extending vmem(9) to be able to allocated resources for it's own needs.
simplifying uvm_map handling (no special kernel entries anymore no relocking)
make malloc(9) a thin wrapper around kmem(9)
(with private interface for interrupt safety reasons)

releng@ acknowledged
2012-01-27 19:48:38 +00:00
darran 9a00affba3 Fix a segfault in ctfmerge.
GCC can generate bogus dwarf attributes with DW_AT_byte_size set to 0xFFFFFFFF.
See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35998 .

GCC is currently doing this for external/bsd/tmux/dist/compat/imsg-buffer.c:
    readelf -a --debug-dump imsg-buffer.o
	...
	 <2><6e3>: Abbrev Number: 32 (DW_TAG_union_type)
	    <6e4>   DW_AT_byte_size   : 0xffffffff
	    <6e8>   DW_AT_decl_file   : 1
	    <6e9>   DW_AT_decl_line   : 229
	    <6ea>   DW_AT_sibling     : <0x705>

This resulted in ctfconvert generating a faulty CTF entry which then caused the
segfault in ctfmerge.

The fix has ctfconvert check for the bogus 0xFFFFFFFF value and works around it.
It also adds some protection to ctfmerge to avoid the segfault and fail
more gracefully if the error should occur in the future.
2012-01-10 08:42:22 +00:00
christos dd89f66f56 make this compile again. VOP_CLOSE is really vn_close() through macros. 2011-11-21 17:51:03 +00:00
christos bde7230620 correct declaration of vn_close()
XXX: Should all those dup declarations be here?
2011-11-21 05:50:11 +00:00
christos 6a2b307489 close file in a way that it does not trigger an assertion :-)
now zpool create works again.
2011-11-21 00:24:24 +00:00
christos eb50a1b80e enough with the compile time warnings. 2011-11-20 02:54:25 +00:00
yamt fb69e65229 make aggregate work for > 1 cpus 2011-10-19 11:03:52 +00:00
yamt f34e2253c6 because our xcall stuff can't be used in softint, use kernel threads
for cleaner/deadman low-level cyclic replacement.  PR/44905
2011-10-19 11:02:08 +00:00
yamt ad773a12d3 fbt_provide_module_cb: exclude some functions known unsafe to probe 2011-10-19 10:55:50 +00:00
hannken 34f54c83be As vnalloc() always allocates with PR_WAITOK there is no longer the need
to test its result for NULL.
2011-10-07 09:35:04 +00:00
christos b6f6e1bfbd fix a shadow variable warning. 2011-09-09 17:48:39 +00:00
christos a222eb155b catch up with vmem_alloc signature change. 2011-09-07 21:32:07 +00:00
christos 4aa752a401 fix shadow warnings.
XXX: might be a good idea to kill global 'cpu' and 'version' variables.
2011-08-31 21:57:16 +00:00
uebayasi eab2487254 Fix a local var name. 2011-07-30 10:12:14 +00:00
uebayasi 6ed9c23d3b KNF. 2011-07-29 13:10:23 +00:00
yamt e3bb2d6eba mark this driver D_MPSAFE 2011-07-26 12:54:28 +00:00
yamt afe833af51 fix a merge botch in rev.1.7 2011-07-26 12:33:23 +00:00
yamt 696f2a9301 remove debug printfs 2011-07-26 12:28:39 +00:00
yamt 7695ef3cd1 remove a debug printf 2011-07-26 12:28:01 +00:00
yamt 223b285dcf fix a kmem_alloc/free size mismatch 2011-07-26 12:26:33 +00:00
tron 71477abcdc Fix uninitialized variables reported by GCC 4.5. 2011-07-20 19:51:57 +00:00
christos 9b1cdf6a14 better fix for gcc uninitialized. 2011-07-18 02:47:52 +00:00
christos 6e03a05a94 fix gcc uninitialized warnings 2011-07-18 00:43:35 +00:00
christos 6c10492aaa fix uninitialized gcc variables 2011-07-18 00:42:40 +00:00
joerg 3eb244d801 Retire varargs.h support. Move machine/stdarg.h logic into MI
sys/stdarg.h and expect compiler to provide proper builtins, defaulting
to the GCC interface. lint still has a special fallback.
Reduce abuse of _BSD_VA_LIST_ by defining __va_list by default and
derive va_list as required by standards.
2011-07-17 20:54:30 +00:00
rmind 1ab522108e Fix ZFS build. 2011-06-12 14:47:20 +00:00
mrg b156c02e66 v_interlock is now a pointer to kmutex_t, use it as one.
fixes many of the 5.99.53 build issues in zfs, but not all of them.
2011-06-12 04:43:11 +00:00
christos 4e14e91053 fix missing prototypes. 2011-05-15 18:33:33 +00:00
rmind 756122ce22 Remove unused M_MOUNT. 2011-04-02 04:57:35 +00:00
joerg e2e40b270e Don't define acl_alloc and acl_free during kernel builds.
Fixes module build with clang.
2011-03-15 00:48:04 +00:00
pooka eb63257707 adjust some pretty likely broken assertion (stksize is hardcoded
from caller, but not used here).  now zpool doesn't cause a
kernel crash anymore.
2011-03-10 19:35:24 +00:00
pooka 3140523bc0 pass in correct variable, the old code can't possibly be correct. 2011-03-10 19:32:39 +00:00
riz 3406e189a5 #include <sys/debug.h> (from the ZFS sources) so that ASSERT() is
defined, and we don't get problems like kern/44430.  This is
more a workaround than a fix, but at least I can load zfs now.

ok haad@
2011-03-09 23:55:46 +00:00
riz c29d7160e5 If the config is zero size, don't try to read it.
OK haad@
2011-03-09 23:49:06 +00:00
pooka 1c44cbfd96 Don't allow module to init if root is not mounted since the modcmd
wants to traverse the file system.  This *might* fix statically
linking zfs support into the kernel (at least it fixes rump kernel
bootstrap).
2011-01-21 13:08:42 +00:00
pooka 51f08b56c8 fix kobj_open_file_vnode()
patch from haad
2011-01-21 12:24:24 +00:00
haad c7287ec04b Fix zfs Makefiles + debug, don't add -g by default only when MKDEBUG is
enabled. Fix header assert conflicts + bump WARNS for some libs.
2011-01-13 23:18:23 +00:00
dholland 42bae07fce Remove references to SAVESTART in zfs. 2011-01-02 05:12:03 +00:00
haad bec5c61e50 Define vn_getattr in zfs_context.h. 2010-12-28 16:44:45 +00:00
haad bca088ab45 Fix problem where vnode vp_size was not updated when vndoe was already allocated,
for vdev. This makes ztest survive ztest_vdev_LUN_growth test. Replace dummy
VOP_GETATTR with vn_getattr routine which reset vp_size and vattr_size accordingly
to reality.
2010-12-28 13:36:09 +00:00
haad 8f7b707f59 libzfs_fru_clear was not ported to NetBSD disable it foor now. 2010-12-24 16:13:58 +00:00
haad 363aa1ba89 Whitespace police. 2010-12-15 22:49:42 +00:00
haad 59385470cf Only KM_SLEEP | KM_NOSLEEP can be passed down to kmem layer, clean up
tqflags from internal taskq flags (TQ_FRONT) before calling kmem_alloc.
2010-12-15 22:09:14 +00:00
haad 591e382e8c Revert last commit it's not needed anymore. 2010-12-15 00:58:58 +00:00
haad 3bd4964ac1 Do not built 64b atomic ops to libzpool they are in libc again. 2010-12-14 23:39:11 +00:00
tron 4dd88e84a3 Get DTrace to build again. 2010-12-14 14:08:42 +00:00
haad 4d468780ce Use only cas versions of 64 bit atomic ops. 2010-12-14 09:19:14 +00:00
haad 7527c22f7f Add NetBSD version of zfs snapshot management code. IT needs testing it
was only compile tested for now, but I would like to have some code in to be
sure that it will not be lost.
2010-12-14 01:28:18 +00:00
haad 732f954b5c Define mutex_owned. 2010-12-14 01:25:37 +00:00
haad f60c1b8f4b Remove now unneeded print_timestamp. 2010-12-14 01:23:43 +00:00
haad 9e62f6ad09 Fix amd64 build where sysinfo was not defined, disable libshare for now. 2010-12-14 01:22:24 +00:00
haad b407fc2e79 Do not include debug.h 2010-12-14 01:21:25 +00:00
haad a0200337cd Add some more solaris vnode defs for zfs_ctldir. 2010-12-14 01:21:02 +00:00
haad 3c4cc2dec7 Include sys/debug.h to get ASSERT defined. 2010-12-14 01:18:34 +00:00
haad 72392f89e6 Define print_timestamp during build, to shut up gcc warning. 2010-12-14 01:03:10 +00:00
haad 01d7ba741b Simple routine to convert long to string. 2010-12-14 01:01:40 +00:00
haad 2940dfac08 NetBSD doesn't have /etc/mnttab replace it with /dev/null. 2010-12-14 01:00:26 +00:00
dholland a2f7dda335 SAVENAME and HASBUF namei flags have been abolished; update zfs to match. 2010-11-30 10:45:27 +00:00
haad bcfeb94d61 Update TODO for zfs add new tasks, list some know issues and mark some done stuff.
iRequested by: agc@
2010-11-30 00:14:42 +00:00
dholland 8f6ed30d57 Introduce struct pathbuf. This is an abstraction to hold a pathname
and the metadata required to interpret it. Callers of namei must now
create a pathbuf and pass it to NDINIT (instead of a string and a
uio_seg), then destroy the pathbuf after the namei session is
complete.

Update all namei call sites accordingly. Add a pathbuf(9) man page and
update namei(9).

The pathbuf interface also now appears in a couple of related
additional places that were passing string/uio_seg pairs that were
later fed into NDINIT. Update other call sites accordingly.
2010-11-19 06:44:33 +00:00
christos 00defba087 Adapt to new module locking regime. Is that even right? 2010-08-22 18:01:01 +00:00
hannken 2d762927fb VOP_LOCK() will not be called with LK_INTERLOCK. 2010-07-25 10:31:45 +00:00
hannken fb62bef947 Make holding v_interlock mandatory for callers of vget().
Announced some time ago on tech-kern.
2010-07-21 17:52:09 +00:00
hannken 1423e65b26 Clean up vnode lock operations pass 2:
VOP_UNLOCK(vp, flags) -> VOP_UNLOCK(vp): Remove the unneeded flags argument.

Welcome to 5.99.32.

Discussed on tech-kern.
2010-06-24 12:58:48 +00:00
haad 1b1a9e8e92 Use ddi_copyin and ddi_copyout as solaris does, change them to
ioctl_copyin/ioctl_copyout in kernel and to bcopy in user space.
2010-05-19 18:01:26 +00:00
haad a18cf73bc7 Do not call zfs_init and zfs_fini directly they will be called by vfs routines. 2010-05-19 17:57:42 +00:00
haad d0ec786298 Do not initialize space map cv twice. 2010-05-19 17:50:59 +00:00
haad 04d9252504 Fix userspace cv_timedwait implementation to work on NetBSD. 2010-05-11 22:18:10 +00:00
haad c84b9426dd Disable building of stub_stand.c we build all locking primitives in libzpool. 2010-05-10 06:27:57 +00:00
haad 0fbd0bfd4f If thread_create was called with thread_id = NULL use our local thread id
as replacement otherwise we will crash.
2010-05-10 06:26:11 +00:00
haad 4296646a10 Fix spa_thread to compile under the NetBSD. 2010-05-10 06:15:28 +00:00
haad fd29a8703f Get new vnode when creating zfs share dir for it's znode. 2010-05-10 06:10:59 +00:00
haad 4d91be73cd Disable uvm_reclaim_hook for userland builds. 2010-05-06 22:35:37 +00:00
haad ffca0f125a Fix difference btween solaris cv_timedwait and NetBSD one. NetBSD takes
offset from current time and solaris exact time from unix born.
2010-05-06 22:31:46 +00:00
haad 6e62dfc5b4 Fix zfs version 22 merge error. 2010-05-06 22:26:55 +00:00
darran 80dda7416d DTrace: print a warning no CTF section is found when processing arguments.
This should help diagnose problems such as netbsd images without CTF
sections and old boot loaders.
2010-05-03 09:28:38 +00:00
haad 4673d87178 Add _mutex_held routine to test if mutex_t * is held. 2010-05-03 00:31:32 +00:00
haad 91b542a3db In NetBSD pool cache constructor/destructor routines has inverted arguments.
C
2010-05-02 23:59:54 +00:00
haad 951cf32ac2 Initialize system_taskq during taskq init. This fixes ztest crash in taskq_dispatch. 2010-05-02 23:50:34 +00:00
ahoka 9db315bb61 Add a missing parentheses. 2010-04-23 16:44:10 +00:00
ahoka 290cdd631e Remove a couple of zero length kmem_frees.
It should fix at least one crash when unloading the dtrace module,
possibly many others.
2010-04-23 11:39:52 +00:00