summaryrefslogtreecommitdiffstats
path: root/sys/fs/nfsclient/nfs_clvnops.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r303710:kib2016-08-101-5/+5
| | | | | | | Remove unneeded (recursing) Giant acquisition around vprintf(9). MFC r303715: Remove ncl_printf(), use printf(9) directly.
* MFC r302019:kib2016-06-261-4/+8
| | | | Do not access NFS data for reclaimed vnode.
* MFC r299413:kib2016-05-181-33/+0
| | | | Use vfs_hash_ref(9) to eliminate LK_EXCLOTHER kludge.
* MFC: r283273rmacklem2015-06-041-1/+15
| | | | | | | | The NFS client wasn't handling getdirentries(2) requests for sizes that are not an exact multiple of DIRBLKSIZ correctly. Fortunately readdir(3) always uses an exact multiple of DIRBLKSIZ, so few applications were affected. This patch fixes this problem by reducing the size of the directory read to an exact multiple of DIRBLKSIZ.
* MFC r275897:kib2015-01-011-2/+1
| | | | | Set NOCACHE flag for CREATE namei() calls, do not specially handle MAKEENTRY in VOP_LOOKUP().
* MFC: r276221rmacklem2014-12-311-14/+0
| | | | | | | Delete some duplicate code that was harmless because exactly the same code is at the end of the nfscl_checksattr() function that is called just before it. As such, this code had already been executed and didn't do anything.
* MFC r268764:kib2014-07-301-4/+0
| | | | | Check for the cross-device cross-link attempt in the VFS, instead of VOP_LINK() implemenations.
* MFC: r264842rmacklem2014-05-071-2/+5
| | | | | | Modify the NFSv4 client's Pathconf RPC (actually a Getattr Op.) so that it only does the RPC for names that are answered by the RPC. Doing the RPC for other names is harmless, but unnecessary.
* MFC: r264738rmacklem2014-05-061-1/+3
| | | | | | For an NFSv4 mount with the "nocto" option, don't get the up to date file attributes upon close. This reduces the Getattr RPC count by about 65% for software builds.
* MFC: r259084rmacklem2013-12-301-0/+10
| | | | | | | | | | | | | | | | | | For software builds, the NFS client does many small synchronous (with FILE_SYNC) writes because non-contiguous byte ranges in the same buffer cache block are being written. This patch adds a new mount option "noncontigwr" which allows the non-contiguous byte ranges to be combined, with the dirty byte range becoming the superset of the bytes that are dirty, if the file has not been file locked. This reduces the number of writes significantly for software builds. The only case where this change might break existing applications is where an application is writing non-overlapping byte ranges within the same buffer cache block of a file from multiple clients concurrently. Since such an application would normally do file locking on the file, avoiding the byte range merge for files that have been file locked should be sufficient for most (maybe all?) cases.
* When the NFSv4.1 client is writing to a pNFS Data Server (DS), thermacklem2013-06-211-2/+9
| | | | | | | file's size attribute does not get updated. As such, it is necessary to invalidate the attribute cache before clearing NMODIFIED for pNFS. MFC after: 2 weeks
* - Convert the bufobj lock to rwlock.jeff2013-05-311-1/+1
| | | | | | | | | | - Use a shared bufobj lock in getblk() and inmem(). - Convert softdep's lk to rwlock to match the bufobj lock. - Move INFREECNT to b_flags and protect it with the buf lock. - Remove unnecessary locking around bremfree() and BKGRDINPROG. Sponsored by: EMC / Isilon Storage Division Discussed with: mckusick, kib, mdf
* Add support for the eofflag to nfs_readdir() in the new NFSrmacklem2013-05-121-1/+8
| | | | | | | | client so that it works under a unionfs mount. Submitted by: Jared Yanovich (slovichon@gmail.com) Reviewed by: kib MFC after: 2 weeks
* Revert 195703 and 195821 as this special stop handling in NFS is nowjhb2013-03-131-3/+3
| | | | | implemented via VFCF_SBDRY rather than passing PBDRY to individual sleep calls.
* Rename VM_OBJECT_LOCK(), VM_OBJECT_UNLOCK() and VM_OBJECT_TRYLOCK() toattilio2013-02-201-2/+2
| | | | | | their "write" versions. Sponsored by: EMC / Isilon storage division
* Use vfs_timestamp() to set file timestamps rather than invokingjhb2013-01-181-3/+3
| | | | | | | getmicrotime() or getnanotime() directly in NFS. Reviewed by: rmacklem, bde MFC after: 1 week
* Move the NFSv4.1 client patches over from projects/nfsv4.1-clientrmacklem2012-12-081-19/+37
| | | | | | | | | | to head. I don't think the NFS client behaviour will change unless the new "minorversion=1" mount option is used. It includes basic NFSv4.1 support plus support for pNFS using the Files Layout only. All problems detecting during an NFSv4.1 Bakeathon testing event in June 2012 have been resolved in this code and it has been tested against the NFSv4.1 server available to me. Although not reviewed, I believe that kib@ has looked at it.
* PR# 165923 reported intermittent write failures for dirtyrmacklem2012-05-121-0/+16
| | | | | | | | | | | | | | | | | | | memory mapped pages being written back on an NFS mount. Since any thread can call VOP_PUTPAGES() to write back a dirty page, the credentials of that thread may not have write access to the file on an NFS server. (Often the uid is 0, which may be mapped to "nobody" in the NFS server.) Although there is no completely correct fix for this (NFS servers check access on every write RPC instead of at open/mmap time), this patch avoids the common cases by holding onto a credential that recently opened the file for writing and uses that credential for the write RPCs being done by VOP_PUTPAGES() for both NFS clients. Tested by: Joel Ray Holveck (joelh at juniper.net) PR: kern/165923 Reviewed by: kib MFC after: 2 weeks
* It was reported via email that some non-FreeBSD NFS serversrmacklem2012-04-271-1/+4
| | | | | | | | | | | | do not include file attributes in the reply to an NFS create RPC under certain circumstances. This resulted in a vnode of type VNON that was not usable. This patch adds an NFS getattr RPC to nfs_create() for this case, to fix the problem. It was tested by the person that reported the problem and confirmed to fix this case for their server. Tested by: Steven Haber (steven.haber at isilon.com) MFC after: 2 weeks
* Add sysctl vfs.nfs.nfs_keep_dirty_on_error to switch the nfs clientkib2012-03-171-0/+4
| | | | | | | | | behaviour on error from write RPC back to behaviour of old nfs client. When set to not zero, the pages for which write failed are kept dirty. PR: kern/165927 Reviewed by: alc MFC after: 2 weeks
* Post r230394, the Lookup RPC counts for both NFS clients increasedrmacklem2012-03-031-20/+23
| | | | | | | | | | | | | | | | | | | | | significantly. Upon investigation this was caused by name cache misses for lookups of "..". For name cache entries for non-".." directories, the cache entry serves double duty. It maps both the named directory plus ".." for the parent of the directory. As such, two ctime values (one for each of the directory and its parent) need to be saved in the name cache entry. This patch adds an entry for ctime of the parent directory to the name cache. It also adds an additional uma zone for large entries with this time value, in order to minimize memory wastage. As well, it fixes a couple of cases where the mtime of the parent directory was being saved instead of ctime for positive name cache entries. With this patch, Lookup RPC counts return to values similar to pre-r230394 kernels. Reported by: bde Discussed with: kib Reviewed by: jhb MFC after: 2 weeks
* Fix found places where uio_resid is truncated to int.kib2012-02-211-1/+2
| | | | | | | | | Add the sysctl debug.iosize_max_clamp, enabled by default. Setting the sysctl to zero allows to perform the SSIZE_MAX-sized i/o requests from the usermode. Discussed with: bde, das (previous versions) MFC after: 1 month
* Rename cache_lookup_times() to cache_lookup() and retire the old API andjhb2012-02-061-1/+1
| | | | ABI stub for cache_lookup().
* Current implementations of sync(2) and syncer vnode fsync() VOP useskib2012-02-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | mnt_noasync counter to temporary remove MNTK_ASYNC mount option, which is needed to guarantee a synchronous completion of the initiated i/o before syscall or VOP return. Global removal of MNTK_ASYNC option is harmful because not only i/o started from corresponding thread becomes synchronous, but all i/o is synchronous on the filesystem which is initiated during sync(2) or syncer activity. Instead of removing MNTK_ASYNC from mnt_kern_flag, provide a local thread flag to disable async i/o for current thread only. Use the opportunity to move DOINGASYNC() macro into sys/vnode.h and consistently use it through places which tested for MNTK_ASYNC. Some testing demonstrated 60-70% improvements in run time for the metadata-intensive operations on async-mounted UFS volumes, but still with great deviation due to other reasons. Reviewed by: mckusick Tested by: scottl MFC after: 2 weeks
* Fix remaining calls to cache_enter() in both NFS clients to providekib2012-01-251-17/+18
| | | | | | | | appropriate timestamps. Restore the assertions which verify that NCF_TS is set when timestamp is asked for. Reviewed by: jhb (previous version) MFC after: 2 weeks
* Add a timeout on positive name cache entries in the NFS client. That is,jhb2012-01-251-2/+4
| | | | | | | | | | | we will only trust a positive name cache entry for a specified amount of time before falling back to a LOOKUP RPC, even if the ctime for the file handle matches the cached copy in the name cache entry. The timeout is configured via a new 'nametimeo' mount option and defaults to 60 seconds. It may be set to zero to disable positive name caching entirely. Reviewed by: rmacklem MFC after: 1 week
* Close a race in NFS lookup processing that could result in stale name cachejhb2012-01-201-49/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | entries on one client when a directory was renamed on another client. The root cause for the stale entry being trusted is that each per-vnode nfsnode structure has a single 'n_ctime' timestamp used to validate positive name cache entries. However, if there are multiple entries for a single vnode, they all share a single timestamp. To fix this, extend the name cache to allow filesystems to optionally store a timestamp value in each name cache entry. The NFS clients now fetch the timestamp associated with each name cache entry and use that to validate cache hits instead of the timestamps previously stored in the nfsnode. Another part of the fix is that the NFS clients now use timestamps from the post-op attributes of RPCs when adding name cache entries rather than pulling the timestamps out of the file's attribute cache. The latter is subject to races with other lookups updating the attribute cache concurrently. Some more details: - Add a variant of nfsm_postop_attr() to the old NFS client that can return a vattr structure with a copy of the post-op attributes. - Handle lookups of "." as a special case in the NFS clients since the name cache does not store name cache entries for ".", so we cannot get a useful timestamp. It didn't really make much sense to recheck the attributes on the the directory to validate the namecache hit for "." anyway. - ABI compat shims for the name cache routines are present in this commit so that it is safe to MFC. MFC after: 2 weeks
* Modify the new NFS client so that nfs_fsync() only calls ncl_flush()rmacklem2011-11-151-0/+10
| | | | | | | | | for regular files. Since other file types don't write into the buffer cache, calling ncl_flush() is almost a no-op. However, it does clear the NMODIFIED flag and this shouldn't be done by nfs_fsync() for directories. MFC after: 2 weeks
* Since NFSv4 byte range locking only works for regular files,rmacklem2011-11-141-0/+2
| | | | | | add a sanity check for the vnode type to the NFSv4 client. MFC after: 2 weeks
* The new NFS client failed to vput() the new vnode if a setattrrmacklem2011-07-301-0/+2
| | | | | | | | | | | failed after the file was created in nfs_create(). This would probably only happen during a forced dismount. The old NFS client does have a vput() for this case. Detected by pho during recent testing, where an open syscall returned with a vnode still locked. Tested by: pho Approved by: re (kib) MFC after: 2 weeks
* Simple find/replace of VOP_ISLOCKED -> NFSVOPISLOCKED. This is done so that ↵zack2011-07-161-1/+1
| | | | | | | | NFSVOPISLOCKED can be modified later to add enhanced logging and assertions. Reviewed by: rmacklem Approved by: zml (mentor) MFC after: 2 weeks
* Simple find/replace of VOP_UNLOCK -> NFSVOPUNLOCK. This is done so that ↵zack2011-07-161-14/+14
| | | | | | | | NFSVOPUNLOCK can be modified later to add enhanced logging and assertions. Reviewed by: rmacklem Approved by: zml (mentor) MFC after: 2 weeks
* Simple find/replace of vn_lock -> NFSVOPLOCK. This is done so that ↵zack2011-07-161-7/+7
| | | | | | | | NFSVOPLOCK can be modified later to add enhanced logging and assertions. Reviewed by: rmacklem Approved by: zml (mentor) MFC after: 2 weeks
* Add DTrace support to the new NFS client. This is essentiallyrmacklem2011-06-181-4/+60
| | | | | | | cloned from the old NFS client, plus additions for NFSv4. A review of this code is in progress, however it was felt by the reviewer that it could go in now, before code slush. Any changes required by the review can be committed as bug fixes later.
* Add support for flock(2) locks to the new NFSv4 client. I think thisrmacklem2011-06-051-2/+5
| | | | | | | | | | should be ok, since the client now delays NFSv4 Close operations until VOP_INACTIVE()/VOP_RECLAIM(). As such, there should be no risk that the NFSv4 Open is closed while an associated byte range lock still exists. Tested by: avg MFC after: 2 weeks
* The new NFSv4 client was erroneously using "p" instead ofrmacklem2011-06-051-2/+3
| | | | | | | | | | "p_leader" for the "id" for POSIX byte range locking. I think this would only have affected processes created by rfork(2) with the RFTHREAD flag specified. This patch fixes that by passing the "id" down through the various functions from nfs_advlock(). MFC after: 2 weeks
* Fix the new NFS client so that it doesn't do an NFSv3rmacklem2011-05-311-2/+11
| | | | | | | | | | Pathconf RPC for cases where the reply doesn't include the answer. This fixes a problem reported by avg@ where the NFSv3 Pathconf RPC would fail when "ls -l" did an lpathconf(2) for _PC_ACL_NFS4. Tested by: avg MFC after: 2 weeks
* Add some missing mutex locking to the new NFS client.rmacklem2011-05-251-0/+2
| | | | MFC after: 2 weeks
* Fix the new NFS client so that it correctly sets the "must_commit"rmacklem2011-05-251-11/+1
| | | | | | | | argument for a write RPC when it succeeds for the first one and fails for a subsequent RPC within the same call to the function. This makes it compatible with the old NFS client for this case. MFC after: 2 weeks
* Eliminate duplicate #include's.alc2011-05-221-1/+0
|
* Change the sysctl naming for the old and new NFS clientsrmacklem2011-05-151-9/+9
| | | | | to vfs.oldnfs.xxx and vfs.nfs.xxx respectively. This makes the default nfs client use vfs.nfs.xxx after r221124.
* Implemented a mount option "nocto" that disables cache coherencyru2011-05-041-1/+2
| | | | | | | | checking at open time. It may improve performance for read-only NFS mounts. Use deliberately. MFC after: 1 week Reviewed by: rmacklem, jhb (earlier version)
* Add a vput() to nfs_lookitup() in the experimental NFS clientrmacklem2011-04-181-1/+4
| | | | | | | | | | | for a case that will probably never happen. It can only happen if a server were to successfully lookup a file, but not return attributes for that file. Although technically allowed by the NFSv3 RFC, I doubt any server would ever do this. However, if it did, the client would have not vput()'d the new vnode when it needed to do so. MFC after: 2 weeks
* Add vput() calls in two places in the experimental NFS clientrmacklem2011-04-181-2/+5
| | | | | | | | that would be needed if, in the future, nfscl_loadattrcache() were to return an error. Currently nfscl_loadattrcache() never returns an error, so these cases never currently happen. MFC after: 2 weeks
* Change the mutex locking for several locations in thermacklem2011-04-171-28/+60
| | | | | | | | | | | experimental NFS client's vnode op functions to make them compatible with the regular NFS client. I'll admit I'm not sure that the mutex locks around the assignments are needed, but the regular client has them, so I added them. Also, add handling of the case of partial attributes in setattr to be compatible with the regular client. MFC after: 2 weeks
* Fix up some of the sysctls for the experimental NFS client sormacklem2011-04-171-2/+2
| | | | | | | that they use the same names as the regular client. Also add string descriptions for them. MFC after: 2 weeks
* Add a lktype flags argument to nfscl_nget() and ncl_nget() in thermacklem2011-04-161-8/+11
| | | | | | | experimental NFS client so that its nfs_lookup() function can use cn_lkflags in a manner analagous to the regular NFS client. MFC after: 2 weeks
* Add VOP_PATHCONF() support to the experimental NFS clientrmacklem2011-04-131-0/+115
| | | | | | | so that it can, along with other things, report whether or not NFS4 ACLs are supported. MFC after: 2 weeks
* Modify nfs_open() in the experimental NFS client to be compatiblermacklem2010-10-291-46/+40
| | | | | | with the regular NFS client. Also, fix a couple of mutex lock issues. MFC after: 1 week
* Modify the NFS clients and the NLM so that the NLM can be usedrmacklem2010-10-191-3/+2
| | | | | | | | | | | | | by both clients. Since the NLM uses various fields of the nfsmount structure, those fields were extracted and put in a separate nfs_mountcommon structure stored in sys/nfs/nfs_mountcommon.h. This structure also has a function pointer for a function that extracts the required information from the mount point and nfs vnode for that particular client, for information stored differently by the clients. Reviewed by: jhb MFC after: 2 weeks
OpenPOWER on IntegriCloud