Commit Graph

705 Commits

Author SHA1 Message Date
yamt bcf2e4f22f fix a problem in 'protected' case of writerpc.
retransmitted mbufs can survive even after requests themselves
finished.  so, before unbusy pages, make sure that mbufs referring them
go away.

pointed by enami tsugutomo on port-mips.
2003-06-03 14:27:48 +00:00
yamt 85d0052723 workaround for UBC limit.
while our nfsd announces MAXBSIZE as wtmax for tcp,
VOP_GETPAGES of filesystems that uses genfs_getpages can't
handle >= MAX_READ_AHEAD(16) pages at once.
therefore, depending on PAGE_SIZE of the machine and file offset of
a read request, we can't VOP_GETPAGES the range at once.
2003-05-29 15:18:14 +00:00
yamt d36494e29b fix a memory leak bug that i introduced in rev.1.167.
patch provided by enami tsugutomo on current-users.
2003-05-27 14:41:06 +00:00
yamt a340c1b544 when a result of NFSv3 READLINK is too long for us,
return ENAMETOOLONG rather than EBADRPC.
(it's our implementation limit, not protocol limit.)
2003-05-26 13:34:38 +00:00
yamt 9c1b2d7aa2 make duplicated codes to a function, nfsrv_sockalloc. 2003-05-26 13:30:07 +00:00
yamt c8ad6cc17b interlock for NFLUSHINPROG/NFLUSHWANT. 2003-05-22 15:59:24 +00:00
yamt 85b757c497 poolify nfsrv_descript. 2003-05-22 14:16:23 +00:00
yamt a423954d74 indent (nfssvc_nfsd) 2003-05-22 14:14:41 +00:00
yamt b24da550a0 avoid double free with xlatecookie. 2003-05-22 14:14:02 +00:00
yamt ead5df5837 interlock for nfs_rcvlock. 2003-05-22 14:11:50 +00:00
yamt 78fe726a6f - use FREE not free for MALLOC'ed memory.
- remove unneeded caddr_t casts.
2003-05-21 14:41:26 +00:00
yamt 132782522f simplelock for nfsd request cache. 2003-05-21 14:13:34 +00:00
yamt a055ad0f6a - KNF.
- remove unneeded casts.
2003-05-21 13:56:21 +00:00
yamt 8ee3b648b4 poolify nfsd request cache. 2003-05-21 13:55:28 +00:00
yamt 75fa9b73b5 indent. 2003-05-21 13:53:18 +00:00
yamt 08bf5aae7b remove local definitions of TRUE and FALSE. 2003-05-21 13:50:54 +00:00
yamt db8b252c5e indent 2003-05-21 13:31:04 +00:00
yamt ddd5ced644 eliminate memcpy in the common and easy case of write. 2003-05-21 13:27:19 +00:00
yamt 4811ccb6a0 correct a KASSERT. 2003-05-16 17:16:05 +00:00
yamt 19bdd5d1e5 acquire vmobjlock when touch pg->flags. 2003-05-15 14:34:06 +00:00
yamt de31ef25cd simple lock for nfs iod. 2003-05-07 16:18:53 +00:00
yamt a4ae58105f indent. 2003-05-07 16:18:17 +00:00
yamt 8a4e0a8444 use hashdone to free hashinit'ed memory. 2003-05-07 13:16:35 +00:00
yamt c573c77372 - indent.
- fix a comment typo (mus -> must)
- remove an unneeded caddr_t cast.
2003-05-07 13:10:44 +00:00
yamt 469a401cf5 remove nfsm_srvstrsiz as it's no longer used. 2003-05-06 13:52:36 +00:00
yamt 6f30440f90 keep things not needed by userland in #ifdef _KERNEL.
(e.g. prototypes for in-kernel functions)
2003-05-05 13:21:00 +00:00
yamt 777190167d fix handling of the case that readsize == 0. 2003-05-04 11:40:22 +00:00
yamt ca9e55bd66 use uvm page loanout mechanism for nfsd READ procedure processing.
reviewed by Frank van der Linden and Chuck Silvers.
tested by Wojciech Puchar.
2003-05-03 18:36:26 +00:00
yamt 92a566bbbd tweak nfsm_adj to pay attention to read only mbufs. 2003-05-03 18:07:42 +00:00
yamt 3698fcc62e - check page's offset in the object as well. (pointed by Chuck Silvers.)
- remove false assertion.
2003-05-03 17:27:20 +00:00
yamt 455e4333eb - if writerpc ends with a stable result, no need to commit them anymore.
- add comments.
2003-05-03 16:46:39 +00:00
yamt a74480a1a6 more comment. 2003-05-03 16:35:22 +00:00
yamt 8c5ba805e5 better handling of write verifier change. 2003-05-03 16:28:57 +00:00
drochner 9e95dcb696 Change some subordinate functions to take a "struct nfsnode" argument
instead of "struct vnode". This saves a number of pointer dereferences;
it sums up to about half a kB for me. And it paves the way for future
fixes.
While cleaning up, eliminate a write-only member of "struct nfsreq"
and a pointless assignment in the NFS_V2_ONLY case.
2003-04-24 21:21:04 +00:00
yamt 8178e19cb6 fix a use of an uninitialized variable. 2003-04-18 15:19:02 +00:00
christos 80ecd573c0 PR/1796: John Kohl: statfs misbehaves under chrooted environments.
- Under chroot it displays only the visible filesystems with appropriate paths.
- The statfs f_mntonname gets adjusted to contain the real path from root.
- While was there, fixed a bug in ext2fs, locking problems with vfs_getfsstat(),
  and factored out some of the vfsop statfs() code to copy_statfs_info(). This
  fixes the problem where some filesystems forgot to set fsid.
- Made coda look more like a normal fs.
2003-04-16 21:44:18 +00:00
yamt 503590c138 sync a comment with reality. 2003-04-16 14:51:55 +00:00
yamt 0012a58814 fix indent. 2003-04-15 13:51:11 +00:00
yamt 63de87c34b remove line-wrapping that is no longer needed. 2003-04-15 13:48:40 +00:00
yamt dcf4c9093f fix a typo in the previous. 2003-04-12 14:41:28 +00:00
yamt 1505b097fa set b_resid correctly. 2003-04-12 14:38:57 +00:00
yamt 9ad479d8c2 split nfs_doio to nfs_doio_{phys,read,write} to avoid too deep indents. 2003-04-12 14:26:58 +00:00
yamt 043759a005 - do FILESYNC writes if we're freeing the page or the page doesn't
belong to us.  otherwise, data will be lost on server crash.
- use b_bcount instead of b_bufsize to determine
  how many pages we should deal with.

based on a patch from Chuck Silvers.
discussed on tech-kern.
2003-04-12 06:53:09 +00:00
yamt 65e3d14a8a rename a very confusing variable name.
(must_commit -> stalewriteverf)
2003-04-09 14:30:30 +00:00
yamt b90af31ce6 when commit failed and fall to write, re-set 'off' and 'cnt'
because it can be changed in 'needcommit' path.
2003-04-09 14:27:58 +00:00
yamt 2cca2b5641 update a comment to follow the previous change. 2003-04-09 14:24:32 +00:00
yamt 9b96b4ab78 make per-iod datas together. 2003-04-09 14:22:33 +00:00
yamt 0dff798bde rename nm_verf to nm_writeverf because it's confusing with nm_verf{str,len}. 2003-04-09 14:21:24 +00:00
yamt d16c4c058f return rtmax bytes if we get READ requests larger than rtmax. 2003-04-03 15:19:12 +00:00
yamt 8cc1df8614 use m_copydata and m_split instead of similar inlined ones. 2003-04-03 15:14:51 +00:00
yamt a14f444335 use queue manipulation macros. 2003-04-02 15:14:19 +00:00
yamt 4f8b9f357f add an assertion. 2003-04-01 11:59:03 +00:00
yamt 1f94d18621 rename fvdl_debug to NFS_DEBUG_COMMIT.
ok'ed by fvdl.
2003-03-31 14:47:03 +00:00
yamt 0d3c7b7285 adapt to file interlock. 2003-03-31 14:43:59 +00:00
yamt 9fe1125599 reply FSINFO rtmax and wtmax for DGRAM properly. 2003-03-28 15:24:58 +00:00
yamt b44d2a5667 i forgot to check this in with the previous (reply ENAMETOOLONG properly). 2003-03-28 15:13:35 +00:00
yamt 2d45e41adb reply ENAMETOOLONG properly instead of discarding request as BADRPC.
my own PR20791.
2003-03-28 13:05:47 +00:00
yamt 8a890efe2b if rsize was explicitly specified by mount_nfs,
prefer it to rtpref from nfsd.  the same for wsize and wtpref.

ok'ed by fvdl.
2003-03-28 12:33:17 +00:00
jdolecek 7337bd06a3 nfs_kqfilter(): add the knote to v_klist only if guaranteed to return success 2003-03-27 19:58:26 +00:00
jdolecek c2793620f8 fix typo in comment 2003-02-27 09:01:09 +00:00
matt d283628c8e Fix typo. 2003-02-26 07:33:57 +00:00
matt 65e5548a17 Add MBUFTRACE kernel option.
Do a little mbuf rework while here.  Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *).  These are not performance critical and making them
call m_get saves considerable space.  Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.
2003-02-26 06:31:08 +00:00
jdolecek f8595b9782 add missing dot in comment 2003-02-18 14:37:08 +00:00
perseant b397c875ae Add code to UBCify LFS. This is still behind "#ifdef LFS_UBC" for now
(there are still some details to work out) but expect that to go
away soon.  To support these basic changes (creation of lfs_putpages,
lfs_gop_write, mods to lfs_balloc) several other changes were made, to
wit:

* Create a writer daemon kernel thread whose purpose is to handle page
  writes for the pagedaemon, but which also takes over some of the
  functions of lfs_check().  This thread is started the first time an
  LFS is mounted.

* Add a "flags" parameter to GOP_SIZE.  Current values are
  GOP_SIZE_READ, meaning that the call should return the size of the
  in-core version of the file, and GOP_SIZE_WRITE, meaning that it
  should return the on-disk size.  One of GOP_SIZE_READ or
  GOP_SIZE_WRITE must be specified.

* Instead of using malloc(...M_WAITOK) for everything, reserve enough
  resources to get by and use malloc(...M_NOWAIT), using the reserves if
  necessary.  Use the pool subsystem for structures small enough that
  this is feasible.  This also obsoletes LFS_THROTTLE.

And a few that are not strictly necessary:

* Moves the LFS inode extensions off onto a separately allocated
  structure; getting closer to LFS as an LKM.  "Welcome to 1.6O."

* Unified GOP_ALLOC between FFS and LFS.

* Update LFS copyright headers to correct values.

* Actually cast to unsigned in lfs_shellsort, like the comment says.

* Keep track of which segments were empty before the previous
  checkpoint; any segments that pass two checkpoints both dirty and
  empty can be summarily cleaned.  Do this.  Right now lfs_segclean
  still works, but this should be turned into an effectless
  compatibility syscall.
