Commit Graph

1179 Commits

Author SHA1 Message Date
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
ad
9f56dfa520 Merge brelse() changes from the vmlocking branch. 2007-10-08 18:02:53 +00:00
ad
451aacda90 Merge file descriptor locking, cwdi locking and cross-call changes
from the vmlocking branch.
2007-10-08 15:12:05 +00:00
rmind
27ad3d8619 nfs_mount: Plug a possible leaks.
Invented in 1.114 rev.
From CID: 4534
2007-09-06 01:11:44 +00:00
dyoung
bb04fc71fb Use sockaddr_in_init() and ifreq_setaddr() to initialize a sockaddr_in
and an ifreq.ifr_addr, respectively.  Get rid of an extraneous
cast---down the elevator shaft!  Change 'ireq' to 'ifr', which is
what the kernel calls a temporary struct ifreq virtually everywhere
else.
2007-08-31 22:02:58 +00:00
dyoung
1751c5101f Constify: LLADDR() -> CLLADDR(). 2007-08-29 22:53:35 +00:00
yamt
c379ad6567 - instead of scanning an array of iods, maintain a list of idle iods.
- make nfs_getset_niothreads MP friendly.
2007-08-10 15:12:56 +00:00
yamt
8e473ee7cb push kernel_lock a little. 2007-08-08 12:27:56 +00:00
yamt
9c0f7c2a93 nfs_inactive: turn a panic into a printf for now, as it isn't critical.
PR/36572 from Martin Husemann.
2007-08-06 11:55:08 +00:00
yamt
1f0f803e45 use kpause rather than lbolt. 2007-08-05 09:40:39 +00:00
yamt
5bde4f20f7 nfsrv_slpderef: add an assertion. 2007-08-02 12:46:03 +00:00
yamt
d72bfdbeb2 nfsdsock_unlock: add an assertion. 2007-08-02 12:45:37 +00:00
yamt
4af13cf23b nfssvc_nfsd: fix a wrong assertion. PR/36710 from Tobias Nygren. 2007-08-02 12:44:18 +00:00
yamt
6bc5a5a70f nfsrv_zapsock: update SLP_DOREC for consistency. 2007-08-02 12:42:17 +00:00
yamt
76eb9e074c nfssvc_nfsd: don't leave sockets with SLP_DISCONN. 2007-08-02 12:40:36 +00:00
pooka
8d1f899239 * nuke the nameidata parameter from VFS_MOUNT(). Nobody on tech-kern
knew what it was supposed to be used for and wrstuden gave a go-ahead
* while rototilling, convert file systems which went easily to
  use VFS_PROTOS() instead of manually prototyping the methods
2007-07-31 21:14:15 +00:00
ad
a0d1fd8d0c 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 13:31:07 +00:00
yamt
c90a0e2579 stop nfs tick when we have nothing to do. 2007-07-27 10:03:58 +00:00
yamt
662e7a9e40 use ubc_uiomove for read as well. 2007-07-27 10:00:42 +00:00
yamt
3822af7031 ubc_uiomove: add an "advice" argument rather than using UVM_ADV_RANDOM blindly. 2007-07-27 09:50:36 +00:00
pooka
d9970c8066 Use eopnotsupp() instead of vfs_stdsuspendctl() and retire the latter. 2007-07-26 22:57:36 +00:00
pooka
9137aeda4b In sync, skip over vnodes based on if they are clean rather than
if they have pages.
2007-07-20 16:46:43 +00:00
yamt
97c7bbe6b8 - fix decreasing of vfs.nfs.iothreads after the recent partial merge
of vmlocking.
- don't make nfsiod exit with requests left.
- make NFSSVC_BIOD a dummy so that nfsiod can be simplified.
2007-07-20 15:36:41 +00:00
dyoung
08e6f22226 Take steps to hide the radix_node implementation of the forwarding table
from the forwarding table's users:

        Introduce rt_walktree() for walking the routing table and
        applying a function to each rtentry.  Replace most
        rn_walktree() calls with it.

        Use rt_getkey()/rt_setkey() to get/set a route's destination.
        Keep a pointer to the sockaddr key in the rtentry, so that
        rtentry users do not have to grovel in the radix_node for
        the key.

        Add a RTM_GET method to rtrequest.  Use that instead of
        radix_node lookups in, e.g., carp(4).

Add sys/net/link_proto.c, which supplies sockaddr routines for
link-layer socket addresses (sockaddr_dl).

Cosmetic:

        Constify.  KNF.  Stop open-coding LIST_FOREACH, TAILQ_FOREACH,
        et cetera.  Use NULL instead of 0 for null pointers.  Use
        __arraycount().  Reduce gratuitous parenthesization.

        Stop using variadic arguments for rip6_output(), it is
        unnecessary.

        Remove the unnecessary rtentry member rt_genmask and the
        code to maintain it, since nothing actually used it.

        Make rt_maskedcopy() easier to read by using meaningful variable
        names.

        Extract a subroutine intern_netmask() for looking up a netmask in
        the masks table.

        Start converting backslash-ridden IPv6 macros in
        sys/netinet6/in6_var.h into inline subroutines that one
        can read without special eyeglasses.

