summaryrefslogtreecommitdiff
path: root/sys/nfs/nfs_vfsops.c
AgeCommit message (Collapse)Author
2021-01-02nfs: don't sleep on lboltcheloha
We can simulate the current behavior without lbolt by sleeping for 1 second on the &nowake channel. ok mpi@
2020-01-10Convert the vnode list at the mount point into a tailq. DuringAlexander Bluhm
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@
2020-01-08Convert infinite sleeps to tsleep_nsec(9).Martin Pieuchot
ok bluhm@
2019-12-26Convert struct vfsops initializer to C99 style.Alexander Bluhm
OK visa@
2018-07-02Use more list macros for v_dirtyblkhd.Alexander Bluhm
OK mpi@
2018-05-27Drop unnecessary `p' parameter from vget(9).Visa Hankala
OK mpi@
2018-05-04After unmount nfs_timer() could access the freed memory of structAlexander Bluhm
nfsmount. Delay the free(9) of the nfs mount point data until pending or sleeping timeouts have finished by running it on the softclock thread. OK visa@
2018-05-02Remove proc from the parameters of vn_lock(). The parameter isVisa Hankala
unnecessary because curproc always does the locking. OK mpi@
2018-04-28Clean up the parameters of VOP_LOCK() and VOP_UNLOCK(). It is alwaysVisa Hankala
curproc that does the locking or unlocking, so the proc parameter is pointless and can be dropped. OK mpi@, deraadt@
2018-04-09Change the representation of an NFS mount point by caching the rootMartin Pieuchot
nodes. nfs_root() now returns a "locked" vnode, so vput(9) must be called to release it. Note that this has currently no effect as nfs_lock/unlock are still stubs. This will prevent some lock odering problems with upcoming NFSnode locking. Tested by landry@, sthen@, visa@, naddy@ and myself. From NetBSD with some tweaks, ok visa@
2018-02-10Syncronize filesystems to disk when suspending. Each mountpoint's vnodesTheo de Raadt
are pushed to disk. Dangling vnodes (unlinked files still in use) and vnodes undergoing change by long-running syscalls are identified -- and such filesystems are marked dirty on-disk while we are suspended (in case power is lost, a fsck will be required). Filesystems without dangling or busy vnodes are marked clean, resulting in faster boots following "battery died" circumstances. Tested by numerous developers, thanks for the feedback.
2017-12-11In uvm Chuck decided backing store would not be allocated proactivelyTheo de Raadt
for blocks re-fetchable from the filesystem. However at reboot time, filesystems are unmounted, and since processes lack backing store they are killed. Since the scheduler is still running, in some cases init is killed... which drops us to ddb [noted by bluhm]. Solution is to convert filesystems to read-only [proposed by kettenis]. The tale follows: sys_reboot() should pass proc * to MD boot() to vfs_shutdown() which completes current IO with vfs_busy VB_WRITE|VB_WAIT, then calls VFS_MOUNT() with MNT_UPDATE | MNT_RDONLY, soon teaching us that *fs_mount() calls a copyin() late... so store the sizes in vfsconflist[] and move the copyin() to sys_mount()... and notice nfs_mount copyin() is size-variant, so kill legacy struct nfs_args3. Next we learn ffs_mount()'s MNT_UPDATE code is sharp and rusty especially wrt softdep, so fix some bugs adn add ~MNT_SOFTDEP to the downgrade. Some vnodes need a little more help, so tie them to &dead_vnops. ffs_mount calling DIOCCACHESYNC is causing a bit of grief still but this issue is seperate and will be dealt with in time. couple hundred reboots by bluhm and myself, advice from guenther and others at the hut
2017-05-17Remove useless splsoftnet().Martin Pieuchot
Outside of USB, no code is executed in a softnet interrupt context. So what's protecting NFS data structures is the KERNEL_LOCK(). But more importantly, since r1.114 of nfs_socket.c, the 'softnet' thread is no longer executing NFS code. ok visa@
2017-02-22Keep local definitions local.Martin Pieuchot
"good work" deraadt@, ok visa@
2016-11-15Switch nfs_timer() to timeout_set_proc(9) as it might end up doing aMartin Pieuchot
PRU_SEND.
2016-09-27replace the use of RB macros with the RBT functions.David Gwynne
2016-08-13Eliminate pointless casts to qaddr_t of a value being assigned to a void*Philip Guenther
ok kettenis@ krw@ natano@ dlg@ espie@
2016-04-26Populate all necessary statfs members in .vfs_statfs. cd9660, udf,Martin Natano
msdosfs and nfsv2 don't set f_namemax. ntfs and ext2fs don't set f_namemeax and f_favail. fusefs doesn't set f_mntfromspec, f_favail and f_iosize. Also, make all filesystems use copy_statfs_info(), so that all statfs information is filled in correctly for the (sb != &mp->mnt-stat) case. ok stefan
2016-03-17Set mnt_data to NULL after freeing the file system specific mount point.Alexander Bluhm
OK krw@ natano@ as part of a larger diff
2015-03-14Remove some includes include-what-you-use claims don'tJonathan Gray
have any direct symbols used. Tested for indirect use by compiling amd64/i386/sparc64 kernels. ok tedu@ deraadt@
2015-01-17use NGROUPS_MAXTheo de Raadt
2014-12-18delete a whole mess of unnecessary caddr_t castsTed Unangst
2014-12-16primary change: move uvm_vnode out of vnode, keeping only a pointer.Ted Unangst
objective: vnode.h doesn't include uvm_extern.h anymore. followup changes: include uvm_extern.h or lock.h where necessary. ok and help from deraadt
2014-11-15add sizes for free(ptr, sizeof(*ptr)). use sizeof(*ptr) for malloc sizes.Ted Unangst
2014-11-14bzero -> memsetTed Unangst
2014-09-08remove uneeded route.h includesJonathan Gray
ok miod@ mpi@
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2013-12-01Change 'mountlist' from CIRCLEQ to TAILQ. Be paranoid andKenneth R Westerback
use TAILQ_*_SAFE more than might be needed. Bulk ports build by sthen@ showed nobody sticking their fingers so deep into the kernel. Feedback and suggestions from millert@. ok jsing@
2013-09-20Add support for root on nfs using v3. Code adapted from NetBSD.Federico G. Schwindt
Tested on sparc by miod, octeon by aalm and armv7 by me. miod ok.
2013-04-17Unbreak and cleanup diskless swap automount.Florian Obser
Initial diff to replace unclear short variable name "nd" by "nfs_diskless" and to display the real nfs path to swap in pstat -s by deraadt@ Testing by me revealed diskless swap automount was broken since some time. Fix this by passing and using the correct vnode in nfs_diskless to swapmount(). Lots of input / help deraadt@, tweaks by deraadt@ OK deraadt@
2013-04-15Add an f_mntfromspec member to struct statfs, which specifies the name ofJoel Sing
the special provided when the mount was requested. This may be the same as the special that was actually used for the mount (e.g. in the case of a device node) or it may be different (e.g. in the case of a DUID). Whilst here, change f_ctime to a 64 bit type and remove the pointless f_spare members. Compatibility goo courtesy of guenther@ ok krw@ millert@
2013-01-16do not expose NETDEV to userland from param.hTheo de Raadt
2012-09-10Cleanup VFS mount string handling:Joel Sing
- Avoid using copyinstr() without checking the return value. - sys_mount() has already copied the path in, so pass this to the filesystem mount code so that it does not have to copy it in again. - Avoid copyinstr()/bzero() dance when we can simply bzero() and strlcpy(). ok krw@
2011-07-09KNFBob Beck
ok md5 "can't be worse" thib@
2009-10-19antsyJonathan Gray
no binary change apart from nfsm_reqhead() which is clearly correct. ok thib@
2009-09-02Backout the asyncio/aiod change, as it causes buf's to get hung.Thordur I. Bjornsson
problem noticed by deraadt@ ok beck@
2009-08-25move to having requests on a per nfsmount tailq instead of one global one.Thordur I. Bjornsson
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@
2009-08-20Rework the way we do async I/O in nfs. Introduce separate buf queues forThordur I. Bjornsson
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@.
2009-08-13Teach nfsm_fhtom about nfsm_info structsBret Lambert
ok thib@
2009-08-10Use an RB tree instead of a hashtable for fh/node lookups.Thordur I. Bjornsson
Idea from NetBSD. OK blambert@
2009-08-04group all of the on-stack variables that are uses by the nfsm_macrosThordur I. Bjornsson
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@.
2009-07-20(struct foo *)0 -> NULL, every where I could find it.Thordur I. Bjornsson
OK blambert@
2009-07-13Make the callers of nfs_request() responsible for freeing the reply mbuf,Thordur I. Bjornsson
if the reply is an error and retire the NFS_RETERR hack. For NFSv3 mounts the flag was set and reply mbuf not freed to allow the callers to handle the post-op attributes, or just free the mbuf for NFSv2. Tested by myself and jasper@ on various arch's. OK blambert@.
2009-06-04Demacro nfsm_lookup for great justice.Bret Lambert
Thanks to ckuethe for saving much typing with a drive-by perl script. ok thib@
2009-06-02give the retransmission count booking keeping a facelift,Thordur I. Bjornsson
just store the maximun amount of rexmits in one place and cleanup. Also make sure this only effects soft mounts. OK blambert@
2009-04-13Convert macros to functions to reduce kernel memory usage.Bret Lambert
In snaps for a while (way too long, according to deraadt@)
2008-12-24Replace the TRUE/FALSE defines with 1/0 respectively. This doesn'tThordur I. Bjornsson
hurt readability and it was just plain annoying seeing them defined in every other .c file. OK blambert@
2008-07-28dont stuff nfs mount point flags into the statfs f_flags member, itsThordur I. Bjornsson
wrong. But this was harmless anyway since sys_statfs() sets this field corrently after calling VFS_STATFS(); ok pedro@, blambert@
2008-07-10nuke two bogus ARGSUSEDThordur I. Bjornsson
2008-07-05Clean up some old dead code, mostly nqnfs and kerberos leftoversThordur I. Bjornsson
for uid goo, mostly zapping unused members from various structures. ok blambert@