summaryrefslogtreecommitdiff
path: root/sys/nfs
AgeCommit message (Collapse)Author
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-30if nfs_namei() fails, there's no ni_startdir and the pathname buffer hasThordur I. Bjornsson
already been freed, thus make the callers of nfs_namei() bail out early, instead of jumping to nfsmout as there they will try to vrele() vnodes that don't exists (NULL pointers) and free the pathname buffer. this is way nicer then adding checks after the nfsmout label. OK blambert@
2009-08-27Garbage collect two variables that where set but unused.Thordur I. Bjornsson
Tiny spacing nit. Fix a typo, pointed out by miod@.
2009-08-27introduce a flag member to struct nfs_aiod, and use flags instead of the exitThordur I. Bjornsson
and worked members. nad_worked becomes NFSAIOD_WAKEUP, which is set after if an aiod was removed from the idle list and woken up by nfs_asyncio(). don't rely on tsleep wchans being unique, that is keep going back to sleep if woken up unless the NFSAIOD_WAKEUP flag is set. fix a divide by zero crash if nfs.vfs.iothreads is set to 0, as that can happen when we recalculate the maximum buf's to queue up for each aiod. in nfs_asyncio() set the nad_mnt to NULL before returning the aiod back to the idle list in the case where we have already queued up to many bufs, otherwise we trip an assertion. minimize the time we are holding the nfs_aiodl_mtx to only when we are inserting or removing from the lists, with the exception of nfs_set_naiod() as it would make the loops more complicated and its uncommon in any case. tested by myself and deraadt@ "fine with me" deraadt@
2009-08-26make sure that an aiod has been removed from the nfs_aiods_idle listThordur I. Bjornsson
before inserting it back into the list. crashes debugged with help from deraadt@ who also tested this fix.
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-14add ddb functions to be able to show all the nfsnodes in the systemThordur I. Bjornsson
and rewrite the nfsreq code to use pool_walk(). OK beck@, blambert@
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-14Avoid double-release of vnodes in several functionsBret Lambert
ok thib@
2009-08-14Initialize len variable; found by Martynas VenckusBret Lambert
ok thib@
2009-08-13Teach nfsm_fhtom about nfsm_info structsBret Lambert
ok thib@
2009-08-13change version 3 post-operation attribute building function to notBret Lambert
use mbufs directly, but the shiny new nfsm_info struct ok thib@
2009-08-13- remove super-obvious comments from $fs_vnodeop_entries[]Jasper Lievisse Adriaanse
prodded by and ok thib@ agreed by art@ and 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-11Fix a few bugs in nfsrv_rename() error recovery code.Thordur I. Bjornsson
- Prevent a double vrele() by setting the vnode pointer to NULL. - Check if vnode pointers have been set to NULL before trying to vrele(). - don't double free the component path name buffer. - Add a workaround for multiple vnode pointers all pointing to the same vnode and the code doing vrele() on all of them, leading to botched refcounts. This is a horrible hack, but a real fix is being worked on. 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-08-10AnotherBret Lambert
error = operation(); memory = malloc(); if (error) free(memory); gets relegated to the dustbin of history ok thib@
2009-08-10Remove the v2 writegather code. It did help alot back in the 80sThordur I. Bjornsson
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@
2009-08-10The only caller of NFSMSIZ got changed yesterday, so remove it.Bret Lambert
High five from thib@
2009-08-09MLEN < NFS_MAXPATHLEN < MCLBYTES, so there's no need toBret Lambert
loop over allocating a chain of mbufs to store <= NFS_MAXPATHLEN bytes. Clean up some variables, which thib@ likes. ok thib@
2009-08-09error = operation();Bret Lambert
memory = malloc(); if (error) free(memory); makes no sense; move error checking to above memory allocation ok thib@
2009-08-09set the mrq pointer (request) in the nfsm_reply() macro, as we can return ↵Thordur I. Bjornsson
from it. This can cause us to follow garbage in the nfsd loop, causing two kinds of hell. problem noticed by nicm@. 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-30make sure we only ever try to read out post-op attributesThordur I. Bjornsson
or wcc data if we have a proper reply. found the hard way by ariane@, tested by ariane@. OK blambert@
2009-07-28Using the buf pointer returned from incore is a really bad idea.Artur Grabowski
Even if we know that someone safely holds B_BUSY and will not modify the buf (as was the case in here), we still need to be sure that the B_BUSY will not be released while we fiddle with the buf. In this case, it was not safe, since copyout can sleep and whoever was writing out the buf could finish the write and release the buf which could then get recycled or unmapped while we slept. Always acquire B_BUSY ourselves, even when it might give a minor performance penalty. thib@ ok
2009-07-22Instead of calculating a number of seconds to sleep, tsleep()ing onBret Lambert
lbolt and waking up every second and checking to see if the correct number of seconds has passed, just calculate the timeout once and pass that to tsleep(). ok thib@
2009-07-22remove a comment thats part lie and part stating the obvious.Thordur I. Bjornsson
ok blambert@
2009-07-20(struct foo *)0 -> NULL, every where I could find it.Thordur I. Bjornsson
OK blambert@
2009-07-20For memory that gets allocated for every NFS request, pools make moreBret Lambert
sense than malloc. ok thib@, who says the puffin still gets it either way
2009-07-18if -> in, and the sentance makes more sense.Thordur I. Bjornsson
2009-07-18Fixes for the NFSERR_RETERR commit.Thordur I. Bjornsson
- Make sure to set the mbuf pointers and the dpos pointer correctly in nfs_request() before returning an error. - Fix potential mbufs leaks in nfs_{read,write}rpc for v2. The reply mbuf was not being freed before the jump to nfsmout. - Reorder error handling to prevent an error case being treated as a non-error case. Fixes issues noticed by sthen@ and ajacoutot@. Tested by both of them. Reviewd by oga@ OK blambert@
2009-07-17Initialize a variable that was previously using a mystery value inBret Lambert
some error cases ok thib@
2009-07-14don't give people any ideas. nfssvc(2) should not be usedThordur I. Bjornsson
by anyone besides nfsd(8). 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-07-09Remove the VREF() macro and replaces all instances with a call to verf(),Thordur I. Bjornsson
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.
2009-07-08remove redundant comment.Thordur I. Bjornsson
OK blambert@
2009-06-25backout the buf_acquire() does the bremfree() since all callersThordur I. Bjornsson
where doing bremfree() befure calling buf_acquire(). This is causing us headache pinning down a bug that showed up when deraadt@ too cvs to current, and will have to be done anyway as a preperation for backouts. OK deraadt@
2009-06-23- /dev/drum is long gone; sync comment with realityJasper Lievisse Adriaanse
ok thib@
2009-06-06Don't allocate an mbuf cluster without checking to see if it willBret Lambert
actually get us anything. ok thib@
2009-06-06Consolidate error handling in read case.Bret Lambert
ok thib@
2009-06-06All caller of buf_acquire were doing bremfree before the call.Artur Grabowski
Just put it in the buf_acquire function. oga@ ok
2009-06-06Consolidate error handling code. Much less atrocious than before.Bret Lambert
"get it in" thib@
2009-06-06turdshine previousThordur I. Bjornsson
2009-06-05bring back rev1.70Thordur I. Bjornsson
2009-06-05revert to 1.67 to unbreak NFS writes; ok beck@ thib@Christian Weisgerber
2009-06-05- make this a lot more readable; no binary changeJasper Lievisse Adriaanse
ok thib@
2009-06-05EPERM from VOP_ACCESS() is always an error, so don't hide it.Thordur I. Bjornsson
Diff from FreeBSD. OK blambert@
2009-06-04typo; init -> in itBret Lambert
ok thib@
2009-06-04the following:Bret Lambert
error = foo(); if (!error) bar(); is an alien construct; replace with one from this planet ok thib@