Commit Graph

405 Commits

Author SHA1 Message Date
Martin Matuska
77a7f64749 Fix deadlock during zfs receive.
OpenSolaris onnv revision:	9299:8809e849f63e

PR:		kern/146296
Submitted by:	myself
Approved by:	pjd, delphij (mentor)
Obtained from:	OpenSolaris (Bug ID 6783818, 6826836)
MFC after:	1 week
2010-05-04 17:30:07 +00:00
Martin Matuska
df04ddbaa6 Add sysctl and loader tunable vfs.zfs.txg.write_limit_override.
This tunable improves fine-tuning of ZFS write throttling.

PR:		kern/146108
Suggested by:	Nikolay Denev <ndenev at gmail.com>
Approved by:	pjd, delphij (mentor)
MFC after:	2 weeks
2010-05-01 20:44:37 +00:00
Martin Matuska
9ccdc9600e Change description of tunable group vfs.zfs.txg to be more
understandable.

Approved by:	pjd, delphij (mentor)
MFC after:	3 days
2010-05-01 19:53:15 +00:00
Martin Matuska
d8665eb1f6 Fix improper pool write throughput calculation.
OpenSolaris onnv revision:	9366:17553395a745

PR:		kern/146108
Approved by:	pjd, delphij (mentor)
Obtained from:	OpenSolaris, Bug ID 6817339
MFC after:	2 weeks
2010-04-30 07:48:29 +00:00
Pawel Jakub Dawidek
b19b0de471 Backport fix for 'zfs_znode_dmu_init: existing znode for dbuf' panic from OpenSolaris.
PR:		kern/144402
Reported by:	Alex Bakhtin <alex.bakhtin@gmail.com>
Tested by:	Alex Bakhtin <alex.bakhtin@gmail.com>
Obtained from:	OpenSolaris, Bug ID 6895088
MFC after:	3 days
2010-04-28 18:29:48 +00:00
Pawel Jakub Dawidek
7af9c09a61 Allow to modify directory's content even if the ZFS_NOUNLINK (SF_NOUNLINK,
sunlnk) flag is set. We only deny dirctory's removal or rename.

PR:		kern/143343
Reported by:	marck
MFC after:	3 days
2010-04-22 18:47:23 +00:00
Rui Paulo
ff569d8436 Rename the cyclic global variable lapic_cyclic_clock_func to just
cyclic_clock_func. This will make more sense when we start developing non
x86 cyclic version.
2010-04-20 17:03:30 +00:00
Rui Paulo
b527a2a4dc The amd64 version of the cyclic dtrace module is a verbatim copy of the
i386 version, so instead having a copy of the same file, use Makefile
foo to include the i386 version on amd64.
2010-04-20 16:30:17 +00:00
Xin LI
0e568ab25c Partially MFp4 #176265 by pjd@:
- Properly initialize and destroy system_taskq.
 - Add a dummy implementation of taskq_create_proc().

Note: We do not currently use system_taskq in ZFS so this is mostly a
no-op at this time.  Proper system_taskq initialization is required
by newer ZFS code.

Ok'ed by:	pjd
MFC after:	2 weeks
2010-04-19 09:03:36 +00:00
Pawel Jakub Dawidek
bd7226a572 Restore previous order. 2010-04-18 12:43:33 +00:00
Pawel Jakub Dawidek
224329fb6b Style fixes. 2010-04-18 12:36:53 +00:00
Pawel Jakub Dawidek
eb998be67d Add missing list and lock destruction. 2010-04-18 12:27:07 +00:00
Pawel Jakub Dawidek
ad3cb80827 Extend locks scope to match OpenSolaris. 2010-04-18 12:25:40 +00:00
Pawel Jakub Dawidek
57a81a8bbc Remove racy assertion.
Obtained from:	OpenSolaris
2010-04-18 12:21:52 +00:00
Pawel Jakub Dawidek
5195ca2307 Set ARC_L2_WRITING on L2ARC header creation.
Obtained from:	OpenSolaris
2010-04-18 12:20:33 +00:00
Pawel Jakub Dawidek
40c7da090f Fix 3-way deadlock that can happen because of ZFS and vnode lock
order reversal.

