Commit Graph

1179 Commits

Author SHA1 Message Date
dsl
82357f6d42 ANSIfy another 1261 function definitions.
The only ones left in sys are beyond by sed script!
(or in sys/dist or sys/external)
Mostly they have function pointer parameters.
2009-03-14 21:04:01 +00:00
dsl
454af1c0e8 Change about 4500 of the K&R function definitions to ANSI ones.
There are still about 1600 left, but they have ',' or /* ... */
in the actual variable definitions - which my awk script doesn't handle.
There are also many that need () -> (void).
(The script does handle misordered arguments.)
2009-03-14 15:35:58 +00:00
dsl
02cdf4d2c8 Remove all the __P() from sys (excluding sys/dist)
Diff checked with grep and MK1 eyeball.
i386 and amd64 GENERIC and sys still build.
2009-03-14 14:45:51 +00:00
yamt
6f8f12ad37 nfs_lookup: fix a comment. 2009-03-13 15:01:29 +00:00
yamt
d32e59ebfc nfs_bioread: don't truncate values in a debug printf. 2009-03-13 15:00:34 +00:00
nisimura
e12e37e63e Update comments to reflect realities; the filenames were changed in 1997
and another one was added years ago.
2009-03-04 06:56:25 +00:00
ad
350a5f88e7 PR kern/40491 5.0: nfs timer can crash/break on smp
Hack around it by acquiring softnet_lock around the client-side timer loop.
2009-02-04 20:36:54 +00:00
yamt
812bb0d164 restore the pre socket locking patch signal behaviour.
this fixes a busy-loop in nfs_connect.
2009-01-21 06:59:29 +00:00
mrg
f41b56aff5 Actually enforce the maximum timeout (60s by default) rather
than backing off to 256*SRTT.  This is why it sometimes could take
hours for a NFS mount to come back when the server returned.

contributed anonymously.
2009-01-18 09:45:05 +00:00
christos
461a86f9bd merge christos-time_t 2009-01-11 02:45:45 +00:00
christos
ed795a66a7 protect sillyrename with _KERNEL 2009-01-02 21:06:11 +00:00
ad
27bc6a2391 - Don't vput() a vnode that we do not hold locked.
- Eliminate one of the few remaining uses of LK_CANRECURSE.
2009-01-02 12:57:29 +00:00
cegger
9b87d582bd kill MALLOC and FREE macros. 2008-12-17 20:51:31 +00:00
pooka
4b18ba9da3 nfsd_use_loan: int -> bool 2008-12-03 14:56:05 +00:00
pooka
0fa0158c37 Use kmem instead of malloc to avoid hassle with dynamically attaching
a malloc type.  Makes nfsserver-as-a-module work.

reported on current-users & tested by Geoff Wing
2008-11-28 07:23:22 +00:00
pooka
bd6148602f g/c unused malloc types 2008-11-28 06:47:08 +00:00
pooka
83f531e6a8 Use struct nfs_fattr in struct flrep instead of uint32_t array
acrobatics to get rid of type punning warning.
2008-11-27 14:04:58 +00:00
pooka
1ba9363d08 Comment police. No functional or GENERIC size change. 2008-11-25 14:28:42 +00:00
pooka
ad71247a89 When testing if a file system handles file handles (ha ha ha), be
content with just the vp-to-fh-size check.
(removes a very weird error path in the code)
2008-11-25 14:04:23 +00:00
mrg
d7d9597105 avoid noisy nfs_timer/nfs_reply DEBUG output that occurs when the
NFS server goes away.  use ratelimit(9) and only print the console
error once every 10 seconds.  PR#31562.
2008-11-23 08:22:07 +00:00
ad
92ce8c6a3d Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
2008-11-19 18:35:57 +00:00
ad
df8183316d Remove COMPAT ifdefs that might as well be comments (i.e., they cost us
almost nothing).
2008-11-14 13:33:55 +00:00
christos
2a274197af - allocate 8 pointers on the stack to avoid stack overflow in nfs.
- make that 8 a constant
- remove bogus panic
2008-10-31 20:42:41 +00:00
cegger
6b4fb5f4de make this build again without having
NFS_BOOT_BOOTSTATIC, NFS_BOOT_BOOTP, NFS_BOOT_DHCP or NFS_BOOT_BOOTPARAM
defined.

I uncovered this case when compiling rump.
2008-10-27 13:24:01 +00:00
cegger
c479884027 change nfs boot behaviour to automatically try next boot method if boot information are incomplete to succeed.
That way, it is possible combine static and dhcp boot:
  For example, to boot diskless you can specify the nfs-server and the rootpath statically. All other information will be taken via dhcp.

Patch has been presented on port-xen, tech-kern and tech-net:
http://mail-index.netbsd.org/port-xen/2008/10/24/msg004488.html
http://mail-index.netbsd.org/tech-kern/2008/10/24/msg003255.html
http://mail-index.netbsd.org/tech-net/2008/10/24/msg000864.html

No comments, no objections.
2008-10-27 10:58:22 +00:00
cegger
cac6895435 - ansify function definition
- de- __P
- u_int32_t -> uint32_t

