Commit Graph

70 Commits

Author SHA1 Message Date
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
pooka 0971e4900c release lock in error branch 2010-04-16 11:22:43 +00:00
hannken d4436d742d fss_softc_free: don't detach a disk that is not attached. Disk is
attached only if the backing store thread is running.

Resolves PR #43153: fss error branch error
2010-04-13 07:58:54 +00:00
pooka 536aa3a306 Ignore EEXIST from devsw_attach. This is not the optimal solution,
but it makes it possible to dynamically create device nodes for
fss before the fss module init runs by allowing to run devsw_attach
earlier.
2010-04-12 22:29:11 +00:00
hannken 374700a3d9 Remove unused fss_softc member sc_bs_size. 2010-04-05 09:30:46 +00:00
hannken 58cd15b068 Remove unneeded vinvalbuf() on backing store as we don't use
VOP_BMAP()/VOP_STRATEGY() here.
2009-10-17 10:29:29 +00:00
hannken 64747bca1d Fix a race where the backing store thread runs (and exits immediately)
before kthread_create() returns.
2009-10-13 12:37:19 +00:00
dholland effcf1af5c Convert 67 namei call sites to use namei_simple, in these functions:
check_console, veriexecclose, veriexec_delete, veriexec_file_add,
emul_find_root, coff_load_shlib (sh3 version), coff_load_shlib,
compat_20_sys_statfs, compat_20_netbsd32_statfs,
ELFNAME2(netbsd32,probe_noteless), darwin_sys_statfs,
ibcs2_sys_statfs, ibcs2_sys_statvfs, linux_sys_uselib,
osf1_sys_statfs, sunos_sys_statfs, sunos32_sys_statfs,
ultrix_sys_statfs, do_sys_mount, fss_create_files (3 of 4),
adosfs_mount, cd9660_mount, coda_ioctl, coda_mount, ext2fs_mount,
ffs_mount, filecore_mount, hfs_mount, lfs_mount, msdosfs_mount,
ntfs_mount, sysvbfs_mount, udf_mount, union_mount, sys_chflags,
sys_lchflags, sys_chmod, sys_lchmod, sys_chown, sys_lchown,
sys___posix_chown, sys___posix_lchown, sys_link, do_sys_pstatvfs,
sys_quotactl, sys_revoke, sys_truncate, do_sys_utimes, sys_extattrctl,
sys_extattr_set_file, sys_extattr_set_link, sys_extattr_get_file,
sys_extattr_get_link, sys_extattr_delete_file,
sys_extattr_delete_link, sys_extattr_list_file, sys_extattr_list_link,
sys_setxattr, sys_lsetxattr, sys_getxattr, sys_lgetxattr,
sys_listxattr, sys_llistxattr, sys_removexattr, sys_lremovexattr

All have been scrutinized (several times, in fact) and compile-tested,
but not all have been explicitly tested in action.

XXX: While I haven't (intentionally) changed the use or nonuse of
XXX: TRYEMULROOT in any of these places, I'm not convinced all the
XXX: uses are correct; an audit might be desirable.
2009-06-29 05:08:15 +00:00
yamt 70de973662 g/c BUFQ_FOO() macros and use bufq_foo() directly. 2009-01-13 13:33:58 +00:00
hannken a797621996 fss_bs_thread: initialize b_error and b_resid.
Before it was possible for fss reads to return bogus b_resid values
leading to "delta > 0" panics from physio().
2008-11-05 19:30:57 +00:00
hannken 597afdd860 Make fss(4) D_MPSAFE.
- Use the device lock to protect fss_open(), fss_close() and fss_unmount_hook().
- Make sure fss_bs_thread() does not call biodone() with locks held.

Reviewd by: Andrew Doran <ad@netbsd.org>
2008-10-01 10:45:11 +00:00
hannken 95da771bbd Build modular fss driver.
Reviewed by: Quentin Garnier <cube@netbsd.org>
2008-09-23 07:56:59 +00:00
hannken 2b3efeeac5 Persistent snapshots do not need to allocate the variable softc elements. 2008-09-18 10:52:14 +00:00
hannken 8de1a273e1 Replace the fss unmount hook with a vfs_hook.
fssvar.h:       struct device * -> device_t.
fss.c:          establish unmount hook on first attach, remove on last detach.
vfs_syscalls.c: remove the call of fss_umount_hook().
vfs_trans.c:    destroy cow handlers on unmount as fstrans_unmount() will be
                called before vfs_hooks.