thread0 (vfs_fhtovp)	thread1 (vop_getattr)	thread2 (zfs_recv)
--------------------	---------------------	------------------
			vn_lock
rrw_enter_read
						rrw_enter_write (hangs)
			rrw_enter_read (hangs)
vn_lock (hangs)

Submitted by:	Attila Nagy <bra@fsn.hu>
MFC after:	3 days
2010-04-15 16:40:54 +00:00
Pawel Jakub Dawidek
58804a192e The same code is used to import and to create pool.
The order of operations is the following:
1. Try to open vdev by remembered path and guid.
2. If 1 failed, try to find vdev which guid matches and ignore the path.
3. If 2 failed this means either that the vdev we're looking for is gone
   or that pool is being created and vdev doesn't contain proper guid yet.
   To be able to handle pool creation we open vdev by path anyway.

Because of 3 it is possible that we open wrong vdev on import which can lead to
confusions.

The solution for this is to check spa_load_state. On pool creation it will be
equal to SPA_LOAD_NONE and we can open vdev only by path immediately and if it
is not equal to SPA_LOAD_NONE we first open by path+guid and when that fails,
we open by guid. We no longer open wrong vdev on import.

MFC after:	2 weeks
2010-03-19 20:14:27 +00:00
Kip Macy
e577b0b2e3 - cache line align arcs_lock array (h/t Marius Nuennerich)
- fix ARCS_LOCK_PAD to use architecture defined CACHE_LINE_SIZE
- cache line align buf_hash_table ht_locks array

MFC after:	7 days
2010-03-17 21:10:09 +00:00
Kip Macy
07c5b1686e use CACHE_LINE_SIZE instead of hardcoding 128 for lock pad
pointed out by Marius Nuennerich and jhb@
2010-03-17 20:00:22 +00:00
Kip Macy
285738b6ad - reduce contention by breaking up ARC state locks in to 16 for data
and 16 for metadata
- export L2ARC tunables as sysctls
- add several kstats to track L2ARC state more precisely
- avoid holding a contended lock when atomically incrementing a
  contended counter (no lock protection needed for atomics)
2010-03-16 22:17:21 +00:00
Kip Macy
03af82ac5e fix compilation under ZIO_USE_UMA 2010-03-13 21:52:21 +00:00
Kip Macy
181c6ae3f0 Don't bottleneck on acquiring the stream locks - this avoids a massive
drop off in throughput with large numbers of simultaneous reads

MFC after:	7 days
2010-03-13 21:41:52 +00:00
Pawel Jakub Dawidek
3a98b0c4df Remove bogus assertion.
Reported by:	Johan Ström <johan@stromnet.se>
Obtained from:	OpenSolaris, Bug ID 6827260
MFC after:	1 week
2010-03-12 12:07:21 +00:00
Pawel Jakub Dawidek
5b2e8d582f Remove racy assertion.
Reported by:	Attila Nagy <bra@fsn.hu>
Obtained from:	OpenSolaris, Bug ID 6827260
MFC after:	1 week
2010-03-06 20:03:26 +00:00
Marcel Moolenaar
d49ebec408 Use mf and not mf.a. The latter doesn't force memory ordering and
applies to sequential memory.
2010-02-22 01:24:34 +00:00
Pawel Jakub Dawidek
251294bca9 Don't set f_bsize to recordsize. It might confuse some software (like squid).
Submitted by:	Alexander Zagrebin <alexz@visp.ru>
MFC after:	2 weeks
2010-02-19 20:18:16 +00:00
Pawel Jakub Dawidek
bbd388268e Add tunable and sysctl to skip hostid check on pool import. 2010-02-18 22:31:43 +00:00
Xin LI
d0d444da07 Remove two files that are not needed by FreeBSD.
Approved by:	pjd
MFC after:	2 weeks
2010-02-05 23:17:59 +00:00
Pawel Jakub Dawidek
9d3f36a309 Open provider for writting when we find the right one. Opening too much
providers for writing provokes huge traffic related to taste events send
by GEOM on close. This can lead to various problems with opening GEOM
providers that are created on top of other GEOM providers.

