summaryrefslogtreecommitdiffstats
path: root/sys/nfs/nfs_subs.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* kernel: use gettime(9)/getuptime(9) in lieu of time_second(9)/time_uptime(9)cheloha2020-06-241-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | time_second(9) and time_uptime(9) are widely used in the kernel to quickly get the system UTC or system uptime as a time_t. However, time_t is 64-bit everywhere, so it is not generally safe to use them on 32-bit platforms: you have a split-read problem if your hardware cannot perform atomic 64-bit reads. This patch replaces time_second(9) with gettime(9), a safer successor interface, throughout the kernel. Similarly, time_uptime(9) is replaced with getuptime(9). There is a performance cost on 32-bit platforms in exchange for eliminating the split-read problem: instead of two register reads you now have a lockless read loop to pull the values from the timehands. This is really not *too* bad in the grand scheme of things, but compared to what we were doing before it is several times slower. There is no performance cost on 64-bit (__LP64__) platforms. With input from visa@, dlg@, and tedu@. Several bugs squashed by visa@. ok kettenis@
* struct vops is not modified during runtime so use const which moves eachclaudio2020-01-201-3/+3
| | | | | into read-only data segment. OK deraadt@ tedu@
* In nfs_clearcommit() the loops over mnt_vnodelist and v_dirtyblkhdbluhm2020-01-141-5/+5
| | | | | | do not delete anything. So the safe variant of foreach is not necessary. OK mpi@ millert@ tedu@
* Convert the vnode list at the mount point into a tailq. Duringbluhm2020-01-101-2/+2
| | | | | | | | | | | | unmount this list is traversed and the dirty vnodes are flushed to disk. Forced unmount expects that the list is empty after flushing, otherwise the kernel panics with "dangling vnode". As the write to disk can sleep, new vnodes may be inserted. If softdep is enabled, resolving the dependencies creates new dirty vnodes and inserts them to the list. To fix the panic, let insmntque() insert new vnodes at the tail of the list. Then vflush() will still catch them while traversing the list in forward direction. OK tedu@ millert@ visa@
* Use FOREACH macro to iterate over mnt_vnodelist.bluhm2019-12-251-3/+2
| | | | OK millert@ visa@ benno@
* Switch MH_ALIGN to m_align which is the same.claudio2018-11-301-2/+2
| | | | OK bluhm@
* M_LEADINGSPACE() and M_TRAILINGSPACE() are just wrappers forclaudio2018-11-091-4/+4
| | | | | | m_leadingspace() and m_trailingspace(). Convert all callers to call directly the functions and remove the defines. OK krw@, mpi@
* Use more list macros for v_dirtyblkhd.bluhm2018-07-021-4/+3
| | | | OK mpi@
* Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is alwaysvisa2018-04-281-3/+2
| | | | | | | curproc that does the locking or unlocking, so the proc parameter is pointless and can be dropped. OK mpi@, deraadt@
* Remove old deactivated pledge path code. A replacement mechanism isderaadt2017-08-291-7/+1
| | | | | being brewed. ok beck
* Keep local definitions local.mpi2017-02-221-1/+2
| | | | "good work" deraadt@, ok visa@
* all pools have their ipl set via pool_setipl, so fold it into pool_init.dlg2016-09-151-6/+4
| | | | | | | | | | | | | | | | | | | | | | the ioff argument to pool_init() is unused and has been for many years, so this replaces it with an ipl argument. because the ipl will be set on init we no longer need pool_setipl. most of these changes have been done with coccinelle using the spatch below. cocci sucks at formatting code though, so i fixed that by hand. the manpage and subr_pool.c bits i did myself. ok tedu@ jmatthew@ @ipl@ expression pp; expression ipl; expression s, a, o, f, m, p; @@ -pool_init(pp, s, a, o, f, m, p); -pool_setipl(pp, ipl); +pool_init(pp, s, a, ipl, f, m, p);
* pool_setipl for nfs poolsdlg2016-08-301-1/+3
| | | | ok natano@
* Fix some gibbering horrors due to uninitialized struct nameidata'sbeck2016-04-291-1/+8
| | | | | | | | | | | | | | | 1) turn NDINITAT into a function and make the macros point to it with the later goal of getting rid of them. 2) Sweep the kernel for places where people make a struct nameidata manually on the stack and fill in what they hope are the required fields and count on prayer and clean living to always get them right. Instead use NDINIT everywhere. NFS was especially bad for this and there have likely been things lurking there for a while. 3) Add a couple of strategic KASSERT's to catch future offenders. ok krw@ sthen@ deraadt@
* Remove the unused flags argument from VOP_UNLOCK().natano2016-03-191-2/+2
| | | | | | torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
* Convert to uiomove. From Martin Natano.stefan2016-02-131-3/+3
|
* Store a unique ID, an interface index, rather than a pointer to thempi2015-06-161-2/+2
| | | | | | | | | | | | | | | receiving interface in the packet header of every mbuf. The interface pointer should now be retrieved when necessary with if_get(). If a NULL pointer is returned by if_get(), the interface has probably been destroy/removed and the mbuf should be freed. Such mechanism will simplify garbage collection of mbufs and limit problems with dangling ifp pointers. Tested by jmatthew@ and krw@, discussed with many. ok mikeb@, bluhm@, dlg@
* Tweaks utimensat/futimens handling to always update ctime, even when bothguenther2015-04-171-3/+26
| | | | | | | atime and mtime are UTIME_OMIT (at least for ufs, tmpfs, and ext2fs), and to correctly handle a timestamp of -1. ok millert@
* Remove some includes include-what-you-use claims don'tjsg2015-03-141-2/+1
| | | | | | | have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
* First step towards making uiomove() take a size_t size argument:miod2015-02-101-2/+2
| | | | | | | - rename uiomove() to uiomovei() and update all its users. - introduce uiomove(), which is similar to uiomovei() but with a size_t. - rewrite uiomovei() as an uiomove() wrapper. ok kettenis@
* use NGROUPS_MAXderaadt2015-01-171-2/+2
|
* Explicitely include <uvm/uvm_extern.h> in order to build on variable page sizemiod2014-12-291-1/+2
| | | | architectures.
* change req pool alloc to null. add prwaitok here and nfs_node_pool whichtedu2014-12-231-4/+4
| | | | is also sleeping in all callers, but already used null
* convert one hot looking bcopy to memcpytedu2014-12-181-2/+2
|
* delete a whole mess of unnecessary caddr_t caststedu2014-12-181-3/+3
|
* move arc4random prototype to systm.h. more appropriate for most codetedu2014-11-181-2/+1
| | | | to include that than rdnvar.h. ok deraadt dlg
* bzero -> memsettedu2014-11-141-2/+2
|
* remove uneeded proc.h includesjsg2014-09-141-2/+1
| | | | ok mpi@ kspillner@
* decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hderaadt2014-07-081-3/+1
| | | | | don't need to be married. ok guenther miod beck jsing kettenis
* If the v_type is going to change when loading the NFS attribute cache,jsing2013-11-271-1/+2
| | | | | | | | | purge the vnode from the namecache first. This prevents cache_purge() from later getting confused and trying to cache_zap() a namecache entry multiple times over, due to cache_zap() believing that the entry does not need to be removed from the vnode destinations queue. ok beck@
* Switch time_t, ino_t, clock_t, and struct kevent's ident and dataguenther2013-08-131-6/+4
| | | | | | | | | | | | | | | | | | | | members to 64bit types. Assign new syscall numbers for (almost all) the syscalls that involve the affected types, including anything with time_t, timeval, itimerval, timespec, rusage, dirent, stat, or kevent arguments. Add a d_off member to struct dirent and replace getdirentries() with getdents(), thus immensely simplifying and accelerating telldir/seekdir. Build perl with -DBIG_TIME. Bump the major on every single base library: the compat bits included here are only good enough to make the transition; the T32 compat option will be burned as soon as we've reached the new world are are happy with the snapshots for all architectures. DANGER: ABI incompatibility. Updating to this kernel requires extra work or you won't be able to login: install a snapshot instead. Much assistance in fixing userland issues from deraadt@ and tedu@ and build assistance from todd@ and otto@
* move the specfs code to a place people can see it; ok guenther thib krwderaadt2011-07-041-2/+2
|
* Bring back the "End the VOP experiment." diff, naddy's issues wherethib2010-12-211-6/+6
| | | | | | unrelated, and his alpha is much happier now. OK deraadt@
* Backout the VOP diff until the issues naddy was seeing on alpha (gcc3)thib2010-09-101-6/+6
| | | | have been resolved.
* Rename lookup/relookup to vfs_lookup/vfs_relookup.thib2010-09-091-2/+2
| | | | OK oga@, beck@, matthew@
* End the VOP experiment. Instead of the ridicolusly complicated operationthib2010-09-061-6/+6
| | | | | | | | | | | | | | | | | | | vector setup that has questionable features (that have, as far as I can tell never been used in practice, atleast not in OpenBSD), remove all the gunk and favor a simple struct full of function pointers that get set directly by each of the filesystems. Removes gobs of ugly code and makes things simpler by a magnitude. The only downside of this is that we loose the vnoperate feature so the spec/fifo operations of the filesystems need to be kept in sync with specfs and fifofs, this is no big deal as the API it self is pretty static. Many thanks to armani@ who pulled an earlier version of this diff to current after c2k10 and Gabriel Kihlman on tech@ for testing. Liked by many. "come on, find your balls" deraadt@.
* clean up a few things that where left to rot after bob's vfs cache work.thib2010-05-191-3/+1
| | | | | | | sync a few comments to reality (or remove them), remove the cn_hash member from struct componentname, spacing. ok beck@
* antsyjsg2009-10-191-85/+29
| | | | | | no binary change apart from nfsm_reqhead() which is clearly correct. ok thib@
* Backout the asyncio/aiod change, as it causes buf's to get hung.thib2009-09-021-4/+2
| | | | | | problem noticed by deraadt@ ok beck@
* move to having requests on a per nfsmount tailq instead of one global one.thib2009-08-251-11/+1
| | | | | | | | | | also make the rexmit timeout per nfsmount, and make sure to start/stop the timer appropriately. now the nfs_timer() only fires if there is work todo, not always at nfs_ticks (it did, even if there where no nfsmounts in the system!). OK blambert@
* Rework the way we do async I/O in nfs. Introduce separate buf queues forthib2009-08-201-2/+4
| | | | | | | | | | | | | | | | each mount, and when work is "found", peg an aiod to that mount todo the I/O. Make nfs_asyncio() a bit smarter when deciding when to do asyncio and when to force it sync, this is done by keeping the aiod's one two lists, an "idle" and an "all" list, so asyncio is only done when there are aiods hanging around todo it for us or are already pegged to the mount. Idea liked by at least beck@ (and I think art@). Extensive testing done by myself and jasper and a few others on various arch's. Ideas/Code from Net/Free. OK blambert@.
* Teach nfsm_fhtom about nfsm_info structsblambert2009-08-131-4/+4
| | | | ok thib@
* change version 3 post-operation attribute building function to notblambert2009-08-131-23/+12
| | | | | | use mbufs directly, but the shiny new nfsm_info struct ok thib@
* Use an RB tree instead of a hashtable for fh/node lookups.thib2009-08-101-4/+7
| | | | | | Idea from NetBSD. OK blambert@
* Remove the v2 writegather code. It did help alot back in the 80sthib2009-08-101-43/+1
| | | | | | | | | | but extensive performance benchmarking done by myself and jasper@ has shown that it doesn't help, at all - even on vaxens and in some cases it makes things significantly slower. "this excites me sexually" jetpack@ Tested by jasper@. OK blambert@
* group all of the on-stack variables that are uses by the nfsm_macrosthib2009-08-041-14/+7
| | | | | | | | | | | | | | to keep the data munging "state" into an nfsm_info structure. Each function now has this structure on its stack, and it and its members are now passed around so that the macros/functions can work there magic. this will make removing the nfsm_* macros way easier. Idea/code picked up from DragonflyBSD. Tested by krw@, jacekm@ and myself. OK blambert@.
* (struct foo *)0 -> NULL, every where I could find it.thib2009-07-201-4/+4
| | | | OK blambert@
* Remove the VREF() macro and replaces all instances with a call to verf(),thib2009-07-091-2/+2
| | | | | | | | | | | which is exactly what the macro does. Macro's that are nothing more then: #define FUNCTION(arg) function(arg) are almost always pointless and should go away. OK blambert@ Agreed by many.
* Remove unused procnums (NQNFS leftovers) and cleanup.thib2009-05-301-8/+2
| | | | OK blambert@ sometime ago
* retire the nfs rtt log code, this isnt really all thatthib2009-05-221-5/+1
| | | | | | | usefull, and has been disabled for a long long time. Cleans house a bit. OK blambert@