summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient/nfs_vnops.c
Commit message (Collapse)AuthorAgeFilesLines
* Stop using shared locks for nfs vop locks.alfred2003-11-111-3/+0
| | | | | | | | | | | | | The reason this was done was to avoid a race to the root when an NFS server went down. However a semi-recent change to the way that the kernel's lookup() routine traverses mount points prevents this. Rev 1.39 of vfs_lookup.c changed the ordering of locks such that we aquire a shared lock on the mount point being accessed and then drop the directory vnode lock before requesting the target lock. With that in place we no longer need shared locks for NFS to prevent race to the root lockups.
* DuH!phk2003-10-181-1/+1
| | | | | bp->b_iooffset (the spot on the disk), not bp->b_offset (the offset in the file)
* Initialize bp->b_offset before calling VOP_STRATEGY().phk2003-10-181-3/+1
| | | | Remove KASSERTS and panics with B_PHYS checks which no longer apply.
* Name the vnode method vectors consistently with the rest of the filesystems.phk2003-09-121-15/+15
| | | | This improves the output of src/tools/tools/vop_table
* KNF: parentheses around return values.dds2003-09-041-4/+4
| | | | | | Suggested by: bde Approved by: schweikh (mentor - blanket) MFC after: 6 weeks
* Fix errno return values to better represent failure reasons fordds2003-09-021-4/+9
| | | | | | | | read and open. Approved by: schweikh (mentor) Agreed: bde MFC after: 6 weeks
* Fix a problem that occurs when truncating files on NFSv3 mounts: we needtjr2003-07-291-1/+7
| | | | | | | | | | | | to set np->n_size back to the desired size again after calling nfs_meta_setsize(), since it could end up in nfs_loadattrcache() getting called, which would change n_size back to the value it had before the truncate request was issued. The result of this bug is that the size info cached in the nfsnode becomes incorrect, lseek(fd, ofs, SEEK_END) seeks past the end of the file, stat() returns the wrong size, etc. PR: 41792 MFC after: 2 weeks
* Add the same KASSERT to all VOP_STRATEGY and VOP_SPECSTRATEGY implementationsphk2003-06-151-0/+2
| | | | to check that the buffer points to the correct vnode.
* When removing a sillyrename file, make sure that the directory vnodeiedowse2003-06-121-0/+6
| | | | | | | | | | has not been cleaned in the meantime, since this can happen during a forced unmount. Also add a comment that nfs_removeit() should really be locking the directory vnode before calling nfs_removerpc(). Reported by: mbr Tested by: mbr MFC after: 1 week
* This change grabs the vnode lock for NFS client vnodes when callingrwatson2003-05-151-0/+4
| | | | | | | | | | VOP_SETATTR() or VOP_GETATTR(); without these locks (a) VFS_DEBUG_LOCKS will panic, and (b) it may be possible to corrupt entries in the cached vnode attributes in the nfsnode, since nfsnode attribute cache data is also protected by the vnode lock. Approved by: re (jhb) Pointed out by: VFS_DEBUG_LOCKS
* VOP_FSYNC() expects to be called with the vnode locked, so lock fvp intruckman2003-04-241-1/+9
| | | | | | nfs_rename() before calling VOP_FSYNC() and unlock fvp immediately after. Reviewed by: bde
* Release the vnode interlock in nfs_flush() before calling nfs_sigintr(),truckman2003-04-231-1/+2
| | | | | and grab it again later if necessary. This prevents a lock order reversal because nfs_sigintr() calls PROC_LOCK().
* Revert change 1.201 (removing mapping of VAPPEND to VWRITE).thomas2003-03-311-32/+2
| | | | | | | | | | Instead, use the generic vaccess() operation to determine whether an operation is permitted. This avoids embedding knowledge on vnode permission bits such as VAPPEND in the NFS client. PR: kern/46515 vaccess() patch submitted by: "Peter Edwards" <pmedwards@eircom.net> Approved by: tjr, roberto (mentor)
* Map VAPPEND to VWRITE in nfsspec_access() - VAPPEND is never set in thetjr2003-03-211-0/+7
| | | | | mode returned by VOP_GETATTR. This fixes incorrect "Permission denied" errors when trying to append to a file on an NFSv2 mount.
* - Add a forgotten BUF_LOCK()jeff2003-03-141-0/+1
| | | | Most sincere apologies to: jake
* - Lock the buf before inspecting its contents.jeff2003-03-131-6/+4
|
* Finish cleanup of vprint() which was begun with changing v_tag to a string.njl2003-03-031-2/+2
| | | | | | Remove extraneous uses of vop_null, instead defering to the default op. Rename vnode type "vfs" to the more descriptive "syncer". Fix formatting for various filesystems that use vop_print.
* - The interlock was not being droped in nfs_flush() if the first part ofjeff2003-02-261-2/+5
| | | | | | | | an if clause was true. Break the two clauses out into seperate statements since they require different actions. Reported/Tested by: jake Spotted by: jhb
* - Properly handle the vnode interlock in nfs_fsync.jeff2003-02-251-1/+1
| | | | Reported by: phk
* - Add an interlock argument to BUF_LOCK and BUF_TIMELOCK.jeff2003-02-251-9/+9
| | | | | | | | | | - Remove the buftimelock mutex and acquire the buf's interlock to protect these fields instead. - Hold the vnode interlock while locking bufs on the clean/dirty queues. This reduces some cases from one BUF_LOCK with a LK_NOWAIT and another BUF_LOCK with a LK_TIMEFAIL to a single lock. Reviewed by: arch, mckusick
* Back out M_* changes, per decision of the TRB.imp2003-02-191-3/+3
| | | | Approved by: trb
* Remove M_TRYWAIT/M_WAITOK/M_WAIT. Callers should use 0.alfred2003-01-211-3/+3
| | | | Merge M_NOWAIT/M_DONTWAIT into a single flag M_NOWAIT.
* Since Jeffr made the std* functions the default in rev 1.63 ofphk2003-01-041-6/+0
| | | | | | | kern/vfs_defaults.c it is wrong for the individual filesystems to use the std* functions as that prevents override of the default. Found by: src/tools/tools/vop_table
* Convert calls to BUF_STRATEGY to VOP_STRATEGY calls. This is a no-op sincephk2003-01-031-1/+1
| | | | all BUF_STRATEGY did in the first place was call VOP_STRATEGY.
* Avoid holding the vnode interlock around malloc() or free() to prevent aalc2002-12-231-2/+8
| | | | | | lock order reversal. Reviewed by: jeff
* Change iov_base's type from `char *' to the standard `void *'. Allmike2002-10-111-9/+19
| | | | | uses of iov_base which assume its type is `char *' (in order to do pointer arithmetic) have been updated to cast iov_base to `char *'.
* - Lock access to the buf lists.jeff2002-09-251-10/+26
| | | | | - Use vrefcnt() where appropriate. - Add some locking asserts.
* Remove all use of vnode->v_tag, replacing with appropriate substitutes.njl2002-09-141-2/+2
| | | | | | | | | | | | v_tag is now const char * and should only be used for debugging. Additionally: 1. All users of VT_NTS now check vfsconf->vf_type VFCF_NETWORK 2. The user of VT_PROCFS now checks for the new flag VV_PROCDEP, which is propagated by pseudofs to all child vnodes if the fs sets PFS_PROCDEP. Suggested by: phk Reviewed by: bde, rwatson (earlier version)
* - Add a missing VI_UNLOCK to an error case in nfs_flush.jeff2002-08-051-0/+1
|
* - Replace v_flag with v_iflag and v_vflagjeff2002-08-041-2/+4
| | | | | | | | | | | | | | | - v_vflag is protected by the vnode lock and is used when synchronization with VOP calls is needed. - v_iflag is protected by interlock and is used for dealing with vnode management issues. These flags include X/O LOCK, FREE, DOOMED, etc. - All accesses to v_iflag and v_vflag have either been locked or marked with mp_fixme's. - Many ASSERT_VOP_LOCKED calls have been added where the locking was not clear. - Many functions in vfs_subr.c were restructured to provide for stronger locking. Idea stolen from: BSD/OS
* Convert old style (type foo *)0 casts to NULLsdillon2002-07-111-24/+24
| | | | | PR: kern/40360 Requested by: Hiten PAndya via direct email
* In namei(), we use a NULL thread for uio_td when doing a VOP_READLINK().jhb2002-06-281-2/+2
| | | | | | | | | | | | nfs_readlink() calls nfs_bioread() which passes in uio_td as the thread argument to nfs_getcacheblk(). In nfs_getcacheblk() we dereference the thread pointer to get a process pointer to pass to nfs_sigintr(). This obviously results in a panic. :) Rather than change nfs_getcacheblk() to check if the thread pointer is NULL when calling nfs_sigintr() like other callers do, change nfs_sigintr() to take a thread as the last argument instead of a process so none of the callers have to care if the thread is NULL or not.
* vhold() our vnode while checking the remote side.phk2002-03-081-0/+3
| | | | | | | | | This is belived to be the only place where a soft reference to a vnode is held with no sort of hard reference, consequently this change should allow us to free(9) vnodes from the freelist after properly cleaning them up. Reviewed by: dillon
* Avoid passing the variable `tl' to functions that just use it foriedowse2001-12-181-10/+0
| | | | | | | | | | | | | temporary storage. In the old NFS code it wasn't at all clear if the value of `tl' was used across or after macro calls, but I'm fairly confident that the convention was to keep its use local. Each ex-macro function now uses a local version of this variable, so all of the double-indirection goes away. The only exception to the `local use' rule for `tl' is nfsm_clget(), which is left unchanged by this commit. Reviewed by: peter
* This fixes a large number of bugs in our NFS client side code. A recentdillon2001-12-141-5/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit by Kirk also fixed a softupdates bug that could easily be triggered by server side NFS. * An edge case with shared R+W mmap()'s and truncate whereby the system would inappropriately clear the dirty bits on still-dirty data. (applicable to all filesystems) THIS FIX TEMPORARILY DISABLED PENDING FURTHER TESTING. see vm/vm_page.c line 1641 * The straddle case for VM pages and buffer cache buffers when truncating. (applicable to NFS client side) * Possible SMP database corruption due to vm_pager_unmap_page() not clearing the TLB for the other cpu's. (applicable to NFS client side but could effect all filesystems). Note: not considered serious since the corruption occurs beyond the file EOF. * When flusing a dirty buffer due to B_CACHE getting cleared, we were accidently setting B_CACHE again (that is, bwrite() sets B_CACHE), when we really want it to stay clear after the write is complete. This resulted in a corrupt buffer. (applicable to all filesystems but probably only triggered by NFS) * We have to call vtruncbuf() when ftruncate()ing to remove any buffer cache buffers. This is still tentitive, I may be able to remove it due to the second bug fix. (applicable to NFS client side) * vnode_pager_setsize() race against nfs_vinvalbuf()... we have to set n_size before calling nfs_vinvalbuf or the NFS code may recursively vnode_pager_setsize() to the original value before the truncate. This is what was causing the user mmap bus faults in the nfs tester program. (applicable to NFS client side) * Fix to softupdates (see ufs/ffs/ffs_inode.c 1.73, commit made by Kirk). Testing program written by: Avadis Tevanian, Jr. Testing program supplied by: jkh / Apple (see Dec2001 posting to freebsd-hackers with Subject 'NFS: How to make FreeBS fall on its face in one easy step') MFC after: 1 week
* Allow users to use the 'nolockd' or -L options with mount_nfs in orderalfred2001-11-121-0/+5
| | | | | | to avoid the need for rpc.lockd to perform client locks. Using this option a user can revert back to using local locks for NFS mounts like we did before we had rpc.lockd.
* Change the kernel's ucred API as follows:jhb2001-10-111-2/+1
| | | | | | | | - crhold() returns a reference to the ucred whose refcount it bumps. - crcopy() now simply copies the credentials from one credential to another and has no return value. - a new crshared() primitive is added which returns true if a ucred's refcount is > 1 and false (0) otherwise.
* Use crhold() instead of crdup() since we aren't modifying the cred butjhb2001-10-091-1/+2
| | | | just need to ensure it remains immutable.
* Make nfsm_dissect() have an obvious return value.peter2001-09-271-18/+18
|
* Tidy up nfsm_build usage. This is only partially finished.peter2001-09-271-18/+18
|
* Cleanup and split of nfs client and server code.peter2001-09-181-602/+369
| | | | This builds on the top of several repo-copies.
* KSE Milestone 2julian2001-09-121-114/+114
| | | | | | | | | | | | | | Note ALL MODULES MUST BE RECOMPILED make the kernel aware that there are smaller units of scheduling than the process. (but only allow one thread per process at this time). This is functionally equivalent to teh previousl -current except that there is a thread associated with each process. Sorry john! (your next MFC will be a doosie!) Reviewed by: peter@freebsd.org, dillon@freebsd.org X-MFC after: ha ha ha ha
* Fix a client-side memory leak in nfs_flush(). The code allocatesiedowse2001-08-011-2/+2
| | | | | | | | | | | | | a temporary array to store struct buf pointers if the list doesn't fit in a local array. Usually it frees the array when finished, but if it jumps to the 'again' label and the new list does fit in the local array then it can forget to free a previously malloc'd M_TEMP memory. Move the free() up a line so that it frees any previously allocated memory whether or not it needs to malloc a new array. Reviewed by: dillon
* - FDESC, FIFO, NULL, PORTAL, PROC, UMAP and UNION fileru2001-05-231-1/+1
| | | | | | | | | | | | | | | systems were repo-copied from sys/miscfs to sys/fs. - Renamed the following file systems and their modules: fdesc -> fdescfs, portal -> portalfs, union -> unionfs. - Renamed corresponding kernel options: FDESC -> FDESCFS, PORTAL -> PORTALFS, UNION -> UNIONFS. - Install header files for the above file systems. - Removed bogus -I${.CURDIR}/../../sys CFLAGS from userland Makefiles.
* Add a vop_stdbmap(), and make it part of the default vop vector.phk2001-04-291-35/+0
| | | | | | Make 7 filesystems which don't really know about VOP_BMAP rely on the default vector, rather than more or less complete local vop_nopbmap() implementations.
* Remove incorrect comment.alfred2001-04-291-1/+0
| | | | | Submitted by: quinot@inf.enst.fr <quinot@inf.enst.fr> PR: kern/26893
* Revert consequences of changes to mount.h, part 2.grog2001-04-291-2/+0
| | | | Requested by: bde
* Correct #includes to work with fixed sys/mount.h.grog2001-04-231-0/+2
|
* Implement client side NFS locks.alfred2001-04-171-7/+2
| | | | | Obtained from: BSD/os Import Ok'd by: mckusick, jkh, motd on builder.freebsd.org
* This patch removes the VOP_BWRITE() vector.phk2001-04-171-19/+4
| | | | | | | | | | | | | VOP_BWRITE() was a hack which made it possible for NFS client side to use struct buf with non-bio backing. This patch takes a more general approach and adds a bp->b_op vector where more methods can be added. The success of this patch depends on bp->b_op being initialized all relevant places for some value of "relevant" which is not easy to determine. For now the buffers have grown a b_magic element which will make such issues a tiny bit easier to debug.
OpenPOWER on IntegriCloud