One functional change: when the kernel serves an RTM_GET, RTM_LOCK,
or RTM_CHANGE request, it applies the netmask (if supplied) to a
destination before searching for it in the forwarding table.

I have changed sys/netinet/ip_carp.c, carp_setroute(), to remove
the unlawful radix_node knowledge.

Apart from the changes to carp(4), netiso, ATM, and strip(4), I
have run the changes on three nodes in my wireless routing testbed,
which involves IPv4 + IPv6 dynamic routing acrobatics, and it's
working beautifully so far.
2007-07-19 20:48:52 +00:00
pooka
e24b0872a4 Make set_statvfs_info() take a parameter for the vfs name instead
of always retrieving it from mp->mnt_op->vfs_name

christos ok
2007-07-17 11:19:31 +00:00
yamt
bc1bb99dc5 remove (void)0; nonsense. 2007-07-17 10:24:10 +00:00
yamt
9dc12587a5 fix a typo in a comment. 2007-07-17 10:23:33 +00:00
dsl
2721ab6c7b Change the VFS_MOUNT() interface so that the 'data' buffer passed to the
fs code is a kernel buffer, pass though the length of the buffer as well.
Since the length of the userspace buffer isn'it (yet) passed through the mount
system call, add a field to the vfsops structure containing the default length.
Split sys_mount() for calls from compat code.
Ride one of the recent kernel version changes - old fs LKMs will load, but
sys_mount() will reject any attempt to use them.
2007-07-12 19:35:32 +00:00
rmind
845fda992a nfs_asyncio: fix the locking in error case, problem was introduced
in 1.153 revision, where ltsleep() was replaced with condvar.

Problem found and fix provided by David A. Holland, PR/36610.
Actually, relock is not needed here, and mutex would be unlocked
only on nfs_sigintr() fail case.
2007-07-12 18:29:43 +00:00
ad
e05e11c21a Fix build when not !NFSSERVER. 2007-07-09 21:29:09 +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
bouyer
a92a400fbf Add a new BOOTSTATIC flag, NFS_BOOTSTATIC_NOSTATIC, which causes
nfs_bootstatic() to abort with EOPNOTSUPP. This allows a callback to
say that there is no bootstatic config, and the next NFS boot method should
be tried.
2007-07-08 21:08:09 +00:00
dsl
6319443e37 Updates for changes prototype of kauth_cred_set/getgroups(). 2007-06-30 15:27:02 +00:00
yamt
f0baa9219b - nfsrv_slpderef: fix a locking botch.
(should fix "slp->ns_sref == 0" assertion failures in nfsrv_init)
- add some related assertions.
2007-06-22 14:39:59 +00:00
yamt
0eaaf7405e nfssvc_iod: fix nm_bufqiods accounting on exit. 2007-06-19 13:13:37 +00:00
yamt
7508122896 nfs_write:
- IO_SYNC: don't bother to flush dirty pages before copying data from
  user buffer.
- IO_APPEND: don't invalidate pages blindly.  PR/28472 from Brian Marcotte.
2007-06-12 09:42:27 +00:00
yamt
f1ce35c9f6 nfs_inactive: don't clear NTRUNCDELAYED erroneously.
(fix cache consistency problems like NUL bytes near EOF.)
2007-06-12 09:33:25 +00:00
yamt
ac63eb98da - nfssvc_nfsd: clear nfsd_slp when exiting.
(fix an assertion failure in rev.1.112.)

- nfsrv_init: add assertions.
2007-06-12 09:30:49 +00:00
dyoung
a8fef725ac There is only one radix trie walker, and it is rn_walktree(), so
use that instead of the indirect function call through rnh,
rnh->rnh_walktree.
2007-06-09 02:33:41 +00:00
dyoung
99964897cf Cosmetic: de-__P() et cetera. 2007-06-09 02:32:34 +00:00
yamt
a4a20623eb nfs_getattrcache: simplify. no functional changes. 2007-06-06 09:23:55 +00:00
yamt
da51d139a4 improve post-ubc file overwrite performance in common cases.
ie. when it's safe, actually overwrite blocks rather than doing
read-modify-write.

also fixes PR/33152 and PR/36303.
2007-06-05 12:31:30 +00:00
yamt
326517bd8d add some #include. 2007-06-02 03:32:51 +00:00
dogcow
0023297d28 it seems like a good idea to include <sys/condvar.h>, as we're using them... 2007-06-01 23:16:33 +00:00
yamt
63abe2b629 nfssvc_nfsd: check SPCF_SHOULDYIELD and yield cpu. 2007-06-01 14:43:17 +00:00
yamt
ab5f84630b nfssvc_nfsd: add assertions. 2007-06-01 14:10:02 +00:00
yamt
05aaff39ff use mutex and condvar. 2007-06-01 11:56:03 +00:00
yamt
61131eb130 nfsdsock_lock: fix an inverted check of SLP_VALID. 2007-06-01 11:38:44 +00:00
yamt
febe85111f - remove nfs_exit exit hook. ok'ed by christos@.
- as far as i understand the code, it shouldn't be necessary
	  because nfs_request can't return without removing its request
	  and r->r_lwp is either curlwp or NULL.
	- even if it's necessary, leaking requests is not the correct way
	  to recover from the condition.