Reorted by:	Kurt Touet <ktouet@gmail.com>, mr
Tested by:	mr, Baginski Darren <kickbsd@ya.ru>
MFC after:	2 weeks
2010-02-04 21:11:44 +00:00
Xin LI
63243c5c71 On FreeBSD, time_t is 64-bit for all platforms except i386 and powerpc,
where the type is 32-bit.  ZFS can handle 64-bit timestamp internally
but zfs_setattr() would check if the time value can fit, we change the
checking macros to match 64-bit timestamp if the platform supports it.

This change has some downsides like, while you can import zfs on 32-bit
platforms, the timestamp would overflow if they are out of the range.

This fixes the Y2.038K issue on platforms using 64-bit timestamps.

Reviewed by:	pjd
MFC after:	1 month
2010-01-25 07:52:54 +00:00
Xin LI
51b1ec310c Report ZFS filesystem version instead of the zpool version when we say it.
Reported by:	Yuri Pankov (on -fs@)
Submitted by:	delphij
Approved by:	pjd
MFC after:	1 week
2010-01-11 23:15:11 +00:00
Xin LI
017b01f662 Re-apply onnv-gate revisions 7994 and 8986 (corresponds to FreeBSD
revision 200726 and 200727).  It looks like that the two revisions
were not applied in the right sequence, I found this when comparing
with the OpenSolaris code.

MFC after:	3 days
Reviewed by:	mm@
2010-01-07 20:10:22 +00:00
Xin LI
03ec6213ee Instead of assuming all vdevs are healthy, check the newest vdev label
for each vdev's status.  Booting from a degraded vdev should now be
more robust.

Submitted by:	Matt Reimer <mattjreimer at gmail.com>
Sponsored by:	VPOP Technologies, Inc.
MFC after:	2 weeks
2010-01-06 23:09:23 +00:00
Pawel Jakub Dawidek
49335ba853 Teach the (gpt)zfsboot and zfsloader raidz code to use its buffers
more efficiently.

Before this patch, in the worst case memory use would increase
exponentially on the number of drives in the raidz vdev.

Submitted by:	Matt Reimer <mattjreimer@gmail.com>
Sponsored by:	VPOP Technologies, Inc.
Silence from:	dfr
2010-01-06 22:39:40 +00:00
Xin LI
1ee5de4482 Reduce diff against OpenSolaris - move Giant acquire/release to
zfs_znode.c.  As a side effect this also eliminates two potential
Giant leaks.

Approved by:	pjd
MFC after:	1 month
2010-01-02 23:38:03 +00:00
Xin LI
9189129097 Apply OpenSolaris revision 8012 which brings our zpool to version 14,
making it possible for zpools created on OpenSolaris 2009.06 be used
on FreeBSD.

PR:		kern/141800
Submitted by:	mm
Reviewed by:	pjd, trasz
Obtained from:	OpenSolaris
MFC after:	2 weeks
2009-12-28 22:15:11 +00:00
Xin LI
dd0c145752 Apply fix for Solaris bug 6462803: zfs snapshot -r failed because
filesystem was busy
(onnv revision 8989)

Submitted by:	mm
Approved by:	pjd
Obtained from:	OpenSolaris
MFC after:	2 weeks
2009-12-19 11:49:20 +00:00
Xin LI
24a41d7ec6 Apply fix for Solaris bug 6801979: zfs recv can fail with E2BIG
(onnv revision 8986)

Requested by:	mm
Submitted by:	pjd
Obtained from:	OpenSolaris
MFC after:	2 weeks
2009-12-19 11:47:22 +00:00
Xin LI
775f802393 Apply fix Solaris bug 6462803 zfs snapshot -r failed because
filesystem was busy.

