Commit Graph

207 Commits

Author SHA1 Message Date
hannken
2b6ec89863 The current implementation of vn_lock() is racy. Modification of
the vnode operations vector for active vnodes is unsafe because it
is not known whether deadfs or the original file system will be
called.

- Pass down LK_RETRY to the lock operation (hint for deadfs only).

- Change deadfs lock operation to return ENOENT if LK_RETRY is unset.

- Change all other lock operations to check for dead vnode once
  the vnode is locked and unlock and return ENOENT in this case.

With these changes in place vnode lock operations will never succeed
after vclean() has marked the vnode as VI_XLOCK and before vclean()
has changed the operations vector.

Adresses PR kern/37706 (Forced unmount of file systems is unsafe)

Discussed on tech-kern.

Welcome to 6.99.33
2014-02-27 16:51:37 +00:00
pooka
4f6fb3bf35 Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
2014-02-25 18:30:08 +00:00
hannken
97834f7ba0 Change vnode operation lookup to return the resulting vnode *vpp unlocked.
Change cache_lookup() to return an unlocked vnode.

Discussed on tech-kern@

Welcome to 6.99.31
2014-02-07 15:29:20 +00:00
hannken
04c776e5c8 Change vnode operations create, mknod, mkdir and symlink to return
the resulting vnode *vpp unlocked.

Discussed on tech-kern@

Welcome to 6.99.30
2014-01-23 10:13:55 +00:00
hannken
1139274440 Change vnode operations create, mknod, mkdir and symlink to keep the
directory node dvp locked on return.

Discussed on tech-kern@

Welcome to 6.99.29
2014-01-17 10:55:01 +00:00
christos
9d605174d9 Change the queue.3 *_END(&head) macros to NULL. Since we don't have CIRCLEQ
anymore, all the macros expand to NULL anyway, so this improves readability.
Requested by rmind@
2013-11-27 17:24:43 +00:00
christos
5ab798df60 tuck in code inside the mutex 2013-11-23 23:14:55 +00:00
christos
c82871218e replace open-coded scan with macro; fix locking 2013-11-23 17:57:23 +00:00
riz
4d884f3fb4 Since mountlist is now a TAILQ, convert some missed usages
so things build again.
2013-11-23 16:15:24 +00:00
riz
65fba94655 C requires a statement after a label, and a declaration is not a
statement, so create a block using {}.  From christos.
2013-10-18 00:03:35 +00:00
christos
9263de029f remove unused code from macro 2013-10-17 20:56:02 +00:00
christos
641eff3991 remove unused code. 2013-10-17 20:55:30 +00:00
christos
289bc9f713 move module code inside module ifdef 2013-10-17 20:54:24 +00:00
christos
912592a638 mention current status 2012-08-04 12:47:00 +00:00
christos
0c222dcdd0 Don't increment the mount reference count here. Otherwise we are left with
refcount of one when we unmount, and vfs_destroy does not... Who is expected
to decrement this anyway?!?!
2012-08-04 12:31:57 +00:00
christos
020a6ad2d4 - move debugging functions to vcoda so modules with -DDEBUG link
- fix writing to coda files. this is probably not the right way to do
  this, but it satisfies the locking protocol:
	1. Sometimes coda_open() is called with an unlocked vnode which
	   does not satisfy the locking protocol. Lock it for now. We
	   need to find out why this happens
	2. VFS_VGET sometimes returns the container vnode unlocked. What
	   is the locking protocol for VFS_VGET? We also lock it here.
2012-08-02 16:06:58 +00:00
matt
10543b2146 -fno-common fallout. 2012-07-28 00:10:22 +00:00
christos
4af0aec9a5 comment out debugging printfs 2012-05-04 17:57:22 +00:00
christos
b01ba4dca4 depend on "vcoda" since it has symbols we need. 2012-05-04 02:06:27 +00:00
christos
b6690e266f fix locking in getpages when running executables. 2012-05-04 01:40:13 +00:00
christos
89fb5ce609 remove variable names from prototypes. 2012-05-04 01:38:56 +00:00
christos
b43ddeabe0 move the assert after the locked case. 2012-05-03 14:26:42 +00:00
christos
e4d18b9bd2 Instead of sharing the coda vnode lock with the ffs vnode lock, share the
ffs vnode lock with coda.
2012-05-02 16:51:01 +00:00
christos
bc2122f164 cosmetic only: __func__, vnode_t 2012-04-28 20:15:07 +00:00
christos
ee12655fb3 Fixes from get/putpages from rmind.
In grab vnode, share the lock of the coda vnode with the underlying vnode,
so that the locking protocol works.
2012-04-28 20:01:09 +00:00
christos
a28e849d3a remove multiple definitions. 2012-04-26 17:18:33 +00:00
christos
704aca390d re-arrange things so that vcoda does not depend on coda. 2012-04-26 03:04:54 +00:00
christos
c51fe45f15 use CODA_MAXNAMLEN instead of bogus MAXNAMLEN 2011-09-27 00:54:47 +00:00
gdt
bcb68cbe5c Reduce verbosity of semi-debug coda_inactive printf.
Rather than print if the usecount is > 0, only print if it is greater
than 1.  It seems 1 is normal.
2011-09-13 19:34:27 +00:00
plunky
7f3d4048d7 NULL does not need a cast 2011-08-31 18:31:02 +00:00
rmind
e225b7bd09 Welcome to 5.99.53! Merge rmind-uvmplock branch:
- Reorganize locking in UVM and provide extra serialisation for pmap(9).
  New lock order: [vmpage-owner-lock] -> pmap-lock.