- nfs_request: add a related assertion.
2007-05-28 16:47:38 +00:00
yamt
683644f00e nfs_write: report an error correctly in the case of IO_SYNC. 2007-05-09 23:17:45 +00:00
manu
f39939ad43 Fix buid (broken by a fix introduced in the wrong file...) 2007-05-08 09:29:50 +00:00
manu
31b57f40ff Add the TFTPROOT kernel option for TFTP'ing root RAMdisk at root mount time.
This allows working around situations where a kernel with embedded RAMdisk
cannot be booted by the bootloader because the RAMdisk is too big.
2007-05-08 06:10:27 +00:00
yamt
fce3c58e5e nfs_rcvlock: fix NFSMNT_INT check, which has been broken since rev.1.39. 2007-05-02 16:19:55 +00:00
yamt
e4c778084c - nfs_reply: keep rcvlock longer so that lwp which already have its reply
received won't be stuck in nfs_receive.
- nfs_rcvlock: check exceptions before sleeping on the lock.
- nfs_rcvunlock: use cv_broadcast rather than cv_signal to ensure that
  lwps which received its reply get woken up.
2007-05-02 14:48:47 +00:00
yamt
ab54f30196 remove R_GETONEREP. 2007-04-30 23:10:55 +00:00
yamt
6e3d653f39 fix a lock leak in rev.1.109. pointed by Mindaugas R. 2007-04-30 10:30:51 +00:00
yamt
fbee155d25 use mutex and condvar. 2007-04-29 15:31:53 +00:00
yamt
6623a01439 don't forget to destroy mutex and condvar. 2007-04-29 15:30:26 +00:00
yamt
f14398066d include condvar.h. pointed by Kurt Schreiner. 2007-04-29 14:58:21 +00:00
yamt
bbe5115ad9 use condvar. 2007-04-29 14:56:59 +00:00
yamt
aca6764004 use mutex and condver. 2007-04-29 10:30:18 +00:00
yamt
ac99b69f8d use mutex and condvar. 2007-04-29 08:41:10 +00:00
dsl
b8fbaf8c4b Change the way that emulations locate files within the emulation root to
avoid having to allocate space in the 'stackgap'
  - which is very LWP unfriendly.
The additional code for non-emulation namei() is trivial, the reduction for
  the emulations is massive.
The vnode for a processes emulation root is saved in the cwdi structure
  during process exec.
If the emulation root the TRYEMULROOT flag are set, namei() will do an initial
  search for absolute pathnames in the emulation root, if that fails it will
  retry from the normal root.
".." at the emulation root will always go to the real root, even in the middle
  of paths and when expanding symlinks.