Submitted by:	mm
Approved by:	pjd
MFC after:	2 weeks
2009-12-19 11:43:39 +00:00
Konstantin Belousov
88f2d72947 Change VOP_FSYNC for zfs vnode from VOP_PANIC to zfs_freebsd_fsync(),
both to not panic when fsync(2) is called for fifo on zfs
filedescriptor, and to actually fsync fifo inode to permanent storage.

PR:	kern/141177
Reviewed by:	pjd
MFC after:	1 week
2009-12-05 20:36:42 +00:00
Pawel Jakub Dawidek
dfb903e852 We have to eventually look for provider without checking guid as this is need
for attaching when there is no metadata yet.

Before r200125 the order of looking for providers was wrong. It was:
1. Find provider by name.
2. Find provider by guid.
3. Find provider by name and guid.

Where it should have been:
1. Find provider by name and guid.
2. Find provider by guid.
3. Find provider by name.

MFC after:	1 week
2009-12-05 20:16:28 +00:00
Pawel Jakub Dawidek
6468cb2ce0 Fix deadlock when ZVOLs are present and we are replacing dead component or
calling scrub when pool is in a degraded state. It will try to taste ZVOLs,
which will lead to deadlock, as ZVOL will try to acquire the same locks as
replace/scrub is holding already.

We can't simply skip provider based on their GEOM class, because ZVOL can have
providers build on top of it and we need to skip those as well.

We do it by asking for ZFS::iszvol attribute. Any ZVOL-based provider will give
us positive answer and we have to skip those providers.

This way we remove possibility to create ZFS pools on top of ZVOLs, but it is
not very useful anyway.

I believe deadlock is still possible in some very complex situations like when
we have MD provider on top of UFS file on top of ZVOL. When we try to replace
dead component in the pool mentioned ZVOL is based on, there might be a
deadlock when ZFS will try to taste MD provider. There is no easy way to detect
that, but it isn't very common.

MFC after:	1 week
2009-12-05 14:33:11 +00:00
Pawel Jakub Dawidek
ccba826977 Always check guid when opening by path, because we may end up with provider
that does have the same name, but only by accident.

MFC after:	1 week
2009-12-05 14:24:22 +00:00
Pawel Jakub Dawidek
29c8c85594 Avoid using additional variable for storing an error if we are not going
to do anything with it.
2009-12-05 14:21:42 +00:00
Paul Saab
e44920da1a Correct another case of not doing 64bit math. This allows mine and
other raidz2 volumes to boot.

Submitted by:	Matt Reimer <mattjreimer@gmail.com>
2009-11-13 02:50:50 +00:00
Pawel Jakub Dawidek
fd9ee28bfc Be careful which vattr fields are set during setattr replay.
Without this fix strange things can appear after unclean shutdown like
files with mode set to 07777.

Reported by:	des
MFC after:	3 days
2009-11-10 22:27:33 +00:00
Pawel Jakub Dawidek
56697614cc Avoid passing invalid mountpoint to getnewvnode().
Reported by:	rwatson
Tested by:	rwatson
MFC after:	3 days
2009-11-10 22:25:46 +00:00
Pawel Jakub Dawidek
fd66267ffb - zfs_zaccess() can handle VAPPEND too, so map V_APPEND to VAPPEND and call
zfs_access() instead of vaccess() in this case as well.
- If VADMIN is specified with another V* flag (unlikely) call both
  zfs_access() and vaccess() after spliting V* flags.

This fixes "dirtying snapshot!" panic.

PR:		kern/139806
Reported by:	Carl Chave <carl@chave.us>
In co-operation with:	jh
MFC after:	3 days
2009-10-30 23:33:06 +00:00
Robert Noland
14c436e101 Correct some issues with zfs boot.
- Teach it to read gang blocks. (essentially untested)
   If you see "ZFS: gang block detected!", please let
   me know, so we can either remove the printf if it
   works, or fix it if it doesn't.

 - If multiple partitions exist on a disk, probe them all.
   We also need to reset dsk->start to 0 to read the right
   sector here.

 - With GPT, we can have 128 partitions.

 - If the bootfs property has ever been set on a pool
   it seems that it never goes away.  zpool won't allow
   you to add to the pool with the bootfs property set.
   However, if you clear the property back to default
   we end up getting 0 for the object number and read
   a bogus block pointer and fail to boot.

 - Fix some error printfs. The printf in the loader is
   only capable of c,s and u formats.

 - Teach printf how to display %llu