2008-09-17 14:49:25 +00:00
hannken fce2c1d412 Create fss(4) devices on first open and destroy on last close of an
unconfigured device.  That removes the compile-time constant number
of useable devices.
While here, add disk_busy()/disk_unbusy() instrumentation.

Reviewed by: Quentin Garnier <cube@netbsd.org>
2008-09-14 16:10:19 +00:00
hannken d5a365311b Remove FSS_STATISTICS. It was never documented and has no real value.
While here, modify fss_error() to no longer use variable arguments.

No functional changes.
2008-09-14 10:12:14 +00:00
hannken dee5129905 - Replace simple_lock/ltsleep/wakeup with mutex/cv.
- Replace malloc/free with kmem_alloc/kmem_free.
- Use bdev_ioctl() instead of bdevsw_lookup()/(*d_ioctl)().
- Be more fair to readers by cleaning the cache one slot at a time.
2008-09-12 10:56:14 +00:00
hannken 31cd18f961 fss_copy_on_write(): return error if reading the snapshotted device failed.
fss_read_cluster():  use nestiobuf for reading.
fss_bs_thread():     dont read the snapshotted device if a request is
                     completely covered by backing store.
2008-09-11 09:37:53 +00:00
hannken 83e3e8b863 Use (*bdev->d_ioctl)() to get the size of the block device the file system
is mounted on.  VOP_IOCTL() without VOP_OPEN() is wrong and we cannot
open a block device twice.

Fixes PR #39405
2008-08-26 13:04:55 +00:00
hannken 8c66a4c56f Fail requests from pagedaemon that need to copy-on-write. 2008-08-15 10:31:24 +00:00
hannken 93d3ff0e45 Deny read/write access to snapshot vnodes. We use fss(4) to read from
snapshots.  With this policy in place:

- Separate the snapshot vnode lock from the snapshot common lock.
  Snapshots no longer need recursive vnode locks.

- Use a mutex (si_snaplock) to serialize creation, deletion, reading and
  writing of snapshots.

- Move ffs_read() for snapshots into ffs_snapshot.c.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>

While here change ffs_copyonwrite() to fail requests from pagedaemon that need
to copy-on-write.
2008-08-12 10:14:37 +00:00
hannken ca4c4b49e1 Stop reusing a buffer obtained with getiobuf(). 2008-07-08 14:57:03 +00:00
mlelstv cc60ba374c fix copy&paste error 2008-06-17 15:05:15 +00:00
mlelstv b0199ee162 One more place to mark an iobuf busy before use. 2008-06-17 15:04:12 +00:00
reinoud f6a70673ba Mark a buffer `busy` in getnewbuf() when it came from the pool_cache since
its not on a free list.

Also change buf_init() to not automatically mark buffers `busy' since this
only makes sense for bufcache buffers.

Mark all buf_init'd buffers 'busy' on the places where they ought to be
flagged as such to not confuse the buffer cache.

Fixes PR 38923.
2008-06-17 14:53:10 +00:00
martin ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
ad a9ca7a3734 Catch up with descriptor handling changes. See kern_descrip.c revision
1.173 for details.
2008-03-21 21:54:58 +00:00
ad 0664a0459b Start detangling lock.h from intr.h. This is likely to cause short term
breakage, but the mess of dependencies has been regularly breaking the
build recently anyhow.
2008-01-04 21:17:40 +00:00
ad 4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
pooka db06a930e6 Remove cn_lwp from struct componentname. curlwp should be used
from on.  The NDINIT() macro no longer takes the lwp parameter and
associates the credentials of the calling thread with the namei
structure.
2007-12-08 19:29:36 +00:00
ad 598ab03ad0 Match the docs: MUTEX_DRIVER/SPIN are now only for porting code written
for Solaris.
2007-12-05 07:06:50 +00:00
hannken d556dc98b0 Fscow_run(): add a flag "bool data_valid" to note still valid data.
Buffers run through copy-on-write are marked B_COWDONE.  This condition
is valid until the buffer has run through bwrite() and gets cleared from
biodone().

Welcome to 4.99.39.

Reviewed by: YAMAMOTO Takashi <yamt@netbsd.org>
2007-12-02 13:56:15 +00:00
pooka 61e8303e9d Remove the "struct lwp *" argument from all VFS and VOP interfaces.
The general trend is to remove it from all kernel interfaces and
this is a start.  In case the calling lwp is desired, curlwp should
be used.

quick consensus on tech-kern
2007-11-26 19:01:26 +00:00
rmind f499d5e662 Use PRI_BIO for kthreads instead of PINOD. Fixes a missed case of priority
inversion, which caused LFS to fire some assertions.

Reported by Kurt Schreiner on <current-users>.
2007-11-10 18:53:57 +00:00
ad 7dad9f7391 Merge from vmlocking:
- Split vnode::v_flag into three fields, depending on field locking.
- simple_lock -> kmutex in a few places.
- Fix some simple locking problems.
2007-10-10 20:42:20 +00:00
hannken 3856acafe2 Update the file system copy-on-write handler.
- Instead of hooking the handler on the specdev of a mounted file system
  hook directly on the `struct mount'.