Absolute symlinks found using absolute paths in the emulation root will be
  relative to the emulation root (so /usr/lib/xxx.so -> /lib/xxx.so links
  inside the emulation root don't need changing).
If the root of the emulation would be returned (for an emulation lookup), then
  the real root is returned instead (matching the behaviour of emul_lookup,
  but being a cheap comparison here) so that programs that scan "../.."
  looking for the root dircetory don't loop forever.
The target for symbolic links is no longer mangled (it used to get the
  CHECK_ALT_xxx() treatment, so could get /emul/xxx prepended).
CHECK_ALT_xxx() are no more. Most of the change is deleting them, and adding
  TRYEMULROOT to the flags to NDINIT().
A lot of the emulation system call stubs could now be deleted.
2007-04-22 08:29:55 +00:00
yamt
337d052ee1 hold proclist_mutex when calling psignal(). 2007-04-19 11:05:14 +00:00
hannken
29ddf6065f Remove calls to now obsolete vn_start_write() and vn_finished_write(). 2007-04-06 14:28:28 +00:00
ad
59d979c5f1 Pass an ipl argument to pool_init/POOL_INIT to be used when initializing
the pool's lock.
2007-03-12 18:18:22 +00:00
yamt
02530653ff nfs_check_wccdata: print timestamps. 2007-03-09 05:55:33 +00:00
yamt
7e98ba85a6 nfsrv_setattr: revive nfsm_srvsattr which was (mistakenly?)
removed with caddr_t.
2007-03-05 23:18:50 +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
yamt
5057834077 nfs_getpages: fix an inverted condition in rev.1.147. 2007-02-27 10:03:56 +00:00
thorpej
b3667ada6d TRUE -> true, FALSE -> false 2007-02-22 06:05:00 +00:00
thorpej
712239e366 Replace the Mach-derived boolean_t type with the C99 bool type. A
future commit will replace use of TRUE and FALSE with true and false.
2007-02-21 22:59:35 +00:00
pooka
033e539d53 after freeing cookies, set the pointer to NULL to prevent dangling reuse 2007-02-20 16:27:21 +00:00
ad
adbb9ec2fa Call genfs_node_destroy() where appropriate. 2007-02-20 16:21:03 +00:00
yamt
6d6b5c51d6 use mutex and rwlock rather than lockmgr. 2007-02-15 16:01:51 +00:00
ad
b07ec3fc38 Merge newlock2 to head. 2007-02-09 21:55:00 +00:00
chs
f0cdf39d80 add back a mistakenly removed vput(). 2007-02-05 16:03:53 +00:00
yamt
cb2e7baf50 have a mowner dedicated to nfs reply cache. 2007-02-05 11:55:45 +00:00
yamt
7224686465 nfsrv_updatecache: actually use reply caches for connection oriented protocols. 2007-02-05 11:55:03 +00:00
chs
0507747213 more fixes for the new vnode locking scheme:
- don't use SAVESTART in calls to relookup() from unionfs,
   just vref() the desired vnode when we need to.
 - fix locking and refcounting in the unionfs EEXIST error cases.
 - release any vnode locks before calling VFS_ROOT(), vfs_busy() is enough.
   this allows us to simplify union_root() and fix PR 3006.
 - union_lock() doesn't handle shared lock requests correctly,
   so convert them to exclusive instead.  fixes PR 34775.
 - in relookup(), avoid reusing "dp" for different purposes,
   the error handling wasn't right.  (actually just get rid of dp.)
   also, change relookup() to ignore LOCKLEAF and always return the
   vnode locked since the callers already expect this.
2007-02-04 15:03:20 +00:00
chs
6721fd793e in nfsrv_rename(), change vput(fdirp) back to vrele() since the dirp
returned from nfs_namei() is not locked in this case.  fixes PR 35542.
also, apply the same fix here as was made in rename_files() to handle
the case when dvp and vp are the same.
2007-02-04 14:48:51 +00:00
hubertf
142c2a33ba Remove duplicate #includes, patch contributed in private mail
by Slava Semushin <slava.semushin@gmail.com>.

To verify that no nasty side effects of duplicate includes (or their
removal) have an effect here, I've compiled an i386/ALL kernel with
and without the patch, and the only difference in the resulting .o
files was in shifted line numbers in some assert() calls.
The comparison of the .o files was based on the output of "objdump -D".

Thanks to martin@ for the input on testing.
2007-01-24 13:08:11 +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
yamt
2224a4350f plug a mbuf leak. 2007-01-17 12:40:36 +00:00
yamt
3be095f658 plug mbuf leaks. 2007-01-17 12:40:08 +00:00
elad
8426ae751a Consistent usage of KAUTH_GENERIC_ISSUSER. 2007-01-04 20:24:08 +00:00
yamt
a23a6ee6c6 remove several nqnfs definitions. 2006-12-28 00:39:03 +00:00
yamt
431da137b1 - remove the rest of nqnfs.
- reject NFSMNT_MNTD and NFSMNT_KERB.  (no users in tree.)
2006-12-27 12:51:22 +00:00
yamt
ccfd2c0df0 remove nqnfs. 2006-12-27 12:10:09 +00:00
chs
c398ae9734 a smorgasbord of improvements to vnode locking and path lookup:
- LOCKPARENT is no longer relevant for lookup(), relookup() or VOP_LOOKUP().
   these now always return the parent vnode locked.  namei() works as before.
   lookup() and various other paths no longer acquire vnode locks in the
   wrong order via vrele().  fixes PR 32535.
   as a nice side effect, path lookup is also up to 25% faster.
 - the above allows us to get rid of PDIRUNLOCK.
 - also get rid of WANTPARENT (just use LOCKPARENT and unlock it).
 - remove an assumption in layer_node_find() that all file systems implement
   a recursive VOP_LOCK() (unionfs doesn't).
 - require that all file systems supply vfs_vptofh and vfs_fhtovp routines.
   fill in eopnotsupp() for file systems that don't support being exported
   and remove the checks for NULL.  (layerfs calls these without checking.)
 - in union_lookup1(), don't change refcounts in the ISDOTDOT case, just
   adjust which vnode is locked.  fixes PR 33374.
 - apply fixes for ufs_rename() from ufs_vnops.c rev. 1.61 to ext2fs_rename().
2006-12-09 16:11:50 +00:00
yamt
9c62b6fe1d nfs_disconnect: 2 -> SHUT_RDWR. no functional change. 2006-12-06 09:13:46 +00:00
yamt
6c575a38c3 nfsrv_rcv: claim ownership of received mbufs. 2006-12-06 08:55:52 +00:00
yamt
89682b24fe remove some __unused in function parameters. 2006-11-09 09:53:57 +00:00
mjf
a2be0ed655 Revert the changes I introduced trying to solve tmpfs' NFS export problem.
Requested by yamt@
2006-10-31 08:12:46 +00:00
jmmv
bccb33bf70 Fix a typo in a comment. 2006-10-30 16:06:05 +00:00
reinoud
dc5b5420b9 Revisit mnt_vnodelist TAILQ patch. Remove all suspicious TAILQ_FOREACH()
loops where vnodes can get removed or added during the loops. This could
lead to panic's on unmount since nodes are skipped or otherwise
TAILQ_NEXT(0xdeadbeef, ...) was dereferenced.
2006-10-25 22:01:54 +00:00
mjf
84bd46b9f9 Add support to allow a file system to not permit being exported over NFS.
Approved by elad@ and wrstuden@
2006-10-24 21:53:10 +00:00
pooka
96d8335980 kauth_cred_uucvt() -> kauth_uucred_to_cred(), introduce kauth_cred_to_uucred()
per tech-kern proposal
2006-10-22 13:07:15 +00:00
reinoud
0ce809091d Replace the LIST structure mp->mnt_vnodelist to a TAILQ structure since all
vnodes were synced and processed backwards. This meant that the last
accessed node was processed first and the earlierst last.

An extra benefit is the removal of the ugly hack from the Berkly days on
LFS.

In the proces, i've also replaced the various variations hand written loops
by the TAILQ_FOREACH() macro's.
2006-10-20 18:58:12 +00:00
dogcow
372e6ef309 now that we have -Wno-unused-parameter, back out all the tremendously ugly
code to gratuitously access said parameters.
2006-10-17 18:21:29 +00:00
christos
3b347a3429 another variable should have been _KERNEL only. 2006-10-17 14:55:13 +00:00
christos
0a3d351aae don't expose kernel variables to userland. 2006-10-17 14:53:54 +00:00
yamt
583781abd3 grab glock when calling uvm_unp_setsize, so that it doesn't interfere
mmap'ed accesses.  this fixes an assertion failure in in nfs_doio_read.
("vp->v_size >= uiop->uio_offset + uiop->uio_resid")
2006-10-14 09:18:57 +00:00
christos
6c265266c5 more __unused 2006-10-13 20:53:59 +00:00
dogcow
44603cac1f more unused variable fallout. 2006-10-13 18:28:06 +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
dogcow
55ddfc9aae change the MOWNER_INIT define to take two args; fix extant struct mowner
decls to use it. Makes options MBUFTRACE compile again and not whinge about
missing structure declarations. (Also makes initialization consistent.)
2006-10-10 21:49:14 +00:00
drochner
429dff1c3d Flush regular files before setattr also if the mode bits are going to
be set. Linux NFS servers (at least) reset suid/sgid bits if a write
happens afterwards. Add a comment why this is done.
This fixes system builds on diskless systems for me where suid bits
were missing after install(1).
Approved by yamt.
2006-09-29 16:19:50 +00:00
yamt
ff1a471a3b nfs_ispublicfh: fix another instance of cast-qual. 2006-09-04 08:38:16 +00:00
yamt
80fe9dcf8f remove (void *) cast from NFSRVFH_DATA as it sometimes
discards const qualifier.  pointed out by Havard Eidnes.
(it wasn't detected by in-tree gcc4.  seems like a compiler bug.)
2006-09-04 08:27:49 +00:00
yamt
8b789e8490 nfs_fhtovp: try to detect stale or invalid handles by issuing VOP_GETATTR. 2006-09-02 13:37:52 +00:00
yamt
b45e7d3197 nfsdreq_free: remove an assertion which is not true. 2006-09-02 13:30:08 +00:00
yamt
3311de9ddc implement vptofh and fhtovp for nfs. 2006-09-02 12:40:58 +00:00
yamt
d7d8adb6ea nfsd: deal with variable-sized filehandles. 2006-09-02 12:40:36 +00:00
yamt
d70ea60617 #ifdef out nqsrv_getlease and friends unless defined(NFSSERVER). 2006-09-02 12:39:59 +00:00
christos
57eb3ffe77 fix default type decls
fix incomplete initializer
2006-09-02 07:26:47 +00:00
christos
da9052a357 Don't free what we did not allocate. 2006-08-24 12:40:39 +00:00
christos
f73c6e5980 Change iostat_alloc() to take the parent pointer and the name directly, so
that callers are not responsible for initializing the fields. Store the name
inside the struct instead of maintaining a pointer to external storage, or
leaked memory (nfs case).
2006-08-23 17:19:32 +00:00
yamt
2253872d55 nfsm_srvfhtom: ensure that padding bytes in nfsv2 file handles are zero. 2006-08-08 13:07:32 +00:00
martin
b4cb63a646 Make filehandles opaque to userland 2006-07-31 16:34:42 +00:00
ad
f474dceb13 Use the LWP cached credentials where sane. 2006-07-23 22:06:03 +00:00
christos
1c50629119 When there are too many empty entries in a row, and we need to try to
read the next block, free the cookie buffer before doing so to avoid
a memory leak. Reported by  Mark Davies.
2006-07-20 15:12:23 +00:00
yamt
b0c4bb36d9 nfs_getreq: fix a kauth fallout.
pointed by nanashi-san.  http://pc8.2ch.net/test/read.cgi/unix/1145181361/786
2006-07-15 05:54:10 +00:00
martin
a3b5baed42 Fix alignement problems for fhandle_t, exposed by gcc4.1.
While touching all vptofh/fhtovp functions, get rid of VFS_MAXFIDSIZ,
version the getfh(2) syscall and explicitly pass the size available in
the filehandle from userland.

Discussed on tech-kern, with lots of help from yamt (thanks!).
2006-07-13 12:00:24 +00:00
yamt
ce1a2b18c3 some comments taken from Jed Davis's patch. 2006-07-01 11:30:44 +00:00
yamt
e38f237e53 if a file is sillyrename'ed because it's a destination of rename,
make sillyrename (try to) use LINK operation rather than RENAME.
PR/33861 from Jed Davis.  he provided the almost same patch.
according to him, it also happen to be what opensolaris does in this case.

from the PR:
> In nfs_rename(), if the destination appears to exist and is "in use"
> (this check is apparently satisfied even if the file isn't in use by
> anything except the rename itself), it will sillyrename it, then delete
> the sillyrenamed file even if the rename fails -- for instance, because
> the "from" file no longer exists on the server.

> mkdir a b; touch a/x; perl -e 'fork(); rename("a/x","b/x") or die "$!\n"'
>
> Afterwards, neither a/x nor b/x will exist.

> 1) Lookup of b/x; fails with NOENT.
> 2) Rename from a/x to b/x; succeeds.
> 3) Lookup of b/x; fails with NOENT.
> 4) Rename from b/x to b/.nfsA23a3; succeeds.
> 5) Rename from a/x to b/x; fails with NOENT.
> 6) Remove of b/.nfsA23a3; succeeds.
2006-07-01 11:29:42 +00:00
yamt
2246835eec wrap long lines and fix indents after kauth merge. 2006-06-30 09:56:03 +00:00
yamt
3333e8aa5c fix handling of NFSERR_NOTSUPP and NFSERR_BAD_COOKIE,
which have been broken since nfs_socket.c rev.1.115.
2006-06-30 09:55:34 +00:00
yamt
2a9a8246f0 nfs_request: don't bother to handle NFSERR_STALEWRITEVERF
because it isn't a real nfs error value.
2006-06-30 09:55:06 +00:00
yamt
7d3142aa6a - introduce vfs_composefh() and use it where appropriate.
- fix lock/unlock mismatch in sys_getfh.
2006-06-17 07:06:50 +00:00
christos
d13a9159e3 stack police: don't allocate statvfs on the stack. 2006-06-09 21:41:14 +00:00
kardel
de4337ab21 merge FreeBSD timecounters from branch simonb-timecounters
- struct timeval time is gone
  time.tv_sec -> time_second
