Commit Graph

368 Commits

Author SHA1 Message Date
enami
e6aec5115a Make revoke(2) works as before:
- vfs_syscalls.c rev. 1.342 fails to invert condition correcly when
  then-clause and else-clause is swapped.  Since then, revoke(2) fails
  if it is issued by file owner.
- Probably since rev. 1.160 of genfs_vnops.c, revoke(2) fails if it is
  applied to non-device file and drops kernel into ddb.
2009-02-05 13:37:24 +00:00
enami
3d21969dbd Fix a bug introduced by rev. 1.311. Make the kern.vnode sysctl to expose
correct address of each vnode to userland again.
2009-01-21 00:54:05 +00:00
yamt
cea19a4d14 malloc -> kmem_alloc. 2009-01-17 07:02:35 +00:00
christos
461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
yamt
68b6d8786e remove extra semicolons. 2009-01-03 03:31:23 +00:00
pooka
8583cae233 Rename specfs_lock as device_lock and move it from specfs to devsw.
Relaxes kernel dependency on vfs.
2008-12-29 17:41:18 +00:00
pgoyette
9c68331911 Store config(1)'s root filesystem type as a text string rather than
embedding the address of its xxx_mountroot() in swapnetbsd.c.  This
permits booting of kernels with hard-wired filesystem type even if the
filesystem is in a loadable module (ie, not linked into the kernel
image).

Discussed on current-users.  Tested on amd64 and i386 with both hard-
wired and '?' filesystem times, and on both modular and monolithic
kernels.

Thanks to pooka@ for code review and suggestions.

Addresses my PR kern/40167
2008-12-19 17:11:57 +00:00
christos
9a5d3f2817 replace bitmask_snprintf(9) with snprintb(3) 2008-12-16 22:35:21 +00:00
ad
024c36f64b vclean: be paranoid and set v_tag, v_op while holding v_interlock.
FS code could check their values while scrolling through mnt_vnodelist.
2008-12-14 11:15:59 +00:00
ad
31420e7959 - vrelel: fix broken "dead but not clean" assertion. The vnode can be
dead and dirty if cleaning is in progress.
- Add an assertion, fix some text.
2008-12-14 11:13:36 +00:00
pooka
54b9426187 Move some sysctl node creations away from linksets and into the
constructors for subsystems.

XXX: CTLFLAG_PERMANENT is non-sensible.
2008-12-07 20:58:46 +00:00
ad
edd4d8eda9 PR kern/39307 mfs will sometimes panic at umount time
In vfs_destroy, assert that the refcount is not dropping below zero.
2008-09-24 09:33:40 +00:00
tron
b7cced0000 Remove duplicate definition of "specfs_lock".
Patch provided by Juan RP in PR kern/39493.
2008-09-07 13:09:36 +00:00
simonb
36d65f1138 Merge the simonb-wapbl branch. From the original branch commit:
Add Wasabi System's WAPBL (Write Ahead Physical Block Logging)
   journaling code.  Originally written by Darrin B. Jewell while
   at Wasabi and updated to -current by Antti Kantee, Andy Doran,
   Greg Oster and Simon Burge.

OK'd by core@, releng@.
2008-07-31 05:38:04 +00:00
pooka
f06b295c56 Adjust comment location to make it make sense.
no functional change
2008-07-27 15:08:37 +00:00
pooka
cc7d901591 vfs_subr2 has lost its will to live. vfs_subr was originally split
into two parts so that some of the routines could be used by rump.
Now that rump uses both vfs_subr and vfs_subr2 and there is no
reason to keep two files lying around, re-unite them.
2008-07-16 20:06:19 +00:00
pooka
fc6faa2baf Force vrele_thread to run in vflush() only if there is vrele_pending.
Makes unmounting a file system in a forcibly singlethreaded rump
invocation work.
2008-07-07 14:15:41 +00:00
ad
7756789d3a PR kern/38990: Unmounting a disk fails the first time
vflush: process vrele_list at least once before looking at the mount.
2008-06-23 11:23:39 +00:00
ad
b91062326d Avoid "free vnode isn't" assertion. 2008-06-05 12:32:57 +00:00
ad
457a3f8942 vtryget: try to get an initial reference to a vnode without taking its
interlock. Only works if v_usecount is already non-zero, which is nearly
always true for busy files like libc.so or ld_elf.so.
2008-06-03 14:54:12 +00:00
ad
a51fec9810 Avoid assertion failures. From drochner@. 2008-06-02 22:56:09 +00:00
drochner
99cb76cad6 adjust a KASSERT to reality after atomic vnode usecount changes 2008-06-02 19:20:22 +00:00
ad
3a8db3158e Use atomics to maintain v_usecount. 2008-06-02 16:25:34 +00:00
ad
234470c22e tsleep -> kpause 2008-05-27 17:49:07 +00:00
ad
42d0626726 PR kern/38141 lookup/vfs_busy acquire rwlock recursively
Simplify the mount locking. Remove all the crud to deal with recursion on
the mount lock, and crud to deal with unmount as another weirdo lock.

Hopefully this will once and for all fix the deadlocks with this. With this
commit there are two locks on each mount:

- krwlock_t mnt_unmounting. This is used to prevent unmount across critical
  sections like getnewvnode(). It's only ever read locked with rw_tryenter(),
  and is only ever write locked in dounmount(). A write hold can't be taken
  on this lock if the current LWP could hold a vnode lock.

