summaryrefslogtreecommitdiffstats
path: root/sys/nfsserver
Commit message (Collapse)AuthorAgeFilesLines
* Change the fix in the rev. 1.179 to use nfsrv_lockedpair_nd().kib2008-05-281-6/+2
| | | | | Tested by: pho MFC after: 3 days
* Initialize vfslocked prior to calling nfsm_srvmtofh where it was forgotten.kib2008-05-281-0/+3
| | | | | | Reported by: Andrew Edwards <aedwards sandvine com> Tested by: pho MFC after: 3 days
* Replaced the misleading uses of a historical artefact M_TRYWAIT with M_WAIT.ru2008-03-255-15/+15
| | | | | | | | | | Removed dead code that assumed that M_TRYWAIT can return NULL; it's not true since the advent of MBUMA. Reviewed by: arch There are ongoing disputes as to whether we want to switch to directly using UMA flags M_WAITOK/M_NOWAIT for mbuf(9) allocation.
* - Complete part of the unfinished bufobj work by consistently usingjeff2008-03-221-8/+7
| | | | | | | | | | | | | | | | | BO_LOCK/UNLOCK/MTX when manipulating the bufobj. - Create a new lock in the bufobj to lock bufobj fields independently. This leaves the vnode interlock as an 'identity' lock while the bufobj is an io lock. The bufobj lock is ordered before the vnode interlock and also before the mnt ilock. - Exploit this new lock order to simplify softdep_check_suspend(). - A few sync related functions are marked with a new XXX to note that we may not properly interlock against a non-zero bv_cnt when attempting to sync all vnodes on a mountlist. I do not believe this race is important. If I'm wrong this will make these locations easier to find. Reviewed by: kib (earlier diff) Tested by: kris, pho (earlier diff)
* Fix a regression from the last revision - don't edit the ns_rec list whiledfr2008-03-191-1/+3
| | | | not holding the lock.
* Don't call nfs_realign while holding locks.dfr2008-03-181-4/+5
| | | | Reviewed by: kib
* Fix the Giant leak in the nfsrv_remove().kib2008-03-041-2/+6
| | | | | Reported by: pluknet <pluknet gmail com> MFC after: 1 week
* Use nfsrv_destroycache() only once, else it crashes the server.remko2008-01-181-1/+0
| | | | | | | PR: kern/118152 Submitted by: Bjoern Groenvall <bg at sics dot se> Approved by: imp (mentor, a while ago already), jhb MFC After: 3 days
* VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used inattilio2008-01-132-21/+20
| | | | | | | | | | | conjuction with 'thread' argument passing which is always curthread. Remove the unuseful extra-argument and pass explicitly curthread to lower layer functions, when necessary. KPI results broken by this change, which should affect several ports, so version bumping and manpage update will be further committed. Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com>
* vn_lock() is currently only used with the 'curthread' passed as argument.attilio2008-01-102-14/+14
| | | | | | | | | | | | | | | | Remove this argument and pass curthread directly to underlying VOP_LOCK1() VFS method. This modify makes the code cleaner and in particular remove an annoying dependence helping next lockmgr() cleanup. KPI results, obviously, changed. Manpage and FreeBSD_version will be updated through further commits. As a side note, would be valuable to say that next commits will address a similar cleanup about VFS methods, in particular vop_lock1 and vop_unlock. Tested by: Diego Sardina <siarodx at gmail dot com>, Andrea Di Pasquale <whyx dot it at gmail dot com>
* Garbage collect now-unused nfsrv_setcred() -- it's not only unused, butrwatson2007-11-042-18/+0
| | | | | | | also a purveyor of unfortunate (and now unsupported) direct frobbing of struct ucred. MFC after: 3 days
* Rename mac_associate_nfsd_label() to mac_proc_associate_nfsd(), and moverwatson2007-10-251-1/+1
| | | | | | | | | from mac_vfs.c to mac_process.c to join other functions that setup up process labels for specific purposes. Unlike the two proc create calls, this call is intended to run after creation when a process registers as the NFS daemon, so remains an _associate_ call.. Obtained from: TrustedBSD Project
* Add a -z flag to nfsstat which zeros the NFS statistics after displayingjhb2007-10-181-1/+1
| | | | | | | | them. MFC after: 1 week Requested by: ps Submitted by: ps (6 years ago)
* Set the NFS server sockbuf high watermarks to the system defaultsmohans2007-10-121-4/+3
| | | | | | | (up form 32KB). The low highwatermark setting caused UDP fullsock request drops, throttling thruput greatly. Reported by: Kris Kennaway Approved by: re@ (Ken Smith)
* Remove the now-unused NET_{LOCK,UNLOCK,ASSERT}_GIANT() macros, whichrwatson2007-08-063-22/+4
| | | | | | | | | | | | | | | previously conditionally acquired Giant based on debug.mpsafenet. As that has now been removed, they are no longer required. Removing them significantly simplifies error-handling in the socket layer, eliminated quite a bit of unwinding of locking in error cases. While here clean up the now unneeded opt_net.h, which previously was used for the NET_WITH_GIANT kernel option. Clean up some related gotos for consistency. Reviewed by: bz, csjp Tested by: kris Approved by: re (kensmith)
* First in a series of changes to remove the now-unused Giant compatibilityrwatson2007-07-272-12/+3
| | | | | | | | | | | | | | | | | | | | | | | | | framework for non-MPSAFE network protocols: - Remove debug_mpsafenet variable, sysctl, and tunable. - Remove NET_NEEDS_GIANT() and associate SYSINITSs used by it to force debug.mpsafenet=0 if non-MPSAFE protocols are compiled into the kernel. - Remove logic to automatically flag interrupt handlers as non-MPSAFE if debug.mpsafenet is set for an INTR_TYPE_NET handler. - Remove logic to automatically flag netisr handlers as non-MPSAFE if debug.mpsafenet is set. - Remove references in a few subsystems, including NFS and Cronyx drivers, which keyed off debug_mpsafenet to determine various aspects of their own locking behavior. - Convert NET_LOCK_GIANT(), NET_UNLOCK_GIANT(), and NET_ASSERT_GIANT into no-op's, as their entire behavior was determined by the value in debug_mpsafenet. - Alias NET_CALLOUT_MPSAFE to CALLOUT_MPSAFE. Many remaining references to NET_.*_GIANT() and NET_CALLOUT_MPSAFE are still present in subsystems, and will be removed in followup commits. Reviewed by: bz, jhb Approved by: re (kensmith)
* Include priv.h to pick up suser(9) definitions, missed in an earlierrwatson2007-06-131-0/+1
| | | | | | commit. Warnings spotted by: kris
* Init timespec to zero fo quiesce warnings.mjacob2007-06-101-1/+1
|
* Remove MAC Framework access control check entry points made redundant withrwatson2007-04-221-8/+0
| | | | | | | | | | | | | | | | | | the introduction of priv(9) and MAC Framework entry points for privilege checking/granting. These entry points exactly aligned with privileges and provided no additional security context: - mac_check_sysarch_ioperm() - mac_check_kld_unload() - mac_check_settime() - mac_check_system_nfsd() Add mpo_priv_check() implementations to Biba and LOMAC policies, which, for each privilege, determine if they can be granted to processes considered unprivileged by those two policies. These mostly, but not entirely, align with the set of privileges granted in jails. Obtained from: TrustedBSD Project
* Attempt to rationalize NFS privileges:rwatson2007-04-211-1/+1
| | | | | | | | | | | - Replace PRIV_NFSD with PRIV_NFS_DAEMON, add PRIV_NFS_LOCKD. - Use PRIV_NFS_DAEMON in the NFS server. - In the NFS client, move the privilege check from nfslockdans(), which occurs every time a write is performed on /dev/nfslock, and instead do it in nfslock_open() just once. This allows us to avoid checking the saved uid for root, and just use the effective on open. Use PRIV_NFS_LOCKD.
* In nfsrv_rcv(), don't reacquire the nfs server lock until afterrwatson2007-04-151-1/+1
| | | | | | | nfs_realign() has been called, as it may sleep waiting on memory allocation. Reported by: simon
* - Split out the part of SYSCALL_MODULE_HELPER() that builds a 'structjhb2007-04-021-9/+12
| | | | | | | | sysent' for a new system call into a new MAKE_SYSENT() macro. - Use MAKE_SYSENT() to build a full sysent for the nfssvc system call in the NFS server and use syscall_register() and syscall_deregister() to manage the nfssvc system call entry instead of manually frobbing the sysent[] array.
* Initialize vfslocked to 0 before nfsm_srvmtofh() so that the variable isjhb2007-03-261-0/+1
| | | | | | | | not used uninitialized in 'nfsmout' if nfsm_srvmtofh() gets an internal error. CID: 1766 Found by: Coverity Prevent (tm)
* - Turn all explicit giant acquires into conditional VFS_LOCK_GIANTs.jeff2007-03-177-644/+236
| | | | | | | | | | | | | | | Only ops which used namei still remained. - Implement a scheme for reducing the overhead of tracking which vops require giant by constantly reducing the number of recursive giant acquires to one, leaving us with only one vfslocked variable. - Remove all NFSD lock acquisition and release from the individual nfs ops. Careful examination has shown that they are not required. This greatly simplifies the code. Sponsored by: Isilon Systems, Inc. Discussed with: rwatson Tested by: kkenn Approved by: re
* Change these descriptions of memory types used in malloc(9), as theirwkoszek2007-03-051-4/+3
| | | | | | current, rather long strings make output from vmstat -m look unpleasant. Approved by: cognet (mentor)
* Remove 'MPSAFE' annotations from the comments above most system calls: allrwatson2007-03-041-3/+0
| | | | | | | | system calls now enter without Giant held, and then in some cases, acquire Giant explicitly. Remove a number of other MPSAFE annotations in the credential code and tweak one or two other adjacent comments.
* Move vnode-to-file-handle translation from vfs_vptofh to vop_vptofh method.pjd2007-02-151-6/+6
| | | | | | | | | | | | | | | | This way we may support multiple structures in v_data vnode field within one file system without using black magic. Vnode-to-file-handle should be VOP in the first place, but was made VFS operation to keep interface as compatible as possible with SUN's VFS. BTW. Now Solaris also implements vnode-to-file-handle as VOP operation. VFS_VPTOFH() was left for API backward compatibility, but is marked for removal before 8.0-RELEASE. Approved by: mckusick Discussed with: many (on IRC) Tested with: ufs, msdosfs, cd9660, nullfs and zfs
* Get the vfs giant lock before calling nfs_access.mpp2007-02-131-3/+9
| | | | Reviewed by: mohan
* The nfsm_srvpathsiz() macro in nfsrv_symlink() in nfs_serv.c shouldhrs2007-01-022-1/+20
| | | | | | | | | check length of the pathname in the range 0<=n<=NFS_MAXPATHLEN, not 0<n<=NFS_MAXPATHLEN. This fixes a minor interoperability problem that the FreeBSD NFS server did not allow a symlink pointing the empty pathname. MFC after: 1 week
* MFp4: 92972, 98913 + one more changebz2006-12-121-9/+13
| | | | | | | In ip6_sprintf no longer use and return one of eight static buffers for printing/logging ipv6 addresses. The caller now has to hand in a sufficiently large buffer as first argument.
* Push Giant a bit further off the NFS server in a number of straightrwatson2006-11-243-224/+297
| | | | | | | | | | | | | | | | | | | | | | | | forward cases by converting from unconditional acquisition of Giant around vnode operations to conditional acquisition: - Remove nfsrv_access_withgiant(), and cause nfsrv_access() to now assert that Giant will be held if it is required for the vnode. - Add nfsrv_fhtovp_locked(), which will drop the NFS server lock if required, and modify nfsrv_fhtovp() to conditionally acquire Giant if required. - In the VOP's not dealing with more than one vnode at a time (i.e., not involving a lookup), conditionally acquire Giant. This removes Giant use for MPSAFE file systems for a number of quite important RPCs, including getattr, read, write. It leaves unconditional Giant acquisitions in vnode operations that interact with the name space or more than one vnode at a time as these require further work. Tested by: kris Reviewed by: kib
* Protect nfsm_srvpathsiz() call with the nfsd_mtx lock.pjd2006-11-201-5/+6
| | | | Reviewed by: mohans
* Sweep kernel replacing suser(9) calls with priv(9) calls, assigningrwatson2006-11-061-1/+2
| | | | | | | | | | | | | specific privilege names to a broad range of privileges. These may require some future tweaking. Sponsored by: nCircle Network Security, Inc. Obtained from: TrustedBSD Project Discussed on: arch@ Reviewed (at least in part) by: mlaier, jmg, pjd, bde, ceri, Alex Lyashkov <umka at sevcity dot net>, Skip Ford <skip dot ford at verizon dot net>, Antoine Brodin <antoine dot brodin at laposte dot net>
* Fix leak in NAMEI zone caused by nfs server when VOP_RENAME fails.kib2006-10-261-2/+2
| | | | | | | Submitted by: Padma Bhooma <pbhooma at panasas com> Reviewed by: bde Approved by: pjd (mentor) MFC after: 1 week
* Complete break-out of sys/sys/mac.h into sys/security/mac/mac_framework.hrwatson2006-10-222-2/+4
| | | | | | | | | | | | | begun with a repo-copy of mac.h to mac_framework.h. sys/mac.h now contains the userspace and user<->kernel API and definitions, with all in-kernel interfaces moved to mac_framework.h, which is now included across most of the kernel instead. This change is the first step in a larger cleanup and sweep of MAC Framework interfaces in the kernel, and will not be MFC'd. Obtained from: TrustedBSD Project Sponsored by: SPARTA
* - Add a new function nfsrv_destroycache() to tear down the server requestjhb2006-08-013-3/+17
| | | | | | | | | cache when unloading the nfsserver module. This fixes a memory leak and a stale pointer. - Use callout_drain() rather than callout_stop() when unloading the nfsserver module. MFC after: 3 days
* Use TAILQ_FOREACH_SAFE() in a couple of places.jhb2006-08-012-5/+2
|
* Now that all system calls are MPSAFE, retire the SYF_MPSAFE flag used tojhb2006-07-281-1/+2
| | | | | | | | | mark system calls as being MPSAFE: - Stop conditionally acquiring Giant around system call invocations. - Remove all of the 'M' prefixes from the master system call files. - Remove support for the 'M' prefix from the script that generates the syscall-related files from the master system call files. - Don't explicitly set SYF_MPSAFE when registering nfssvc.
* soreceive_generic(), and sopoll_generic(). Add new functions sosend(),rwatson2006-07-241-6/+3
| | | | | | | | | | | | | | | | soreceive(), and sopoll(), which are wrappers for pru_sosend, pru_soreceive, and pru_sopoll, and are now used univerally by socket consumers rather than either directly invoking the old so*() functions or directly invoking the protocol switch method (about an even split prior to this commit). This completes an architectural change that was begun in 1996 to permit protocols to provide substitute implementations, as now used by UDP. Consumers now uniformly invoke sosend(), soreceive(), and sopoll() to perform these operations on sockets -- in particular, distributed file systems and socket system calls. Architectural head nod: sam, gnn, wollman
* Size the NFS server dupreq cache on the basis of nmbclusters. On serversmohans2006-06-232-4/+22
| | | | | | | | | | | with low nmbclusters, we tie up too many mbclusters in the NFS duplicate request cache. This change limits the size of the dupreq cache to 1/2 the nmbclusters (and flaots in a range of [64, 2048]). MFC after 2 weeks. Reported by: Steve Kargl, David O'Brien Tested by: Steve Kargl
* Temporary workaround to prevent leak of Giant from nfsd when callingkib2006-06-052-0/+20
| | | | | | | | | lookup(). Reviewed by: tegge Tested by: "Arno J. Klaassen" <arno at heho snv jussieu fr>, "Rong-en Fan" <grafan at gmail com>, Dmitriy Kirhlarov <dimma at higis ru>, Dmitry Pryanishnikov <dmitry at atlantis dp ua> MFC after: 1 week Approved by: kan, pjd (mentors)
* Bump up the NFS server dupreq cache limit to 2K (from 64). With a smallmohans2006-04-251-1/+1
| | | | | | | duplicate request cache, under heavy load a lot of non-idempotent requests were getting served again, resulting in errors. Found by : Kris Kennaway.
* Introduce a new MAC entry point for label initialization of the NFS daemon'scsjp2006-04-061-0/+3
| | | | | | | | | | | | | | | credential: mac_associate_nfsd_label() This entry point can be utilized by various Mandatory Access Control policies so they can properly initialize the label of files which get created as a result of an NFS operation. This work will be useful for fixing kernel panics associated with accessing un-initialized or invalid vnode labels. The implementation of these entry points will come shortly. Obtained from: TrustedBSD Requested by: mdodd MFC after: 3 weeks
* rick says:cel2006-04-021-0/+6
| | | | | | | | | | | | | | | | | | | | | | The following bug was just identified in OpenBSD and it looks like the same bug exists in the other BSDen NFS servers. A Linux client (don't know which version, but you can look at http://bugzilla.kernel.org/show_bug.cgi?id=6256) does a Setattr of mtime to the server's time, where the file is mode 0664 and the client user has group access (ie. caller is not the file owner). The BSD servers fail the Setattr with EPERM, since the VA_UTIMES_NULL flag isn't set before doing the VOP_SETATTR. It seems to me that this should be allowed, since it is allowed for a local utimes(2). If so, the fix is to set VA_UTIMES_NULL for the "set-time-to-server-time" cases of setting atime and/or mtime. Submitted by: rick@snowhite.cis.uoguelph.ca Reviewed by: cel Approved by: silby MFC after: 1 week
* - Release the references acquired by VOP_GETWRITEMOUNT and vfs_getvfs().jeff2006-03-312-2/+15
| | | | | | Discussed with: tegge Tested by: kris Sponsored by: Isilon Systems, Inc.
* - Reorder vrele calls after vput calls to prevent lock order reversalsjeff2006-03-121-26/+17
| | | | | | | between leaf and directory locks. Found by: kris Sponsored by: Isilon Systems, Inc.
* When parsing an RPC request in nfsrv_dorec(), KASSERT that theresimon2006-03-081-0/+1
| | | | | | | | | actually is an mbuf to process. This catches the missing mbuf before it would otherwise causes a NULL pointer dereference, which could be triggered by a 0 length RPC record before the check for such records was added in rev 1.97. Approved by: cperciva (mentor)
* Correct a remote kernel panic when processing zero-length RPC recordssimon2006-03-011-1/+1
| | | | | | | via TCP. [06:10] Security: FreeBSD-SA-06:10.nfs Approved by: cperciva
* - Reorder calls to vrele() after calls to vput() when the vrele is ajeff2006-02-012-39/+38
| | | | | | | | | | | | directory. vrele() may lock the passed vnode, which in these cases would give an invalid lock order of child -> parent. These situations are deadlock prone although do not typically deadlock because the vrele is typically not releasing the last reference to the vnode. Users of vrele must consider it as a call to vn_lock() and order it appropriately. MFC After: 1 week Sponsored by: Isilon Systems, Inc. Tested by: kkenn
* Manage the ucred for the NFS server using the crget/crfree API defined incsjp2006-01-284-39/+47
| | | | | | | | | | | | | | | | | | | | kern_prot.c. This API handles reference counting among many other things. Notably, if MAC is compiled into the kernel, it will properly initialize the MAC labels when the ucred is allocated. This work is in preparation for a new MAC entry point which will be responsible for properly initializing policy specific labels for the NFS server credential. Utilization of the crfree/crget APIs reduce the complexity associated with this label's management. Submitted by: green (with changes) [1] Obtained from: TrustedBSD Project Discussed with: rwatson, alfred [1] I moved the ucred allocation outside the scope of the NFS server lock to prevent M_WAIKOK allocations from occurring with non-sleep-able locks held. Additionally, to reduce complexity, the ucred persist as long as the NFS server descriptor.
OpenPOWER on IntegriCloud