- struct timeval mono_time is gone
  mono_time.tv_sec -> time_uptime
- access to time via
	{get,}{micro,nano,bin}time()
	get* versions are fast but less precise
- support NTP nanokernel implementation (NTP API 4)
- further reading:
  Timecounter Paper: http://phk.freebsd.dk/pubs/timecounter.pdf
  NTP Nanokernel: http://www.eecis.udel.edu/~mills/ntp/html/kern.html
2006-06-07 22:33:33 +00:00
blymn
4a065f3379 Clean up bogus whitespace 2006-05-28 13:23:08 +00:00
yamt
3ef3d785cc nfs_request: use kauth_cred_free rather than kauth_cred_destroy. 2006-05-28 06:47:58 +00:00
yamt
16dbcd1c54 mountnfs: reject wrongly-sized filehandle for nfsv2. 2006-05-20 07:42:02 +00:00
yamt
eb04c18e83 nqsrv_getlease: call nfs_init() to fix NFSSERVER && !NFS case. 2006-05-20 07:40:56 +00:00
yamt
b245701ca1 - fix compilation problem for !NFSSERVER && NFS.
pointed by Tom Spindler on source-changes@.
- make nfs_srvdesc_pool static.
2006-05-19 13:53:11 +00:00
yamt
b861e24c71 - fix some leaks in nfsd, introduced by kauth changes.
- simplify code.
- add some assertions.
- wrap some long lines.
- remove an unnecessary ";".
2006-05-18 12:44:45 +00:00
yamt
635dba4477 - nfs_export_unmount: don't forget to free exports.
- rename clear_exports for consistency.
2006-05-18 10:07:34 +00:00
elad
fc9422c9d9 integrate kauth. 2006-05-14 21:31:52 +00:00
christos
c0fdc5190f XXX: GCC uninitialized 2006-05-14 05:42:43 +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
blymn
10df330c85 Prefix iostat structure elements with io_ 2006-04-20 12:13:51 +00:00
christos
de6470e701 m_freem takes one arg. 2006-04-15 02:49:25 +00:00
christos
2fd9c5d744 s/mfree/m_freem/ 2006-04-15 02:48:32 +00:00
dogcow
bbfbd3e91f #if -> #ifdef 2006-04-15 02:46:39 +00:00
christos
f540054634 Coverity CID 735: Remove duplicate code. 2006-04-15 01:58:44 +00:00
christos
0b55b29a78 Coverity CID 734: Define NFS_TEST_HEAVY for testing nfsds, and use this to
ifdef out dead code. XXX: Why is this turned on by default?
2006-04-15 01:57:36 +00:00
christos
4ea21306a7 Coverity CID 736: Comment out dead code. 2006-04-15 01:54:46 +00:00
christos
0016be6042 Coverity CID 1175: Remove dead code. 2006-04-15 01:52:44 +00:00
christos
1ee078d67e Coverity CID 744: Conditionally define out dead code (only if it is dead) 2006-04-15 01:51:47 +00:00
christos
35829d71d3 Coverity CID 1141: Add a KASSERT before deref. 2006-04-15 01:45:15 +00:00
christos
c3a65fd394 Coverity CID 1142: Add a KASSERT before deref. 2006-04-15 01:41:46 +00:00
christos
d008757117 Coverity CID 1143: Prevent NULL deref. 2006-04-15 01:39:15 +00:00
christos
09436af99e Coverity CID 1144: Protect against NULL deref. 2006-04-15 01:37:46 +00:00
christos
6668c9c154 Coverity CID 1162: Prevent NULL deref. 2006-04-15 01:35:12 +00:00
christos
b31d7b8b49 Coverity CID 1165: Cannot have nfsiod without an lwp, so remove the superfluous
test.
2006-04-15 01:31:11 +00:00
christos
b2bd561652 Coverity CID 2445: Only set from_p if we succeed so that we free it on error. 2006-04-15 01:25:54 +00:00
christos
bd57687667 Don't leak mbufs on error. 2006-04-15 01:25:01 +00:00
christos
6555ff0ad3 From my posting of April 3 to tech-kern:
My understanding is that the CLRSIG() is supposed to clear the signal
that was sent to the syncer process to prevent it from being delivered
to the syncer process in case unmounting fails, so that the syncer process
does not die while the filesystem is still mounted. The typical scenario
is, the syncher process is tsleep()ing in the kernel, and waking up when
it needs to do work. If someone sends a signal to it, eg. kill -TERM
the mfs process, then the kernel will try to unmount the mfs filesystem
before delivering the signal to the process. If that unmount fails, then
we should not really kill the process because that will hang the mount.
So we call CLRSIG() to stop the signal from being delivered.