- Rename from `vn_cow_*' to `fscow_*' and move to `kern/vfs_trans.c'.  Use
  `mount_*specific' instead of clobbering `struct mount' or `struct specinfo'.

- Replace the hand-made reader/writer lock with a krwlock.

- Keep `vn_cow_*' functions and mark as obsolete.

- Welcome to NetBSD 4.99.32 - `struct specinfo' changed size.

Reviewed by: Jason Thorpe <thorpej@netbsd.org>
2007-10-07 13:38:53 +00:00
ad eb171eaaa7 It's not a good idea for device drivers to modify b_flags, as they don't
need to understand the locking around that field. Instead of setting
B_ERROR, set b_error instead. b_error is 'owned' by whoever completes
the I/O request.
2007-07-29 12:50:17 +00:00
ad 88ab7da936 Merge some of the less invasive changes from the vmlocking branch:
- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
2007-07-09 20:51:58 +00:00
christos 53524e44ef Kill caddr_t; there will be some MI fallout, but it will be fixed shortly. 2007-03-04 05:59:00 +00:00
ad 9abeea588a Replace some uses of lockmgr() / simplelocks. 2007-02-15 15:40:50 +00:00
hannken 1b9c6382e3 New file system suspension API to replace vn_start_write and vn_finished_write.
The suspension helpers are now put into file system specific operations.
This means every file system not supporting these helpers cannot be suspended
and therefore snapshots are no longer possible.

Implemented for file systems of type ffs.

The new API is enabled on a kernel option NEWVNGATE.  This option is
not enabled by default in any kernel config.

Presented and discussed on tech-kern with much input from
Bill Studenmund <wrstuden@netbsd.org> and YAMAMOTO Takashi <yamt@netbsd.org>.

Welcome to 4.99.9 (new vfs op vfs_suspendctl).
2007-01-19 14:49:08 +00:00
christos 168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
christos 4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
ad 3029ac48c7 - Use the LWP cached credentials where sane.
- Minor cosmetic changes.
2006-07-21 16:48:45 +00:00
elad 2867b68bc3 integrate kauth. 2006-05-14 21:42:26 +00:00
mrg 084c052803 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-10 21:53:14 +00:00
hannken 3d3a6761ea fss_bs_thread: add FSS_LOCK() in two error cases so the lock is held
on top of the loop.

From Christian Ehrhardt (netbsd-kern AT c--e.de) via tech-kern@
2006-04-13 15:56:53 +00:00
chs 3b7a4338db use lockmgr() instead of bespoke code for mutual exclusion in fss_ioctl().
only take the lock when we actually need it (and particularly not for
unknown cmds that are just going to fail immediately).  fixes PR 33060.
2006-03-14 15:07:29 +00:00
yamt e86cc25701 don't set b_rawblkno unnecessarily.
it will be set by device strategy routine.
2006-01-11 00:49:59 +00:00
yamt ea494c18a9 fss_cluster_iodone: don't call brelvp on non-buffercache buf. 2006-01-07 01:11:42 +00:00