Reviewed by:	dfr, jhb
MFC after:	2 weeks
2009-10-23 18:44:53 +00:00
Pawel Jakub Dawidek
c217b20ef6 Allow file system owner to modify system flags if securelevel permits.
MFC after:	3 days
2009-10-08 16:05:17 +00:00
Pawel Jakub Dawidek
68c53ef849 File system owner is when uid matches and jail matches.
MFC after:	3 days
2009-10-08 16:03:19 +00:00
Pawel Jakub Dawidek
3a6c0cbf26 On FreeBSD it is enough to report provider removal when orphan event is
received, we don't have to do it on every ENXIO error in I/O path.
Solaris has no GEOM so they have to handle it in a less clean way.

MFC after:	3 days
2009-10-07 20:56:15 +00:00
Pawel Jakub Dawidek
2ada529a14 Fix white-spaces.
MFC after:	3 days
2009-10-07 20:54:07 +00:00
Pawel Jakub Dawidek
c0103003c0 Fix situation where Mac OS X NFS client creates a file and when it tries
to set ownership and mode in the same setattr operation, the mode was
overwritten by secpolicy_vnode_setattr().

PR:		kern/118320
Submitted by:	Mark Thompson <info-gentoo@mark.thompson.bz>
MFC after:	3 days
2009-10-07 12:38:19 +00:00
Kip Macy
e6b112e274 Prevent paging pressure from draining arc too much
- always drain arc if above arc_c_max - never drain arc if arc is below arc_c_max

MFC after:	3 days
2009-10-06 21:40:50 +00:00
Xin LI
6f62807611 Return EOPNOTSUPP instead of EINVAL when doing chflags(2) over an old
format ZFS, as defined in the manual page.

Submitted by:	pjd (response of my original patch but bugs are mine)
MFC after:	3 days
2009-10-01 18:58:26 +00:00
Pawel Jakub Dawidek
ab711589df Handle cases where virtual (GFS) vnodes are referenced when doing forced
unmount. In that case we cannot depend on the proper order of invalidating
vnodes, so we have to free resources when we have a chance.

PR:		kern/139062
Reported by:	trasz
MFC after:	3 days
2009-09-26 00:10:45 +00:00
Pawel Jakub Dawidek
a0b238644a On lookup error VFS expects *vpp to be set to NULL, be sure to do that.
MFC after:	3 days
2009-09-26 00:08:44 +00:00
Pawel Jakub Dawidek
a99aaff645 Use traverse() function to find and return mount point's vnode instead of
covered vnode when snapshot is already mounted.

MFC after:	3 days
2009-09-26 00:07:14 +00:00
Pawel Jakub Dawidek
1aba32d9b4 - Don't depend on value returned by gfs_*_inactive(), it doesn't work
well with forced unmounts when GFS vnodes are referenced.
- Make other preparations to GFS for forced unmounts.

PR:		kern/139062
Reported by:	trasz
MFC after:	3 days
2009-09-26 00:04:30 +00:00
Pawel Jakub Dawidek
86758476b4 Switch to fletcher4 as the default checksum algorithm. Fletcher2 was proven to
be a bit weak and OpenSolaris also switched to fletcher4.

PR:		kern/139072
Reported by:	Daniel Grund <bugs@dgrund.de>
MFC after:	3 days
2009-09-25 18:19:50 +00:00
Pawel Jakub Dawidek
ad8294cf98 Before calling vflush(FORCECLOSE) mark file system as unmounted so the
following vnops will fail. This is very important, because without this change
vnode could be reclaimed at any point, even if we increased usecount. The only
way to ensure that vnode won't be reclaimed was to lock it, which would be very
hard to do in ZFS without changing a lot of code. With this change simply
increasing usecount is enough to be sure vnode won't be reclaimed from under
us. To be precise it can still be reclaimed but we won't be able to see it,
because every try to enter ZFS through VFS will result in EIO.