So the first call to issignal() will return the signal number that was
sent to the syncer process (unless someone malicious was able to send
a lower numbered signal between the time tsleep() returned and we called
issignal()... something that is not really easy to do). But you are
right, we should not be calling it many times as a side effect of this
macro.

Rewrite CLRSIG() clear all the signals and call issignal() the correct
number of times.
2006-04-15 01:16:40 +00:00
christos
881fbaa328 Coverity CID 2509: Initialize cache 2006-04-15 00:45:49 +00:00
christos
ff33272e7b Coverity CID 2510-2514: Always initialize cache. 2006-04-15 00:44:18 +00:00
christos
4c9d749d77 Coverity CID 2515-2519: Initialize rexmit on error path. 2006-04-15 00:40:20 +00:00
christos
1099609bd0 Coverity CID 2520: rexmit can be uninitialized on error path. 2006-04-15 00:36:23 +00:00
blymn
3c0adb7d99 Make i/o statistics collection more generic, include tape drives and
nfs mounts in the set of devices that statistics will be reported on.
2006-04-14 13:09:05 +00:00
yamt
c5fcdd1719 some cleanups after the introduction of GOP_SIZE_MEM flag.
- remove GOP_SIZE_READ/GOP_SIZE_WRITE flags.
  they have not been used since the change.