- kmutex_t mnt_updating. This is taken by threads updating the mount, for
  example when going r/o -> r/w, and is only present to serialize updates.
  In order to take this lock, a read hold must first be taken on
  mnt_unmounting, and the two need to be held across the operation.

One effect of this change: previously if an unmount failed, we would make a
half hearted attempt to back out of it gracefully, but that was unlikely to
work in a lot of cases. Now while an unmount that will be aborted is in
progress, new file operations within the mount will fail instead of being
delayed. That is unlikely to be a problem though, because if the admin
requests unmount of a file system then s(he) has made a decision to deny
access to the resource.
2008-05-06 18:43:44 +00:00
ad
bdaf7ef5fc PR kern/38141 lookup/vfs_busy acquire rwlock recursively
vfs_busy: don't deadlock if curlwp is unmounting.
2008-05-06 12:39:32 +00:00
ad
f4d5a72c7b PR kern/38141 lookup/vfs_busy acquire rwlock recursively
getvnode: Use vfs_trybusy, not vfs_busy. If unmount is in progress we
could deadlock, because vnode locks can be held during getnewvnode().
dounmount() locks in the reverse order (vfs_busy -> vnode).
2008-05-06 12:37:04 +00:00
ad
e7d7e96395 vfs_dobusy: add assertions. 2008-05-05 17:08:54 +00:00
ad
04feebca3b PR kern/38141 lookup/vfs_busy acquire rwlock recursively
Until the code paths are fixed properly, put in place an ugly workaround
to make it safe to recursively acquire a read lock on a mount.
2008-05-02 17:40:30 +00:00
ad
928a6b2096 PR kern/38135 vfs_busy/vfs_trybusy confusion
The previous fix worked, but it opened a window where mounts could have
disappeared from mountlist while the caller was traversing it using
vfs_trybusy(). Fix that.
2008-04-30 12:49:16 +00:00
ad
e3610f1886 kern/38135 vfs_busy/vfs_trybusy confusion
The symptom was that sometimes file systems would occasionally not appear
in output from 'df' or 'mount' if the system was busy. Resolution:

- Make mount locks work somewhat like vm_map locks.
- vfs_trybusy() now only fails if the mount is gone, or if someone is
  unmounting the file system. Simple contention on mnt_lock doesn't
  cause it to fail.
- vfs_busy() will wait even if the file system is being unmounted.
2008-04-29 23:51:04 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
cegger
224670ae98 use device_xname() where appropriate
OK martin
2008-04-04 20:13:18 +00:00
dholland
974f37c3af typo patrol 2008-02-24 23:16:24 +00:00
ad
13df0c89b3 vflush: yield at least every 100ms. PR kern/38034. 2008-02-15 13:06:02 +00:00
ad
70c9f5392a vrevoke: if the vnode is already being cleaned out, then ignore it. We
don't need to do anything. PR kern/27622.
2008-02-05 15:13:25 +00:00
ad
22c6a20ebd Lock v_knlist with the vnode interlock. PR kern/37881. 2008-02-05 14:19:52 +00:00
skrll
f5dc52a3c1 Initialise mnt_renamelock in vfs_rootmountalloc. 2008-02-01 08:53:19 +00:00
ad
a3f53add72 Back out previous to let rump compile. Needs to be handled differently. 2008-01-30 15:00:52 +00:00
ad
4df5af489b vlockstatus: return LK_EXCLOTHER as appropriate, for LFS. XXX 2008-01-30 14:53:41 +00:00
ad
abbfb97dd2 vlockmgr: return EBUSY when trylock fails, not EDEADLK.
Pointed out by yamt@.
2008-01-30 12:33:45 +00:00
ad
25153c3ec9 PR kern/37706 (forced unmount of file systems is unsafe):
- Do reference counting for 'struct mount'. Each vnode associated with a
  mount takes a reference, and in turn the mount takes a reference to the
  vfsops.
- Now that mounts are reference counted, replace the overcomplicated mount
  locking inherited from 4.4BSD with a recursable rwlock.
2008-01-30 11:46:59 +00:00
ad
3490efcc63 Replace struct lock on vnodes with a simpler lock object built on
krwlock_t. This is a step towards removing lockmgr and simplifying
vnode locking. Discussed on tech-kern.
2008-01-30 09:50:19 +00:00
dyoung
a2a7fac20f Don't open-code CIRCLEQ, but use CIRCLEQ_*() macros, instead. 2008-01-28 18:24:05 +00:00
pooka
eb6074e41f Replace vrelel() 010101-mania with a flags parameter. However,
leave flags unimplemented for a while (no change in functionality).
2008-01-27 22:47:31 +00:00
pooka
a8d02d0b1a opt_inet.h is no longer necessary 2008-01-26 22:53:10 +00:00
ad
e0f8c5ca59 vrelel: remove a bogus KASSERT. 2008-01-25 16:59:31 +00:00
ad
6da461f692 Fix broken assertion. 2008-01-24 21:04:12 +00:00
ad
d9231f613d Fix 'panic: dangling vnode'. 2008-01-24 18:31:52 +00:00
ad
1de89e3a92 vclean: fix inverted test. 2008-01-24 17:57:14 +00:00