The only function that cannot return EIO, because it is needed for vflush() is
zfs_root(). Introduce ZFS_ENTER_NOERROR() macro that only locks
z_teardown_lock and never returns EIO.

MFC after:	3 days
2009-09-24 15:56:26 +00:00
Pawel Jakub Dawidek
ab9bbf4a2b Close race in zfs_zget(). We have to increase usecount first and then
check for VI_DOOMED flag. Before this change vnode could be reclaimed
between checking for the flag and increasing usecount.

MFC after:	3 days
2009-09-24 15:49:15 +00:00
Edward Tomasz Napierala
c40502ccd0 In VOP_SETACL(9) and VOP_GETACL(9), specifying wrong ACL type should result
in EINVAL, not EOPNOTSUPP.
2009-09-23 15:09:34 +00:00
Pawel Jakub Dawidek
eb03c3cdfb Restore BSD behaviour - when creating new directory entry use parent directory
gid to set group ownership and not process gid.

This was overlooked during v6 -> v13 switch.

PR:		kern/139076
Reported by:	Sean Winn <sean@gothic.net.au>
MFC after:	3 days
2009-09-23 09:18:16 +00:00
Pawel Jakub Dawidek
c4be11d7fc Purge namecache in the same place OpenSolaris does. 2009-09-20 13:28:29 +00:00
Pawel Jakub Dawidek
5469543c92 Purge file system namecache when receiving incremental stream and rolling back
to it.

MFC after:	3 days
2009-09-17 15:14:28 +00:00
Pawel Jakub Dawidek
3282c51713 Purge namecache for the file system being rolled back, so it doesn't point at
invalid vnodes after the rollback resulting in EIO errors when trying to access
files which are in the namecache.

Reported by:	des
MFC after:	3 days
2009-09-17 14:58:21 +00:00
Pawel Jakub Dawidek
95f08808b6 Forced unmounts work just fine in my tests under heavy load. There might
still be a problem, but it isn't worth a warning.
2009-09-15 11:42:08 +00:00
Pawel Jakub Dawidek
a4e6b460d3 We believe ZFS is ready for production use. Remove a warning about it being
experimental. :)
2009-09-15 11:34:53 +00:00
Pawel Jakub Dawidek
63e1d3df27 - Mount ZFS snapshots with MNT_IGNORE flag, so they are not visible in regular
df(1) and mount(8) output. This is a bit smilar to OpenSolaris and follows
  ZFS route of not listing snapshots by default with 'zfs list' command.
- Add UPDATING entry to note that ZFS snapshots are no longer visible in
  mount(8) and df(1) output by default.

Reviewed by:	kib
MFC after:	3 days
2009-09-14 21:10:40 +00:00
Pawel Jakub Dawidek
85c171b2e1 Support both case: when snapshot is already mounted and when it is not yet
mounted.

MFC after:	3 days
2009-09-13 21:40:36 +00:00
Pawel Jakub Dawidek
8a2c4db0fe Add missing \n.
Reported by:	marck
2009-09-13 17:30:56 +00:00
Pawel Jakub Dawidek
7746b6461d Work-around READDIRPLUS problem with .zfs/ and .zfs/snapshot/ directories
by just returning EOPNOTSUPP. This will allow NFS server to fall back to
regular READDIR.

Note that converting inode number to snapshot's vnode is expensive operation.
Snapshots are stored in AVL tree, but based on their names, not inode numbers,
so to convert inode to snapshot vnode we have to interate over all snalshots.

This is not a problem in OpenSolaris, because in their READDIRPLUS
implementation they use VOP_LOOKUP() on d_name, instead of VFS_VGET() on
d_fileno as we do.