- ufs_balloc_range: remove code which has been no-op since the change.
  thanks Konrad Schroder for explaining the original intention of the code.
- ffs_gop_size: don't extend past eof, in the case of GOP_SIZE_MEM.
  otherwise genfs_getpages end up to allocate pages past eof unnecessarily.
2006-03-30 12:40:06 +00:00
martin
d6d75eaf5d KASSERT that the returned file id length from VPTOFH is <= the
maximum allowed value (_VFS_MAXFIDSZ).
2006-03-27 20:20:45 +00:00
christos
c92b23ffa8 Don't use DEBUG, add a new DEBUG_NFS_BOOT_DHCP variable to provide more
information. Print more information about what fails.
2006-03-16 15:55:20 +00:00
yamt
6bf35dc8ec bump NFS_MAXDGRAMDATA from 32k to 60k. (ie. near the protocol limit of udp.)
- it can help performance for some environments.
- administrators should be free to do silly things. :-)
2006-03-14 03:23:23 +00:00
rpaulo
5bb59eeab9 Back out revision 1.125 and 1.124. The code for checking if
slp->ns_reclen == 0, was already there since "Linux sometimes
generates 0-lenght records.".

Bad Rui...
2006-03-01 21:31:00 +00:00
rpaulo
52dc289cfd In nfsrv_getstream(), ns_reclen will never be negative due to the
previous assignment (recmark & ~0x80000000).
Pointed out by Christos.
2006-03-01 19:38:29 +00:00
rpaulo
b948e12637 From FreeBSD SA-06:10
Correct a remote kernel panic when processing zero-length RPC records
	via TCP.
2006-03-01 15:30:12 +00:00
yamt
ec5a93183a merge yamt-uio_vmspace branch.
- use vmspace rather than proc or lwp where appropriate.
  the latter is more natural to specify an address space.
  (and less likely to be abused for random purposes.)
