summaryrefslogtreecommitdiffstats
path: root/sys/nfs (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* clean up a few things that where left to rot after bob's vfs cache work.thib2010-05-192-7/+2
| | | | | | | sync a few comments to reality (or remove them), remove the cn_hash member from struct componentname, spacing. ok beck@
* Don't jump the queue if we have to wait on the client side becausebeck2010-04-124-10/+15
| | | | | | | the nfs_bufq is full - instead tsleep waiting for one of our nfsiod's to free up space for us in the queue so we can enqueue on the end. ok blambert@, tedu@, oga@
* make more bettah. instead of doing:oga2010-04-091-9/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | switch(type) { case VREG: /*something */ break; case VLNK: /* something */ break; default: panic("wtf?"); } do_something_that_doesn't_change_type(); switch(type) { case VREG: /* nowt */ break; case VLNK: n = 0; break; default: panic("wtf?"); } be a bit less silly and replace the second switch with: if (type == VLNK) n = 0; ok beck@, blambert@
* In the nfs bio functions, instead of looking at an invalid vnode type,oga2010-04-091-4/+4
| | | | | | | | | deciding to do nothing, printing about it and continuing along our merry way without even erroring the sodding buffer, just panic. by this point we are liked very fucked up anyway. found in either edmonton or stockholm then forgotten. ok beck@, blambert@
* Don't return 0 if error is set to EBADRPC. Found by jsg@ and clang.krw2010-04-031-2/+2
| | | | ok deraadt@
* Initialize various uninitialized variables. Found by jsg@ via Clang.krw2010-03-292-3/+5
| | | | | | Feedback from miod@ and kettenis@. ok beck@
* This fixes a case where we could panic on a null deref with a bad vnodebeck2009-12-171-6/+32
| | | | | | | | | | | | | | | | | | | 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@
* back out previous fix, apparently neither art or i can fix anything right on the first trybeck2009-12-151-2/+1
| | | | vgone doesn't work in other cases of this. I must fix this slightly differntly
* This fixes a case where we could panic on a null deref with a bad vnodebeck2009-12-151-1/+2
| | | | | | | | | | | | | | | 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@
* Make sillyrename not so damn silly. The kindergarten algorithm here forbeck2009-12-152-17/+14
| | | | | | | | | | | | | picking a name meant that more than 58 sillys in a directory and we fail with EINVAL, resulting in strange problems for nfs which in turn causes pain and stress in building, and PTSD in nfs and vfs hackers. Has bit us in the butt since the vienna f2k7 hackathon. good suggestions from deraadt@ guenther@ and otto@ ok deraadt@,oga@,blambert@,krw@,guenther@, and a "very special ok" tedu@ Oh god, I'm an nfs hacker..
* "fix" from freebsd to hide potential race in silly renames, wherebeck2009-12-101-2/+11
| | | | | | | a directory gets reclaimed on a forced unmount before the silly file in it gets blown away... fixes an issue seen by phessler@ ok oga@, art@
* antsyjsg2009-10-199-550/+217
| | | | | | 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-029-121/+184
| | | | | | problem noticed by deraadt@ ok beck@
* if nfs_namei() fails, there's no ni_startdir and the pathname buffer hasthib2009-08-301-25/+29
| | | | | | | | | | 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@
* Garbage collect two variables that where set but unused.thib2009-08-272-9/+5
| | | | | Tiny spacing nit. Fix a typo, pointed out by miod@.
* introduce a flag member to struct nfs_aiod, and use flags instead of the exitthib2009-08-273-25/+34
| | | | | | | | | | | | | | | | | | | | | | 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@
* make sure that an aiod has been removed from the nfs_aiods_idle listthib2009-08-263-5/+11
| | | | | | before inserting it back into the list. crashes debugged with help from deraadt@ who also tested this fix.
* move to having requests on a per nfsmount tailq instead of one global one.thib2009-08-255-39/+26
| | | | | | | | | | 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-2010-184/+327
| | | | | | | | | | | | | | | | 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@.
* add ddb functions to be able to show all the nfsnodes in the systemthib2009-08-142-14/+44
| | | | | | and rewrite the nfsreq code to use pool_walk(). OK beck@, blambert@
* Use the nfs_hashlock to protect the nfs_nodetree hanging of the mount.thib2009-08-141-9/+27
| | | | | | | | | | | | | | | 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@
* Avoid double-release of vnodes in several functionsblambert2009-08-141-9/+1
| | | | ok thib@
* Initialize len variable; found by Martynas Venckusblambert2009-08-141-2/+2
| | | | ok thib@
* Teach nfsm_fhtom about nfsm_info structsblambert2009-08-134-31/+31
| | | | ok thib@
* change version 3 post-operation attribute building function to notblambert2009-08-133-82/+70
| | | | | | use mbufs directly, but the shiny new nfsm_info struct ok thib@
* - remove super-obvious comments from $fs_vnodeop_entries[]jasper2009-08-131-61/+61
| | | | | prodded by and ok thib@ agreed by art@ and blambert@
* tiny knf and use curproc directly instead of a setting up a local procthib2009-08-111-10/+6
| | | | | | pointer since its just used in one place. ok blambert@
* Fix a few bugs in nfsrv_rename() error recovery code.thib2009-08-111-8/+16
| | | | | | | | | | | | | - 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@
* Use an RB tree instead of a hashtable for fh/node lookups.thib2009-08-107-65/+61
| | | | | | Idea from NetBSD. OK blambert@
* Anotherblambert2009-08-101-9/+10
| | | | | | | | | | error = operation(); memory = malloc(); if (error) free(memory); gets relegated to the dustbin of history ok thib@
* Remove the v2 writegather code. It did help alot back in the 80sthib2009-08-106-658/+136
| | | | | | | | | | 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@
* The only caller of NFSMSIZ got changed yesterday, so remove it.blambert2009-08-101-5/+1
| | | | High five from thib@
* MLEN < NFS_MAXPATHLEN < MCLBYTES, so there's no need toblambert2009-08-091-43/+27
| | | | | | | | | loop over allocating a chain of mbufs to store <= NFS_MAXPATHLEN bytes. Clean up some variables, which thib@ likes. ok thib@
* error = operation();blambert2009-08-091-9/+8
| | | | | | | | | memory = malloc(); if (error) free(memory); makes no sense; move error checking to above memory allocation ok thib@
* set the mrq pointer (request) in the nfsm_reply() macro, as we can return from it.thib2009-08-092-33/+3
| | | | | | This can cause us to follow garbage in the nfsd loop, causing two kinds of hell. problem noticed by nicm@. OK blambert@.
* group all of the on-stack variables that are uses by the nfsm_macrosthib2009-08-047-775/+985
| | | | | | | | | | | | | | 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@.
* make sure we only ever try to read out post-op attributesthib2009-07-302-9/+13
| | | | | | | | or wcc data if we have a proper reply. found the hard way by ariane@, tested by ariane@. OK blambert@
* Using the buf pointer returned from incore is a really bad idea.art2009-07-281-30/+12
| | | | | | | | | | | | | 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
* Instead of calculating a number of seconds to sleep, tsleep()ing onblambert2009-07-221-7/+6
| | | | | | | | 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@
* remove a comment thats part lie and part stating the obvious.thib2009-07-221-4/+1
| | | | ok blambert@
* (struct foo *)0 -> NULL, every where I could find it.thib2009-07-209-99/+97
| | | | OK blambert@
* For memory that gets allocated for every NFS request, pools make moreblambert2009-07-202-8/+15
| | | | | | sense than malloc. ok thib@, who says the puffin still gets it either way
* if -> in, and the sentance makes more sense.thib2009-07-181-2/+2
|
* Fixes for the NFSERR_RETERR commit.thib2009-07-182-64/+60
| | | | | | | | | | | | | | - 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@
* Initialize a variable that was previously using a mystery value inblambert2009-07-171-2/+2
| | | | | | some error cases ok thib@
* don't give people any ideas. nfssvc(2) should not be usedthib2009-07-141-3/+3
| | | | | | by anyone besides nfsd(8). ok blambert@
* Make the callers of nfs_request() responsible for freeing the reply mbuf,thib2009-07-133-233/+169
| | | | | | | | | 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@.
* Remove the VREF() macro and replaces all instances with a call to verf(),thib2009-07-092-7/+7
| | | | | | | | | | | 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 redundant comment.thib2009-07-081-6/+1
| | | | OK blambert@
* backout the buf_acquire() does the bremfree() since all callersthib2009-06-252-2/+5
| | | | | | | | | | 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@