PR:		kern/125149
Reported by:	Weldon Godfrey <wgodfrey@ena.com>
Analysis by:	Jaakko Heinonen <jh@saunalahti.fi>
MFC after:	3 days
2009-09-13 16:05:20 +00:00
Pawel Jakub Dawidek
7b4a12379b When zfs.ko is compiled with debug, make sure that znode and vnode point at
each other.

MFC after:	3 days
2009-09-13 10:33:51 +00:00
Pawel Jakub Dawidek
33a0ef82f2 Extend scope of the z_teardown_lock lock for consistency and "just in case".
MFC after:	3 days
2009-09-13 10:29:51 +00:00
Pawel Jakub Dawidek
7dae3c4faf Be sure not to overflow struct fid.
MFC after:	3 days
2009-09-13 10:25:33 +00:00
Pawel Jakub Dawidek
f53901193d There is a bug where mze_insert() can trigger an assert() of inserting
the same entry twice. This bug is not fixed yet, but leads to situation
where when try to access corrupted directory the kernel will panic.
Until the bug is properly fixed, try to recover from it and log that it
happened.

Reported by:	marck
OpenSolaris bug:	6709336
MFC after:	3 days
2009-09-13 10:12:29 +00:00
Pawel Jakub Dawidek
f5516e3d1d - Protect reclaim with z_teardown_inactive_lock.
- Be prepared for dbuf to disappear in zfs_reclaim_complete() and check if
  z_dbuf field is NULL - this might happen in case of rollback or forced
  unmount between zfs_freebsd_reclaim() and zfs_reclaim_complete().
- On forced unmount wait for all znodes to be destroyed - destruction can be
  done asynchronously via zfs_reclaim_complete().

MFC after:	1 week
2009-09-12 19:53:31 +00:00
Pawel Jakub Dawidek
2a8e7dad33 Tighten up the check for race in zfs_zget() - ZTOV(zp) can not only contain
NULL, but also can point to dead vnode, take that into account.

PR:		kern/132068
Reported by:	Edward Fisk" <7ogcg7g02@sneakemail.com>, kris
Fix based on patch from:	Jaakko Heinonen <jh@saunalahti.fi>
MFC after:	1 week
2009-09-12 19:27:54 +00:00
Pawel Jakub Dawidek
3770996142 Only log successful commands! Without this fix we log even unsuccessful
commands executed by unprivileged users. Action is not really taken, but it is
logged to pool history, which might be confusing.

Reported by:	Denis Ahrens <denis@h3q.com>
MFC after:	3 days
2009-09-08 16:40:08 +00:00
Pawel Jakub Dawidek
d6b8039292 We don't export individual snapshots, so mnt_export field in snapshot's
mount point is NULL. That's why when we try to access snapshots over NFS
use mnt_export field from the parent file system.

MFC after:	1 week
2009-09-08 15:57:03 +00:00
Pawel Jakub Dawidek
f148fd9a4a When we automatically mount snapshot we want to return vnode of the mount point
from the lookup and not covered vnode. This is one of the fixes for using .zfs/
over NFS.

MFC after:	1 week
2009-09-08 15:51:40 +00:00
Pawel Jakub Dawidek
2391003912 On FreeBSD we don't have to look for snapshot's mount point,
because fhtovp method is already called with proper mount point.

MFC after:	1 week
2009-09-08 15:42:55 +00:00
Pawel Jakub Dawidek
6f8e88e1da Call ZFS_EXIT() after locking the vnode.
MFC after:	1 week
2009-09-08 15:37:01 +00:00
Konstantin Belousov
211ddddce7 Lock Giant around vn_open_cred().
Remove innocent unnecessary call to NDFREE().

Reported by:	marcel
Reviewed and tested by:	pjd
MFC after:	3 days
2009-09-08 09:17:34 +00:00
Pawel Jakub Dawidek
1ea3566294 Fix reference count leak for a case where snapshot's mount point is updated.
Such situation is not supported.