2003-02-17 23:48:08 +00:00
drochner 7707c16daa Don't remove the nfsnode from the hash chain in nfs_inactive.
It will never get back... it will not be found in nfs_nget, a new
nfsnode+vnode is allocated instead, which causes a node leak, and
also makes the mountpointness of the vnode to be forgotten, breaking
filesystem crossing lookups through this vnode.
2003-02-15 18:00:25 +00:00
fvdl 2be3d82860 Move purging the dircache and removing a vnode from the nqnfs timer queue
into nfs_inactive, this is a better place for it.

This doesn't actually solve the actual problem, which appears to be a race
condition with unmounting and vnode recycling somewhere, but it fixes
it in the sense that nfs_reclaim will not reference a bad v_mount anymore.
2003-02-12 14:50:52 +00:00
christos 49d7e33c00 move the MALLOC decl for DIROFFS to nfs_subs.c 2003-02-10 17:31:01 +00:00
christos e4d4f01d2b protect <sys/mallocvar.h> ifdef _KERNEL 2003-02-02 02:34:53 +00:00
thorpej b193480908 Add extensible malloc types, adapted from FreeBSD. This turns
malloc types into a structure, a pointer to which is passed around,
instead of an int constant.  Allow the limit to be adjusted when the
malloc type is defined, or with a function call, as suggested by
Jonathan Stone.
2003-02-01 06:23:35 +00:00
thorpej b78f59b443 Merge the nathanw_sa branch. 2003-01-18 08:51:40 +00:00
matt 9bd0cc2bb9 Make sure these all agree on the same definitons of various variables. 2002-12-01 23:02:10 +00:00
matt b5e32a190e Don't define VA_EXCLUSIVE if it's not defined. If we do, it'll be a
different value from the one in <sys/vnode.h>
2002-12-01 23:00:51 +00:00
matt b360b734b1 Add multiple inclusion protection. 2002-12-01 22:59:42 +00:00
lukem 0635de35a3 Remove KDIR=, since SYS_INCLUDE=symlinks and KDIR are not supported any more. 2002-11-26 23:30:07 +00:00
scw ba1d389688 Fix an uninitialised variable warning. 2002-11-24 11:02:57 +00:00
yamt 059aba1c85 fix panic (assertion failure) on error case.
if uiomove is failed, we should clean up pages past eof.

the problem reported by kay.
ok'ed by Chuck Silvers.
2002-10-29 10:15:16 +00:00
jdolecek e0cc03a09b merge kqueue branch into -current
kqueue provides a stateful and efficient event notification framework
currently supported events include socket, file, directory, fifo,
pipe, tty and device changes, and monitoring of processes and signals

kqueue is supported by all writable filesystems in NetBSD tree
(with exception of Coda) and all device drivers supporting poll(2)