- fix a swdmover race.
2006-03-01 12:38:10 +00:00
thorpej
58853410ae Use device_class() instead of accessing dv_class directly. 2006-02-21 04:32:38 +00:00
yamt
dae53410a7 - tweak RUN_ONCE api to allow init_func returns an error.
- physio: handle failure of workqueue_create.
2006-01-16 21:45:38 +00:00
yamt
cabee93abb nfs_doio_read: clear uio_resid when filling a hole. 2006-01-14 08:57:40 +00:00
yamt
24c6af7659 mountd_set_exports_list: check if VFS_VPTOFH actually works. 2006-01-05 12:21:00 +00:00
yamt
28b96a0b9d ensure the export list is not changed during nfsd operations. 2006-01-05 11:22:56 +00:00
yamt
789fa21531 fix a deadlock due to a spl problem. 2006-01-03 22:25:48 +00:00
yamt
463bed6af1 de-__P. 2006-01-03 12:59:49 +00:00
yamt
dbf3dbe4b0 don't install nfs_var.h. 2006-01-03 12:47:51 +00:00
yamt
27dc8f3f48 move function prototypes from nfs.h to nfs_var.h. 2006-01-03 12:30:46 +00:00
yamt
7416ebb551 nfssvc_nfsd: reduce a chance for a slow peer to capture all our threads.
instead of sleeping to wait for the socket to send our reply,
just hand-off our reply to the thread which is holding the socket.
2006-01-03 12:30:01 +00:00
yamt
a5da6cae5b remove a few unnecessary caddr_t casts. 2006-01-03 11:41:50 +00:00
yamt
acff143090 improve nfsd locking.
- don't bother to take nfs_sndlock when doing nfsrv_rcv.
  unlike client, we never reconnect.
- nfsrv_getstream: fix the case that m_split sleeps.
- free socket in nfsrv_slpderef rather than nfsrv_zapsock.
  fix race with nfssvc_nfsd.
- while i'm here, remove NFSD_WAITING and NFSD_REQINPROG
  as they are redundant.
- some comments and assertions.
2006-01-03 11:41:03 +00:00
yamt
07684acc5e nfs_inactive:
- use LK_CANRECURSE instead of LK_RECURSEFAIL.
  PR/32435 from Valeriy E. Ushakov.
- panic explicitly if the parent directory has been revoked.
  add an XXX comment.
2006-01-02 21:43:24 +00:00
jmmv
e7b8314535 Avoid dereferencing the lwp parameter in nfs_receive, as it is always NULL.
Solves a crash when mounting NFS shares.  (The proc parameter used before
the conversion to lwp's was NULL too, so the addition of 'l->l_proc' in the
code was extra.)
2005-12-30 10:35:44 +00:00
yamt
d085790ab8 netcred_lookup: remove a wrong assertion and handle the case properly. 2005-12-15 21:46:31 +00:00
reinoud
255662c92a Fix of panic that was introduced since ktrace-lwp branch was merged. The
shortcut to the process of the passed lwp paniced the kernel since lwp
could/can be passwd as NULL in VOP_WRITE().

This was happening when ktracing to NFS. The function ktrwrite() set the
uio_lwp to NULL and then calls VOP_WRITE() with this argument. nfs_write()
then accessed lwp *l->l_proc wich paniced.

Thanks to David Laight for his help on tracking it down.
2005-12-13 13:12:18 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
yamt
221616873d merge yamt-readahead branch. 2005-11-29 22:52:02 +00:00
thorpej
49fc1cb09c Use a once control to initialize the NFS server / client shared data
from nfs_vfs_init() or sys_nfssvc().  Remove the nfs_init() call from
main().
2005-11-25 20:01:38 +00:00
yamt
b0cf681a01 - reduce number of linear search per rpc.
- coalesce mount_netexport_pair into netexport.
2005-11-22 04:44:29 +00:00
yamt
f1bf6425bc use c99 initializers for proct. 2005-11-21 09:39:02 +00:00
yamt
6e0ca2f323 fix bugs introduced by the recent exports list rototill.
- mountd_set_exports_list: don't discard error.
- nfs_update_exports_30: check the correct flag.
2005-11-20 06:23:44 +00:00
yamt
df6c7b914b nfs_read: return EISDIR rather than EPERM for !VREG files. 2005-11-05 19:21:14 +00:00
yamt
a0a8d930a4 nfs_bioread: push delayed truncation and tweak loop accordingly.
PR/31926 from Jed Davis.
2005-11-04 19:39:30 +00:00
yamt
a748ea88dd merge yamt-vop branch. remove following VOPs.
VOP_BLKATOFF
	VOP_VALLOC
	VOP_BALLOC
	VOP_REALLOCBLKS
	VOP_VFREE
	VOP_TRUNCATE
	VOP_UPDATE
2005-11-02 12:38:58 +00:00
thorpej
f243f4debb Fix paste-o in the NFSV3SATTRTIME_TOSERVER case of mtime handing (need
to set va_mtime, not va_atime).
2005-10-31 14:21:35 +00:00
yamt
793a63d824 - remove a ufs dependency.
- bump readdir block size to 1024.  (the same value as userland DIRBLKSIZ)
2005-10-06 10:23:01 +00:00