This problem was triggered by something like this:

	# zpool create tank da0
	# zfs snapshot tank@snap
	# cd /tank/.zfs/snapshot/snap  (this will mount the snapshot)
	# cd
	# mount -u nosuid /tank/.zfs/snapshot/snap  (refcount leak)
	# zpool export tank
	cannot export 'tank': pool is busy

MFC after:	1 week
2009-09-08 08:54:15 +00:00
Pawel Jakub Dawidek
28e449adf2 If we have to use avl_find(), optimize a bit and use avl_insert() instead of
avl_add() (the latter is actually a wrapper around avl_find() + avl_insert()).

Fix similar case in the code that is currently commented out.
2009-09-07 21:58:54 +00:00
Pawel Jakub Dawidek
3f6043a57d When snapshot mount point is busy (for example we are still in it)
we will fail to unmount it, but it won't be removed from the tree,
so in that case there is no need to reinsert it.

This fixes a panic reproducable in the following steps:

	# zfs create tank/foo
	# zfs snapshot tank/foo@snap
	# cd /tank/foo/.zfs/snapshot/snap
	# umount /tank/foo
	panic: avl_find() succeeded inside avl_add()

Reported by:	trasz
MFC after:	3 days
2009-09-07 21:46:51 +00:00
Edward Tomasz Napierala
343775c0b4 Enable NFSv4 ACL support in ZFS.
Reviewed by:	pjd
2009-09-07 19:43:13 +00:00
Pawel Jakub Dawidek
08780916dd Defer thread start until we set priority.
Reviewed by:	kib
MFC after:	3 days
2009-09-07 19:22:44 +00:00
Pawel Jakub Dawidek
c739b7b22b Don't recheck ownership on update mount. This will eliminate LOR between
vfs_busy() and mount mutex. We check ownership in vfs_domount() anyway.

Noticed by:	kib
Reviewed by:	kib
MFC after:	1 week
2009-09-07 18:54:55 +00:00
Pawel Jakub Dawidek
2ff6f0f89a - Avoid holding mutex around M_WAITOK allocations.
- Add locking for mnt_opt field.

MFC after:	1 week
2009-09-07 18:23:26 +00:00
Edward Tomasz Napierala
900b1670c4 Prevent the line from wrapping. 2009-09-07 16:56:41 +00:00
Pawel Jakub Dawidek
841bcfea21 Changing provider size is not really supported by GEOM, but doing so when
provider is closed should be ok.

When administrator requests to change ZVOL size do it immediately if ZVOL
is closed or do it on last ZVOL close.

PR:		kern/136942
Requested by:	Bernard Buri <bsd@ask-us.at>
MFC after:	1 week
2009-09-07 14:16:50 +00:00
Pawel Jakub Dawidek
5e65224daf bzero() on-stack argument, so mutex_init() won't misinterpret that the
lock is already initialized if we have some garbage on the stack.

PR:		kern/135480
Reported by:	Emil Mikulic <emikulic@gmail.com>
MFC after:	3 days
2009-09-07 11:38:43 +00:00
Edward Tomasz Napierala
a41422a93e Improve wording.
Discussed with:	pjd, cperciva, rink, wkoszek and des, in order of appearance.
2009-09-05 15:08:58 +00:00
Pawel Jakub Dawidek
26d0605727 Backport the 'dirtying dbuf' panic fix from newer ZFS version.
Reported by:	Thomas Backman <serenity@exscape.org>
MFC after:	1 week
2009-08-31 16:27:00 +00:00
Pawel Jakub Dawidek
575c1d371c Add missing mountpoint vnode locking.
This fixes panic on assertion with DEBUG_VFS_LOCKS and vfs.usermount=1 when
regular user tries to mount dataset owned by him.

MFC after:	1 week
2009-08-30 21:03:40 +00:00
Pawel Jakub Dawidek
5d5535163a - Hide ZFS kernel threads under zfskern process.
- Use better (shorter) threads names:
	'zvol:worker zvol/tank/vol00' -> 'zvol tank/vol00'
	'vdev:worker da0' -> 'vdev da0'
2009-08-23 11:33:46 +00:00