summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient/nfs_vfsops.c
Commit message (Collapse)AuthorAgeFilesLines
* Ugh. Previous commit got the logic exactly backward.des2005-05-171-2/+2
| | | | | Submitted by: bland Pointy hat to: des
* Revision 1.173 broke updating a mount from ro to rw. Fix that by clearingdes2005-05-171-1/+11
| | | | | | the MNT_RDONLY flag if MNT_UPDATE is set and "ro" was not specified. Suggested by: cognet
* Don't copy the NFSMNT_* flags into struct statfs's f_flags field,iedowse2005-05-021-1/+0
| | | | | | | | | | | as they have no connection with the expected MNT_* flags. This bug was exposed 18 months ago when the assignments to f_flags in vfs_syscalls.c were moved to before the VFS_STATFS() call. It was fixed in the CSRG source 10 years ago, but we never picked up that change. PR: kern/80390 MFC after: 1 week
* When NFS was converted to the new mount syscall, code was written that setsdes2005-04-271-3/+1
| | | | | | | | | | | the MNT_RDONLY flag if the "ro" option was passed in from userland, and clears it otherwise. In the diskless case, the MNT_RDONLY flag is already set when this code is reached, but there are no mount options, so it was incorrectly cleared. Change the logic so the MNT_RDONLY flag is set if the "ro" option was specified, and left alone otherwise. Note that the NFS code will still happily let you mount a filesystem RW even if the server exports it RO. I'm not sure how to fix that.
* - Update vfs_root implementations to match the new prototype. None ofjeff2005-03-241-1/+1
| | | | | | | | these filesystems will support shared locks until they are explicitly modified to do so. Careful review must be done to ensure that this is safe for each individual filesystem. Sponsored by: Isilon Systems, Inc.
* Mostly back out rev 1.33 from quite some time ago, and the followup fixespeter2005-01-181-25/+11
| | | | | | | | | and tweaks. The code was actually quite broken because it discarded the upper bits of the 64 bit division. We only had a 50% chance of scaling up the blocksize for large NFS client mounts when it was needed. For 5.x and beyond, this was harmless because we could represent the result in either case. For 4.x this was a big problem though. (4.x also has a df(1) bug to compound the problem)
* Remove the unused credential argument from VOP_FSYNC() and VFS_SYNC().phk2005-01-111-2/+2
| | | | | | | | | | | | | | | | | | I'm not sure why a credential was added to these in the first place, it is not used anywhere and it doesn't make much sense: The credentials for syncing a file (ability to write to the file) should be checked at the system call level. Credentials for syncing one or more filesystems ("none") should be checked at the system call level as well. If the filesystem implementation needs a particular credential to carry out the syncing it would logically have to the cached mount credential, or a credential cached along with any delayed write data. Discussed with: rwatson
* /* -> /*- for license, minor formatting changesimp2005-01-071-1/+1
|
* First cut of NFS direct IO support.ps2004-12-151-0/+1
| | | | | | | | | | | | | | - NFS direct IO completely bypasses the buffer and page caches. If a file is open for direct IO all caching is disabled. - Direct IO for Directories will be addressed later. - 2 new NFS directio related sysctls are added. One is a knob to disable NFS direct IO completely (direct IO is enabled by default). The other is to disallow mmaped IO on a file that has at least one O_DIRECT open (see the comment in nfs_vnops.c for more details). The default is to allow mmaps on a file that has O_DIRECT opens. Submitted by: Mohan Srinivasan mohans at yahoo-inc dot com Obtained from: Yahoo!
* Don't clobber mnt_stat.f_mntonnamephk2004-12-071-13/+8
|
* The remaining part of nmount/omount/rootfs mount changes. I cannot sensiblyphk2004-12-071-21/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | split the conversion of the remaining three filesystems out from the root mounting changes, so in one go: cd9660: Convert to nmount. Add omount compat shims. Remove dedicated rootfs mounting code. Use vfs_mountedfrom() Rely on vfs_mount.c calling VFS_STATFS() nfs(client): Convert to nmount (the simple way, mount_nfs(8) is still necessary). Add omount compat shims. Drop COMPAT_PRELITE2 mount arg compatibility. ffs: Convert to nmount. Add omount compat shims. Remove dedicated rootfs mounting code. Use vfs_mountedfrom() Rely on vfs_mount.c calling VFS_STATFS() Remove vfs_omount() method, all filesystems are now converted. Remove MNTK_WANTRDWR, handling RO/RW conversions is a filesystem task, and they all do it now. Change rootmounting to use DEVFS trampoline: vfs_mount.c: Mount devfs on /. Devfs needs no 'from' so this is clean. symlink /dev to /. This makes it possible to lookup /dev/foo. Mount "real" root filesystem on /. Surgically move the devfs mountpoint from under the real root filesystem onto /dev in the real root filesystem. Remove now unnecessary getdiskbyname(). kern_init.c: Don't do devfs mounting and rootvnode assignment here, it was already handled by vfs_mount.c. Remove now unused bdevvp(), addaliasu() and addalias(). Put the few necessary lines in devfs where they belong. This eliminates the second-last source of bogo vnodes, leaving only the lemming-syncer. Remove rootdev variable, it doesn't give meaning in a global context and was not trustworth anyway. Correct information is provided by statfs(/).
* Rewrite of the NFS client's reply handling. We now have NFS socketps2004-12-061-0/+9
| | | | | | | | upcalls which do RPC header parsing and match up the reply with the request. NFS calls now sleep on the nfsreq structure. This enables us to eliminate the NFS recvlock. Submitted by: Mohan Srinivasan mohans at yahoo-inc dot com
* Convert GIANT_REQUIRED; in nfs_mountroot() to NET_ASSERT_GIANT(),rwatson2004-12-051-1/+6
| | | | | | | | | and annotate that nfs_mountroot assumes it is OK to step on the values in the global NFSv3 diskless structure as the mountroot function is called during a serialized part of the boot, before any other NFS client activity occurs. MFC after: 2 weeks
* VFS_STATFS(mp, ...) is mostly called with &mp->mnt_stat, but a few casesphk2004-12-051-5/+0
| | | | | | | | doesn't. Most of the implementations have grown weeds for this so they copy some fields from mnt_stat if the passed argument isn't that. Fix this the cleaner way: Always call the implementation on mnt_stat and copy that in toto to the VFS_STATFS argument if different.
* Fix for a (blocks) underrun bug where negative values were beingps2004-12-011-3/+4
| | | | | | | | returned back to df from a statfs call. Causing df to print negative values. Submitted by: Mohan Srinivasan mohans at yahoo-inc dot com Reviewed by: rwatson
* Detect root mount attempts on the flag, not on the NULL path.phk2004-11-091-1/+1
|
* Add b_bufobj to struct buf which eventually will eliminate the need for b_vp.phk2004-10-221-1/+2
| | | | | | | | | | | | | | | | | | Initialize b_bufobj for all buffers. Make incore() and gbincore() take a bufobj instead of a vnode. Make inmem() local to vfs_bio.c Change a lot of VI_[UN]LOCK(bp->b_vp) to BO_[UN]LOCK(bp->b_bufobj) also VI_MTX() to BO_MTX(), Make buf_vlist_add() take a bufobj instead of a vnode. Eliminate other uses of bp->b_vp where bp->b_bufobj will do. Various minor polishing: remove "register", turn panic into KASSERT, use new function declarations, TAILQ_FOREACH_SAFE() etc.
* Add a missing newline character.pjd2004-10-141-1/+2
|
* Put a version element in the VFS filesystem configuration structurephk2004-07-301-4/+3
| | | | | | | | | | | | | | | | | | and refuse initializing filesystems with a wrong version. This will aid maintenance activites on the 5-stable branch. s/vfs_mount/vfs_omount/ s/vfs_nmount/vfs_mount/ Name our filesystems mount function consistently. Eliminate the namiedata argument to both vfs_mount and vfs_omount. It was originally there to save stack space. A few places abused it to get hold of some credentials to pass around. Effectively it is unused. Reorganize the root filesystem selection code.
* Remove global variable rootdevs and rootvp, they are unused as such.phk2004-07-281-2/+0
| | | | | | | | Add local rootvp variables as needed. Remove checks for miniroot's in the swappartition. We never did that and most of the filesystems could never be used for that, but it had still been copy&pasted all over the place.
* Make VFS_ROOT() and vflush() take a thread argument.alfred2004-07-121-2/+2
| | | | | | This is to allow filesystems to decide based on the passed thread which vnode to return. Several filesystems used curthread, they now use the passed thread.
* Change the following environment variables to kernel options:brian2004-07-081-11/+5
| | | | | | | | | | | | | bootp -> BOOTP bootp.nfsroot -> BOOTP_NFSROOT bootp.nfsv3 -> BOOTP_NFSV3 bootp.compat -> BOOTP_COMPAT bootp.wired_to -> BOOTP_WIRED_TO - i.e. back out the previous commit. It's already possible to pxeboot(8) with a GENERIC kernel. Pointed out by: dwmalone
* Change the following kernel options to environment variables:brian2004-07-081-5/+11
| | | | | | | | | | | | | | | | | | BOOTP -> bootp BOOTP_NFSROOT -> bootp.nfsroot BOOTP_NFSV3 -> bootp.nfsv3 BOOTP_COMPAT -> bootp.compat BOOTP_WIRED_TO -> bootp.wired_to This lets you PXE boot with a GENERIC kernel by putting this sort of thing in loader.conf: bootp="YES" bootp.nfsroot="YES" bootp.nfsv3="YES" bootp.wired_to="bge1" or even setting the variables manually from the OK prompt.
* use vfs_suser() to restrict access to the nfs mount's timeout.alfred2004-07-061-0/+3
|
* NFS mobility Phase VI:alfred2004-07-061-1/+50
| | | | | Export NFS mount state via sysctl. Export timeout via sysctl.
* NFS mobility PHASE I, II & III (phase VI, and V pending):alfred2004-07-061-0/+26
| | | | | | | | | | | | | | | Rebind the client socket when we experience a timeout. This fixes the case where our IP changes for some reason. Signal a VFS event when NFS transitions from up to down and vice versa. Add a placeholder vfs_sysctl where we will put status reporting shortly. Also: Make down NFS mounts return EIO instead of EINTR when there is a soft timeout or force unmount in progress.
* When we traverse the vnodes on a mountpoint we need to look out forphk2004-07-041-11/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | our cached 'next vnode' being removed from this mountpoint. If we find that it was recycled, we restart our traversal from the start of the list. Code to do that is in all local disk filesystems (and a few other places) and looks roughly like this: MNT_ILOCK(mp); loop: for (vp = TAILQ_FIRST(&mp...); (vp = nvp) != NULL; nvp = TAILQ_NEXT(vp,...)) { if (vp->v_mount != mp) goto loop; MNT_IUNLOCK(mp); ... MNT_ILOCK(mp); } MNT_IUNLOCK(mp); The code which takes vnodes off a mountpoint looks like this: MNT_ILOCK(vp->v_mount); ... TAILQ_REMOVE(&vp->v_mount->mnt_nvnodelist, vp, v_nmntvnodes); ... MNT_IUNLOCK(vp->v_mount); ... vp->v_mount = something; (Take a moment and try to spot the locking error before you read on.) On a SMP system, one CPU could have removed nvp from our mountlist but not yet gotten to assign a new value to vp->v_mount while another CPU simultaneously get to the top of the traversal loop where it finds that (vp->v_mount != mp) is not true despite the fact that the vnode has indeed been removed from our mountpoint. Fix: Introduce the macro MNT_VNODE_FOREACH() to traverse the list of vnodes on a mountpoint while taking into account that vnodes may be removed from the list as we go. This saves approx 65 lines of duplicated code. Split the insmntque() which potentially moves a vnode from one mount point to another into delmntque() and insmntque() which does just what the names say. Fix delmntque() to set vp->v_mount to NULL while holding the mountpoint lock.
* Remove advertising clause from University of California Regent'simp2004-04-071-4/+0
| | | | | | | license, per letter dated July 22, 1999 and email from Peter Wemm, Alan Cox and Robert Watson. Approved by: core, peter, alc, rwatson
* Rename dup_sockaddr() to sodupsockaddr() for consistency with otherrwatson2004-03-011-1/+1
| | | | | | | | | | | | functions in kern_socket.c. Rename the "canwait" field to "mflags" and pass M_WAITOK and M_NOWAIT in from the caller context rather than "1" or "0". Correct mflags pass into mac_init_socket() from previous commit to not include M_ZERO. Submitted by: sam
* If mountnfs returns an error, it will have already freed nam; no need tocperciva2004-02-221-1/+0
| | | | | | | free it again. Reported by: "Ted Unangst" <tedu@coverity.com> Approved by: rwatson (mentor)
* Bump the NFCv3/TCP defaults for rsize and wsize from 8K to 32K to matchobrien2004-01-311-5/+21
| | | | | | | Solaris and HP-UX. This increases read performance for large files across NFS. PR: 62024 & 26324 Submitted by: Bjoern Groenvall <bg@sics.se>
* Use function pointers to remove the depenancy cross dependancy on nfs4alfred2003-11-221-0/+10
| | | | | | | | and the nfs3 client. Also fix some bugs that happen to be causing crashes in both v3 and v4 introduced by the v4 import. Submitted by: Jim Rees <rees@umich.edu> Approved by: re
* University of Michigan's Citi NFSv4 kernel client code.alfred2003-11-141-0/+2
| | | | Submitted by: Jim Rees <rees@umich.edu>
* 1. Consolidate mount struct allocation/destruction into a common code inkan2003-11-121-23/+3
| | | | | | | | | | | | | | | | | | | | | | | vfs_mount_alloc/vfs_mount_destroy functions and take care to completely destroy the mount point along with its locks. Mount struct has grown in coplexity recently and depending on each failure path to destroy it completely isn't working anymore. 2. Eliminate largely identical vfs_mount and vfs_unmount question by moving the code to handle both cases into a newly introduced vfs_domount function. 3. Simplify nfs_mount_diskless to always expect an allocated mount struct and never attempt an allocation/destruction itself. The vfs_allocroot allocation was there to support 'magic' swap space configuration for diskless clients that was already removed by PHK some time ago. 4. Include a vfs_buildopts cleanups by Peter Edwards to validate the sanity of nmount parameters passed from userland. Submitted by: (4) Peter Edwards <peter.edwards@openet-telecom.com> Reviewed by: rwatson
* Assert GIANT_REQUIRED where sockets are manipulated. This issam2003-11-071-0/+2
| | | | | | | preparatory for MPSAFE network commits and ongoing socket locking work. Supported by: FreeBSD Foundation
* Remove mntvnode_mtx and replace it with per-mountpoint mutex.kan2003-11-051-6/+7
| | | | | | | | | | Introduce two new macros MNT_ILOCK(mp)/MNT_IUNLOCK(mp) to operate on this mutex transparently. Eventually new mutex will be protecting more fields in struct mount, not only vnode list. Discussed with: jeff
* Take care not to call vput if thread used in corresponding vgetkan2003-11-021-1/+2
| | | | | | | | | | wasn't curthread, i.e. when we receive a thread pointer to use as a function argument. Use VOP_UNLOCK/vrele in these cases. The only case there td != curthread known at the moment is boot() calling sync with thread0 pointer. This fixes the panic on shutdown people have reported.
* - Remove an incorrect XXX comment. This code does respect the XLOCK sincejeff2003-10-051-1/+0
| | | | it uses vget() which will fail if the identity changes.
* - Acquire the vnode interlock prior to dropping the mntvnode_mtx.jeff2003-10-041-1/+2
| | | | | - Make a note of the lack of XLOCK protection in this code. We would access a vnode while it is changing identities without Giant.
* Remove the magic way of configuring NFS backed swap.phk2003-08-151-63/+0
| | | | | | | | | | | | | This code dates back to the very first diskless support on FreeBSD, back when swapon(8) couldn't simply be run on a NFS backed file. Suggested replacement command sequence on the client: dd if=/dev/zero of=/swapfile bs=1k count=1 oseek=100000 swapon /swapfile rm -f /swapfile For whatever value of 100000 you want.
* Initialize struct vfsops C99-sparsely.phk2003-06-121-14/+7
| | | | | Submitted by: hmp Reviewed by: phk
* Deal with the possibility of negative available space from the file serverpeter2003-05-191-3/+6
| | | | | | | | to avoid Bad Things(TM) happening (eg: df crashing with a floating point exception). Submitted by: Harold Gutch <logix@foobar.franken.de> Approved by: re (scottl)
* Deprecate machine/limits.h in favor of new sys/limits.h.kan2003-04-291-2/+1
| | | | | | | Change all in-tree consumers to include <sys/limits.h> Discussed on: standards@ Partially submitted by: Craig Rodrigues <rodrigc@attbi.com>
* Fix a bug with df on large (>1TB) nfsv3 file servers on 32 bit clientpeter2003-04-241-11/+23
| | | | | | | machines where the 'long' number of blocks in struct statfs wont fit. Instead of chosing an artificial 512 byte block size, simply scale it up until we avoid an overflow. NFSv3 reports the sizes in bytes, and the blocksize is a figment of nfsclient's imagination.
* Back out M_* changes, per decision of the TRB.imp2003-02-191-1/+1
| | | | Approved by: trb
* Provide a sysctl to allow defaulting of the connectionless (-c) featuredillon2003-01-221-0/+15
| | | | | | | | to mount_nfs. The sysctl defaults to 1 (paranoid mode). Setting it to 0 will allow an NFS client to receive replies on a different IP then they were sent to by default. Submitted by: Sean Eric Fagan <sef@kithrup.com>
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-1/+1
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* do not try to free a mountpoint that we did not allocate.dillon2002-12-211-4/+9
| | | | X-MFC after: immediately
* Don't examine an un-initialized variable.phk2002-10-201-4/+0
| | | | Spotted by: FlexeLint.
* Be consistent about "static" functions: if the function is markedphk2002-09-281-1/+1
| | | | | | static in its prototype, mark it static at the definition too. Inspired by: FlexeLint warning #512
OpenPOWER on IntegriCloud