summaryrefslogtreecommitdiff
path: root/sys/nfs/nfs_node.c
AgeCommit message (Collapse)Author
2024-05-01remove unneeded includesJonathan Gray
ok miod@ mpi@
2022-06-27Fix lock order reversal in nfs_inactive()Visa Hankala
Make the silly file removal happen after the vnode has been unlocked. This avoids a file-directory reversal in the vnode locking order. OK jca@
2021-10-20revert vnode: remove VLOCKSWORK and check locking when vop_islocked != nullopSebastien Marie
(both kernel and userland bits) GENERIC + VFSLCKDEBUG is broken with it.
2021-10-19vnode: remove VLOCKSWORK and check locking when vop_islocked != nullopSebastien Marie
This flag is currently used to mark or unmark a vnode to actively check vnode locking semantic (when compiled with VFSLCKDEBUG). Currently, VLOCKSWORK flag isn't properly set for several FS implementation which have full locking support. This commit enable proper checking for them too (cd9660, udf, fuse, msdosfs, tmpfs). Instead of using a particular flag, it directly check if v_op->vop_islocked is nullop or not to activate or not the vnode locking checks. ok mpi@
2021-10-19vnode: do not manipulate vnode lock directlySebastien Marie
use VOP_LOCK / VOP_UNLOCK wrappers. VOP_LOCK() is prefered over vn_lock() here in order to keep equivalent code. ok mpi@ visa@ (as part of larger diff)
2020-01-20struct vops is not modified during runtime so use const which moves eachClaudio Jeker
into read-only data segment. OK deraadt@ tedu@
2018-05-27Drop unnecessary `p' parameter from vget(9).Visa Hankala
OK mpi@
2018-05-05Implement proper locking for NFS nodes.Martin Pieuchot
Tested in bulks by many. ok visa@, beck@
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-03-28Check for possible race after sleeping instead of using a rwlock toMartin Pieuchot
protect insertions in `nm_ntree'. This will prevent a future lock ordering problem with NFSnode's lock. ok tedu@, visa@
2016-09-27replace the use of RB macros with the RBT functions.David Gwynne
2016-03-19Remove the unused flags argument from VOP_UNLOCK().natano
torture tested on amd64, i386 and macppc ok beck mpi stefan "the change looks right" deraadt
2016-02-09sync a function's comment with its signaturemmcc
ok tedu@, with a slight tweak
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@
2014-12-23to be safe, revert locking change until further tested.Ted Unangst
2014-12-23optimize locking a wee bit by holding it for critical parts onlyTed 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-09-14remove uneeded proc.h includesJonathan Gray
ok mpi@ kspillner@
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.
2010-12-21Bring back the "End the VOP experiment." diff, naddy's issues whereThordur I. Bjornsson
unrelated, and his alpha is much happier now. OK deraadt@
2010-09-10Backout the VOP diff until the issues naddy was seeing on alpha (gcc3)Thordur I. Bjornsson
have been resolved.
2010-09-06End the VOP experiment. Instead of the ridicolusly complicated operationThordur I. Bjornsson
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@.
2010-08-07No "\n" needed at the end of panic() strings.Kenneth R Westerback
Bogus chunks pointed out by matthew@ and miod@. No cookies for marco@ and jasper@. ok deraadt@ miod@ matthew@ jasper@ macro@
2009-12-17This fixes a case where we could panic on a null deref with a bad vnodeBob Beck
in nfs_inactive, on a reboot. The core of the problem was in nfs_nget, when we lose the race to put a new nfsnode in the tree, we have previously allocated a vnode, which getnewvnode has done an insmntque into the nfs mp's mntlist. The problem being we then try again with a new vnode, abandoning this one on the mntlist, leaving junk there for us to die on when we unmount. This introduces VLARVAL - so we can indicate in a vnode that the higher level stuff hiding in v_data is incompletely set up. This flag is then used by nfs to deal with a halfway set up vnode and release it correctly. analysis and bogus fix by art@, correct fix by me after serveral failed attempts and much painful testing by krw@, good suggestions by tedu and miod ok krw@ oga@ thib@ blambert@ art@
2009-12-15back out previous fix, apparently neither art or i can fix anything right on ↵Bob Beck
the first try vgone doesn't work in other cases of this. I must fix this slightly differntly
2009-12-15This fixes a case where we could panic on a null deref with a bad vnodeBob Beck
in nfs_inactive, on a reboot. The core of the problem was in nfs_nget, when we lose the race to put a new nfsnode in the tree, we have previously allocated a vnode, which getnewvnode has done an insmntque into the nfs mp's mntlist. The problem being we then try again with a new vnode, abandoning this one on the mntlist, leaving junk there for us to die on when we unmount. analysis and bogus fix by art@, correct fix by me. much painful testing by krw@ ok oga@, art@
2009-08-14Use the nfs_hashlock to protect the nfs_nodetree hanging of the mount.Thordur I. Bjornsson
What can happen is that a recycling of a vnode could pull one from out under us (since NFS has issues with ref counts...). Dance around getnewvnode() since we can end up recycling vnodes that where formerly owned by NFS, causing recursive locking. We where lucky with the old hashtables has the race was rare but now with more aggresive recycling we loose, just as theo found out on vax. help from oga, beck and blambert (beck mostly screamed though). ok oga@, beck@, blambert@
2009-08-11tiny knf and use curproc directly instead of a setting up a local procThordur I. Bjornsson
pointer since its just used in one place. ok blambert@
2009-08-10Use an RB tree instead of a hashtable for fh/node lookups.Thordur I. Bjornsson
Idea from NetBSD. OK blambert@
2009-07-20(struct foo *)0 -> NULL, every where I could find it.Thordur I. Bjornsson
OK blambert@
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-12-23small indent fixThordur I. Bjornsson
2008-08-09o nfs_vinvalbuf() is always called with the intrflag as 1, and thenThordur I. Bjornsson
checks if the mount is actually interrutable, and if not sets it 0. remove this argument from nfs_vinvalbuf and just do the checking inside the function. o give nfs_vinvalbuf() a makeover so it looks nice. (spacing, casts, &c); o Actually pass PCATCH too tsleep() if the mount it interrutable. ok art@, blambert@
2008-08-08Remove code for variable-sized allocations of NFS filehandles by malloc(),Bret Lambert
as it was never used because there were 64-bit buffers already allocated for filehandles in nfsnode structs. ok thib@
2008-06-14A bunch of pool_get() + bzero() -> pool_get(..., .. | PR_ZERO)Michael Knudsen
conversions that should shave a few bytes off the kernel. ok henning, krw, jsing, oga, miod, and thib (``even though i usually prefer FOO|BAR''; thanks for looking.
2008-06-11Canonical for() -> queue.h FOREACH macro conversions.Bret Lambert
Also, it is historical practice to #include <sys/queue.h> when using queue.h macros. ok thib@ krw@ special thanks to krw@ for reminders vice violence
2008-06-10o Avoid putting duplicate entries into the name cache,Thordur I. Bjornsson
add a function to handle cache_enter()'s for us since we need to update the appropriate timestamps so we don't miss on lookup; o Do not purge the dvp in nfs_rmdir(), since there's no need; o cache the new entry created in nfs_mkdir(); o Do caching of the access modes, this drastically reduces the amount of over the wire access RPCs we do in the NFSv3 case. This diff was written by Pedro Martelletto, sometime in 2004. A lot of people have been running with it at one time or another, this includes at least markus and matthieu. OK deraadt@, blambert@
2007-12-13Garbage collect nfsdmap and leftover code. That structureThordur I. Bjornsson
was used as a part of the "old-style directory caching" that was removed in 2001; ok beck@, blambert@
2007-09-20MALLOC/FREE -> malloc/free + M_ZERO.Thordur I. Bjornsson
Uneeded includes and casts... ok krw@
2007-06-01pedro ok'd this ~3500 line diff which removes the vop argumentTheo de Raadt
"ap = v" comments in under 8 seconds, so it must be ok. and it compiles too.
2007-05-29Add a name argument to the RWLOCK_INITIALIZER macro.Thordur I. Bjornsson
Pick reasonble names for the locks involved.. ok tedu@, art@
2007-05-28lockmgr -> rwlock for the nfs_hashlock.Thordur I. Bjornsson
ok tedu@
2006-05-07add a name to rwlock so that we can tell where procs are getting stuckTed Unangst
without breaking into ddb. doubles the size of rwlock [1], but moving forward this really helps. ok/tested pedro fgsch millert krw [1 - next person to add a field to this struct gets whipped with a wet noodle]
2006-01-09Put vprint() under DIAGNOSTIC, as to save space in generated ramdisks.Pedro Martelletto
Inspiration from miod@, okay deraadt@. Tested on i386, macppc and amd64.
2005-11-19Use NULL where NULL is meantPedro Martelletto
2005-11-19Remove unnecessary lockmgr() archaism that was costing too much in termsPedro Martelletto
of panics and bugfixes. Access curproc directly, do not expect a process pointer as an argument. Should fix many "process context required" bugs. Incentive and okay millert@, okay marc@. Various testing, thanks.
2004-12-26Use list and queue macros where applicable to make the code easier to read;Miod Vallat
no change in compiler assembly output.
2004-08-03NFS commit coalescion: instead of sending a commit for each block, coalescemarius eriksen
these into larger ranges wherever possible. this should speed up NFS writes quite a bit. ok art@ millert@ pedro@ tedu@