No functional changes.
2008-10-24 17:17:12 +00:00
matt
b55adffee3 Don't need nfs_vfs_reinit anymore since we don't resize tables anymore.
Move reinit code to init case.
2008-10-22 12:29:35 +00:00
matt
a42078ef92 Change NFS to use a RB-tree for its FH->nfsnode lookups. 2008-10-22 11:36:06 +00:00
christos
02934a6249 Requested by yamt:
- In getpages don't allocate if we are not locked
- Use kmem_alloc instead of malloc and don't sleep

Also provide a 64 entry stack array so we don't have to allocate in the
common case.
2008-10-17 14:24:43 +00:00
dogcow
cff6728f44 it appears the previous commit's sacrifice was "successful compilation with
NFS_V2_ONLY defined".
2008-10-17 06:40:21 +00:00
christos
a7242b8e23 Another sacrifice to the stack protector gods. 2008-10-16 22:04:22 +00:00
christos
96d7a83037 don't use variable allocation on the stack. 2008-10-16 19:33:48 +00:00
pooka
c66ebd3d57 For NFSV3CREATE_EXCLUSIVE verifier, just use arc4random() instead
of the first inet address on INET systems (which is likely to be
localhost).
2008-10-15 14:21:35 +00:00
christos
ff1eb234c1 do the proper ifdef dance for non-inet families 2008-10-09 14:38:21 +00:00
pooka
ae509fabab Use atomic op to get next xid. Initialize value with arc4random()
at nfs init time instead system time based trickery intermingled
with the runtime code.

le bouef: kills last simple_lock from nfs
2008-10-09 00:11:39 +00:00
pooka
d9f75a894c nuke outdated comment 2008-10-07 01:20:37 +00:00
pooka
f4da52c698 Since the nfs root vnode is eternally constant, fully initialize
it in mountfs instead of deferring part of the initialization to
VFS_ROOT().  Fixes theoretical future bugs for nfs roots.
2008-09-30 21:12:48 +00:00
pooka
c7637a677e Initialize nfsnode pools and malloc type dynamically in the
constructor instead of depending on link sets.  Consequently, rename
nfs_nh{init,reinit,done} to nfs_node_{init,reinit,done}, respectively,
to better convey the function.
2008-09-30 14:29:39 +00:00
pooka
7f617ba79e Apply #ifdef modern art to make NFSSERVER-without-NFS possible. 2008-09-30 14:25:15 +00:00
pooka
b334ad7b43 Don't free nd_mrep in case of no reply. It is (at least in one
case) freed already within the rpc handler.

XXX: this line and another was originally committed with "don't
leak mbufs", but given that currently it can double-free an mbuf
and essentially crash the system, I'll opt for the leak.  Needless
to say, this needs revisiting, but that requires a large scale
campaign due to the sticky nature of nfsm love.
2008-09-28 00:10:18 +00:00
plunky
fd7356a917 Convert socket options code to use a sockopt structure
instead of laying everything into an mbuf.

approved by core
2008-08-06 15:01:23 +00:00
uwe
e58a3edb13 When doing pointer arithmetic to compute limit cast bootp to pointer
type of correct signedness.  Caught by lint.
2008-07-20 02:06:37 +00:00
christos
799fe367ce explicitly set birthtime to VNOVAL, since there is no such thing in nfsv{2,3} 2008-07-15 16:06:58 +00:00
ad
a00bd89dab Replace references to getsock/getvnode. 2008-06-24 11:18:14 +00:00
ad
06c343ac94 vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both. 2008-06-04 12:41:40 +00:00
tron
97eb62abf7 Make sure that we flush the NFS directory cache in case of an NFS mount
using the translate cookie option during unmount. This fixes PR kern/38100.
Patch suggested by Michael van Elst during Hackathon 11.
2008-05-24 14:29:18 +00:00
dyoung
b39c416892 Delete unnecessary cast to void *. 2008-05-22 00:57:09 +00:00
ad
d4da0343a9 Make it compile. 2008-05-20 00:18:31 +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
rumble
552b98b94b Fix compilation with DEBUG_NFS_BOOT_DHCP and ssp. 2008-05-09 06:20:39 +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
e071d39c84 - Convert hashinit() to use kmem_alloc(). The hash tables can be large
and it's better to not have them in kmem_map.
- Convert a couple of minor items along the way to kmem_alloc().
- Fix some memory leaks.
2008-05-05 17:11: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
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
yamt
89ee456bc7 as softint network processing is now safe to block,
make some mutexes adaptive.
2008-04-28 15:06:51 +00:00
ad
6d70f903e6 Network protocol interrupts can now block on locks, so merge the globals
proclist_mutex and proclist_lock into a single adaptive mutex (proc_lock).
Implications:

- Inspecting process state requires thread context, so signals can no longer
  be sent from a hardware interrupt handler. Signal activity must be
  deferred to a soft interrupt or kthread.

- As the proc state locking is simplified, it's now safe to take exit()
  and wait() out from under kernel_lock.

