Commit Graph

272 Commits

Author SHA1 Message Date
pooka 89f6fc1189 remove leading whitespace. no functional change. 2009-09-30 18:22:29 +00:00
pooka ce467a3bc2 * fix a race i introduced almost two years ago in rev 1.116:
operations creating a node cannot be considered outgoing operations,
  since after return from userspace they modify file system state
  by creating a new node.  if we do not protect the file system by
  holding the directory lock, a lookup operation might race us into
  the kernel and create the node earlier.
* remove pnode from hashlish before sending the reclaim faf off to
  userspace.  also, hold pmp_lock while frobbing the list.
2009-09-30 18:19:17 +00:00
pooka 8f328cc813 Set SAVENAME for rmdir and remove.
Addresses an easy part of PR kern/38188
2009-09-19 11:44:19 +00:00
tsutsui 46d031a1e7 Fix typo:
-		pcinfo = kmem_zalloc(sizeof_puffs_cacheinfo) + runsize,
+		pcinfo = kmem_zalloc(sizeof(struct puffs_cacheinfo) + runsize,
in #ifdef'ed out code, per paired kmem_free() in the same function.
Closes PR kern/41840.
2009-09-12 18:17:55 +00:00
pooka c94cfd7632 add some todo-items, based on a file which was lingering in my
local tree for apparently almost two years now
2009-05-18 15:47:28 +00:00
cegger df7f595ecd Ansify function definitions w/o arguments. Generated with sed. 2009-03-18 10:22:21 +00:00
pooka 76e97947f5 Bump interface version number for the time_t/dev_t changes. 2009-01-12 18:48:35 +00:00
pooka b4099c3e1d Rototill all remaining file systems to use ubc_uiomove() instead
of the ubc_alloc() - uiomove() - ubc_release() dance.
2008-11-26 20:17:33 +00:00
pooka 010ce4930e more <sys/buf.h> police 2008-11-16 19:34:29 +00:00
ad 43f2119341 PR kern/39307 (mfs will sometimes panic at umount time)
Change dounmount() so that it never drops the caller provided reference.
Garbage collecting 'struct mount' is up to the caller.
2008-09-25 14:17:29 +00:00
christos 9380d4efdb replace 0xa0 with space from Andy Shevchenko 2008-09-10 19:25:33 +00:00
jmcneill e9336f3218 Add module dependency on putter. 2008-05-20 14:19:18 +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
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 ed8a08bae0 PR kern/37950 Unmounting psshfs immediately panics the machine
puffs_getvnode() was inserting vnodes into mnt_vnodelist without taking
a reference to the mount for each. When vnodes are scrubbed, refs to the
vnodes mount structure are dropped => boom.
2008-05-06 12:33:16 +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
ad baa3395f8f PR kern/38057 ffs makes assuptions about devvp file system
PR kern/33406 softdeps get stuck in endless loop

Introduce VFS_FSYNC() and call it when syncing a block device, if it
has a mounted file system.
2008-04-29 18:18:08 +00:00
rmind c6186face4 Welcome to 4.99.55:
- Add a lot of missing selinit() and seldestroy() calls.

- Merge selwakeup() and selnotify() calls into a single selnotify().

- Add an additional 'events' argument to selnotify() call.  It will
  indicate which event (POLL_IN, POLL_OUT, etc) happen.  If unknown,
  zero may be used.

Note: please pass appropriate value of 'events' where possible.
Proposed on: <tech-kern>
2008-03-01 14:16:49 +00:00
tnn d1e420ee23 - Needs sys/atomic.h for atomic_inc_uint()
- Quench compiler warning about signed/unsigned mismatch when building LKM
2008-01-31 08:23:04 +00:00
ad 2290e4283f Expunge references to lockmgr. 2008-01-30 14:16:42 +00:00
ad e556d15453 Make it compile. I'll leave it to pooka to figure out what is the correct
thing here because I don't understand what this code is doing.
2008-01-30 11:57:24 +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
pooka feea4545b8 For code clarity typedef void *puffs_cookie_t.
No functional change.
2008-01-28 21:06:36 +00:00
dholland 717e1785a5 Fix some race conditions in rename.
Introduce a per-FS rename lock and new vfsops to manipulate it.
Get this lock while renaming. Also add another relookup() in do_sys_rename,
which is a hack to kludge around some of the worst deficiencies of
ufs_rename.
reviewed-by: pooka (and an earlier rev by ad)
posted on tech-kern with no objections.
2008-01-28 14:31:15 +00:00
ad 1997a1e1f4 Remove VOP_LEASE. Discussed on tech-kern. 2008-01-25 14:32:11 +00:00
ad 703069c0e9 specfs changes for PR kern/37717 (raidclose() is no longer called on
shutdown). There are still problems with device access and a PR will be
filed.

- Kill checkalias(). Allow multiple vnodes to reference a single device.

- Don't play dangerous tricks with block vnodes to ensure that only one
  vnode can describe a block device. Instead, prohibit concurrent opens of
  block devices. As a bonus remove the unreliable code that prevents
  multiple file system mounts on the same device. It's no longer needed.

- Track opens by vnode and by device. Issue cdev_close() when the last open
  goes away, instead of abusing vnode::v_usecount to tell if the device is
  open.
2008-01-24 17:32:52 +00:00
pooka 89943d2ace fix vmlocking2 fallout: fstrans_mount/unmount 2008-01-03 18:09:35 +00:00
pooka d53e261066 valloc -> vnalloc, vfree -> vnfree
Avoids collision with userland valloc(3).

no functional change
ad ok
2008-01-03 01:26:28 +00:00
pooka 4f32bae2c1 More type-punning workarounds. Curiously the kernel compilation
flags cause gcc to not complain.
2008-01-02 22:37:19 +00:00
pooka b8121d8a80 silence gcc about break type-punning 2008-01-02 22:33:10 +00:00
ad 4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
pooka a5ee2954b8 namespace a bit: vfsops -> puffs_vfsop_x() and vops -> puffs_vnop_x() 2007-12-30 23:04:12 +00:00
pooka 319ddafdc5 Now that "l" is gone both as an argument to operations and from
componentname, remove all vestiges of puffs_cid.
2007-12-08 19:57:02 +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
pooka 7d5d7f4ff9 Send a response message for flush operations from the kernel instead
of abusing the return value of write(2).
2007-12-05 12:11:56 +00:00
pooka c024a3a48f Add a bit to differentiate if a message is a request or a response. 2007-12-04 19:43:42 +00:00
pooka 6a3d9a187d Remove "puffs_cid" from the puffs interface following l-removal
from the kernel vfs interfaces.  puffs_cc_getcaller(pcc) can be
used now should the same information be desired.
2007-11-27 11:31:17 +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
pooka 1b346350d5 In case the userspace wait is interrupted, don't use ERESTART as
the return value, rather use EINTR.

reported by Reinoud
2007-11-26 12:57:26 +00:00
pooka bc7c4b36bc use BUF_ISREAD/WRITE instead of homegrown variants 2007-11-21 16:30:40 +00:00
pooka 7c0ef2ee17 Retire M_PUFFS, use kmem(9) instead. 2007-11-20 11:51:01 +00:00
pooka 61b1e9a615 Make puffs_updatenode() take a puffs_node instead of a vnode. This
way we don't need to worry if a vnode has been reclaimed from under
us.
2007-11-17 21:55:29 +00:00
pooka 63e9f065b3 Start playing around with vnode locks. For now, do the very easy
thing and release locks before the userspace wait for operations
which release the lock before exit from the method in any case.
However, releasing the lock after inserting the request on the
operation queue gives us proper ordering possibilities in userspace
(at least if that bit were implemented, but I don't think there
any file system in userspace that depends on kernel locking and
probably there never should be one).

inspired by a conversation with Nacho Navarro
2007-11-17 21:30:48 +00:00
pooka ac5e27103d Implement a biodone callback for async writes similar to reads and
use that when possible.
2007-11-17 18:09:04 +00:00
pooka 803c088ce0 fix some debug prints 2007-11-17 18:03:15 +00:00
pooka 622412c6c3 Restructure the messaging interface a bit more: make all interfacing
with the file server happen through puffs_msg_enqueue() and
puffs_msg_wait() instead of having a billion different routines.
Build the existing system upon these two.  Most importantly though,
decouple insertation into the op queue from the actual wait.  This
is useful for a number of reasons coming soon to a cvs repo near you.
2007-11-16 20:32:17 +00:00
pooka ca28ea4509 Bounds-check responses from userspace. 2007-11-12 17:42:13 +00:00
pooka 9ac65ee1fe * split the putter header into a kernel version and a userland version
+ install latter to /usr/include/dev/putter
* remove last dependencies to puffs from putter, it's completely
  independent now
2007-11-12 16:39:32 +00:00