based on work done by Jonathan Lemon for FreeBSD
initial NetBSD port done by Luke Mewburn and Jason Thorpe
2002-10-23 09:10:23 +00:00
yamt 869f4a9733 fix panic introduced by my previous commit.
for device special files, VOP_UNLOCK is called
by nfs_loadattrcache with v_data == 0.

reported and tested by Matthias Drochner.
2002-10-22 10:10:28 +00:00
simonb 7a4056e25c "nmp" in nfs_lookup() is set but not used, remove it. 2002-10-22 02:19:57 +00:00
yamt 005c29fafb fix a page locking deadlock problem for nfs.
add a flag that specify if the file can be truncated safely or not
to nfsm_loadattr and friends.  when it isn't safe, just mark the nfsnode
as "should be truncated later".

ok'ed by Frank van der Linden and Chuck Silvers.
close kern/18036.
2002-10-21 12:52:32 +00:00
enami 7409653fdf When printing filesystem specific parameters, also print the address and
port of server numerically.
2002-10-21 03:58:07 +00:00
thorpej ae19c3c263 nfs_remove(): Don't vput() the vnode twice if vp == dvp, vrele() and
vput() instead.
2002-10-18 19:08:15 +00:00
christos 1fafdc0bf2 forgot to set deadthresh; thanks to YAMAMOTO Takashi. 2002-10-01 15:00:04 +00:00
christos 7b0d38f045 back out previous. the problem is not the v_mount is null, but it appears
corrupted.
2002-10-01 14:59:21 +00:00
christos da8db7611e deal with v_mount == NULL in nfs_reclaim(). We should not be touching this
anyway, but nq-nfs wants us to.
2002-09-30 20:55:55 +00:00
bouyer c7b51b5566 In nfs_commit(), sanity-check what we get from network: if we try to fluch
past end of file, or if off + cnt overflows a quad_t, flush to end of file.
2002-09-27 19:30:46 +00:00
provos 0f09ed48a5 remove trailing \n in panic(). approved perry. 2002-09-27 15:35:29 +00:00
bouyer 992abe6e5b In nfsrv_create(), kill an extra PNBUF_PUT() in the NFSv2 mknod case. The
pnbuf has already been freed by VOP_MKNOD. This should have been removed in
rev 1.60.
Should fix PR 18013, OK'd by fvdl.
2002-09-26 20:41:25 +00:00
bouyer 7005ca7253 nfsrv_commit(): Properly handle the case cnt == 0, which means "flush to
end of file". Calling VOP_FSYNC with start == end triggers a DIAGNOSTIC
check. Noticed with NFSv3 Linux clients. OK'd by fvdl.
2002-09-26 20:38:04 +00:00
jdolecek ea3e4c9a2a <sys/conf.h> and <sys/device.h> are not needed here 2002-09-22 19:35:22 +00:00
jdolecek eb337a8a22 don't seem to need <sys/conf.h> or <net/if.h> here 2002-09-22 19:15:09 +00:00
christos 6868d0a7d6 MNT_GETARGS support 2002-09-21 18:08:27 +00:00
chs 73e5c26ec7 pick up a fix from openbsd:
revision 1.33
    date: 2002/07/24 23:32:11;  author: nordin;  state: Exp;  lines: +3 -3
    Use sizeof(array) instead of sizeof(array *) for bcopy length. ok deraadt@
2002-09-14 21:45:16 +00:00
bouyer 3a7aeb79ca nfs_doio(): handle the case where nfs_writerpc() returned error != 0.
Fix kern/18125. OK'd by thorpej and chs.
2002-09-01 10:39:38 +00:00
enami 691598efd0 s/FREE/PNBUF_PUT/ 2002-08-23 05:38:51 +00:00
fvdl 316b8f10e7 Initialize recm to NULL inside the loop, so that a record length of
NULL will not accidentallly append bogus data (the previous record).

Derived from a fix by Matt Dillon in FreeBSD.
2002-08-02 00:09:33 +00:00
soren 178d83d503 Die, qaddr_t, die! - mnt_data in struct mount is already effectively
a void *, so stop pretending otherwise.
2002-07-30 07:40:07 +00:00
enami 5f5918e1e7 Synchronize code and comment again to prevent mbuf leak. Sprinkle some
KNF while I'm here.
2002-07-26 01:36:30 +00:00
jdolecek 413ebb2a10 Reduce stack usage on the NFS mount code path. This fixes kernel stack
overflow when using IPsec on vax, as reported by Olaf Seibert on
current-users@.
2002-07-25 19:03:27 +00:00
drochner 92ade669c9 increase IP TTL for BOOTP/DHCP request packets to avoid dumb
routers dropping the packet
(seems to be a problem with Cisco and its "helper-address" feature;
a Cabletron SSR I tested with didn't have this problem)
2002-06-10 17:45:54 +00:00