- Simplify locking in some pmap(9) modules by removing P->V locking.

- Use lock object on vmobjlock (and thus vnode_t::v_interlock) to share
  the locks amongst UVM objects where necessary (tmpfs, layerfs, unionfs).

- Rewrite and optimise x86 TLB shootdown code, make it simpler and cleaner.
  Add TLBSTATS option for x86 to collect statistics about TLB shootdowns.

- Unify /dev/mem et al in MI code and provide required locking (removes
  kernel-lock on some ports).  Also, avoid cache-aliasing issues.

Thanks to Andrew Doran and Joerg Sonnenberger, as their initial patches
formed the core changes of this branch.
2011-06-12 03:35:36 +00:00
rmind
4a4e52516e Remove cache_purge(9) calls from reclamation routines in the file systems,
as vclean(9) performs it for us since Lite2 merge.
2011-05-19 03:11:55 +00:00
dholland
14402d0ff1 Abolish the SAVENAME and HASBUF flags. There is now always a buffer,
so the path in a struct componentname is now always valid during VOP
calls.
2010-11-30 10:43:01 +00:00
dholland
d4eb05390d Abolish struct componentname's cn_pnbuf. Use the path buffer in the
pathbuf object passed to namei as work space instead. (For now a pnbuf
pointer appears in struct nameidata, to support certain unclean things
that haven't been fixed yet, but it will be going away in the future.)

This removes the need for the SAVENAME and HASBUF namei flags.
2010-11-30 10:29:57 +00:00
christos
0882e5d877 Fix incorrect comments about the buffer size being 2K; it is really 8K now.
From Robert Watson.
2010-08-07 20:39:33 +00:00
christos
014333fdb8 Correct incomplete size checks for the coda ioctls. From Dan Rosenberg. 2010-07-20 17:26:03 +00:00
hannken
245651a23d Remove vlockmgr(). Generic vnode lock operations now use a rwlock located
in the vnode.  All LK_* flags move from sys/lock.h to sys/vnode.h.  Calls
to vlockmgr() in file systems get replaced with VOP_LOCK() or VOP_UNLOCK().

Welcome to 5.99.34.

Discussed on tech-kern.
2010-07-01 13:00:54 +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
hannken
d06039d236 coda_lock(): LK_INTERLOCK flag no longer possible. 2010-06-24 10:37:22 +00:00
hannken
f6c438ba23 Clean up vnode lock operations:
- VOP_LOCK(vp, flags): Limit the set of allowed flags to LK_EXCLUSIVE,
   LK_SHARED and LK_NOWAIT.  LK_INTERLOCK is no longer allowed as it
   makes no sense here.

- VOP_ISLOCKED(vp): Remove the for some time unused return value
  LK_EXCLOTHER.  Mark this operation as "diagnostic only".
  Making a lock decision based on this operation is no longer allowed.

Discussed on tech-kern.
2010-06-24 07:54:46 +00:00
pooka
4f49fb9915 Don't generate unused fs_thefs.h headers. 2010-03-02 16:43:48 +00:00
rmind
dbd9b86792 Remove some unecessary includes sys/user.h header. 2009-11-23 02:13:44 +00:00
blymn
42207b1c5e Make file_id unsigned so it does not get sign extended when promoted
to a 64bit ino_t.
2009-09-28 10:51:35 +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
tsutsui
d779b85d3e Remove extra whitespace added by a stupid tool.
XXX: more in src/sys/arch
2009-04-18 14:58:02 +00:00
cegger
e2cb85904d bcopy -> memcpy 2009-03-18 17:06:41 +00:00
cegger
35fb64746b bcmp -> memcmp 2009-03-18 15:14:29 +00:00
christos
461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
pooka
f9f4344f37 #ifdef _LKM -> #ifndef _KERNEL_OPT 2008-12-30 12:56:12 +00:00
rumble
a1221b6d4a Convert file systems to dynamically attach with the new module interface.
Make VFS hooks dynamic while we're here and say farewell to VFS_ATTACH and
VFS_HOOKS_ATTACH linksets.

As a consequence, most of the file systems can now be loaded as new style
modules.

Quick sanity check by ad@.
2008-05-10 02:26:09 +00:00