- The system spends less time at IPL_SCHED, and there is less lock activity.
2008-04-24 15:35:27 +00:00
ad
15e29e981b Merge the socket locking patch:
- Socket layer becomes MP safe.
- Unix protocols become MP safe.
- Allows protocol processing interrupts to safely block on locks.
- Fixes a number of race conditions.

With much feedback from matt@ and plunky@.
2008-04-24 11:38:36 +00:00
yamt
7f11d683b1 - make nfs_receive and nfs_reply static.
- ansify.
2008-04-10 12:32:37 +00:00
cegger
cc658c528f use aprint_*_dev and device_xname 2008-04-05 13:49:36 +00:00
yamt
9230a9b039 ansify. from Christoph Egger. 2008-03-29 13:48:00 +00:00
yamt
24840272de whitespace. 2008-03-28 14:29:57 +00:00
dholland
d868f7242f Yet another rename workaround - this time check for . and .. early because
relookup() objects to being asked to handle them.
2008-03-28 05:02:08 +00:00
yamt
9a4b7dd279 merge yamt-lazymbuf branch. 2008-03-24 12:24:37 +00:00
rmind
2aaf481e64 G/C l->l_locks.
OK by <ad>.
2008-03-23 00:46:25 +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
yamt
e769ba6b4a desupport link/unlink of directories. noted by Elad Efrat. 2008-03-08 08:03:46 +00:00
elad
4299c49e56 Nuke a KAUTH_GENERIC_ISSUSER, this time in favor of an euid == 0, as
the traditional NFS maproot functionality goes.

Put in a note explaining why and who, also mark for future greps.

Okay yamt@.
2008-03-05 11:49:18 +00:00
elad
cd05a6ee9b Introduce a new kauth action, KAUTH_NETWORK_NFS, and two requests,
KAUTH_REQ_NETWORK_NFS_EXPORT and KAUTH_REQ_NETWORK_NFS_SVC, and use them
to replace two KAUTH_GENERIC_ISSUSER calls in the NFS code.

Also replace two more with KAUTH_SYSTEM_MKNOD, where appropriate.

Documetnation and examples updated. More to come.
2008-02-28 17:07:49 +00:00
matt
d3fcecbd4e Fix extern declaration to match actual declaration (add const). 2008-02-20 17:15:51 +00:00
yamt
5bc7b930ef reject files larger than nm_maxfilesize. 2008-02-13 09:51:37 +00:00
yamt
ee4ca4551d nfs_mountroot: kmem_alloc+memset -> kmem_zalloc 2008-02-13 09:47:12 +00:00
yamt
137ed4c3f9 nfs_kqfilter: fix lock/unlock mismatch. PR/38003 from Geoff C. Wing. 2008-02-12 08:55:27 +00:00
ad
22c6a20ebd Lock v_knlist with the vnode interlock. PR kern/37881. 2008-02-05 14:19:52 +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
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
yamt
d8a5645f80 nfs_check_wccdata: unifdef wcc kludge messages. 2008-01-28 10:44:51 +00:00
ad
52451df464 - Make nfsnode hash MPSAFE.
- Replace use of lockmgr().
2008-01-26 15:30:07 +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
joerg
3615cf7715 Now that __HAVE_TIMECOUNTER and __HAVE_GENERIC_TODR are invariants,
remove the conditionals and the code associated with the undef case.
2008-01-20 18:09:03 +00:00
ad
1e584185b2 Correct test of v_usecount. 2008-01-17 10:27:43 +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
yamt
677860cb8a use kmem_alloc instead of malloc. 2008-01-02 19:26:45 +00:00
ad
4a780c9ae2 Merge vmlocking2 to head. 2008-01-02 11:48:20 +00:00
yamt
0c303876e6 nfsrv_create: fix a use-after-release. 2007-12-22 03:31:15 +00:00
dsl
7e2790cf6f Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
    int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
2007-12-20 23:02:38 +00:00
dyoung
a3f7b0e7a0 Constify. 2007-12-20 16:19:38 +00:00
yamt
a5f2bdb11c nfs_create: try GUARDED if EXCLUSIVE is NOTSUPP. 2007-12-17 16:04:31 +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
4e38160d4d Do not "return 1" from kqfilter for errors. That value is passed
directly to the userland caller and results in a mysterious EPERM.
Instead, return EINVAL or something else sensible depending on the
case.
2007-12-05 17:19:46 +00:00
yamt
1ed3981c19 merge non-intrusive nfs changes from vmlocking. 2007-12-04 17:42:30 +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
yamt
99e9015b80 nfssvc_nfsd: remove a wrong assertion. 2007-11-22 13:30:39 +00:00
yamt
4170b65f86 nfs_lookup: fix indent. 2007-11-13 11:37:08 +00:00
ad
d18c6ca4de Merge from vmlocking:
- pool_cache changes.
- Debugger/procfs locking fixes.
- Other minor changes.
2007-11-07 00:23:13 +00:00
yamt
79606bd6fa make NFS_ATTRTIMEO a function. 2007-10-28 22:24:28 +00:00
yamt
46b951d6aa remove lwp argument from nfs_reconnect and always use &lwp0
because who triggers a reconnect doesn't really matter here.  PR/37145.
2007-10-21 08:23:19 +00:00