Commit Graph

111 Commits

Author SHA1 Message Date
Doug Rabson
09c6884729 Various fixes from frank@fwi.uva.nl (Frank van der Linden) via
rick@snowhite.cis.uoguelph.ca:

1. Clear B_NEEDCOMMIT in nfs_write to make sure that dirty data is
correctly send to the server.  If a buffer was dirtied when it was in
the B_DELWRI+B_NEEDCOMMIT state, the state of the buffer was left
unchanged and when the buffer was later cleaned, just a commit rpc was
made to the server to complete the previous write.  Clearing
B_NEEDCOMMIT ensures that another write is made to the server.

2. If a server returned a server (for whatever reason) returned an
answer to a write RPC that implied that fewer bytes than requested
were written, bad things would happen.

3. The setattr operation passed on the atime in stead of the mtime to
the server. The fix is trivial.

4. XIDs always started at 0, but this caused some servers (older DEC
OSF/1 3.0 so I've been told) who had very long-lasting XID caches to
get confused if, after a reboot of a BSD client, RPCs came in with a
XID that had in the past been used before from that client. Patch is
to use the current time in seconds as a starting point for XIDs. The
patch below is not perfect, because it requires the root fs to be
mounted first. This is because of the check BSD systems do, comparing
FS time to system time.

Reviewed by:	Bruce Evans, Terry Lambert.
Obtained from:  frank@fwi.uva.nl (Frank van der Linden) via rick@snowhite.cis.uoguelph.ca
1996-07-16 10:19:45 +00:00
Garrett Wollman
2c37256e5a Modify the kernel to use the new pr_usrreqs interface rather than the old
pr_usrreq mechanism which was poorly designed and error-prone.  This
commit renames pr_usrreq to pr_ousrreq so that old code which depended on it
would break in an obvious manner.  This commit also implements the new
interface for TCP, although the old function is left as an example
(#ifdef'ed out).  This commit ALSO fixes a longstanding bug in the
TCP timer processing (introduced by davidg on 1995/04/12) which caused
timer processing on a TCB to always stop after a single timer had
expired (because it misinterpreted the return value from tcp_usrreq()
to indicate that the TCB had been deleted).  Finally, some code
related to polling has been deleted from if.c because it is not
relevant t -current and doesn't look at all like my current code.
1996-07-11 16:32:50 +00:00
Bruce Evans
8cd5acbce0 Don't truncate minor or major numbers in the nfsv3 client. 1996-06-23 17:19:25 +00:00
Poul-Henning Kamp
5b28a6011f Fix for NFS_NOSERVER
Poul mentioned that he thought this was some kind of timing problem, and
that started me thinking. After a little poking around, I found that
nfs_timer() was completely disabled when NFS_NOSERVER was #defined.
But after looking at nfs_timer(), it seemed like it was something
required by both the client and server code, and disabling it outright
just didn't seem to make any sense. Parts of it relate only to the
NFS server side code, so I disabled those, but I re-enabled the rest
of the function and made sure that it would be called from nfs_init()
(in nfs_subs.c).

With nfs_timer() re-enabled, everything seems to work again. The only
other changes I made were to #ifdef away some variable declarations
in the NFS_NOSERVER case so that gcc would stop complaining about
unused variables.

Reviewed by:	phk
Submitted by:	Bill Paul <wpaul@skynet.ctr.columbia.edu>
1996-06-14 11:13:21 +00:00
David Greenman
2f9bae59d6 Moved the fsnode MALLOC to before the call to getnewvnode() so that the
process won't possibly block before filling in the fsnode pointer (v_data)
which might be dereferenced during a sync since the vnode is put on the
mnt_vnodelist by getnewvnode.

Pointed out by Matt Day <mday@artisoft.com>
1996-06-12 03:37:57 +00:00
Bruce Evans
39a3579443 Fixed a vnode reference leak in nfsrv_rename(). The target inode wasn't
released until the file system was unmounted.  This bug also affected
kern/vfs_syscalls.c but was fixed in rev.1.18 and rev.1.20 there.

Reviewed by:	davidg
1996-06-08 12:16:26 +00:00
Paul Traina
75985daf3b Clear flags before using an inactive buffer. This is a kludge, but
matches the code in bread().

Reviewed by:	bde
1996-06-08 05:59:04 +00:00
Poul-Henning Kamp
e911eafcba removed:
CLBYTES PD_SHIFT PGSHIFT NBPG PGOFSET CLSIZELOG2 CLSIZE pdei()
        ptei() kvtopte() ptetov() ispt() ptetoav() &c &c
new:
        NPDEPG

Major macro cleanup.
1996-05-02 14:21:14 +00:00
Bruce Evans
71d96b71c2 #include <sys/filedesc.h> explicitly instead of depending on it being
bogusly included by <sys/socketvar.h>.
1996-04-30 23:26:52 +00:00
Bruce Evans
21e0797227 Fixed nfs sysctls. They missed out on the fs -> vfs name changes from
Lite2.  This broke nfsstat.
1996-04-30 23:23:09 +00:00
Garrett Wollman
dc915e7cfc Kill XNS.
While we're at it, fix socreate() to take a process argument.  (This
was supposed to get committed days ago...)
1996-02-13 18:16:31 +00:00
Mike Pritchard
6c5e9bbdf5 Fix a bunch of spelling errors in the comment fields of
a bunch of system include files.
1996-01-30 23:02:38 +00:00
Bruce Evans
ad59a83d3e Fixed spelling of s_namlen so that this compiles again. 1996-01-25 00:45:37 +00:00
Poul-Henning Kamp
1ce9bf88c3 Use new printf features rather than local kludges. 1996-01-24 21:12:23 +00:00
Mike Pritchard
97f1b9871e Add a check to prevent a computation from underflowing and causing
a panic due to an attaempt to allocate a buffer for a terabyte or
so of data when an attempt is made to create sparse data (e.g.
a holey file) more than 1 block past the end of the file.

Note:  some other areas of this code need to be looked at,
since they might cause problems when the file size exceeds 2GB,
due to storing results in ints when the computations are being
done with quad sized variables.

Reviewed by:	bde
1996-01-24 18:52:18 +00:00
John Dyson
bd7e5f992e Eliminated many redundant vm_map_lookup operations for vm_mmap.
Speed up for vfs_bio -- addition of a routine bqrelse to greatly diminish
	overhead for merged cache.
Efficiency improvement for vfs_cluster.  It used to do alot of redundant
	calls to cluster_rbuild.
Correct the ordering for vrele of .text and release of credentials.
Use the selective tlb update for 486/586/P6.
Numerous fixes to the size of objects allocated for files.  Additionally,
	fixes in the various pagers.
Fixes for proper positioning of vnode_pager_setsize in msdosfs and ext2fs.
Fixes in the swap pager for exhausted resources.  The pageout code
	will not as readily thrash.
Change the page queue flags (PG_ACTIVE, PG_INACTIVE, PG_FREE, PG_CACHE) into
	page queue indices (PQ_ACTIVE, PQ_INACTIVE, PQ_FREE, PQ_CACHE),
	thereby improving efficiency of several routines.
Eliminate even more unnecessary vm_page_protect operations.
Significantly speed up process forks.
Make vm_object_page_clean more efficient, thereby eliminating the pause
	that happens every 30seconds.
Make sequential clustered writes B_ASYNC instead of B_DELWRI even in the
	case of filesystems mounted async.
Fix a panic with busy pages when write clustering is done for non-VMIO
	buffers.
1996-01-19 04:00:31 +00:00
Poul-Henning Kamp
99cb299316 Add an option NFS_NOSERVER which saves 100K in the install kernel (or
any other kernel that uses it).  Use with option NFS.
1996-01-13 23:27:58 +00:00
Poul-Henning Kamp
d2f08956ec Don't print swap server as root server.
Submitted by:	Mattias.Gronlund@sa.erisoft.se (Mattias Gronlund)
1995-12-28 21:56:49 +00:00
Poul-Henning Kamp
0240c4db5b Move fs.nfs.nfsstats sysctl var back to it's old OID. 1995-12-22 15:57:38 +00:00
Poul-Henning Kamp
b8dce649f1 Staticize. 1995-12-17 21:14:36 +00:00
David Greenman
efeaf95a41 Untangled the vm.h include file spaghetti. 1995-12-07 12:48:31 +00:00
Bruce Evans
dee6b0ab68 Completed function declarations and/or added prototypes and/or moved
prototypes to the right place.
1995-12-03 10:03:12 +00:00
Bruce Evans
55054f3540 Completed function declarations, added prototypes and removed redundant
declarations.
1995-11-21 15:51:39 +00:00
Bruce Evans
512fef80a9 Completed function declarations and/or added prototypes. 1995-11-21 12:55:26 +00:00
Poul-Henning Kamp
9565c0e60d Get rid of hostnamelen variable. 1995-11-14 09:37:22 +00:00
Bruce Evans
e4f937b07b Included <sys/sysproto.h> to get central declarations for syscall args
structs and prototypes for syscalls.

Ifdefed duplicated decentralized declarations of args structs.  It's
convenient to have this visible but they are hard to maintain.  Some
are already different from the central declarations.  4.4lite2 puts
them in comments in the function headers but I wanted to avoid the
large changes for that.
1995-11-14 05:16:37 +00:00
Bruce Evans
f57e65478d Introduced a type `vop_t' for vnode operation functions and used
it 1138 times (:-() in casts and a few more times in declarations.
This change is null for the i386.

The type has to be `typedef int vop_t(void *)' and not `typedef
int vop_t()' because `gcc -Wstrict-prototypes' warns about the
latter.  Since vnode op functions are called with args of different
(struct pointer) types, neither of these function types is any use
for type checking of the arg, so it would be preferable not to use
the complete function type, especially since using the complete
type requires adding 1138 casts to avoid compiler warnings and
another 40+ casts to reverse the function pointer conversions before
calling the functions.
1995-11-09 08:17:23 +00:00
Bruce Evans
8b25681eb5 Replaced bogus macros for dummy devswitch entries by functions.
These functions went away:

	enosys (hasn't been used for some time)
	enxio
	enodev
	enoioctl (was used only once, actually for a vop)

if_tun.c:
Continued cleaning up...

conf.h:
Probably fixed the type of d_reset_t.  It is hard to tell the correct
type because there are no non-dummy device reset functions.

Removed last vestige of ambiguous sleep message strings.
1995-11-06 00:36:19 +00:00
Joerg Wunsch
e046098fa9 Include a prerequisite header (so this is consistent again with the
NFSv2 state).
1995-10-31 21:17:59 +00:00
Poul-Henning Kamp
a98ca4699e Second batch of cleanup changes.
This time mostly making a lot of things static and some unused
variables here and there.
1995-10-29 15:33:36 +00:00
David Greenman
5344cc61f5 Fix order problem: unbusy pages before releasing the buffer.
Submitted by:	John Dyson <dyson>
1995-10-22 09:37:45 +00:00
David Greenman
d68a41903e Moved the filesystem read-only check out of the syscalls and into the
filesystem layer, as was done in lite-2. Merged in some other cosmetic
changes while I was at it. Rewrote most of msdosfs_access() to be more
like ufs_access() and to include the FS read-only check.

Obtained from: partially from 4.4BSD-lite2
1995-10-22 09:32:48 +00:00
John Dyson
c83ebe7781 Added VOP_GETPAGES/VOP_PUTPAGES and also the "backwards" block count
for VOP_BMAP.  Updated affected filesystems...
1995-09-04 00:21:16 +00:00
Doug Rabson
fac7bcd92c Make nfs diskless work again.
Reviewed by:	John Hay <jhay@mikom.csir.co.za>
1995-08-30 17:24:15 +00:00
David Greenman
c0c06a67d2 Added NFS_ASYNC kernel option. It only has an effect for NFSv2. 1995-08-24 11:39:31 +00:00
David Greenman
dcc84850a7 Killed redundant declarations of nfsm_rpchead(). 1995-08-24 11:04:04 +00:00
Doug Rabson
c3b2cc769c Some fixes found using gcc -Wall:
nfsm_rpchead() has been called with the wrong number of args and misplaced
args since someone added new args in the middle for nfsv3.

Here's another one that would be important on 64-bit systems.  VOP_READDIR
takes a `u_int **cookies' arg.

Submitted by:	Bruce Evans <bde@zeta.org.au>
1995-08-24 10:45:16 +00:00
Doug Rabson
27df97742b Add support for amd direct maps.
Reviewed by:	Thomas Graichen <graichen@sirius.physik.fu-berlin.de>
1995-08-24 10:17:39 +00:00
David Greenman
628641f8a6 Converted mountlist to a CIRCLEQ.
Partially obtained from: 4.4BSD-Lite2
1995-08-11 11:31:18 +00:00
David Greenman
75d8591e04 Fixed bug where vnode_pager_uncache() wasn't always called when it should
be. The result was that the file's space wouldn't be properly freed when
it was deleted.

Submitted by:	John Dyson
1995-08-06 11:55:25 +00:00
Doug Rabson
7faccad982 Slight changes to locking around VOP_READRIR.
Detect in nfsrv_readdirplus when a filesystem soes not support VFS_VGET and
return NFSERR_NOTSUPP so that the client will use ordinary readdir instead.
1995-08-03 12:14:16 +00:00
Doug Rabson
a2c06d4685 Lock the directory vnode before VOP_READDIR in nfsrv_readdirplus 1995-08-02 10:12:47 +00:00
David Greenman
4777741358 Removed my special-case hack for VOP_LINK and fixed the problem with the
wrong vp's ops vector being used by changing the VOP_LINK's argument order.
The special-case hack doesn't go far enough and breaks the generic
bypass routine used in some non-leaf filesystems. Pointed out by Kirk
McKusick.
1995-08-01 18:51:02 +00:00
Bruce Evans
28f8db1403 Eliminate sloppy common-style declarations. There should be none left for
the LINT configuation.
1995-07-29 11:44:31 +00:00
Doug Rabson
e1b686876b Slightly better fix than previous revision.
Submitted by:	Rick Macklem <rick@snowhite.cis.uoguelph.ca>
1995-07-24 16:38:05 +00:00
Doug Rabson
47212158a0 Fix a problem which appeared to truncate a file to the nearest block boundary
when it is moved to an NFS filesystem from from another filesystem and /bin/mv
failed to set the file ownership during the move.

I believe that this bug is present in STABLE but I have not tested it.  The fix
would be the same in STABLE even though the code has changed quite considerably
in CURRENT.
1995-07-24 12:50:49 +00:00
David Greenman
d15ea423f7 Correct my cut-'n-paste job from ffs_vfsops.c and fix up the formatting
to be similar.

Submitted by:	Bruce Evans
1995-07-22 03:32:18 +00:00
David Greenman
f5526ddb48 Implemented an nfs_node hash list lock, similar to what was implemented
in ffs_vget(), and for the same reason: to prevent a race condition that
results in duplicate vnodes/NFSnodes being allocated.
1995-07-21 10:25:13 +00:00
David Greenman
24aa09cd4f vnode_pager_alloc() never returns NULL, so don't check for it. 1995-07-20 09:43:12 +00:00
Doug Rabson
5d81e553a2 I believe that the following fix to nfs_vnops.c should do the trick w.r.t.
the problem "when a file is truncated on the server after being written on
a client under NFSv3, the client doesn't see the size drop to zero".
(As you noted, the problem is that NMODIFIED wasn't being cleared by nfs_close
 when it flushed the buffers. After checking through the code, the only place
 where NMODIFIED was used to test for the possibility of dirty blocks was in
 nfs_setattr(). The two cases are safe to do when there aren't dirty blocks,
 so I just took out the tests. Unfortunately, testing for
 v_dirtyblkhd.lh_first being non-null is not sufficient, since there are
 times when the code moves blocks to the clean list and then back to the
 dirty list.)

Submitted by:	rick@snowhite.cis.uoguelph.ca
1995-07-13 17:55:12 +00:00