summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient
Commit message (Collapse)AuthorAgeFilesLines
* Merge 220876, 220877, and 221537 from the new NFS client to the old:jhb2011-08-093-7/+14
| | | | | | | | | | Allow the NFS client to use a max file size larger than 1TB for v3 mounts. It now allows files up to OFF_MAX subject to whatever limit the server advertises. Reviewed by: rmacklem Approved by: re (kib) MFC after: 1 week
* Fix a LOR in the NFS client which could cause a deadlock.rmacklem2011-08-022-2/+21
| | | | | | | | | | | | | | | | This was reported to the mailing list freebsd-net@freebsd.org on July 21, 2011 under the subject "LOR with nfsclient sillyrename". The LOR occurred when nfs_inactive() called vrele(sp->s_dvp) while holding the vnode lock on the file in s_dvp. This patch modifies the client so that it performs the vrele(sp->s_dvp) as a separate task to avoid the LOR. This fix was discussed with jhb@ and kib@, who both proposed variations of it. Tested by: pho, jlott at averesystems.com Submitted by: jhb (earlier version) Reviewed by: kib Approved by: re (kib) MFC after: 2 weeks
* Fix the kgssapi so that it can be loaded as a module. Currentlyrmacklem2011-06-191-9/+3
| | | | | | | | | | | | | the NFS subsystems use five of the rpcsec_gss/kgssapi entry points, but since it was not obvious which others might be useful, all nineteen were included. Basically the nineteen entry points are set in a structure called rpc_gss_entries and inline functions defined in sys/rpc/rpcsec_gss.h check for the entry points being non-NULL and then call them. A default value is returned otherwise. Requested by rwatson. Reviewed by: jhb MFC after: 2 weeks
* In the VOP_PUTPAGES() implementations, change the default error fromkib2011-06-011-6/+2
| | | | | | | | | | | | | | | | VM_PAGER_AGAIN to VM_PAGER_ERROR for the uwritten pages. Return VM_PAGER_AGAIN for the partially written page. Always forward at least one page in the loop of vm_object_page_clean(). VM_PAGER_ERROR causes the page reactivation and does not clear the page dirty state, so the write is not lost. The change fixes an infinite loop in vm_object_page_clean() when the filesystem returns permanent errors for some page writes. Reported and tested by: gavin Reviewed by: alc, rmacklem MFC after: 1 week
* Add a check for MNTK_UNMOUNTF at the beginning of nfs_sync()rmacklem2011-05-291-1/+11
| | | | | | | | | | in the old NFS client so that a forced dismount doesn't get stuck in the VFS_SYNC() call that happens before VFS_UNMOUNT() in dounmount(). Analagous to r222329 for the new NFS client. An additional change is needed before forced dismounts will work. PR: kern/157365 MFC after: 2 weeks
* Eliminate duplicate #include's.alc2011-05-221-1/+0
|
* Add a sanity check for the existence of an "addr" optionrmacklem2011-05-181-0/+4
| | | | | | | | | | to both NFS clients. This avoids the crash reported by Sergey Kandaurov (pluknet@gmail.com) to the freebsd-fs@ list with subject "[old nfsclient] different nmount() args passed from mount vs mount_nfs" dated May 17, 2011. Tested by: pluknet at gmail.com (old nfs client) MFC after: 2 weeks
* Fix a comment that got missed by r221973 which changedrmacklem2011-05-161-1/+1
| | | | the sysctl naming for the old NFS client to vfs.oldnfs.
* Change the sysctl naming for the old and new NFS clientsrmacklem2011-05-155-31/+31
| | | | | to vfs.oldnfs.xxx and vfs.nfs.xxx respectively. This makes the default nfs client use vfs.nfs.xxx after r221124.
* Move sys/nfsclient/nfs_kdtrace.h to sys/nfs/nfs_kdtrace.h sormacklem2011-05-064-123/+3
| | | | it can be used by the new NFS client as well as the old one.
* Fix the module dependency in nfs_kdtrace.c for the old NFSrmacklem2011-05-061-1/+1
| | | | client. This should fix a problem reported by Marcus Reid.
* Implemented a mount option "nocto" that disables cache coherencyru2011-05-043-2/+6
| | | | | | | | 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)
* Fix module names and dependencies so the NFS clients willrmacklem2011-04-271-5/+5
| | | | load correctly as modules after r221124.
* This patch changes head so that the default NFS client is now the newrmacklem2011-04-271-1/+1
| | | | | | | | | | | | | | NFS client (which I guess is no longer experimental). The fstype "newnfs" is now "nfs" and the regular/old NFS client is now fstype "oldnfs". Although mounts via fstype "nfs" will usually work without userland changes, an updated mount_nfs(8) binary is needed for kernels built with "options NFSCL" but not "options NFSCLIENT". Updated mount_nfs(8) and mount(8) binaries are needed to do mounts for fstype "oldnfs". The GENERIC kernel configs have been changed to use options NFSCL and NFSD (the new client and server) instead of NFSCLIENT and NFSSERVER. For kernels being used on diskless NFS root systems, "options NFSCL" must be in the kernel config. Discussed on freebsd-fs@.
* Fix a kernel linking problem introduced by r221032, r221040rmacklem2011-04-261-0/+12
| | | | | | | | | | when building kernels that don't have "options NFS_ROOT" specified. I plan on moving the functions that use these data structures into the shared code in sys/nfs/nfs_diskless.c in a future commit. At that time, these definitions will no longer be needed in nfs_vfsops.c and nfs_clvfsops.c. MFC after: 2 weeks
* Fix the experimental NFS client so that it does not boguslyrmacklem2011-04-256-2908/+1
| | | | | | | | | | | | | | set the f_flags field of "struct statfs". This had the interesting effect of making the NFSv4 mounts "disappear" after r221014, since NFSMNT_NFSV4 and MNT_IGNORE became the same bit. Move the files used for a diskless NFS root from sys/nfsclient to sys/nfs in preparation for them to be used by both NFS clients. Also, move the declaration of the three global data structures from sys/nfsclient/nfs_vfsops.c to sys/nfs/nfs_diskless.c so that they are defined when either client uses them. Reviewed by: jhb MFC after: 2 weeks
* Modify the experimental NFS client so that it uses the samermacklem2011-04-251-1/+5
| | | | | | | | | | | | | | "struct nfs_args" as the regular NFS client. This is needed so that the old mount(2) syscall will work and it makes sharing of the diskless NFS root code easier. Eary in the porting exercise I introduced a new revision of nfs_args, but didn't actually need it, thanks to nmount(2). I re-introduced the NFSMNT_KERB flag, since it does essentially the same thing and the old one would not have been used because it never worked. I also added a few new NFSMNT_xxx flags to sys/nfsclient/nfs_args.h that are used by the experimental NFS client. MFC after: 2 weeks
* - Fixed nfs_printf() to use vprintf().ru2011-04-131-2/+5
| | | | | | | - Fixed vfs.nfs.acdebug sysctl's description. - Fixed panic when compiled with NFS_ACDEBUG. MFC after: 3 days
* Add some FEATURE macros for various features (AUDIT/CAM/IPC/KTR/MAC/NFS/NTP/netchild2011-02-251-0/+2
| | | | | | | | | | | | | PMC/SYSV/...). No FreeBSD version bump, the userland application to query the features will be committed last and can serve as an indication of the availablility if needed. Sponsored by: Google Summer of Code 2010 Submitted by: kibab Reviewed by: arch@ (parts by rwatson, trasz, jhb) X-MFC after: to be determined in last commit with code from this project
* Mfp4 CH=177274,177280,177284-177285,177297,177324-177325bz2011-02-164-14/+8
| | | | | | | | | | | | | | | | | | | | | | VNET socket push back: try to minimize the number of places where we have to switch vnets and narrow down the time we stay switched. Add assertions to the socket code to catch possibly unset vnets as seen in r204147. While this reduces the number of vnet recursion in some places like NFS, POSIX local sockets and some netgraph, .. recursions are impossible to fix. The current expectations are documented at the beginning of uipc_socket.c along with the other information there. Sponsored by: The FreeBSD Foundation Sponsored by: CK Software GmbH Reviewed by: jhb Tested by: zec Tested by: Mikolaj Golub (to.my.trociny gmail.com) MFC after: 2 weeks
* Fix the nlm so that it no longer depends on the regularrmacklem2011-01-032-2/+10
| | | | | | | | nfs client and, as such, can be loaded for the experimental nfs client without the regular client. Reviewed by: jhb MFC after: 2 weeks
* Remove prtactive variable and related printf()s in the vop_inactivekib2010-11-191-5/+0
| | | | | | | | and vop_reclaim() methods. They seems to be unused, and the reported situation is normal for the forced unmount. MFC after: 1 week X-MFC-note: keep prtactive symbol in vfs_subr.c
* Add missing "readahead" to the nfs_opts list.jh2010-10-271-4/+4
| | | | | | PR: 151321 Tested by: Simon Walton MFC after: 2 weeks
* Fix the type of the 3rd argument for nm_getinfo so that it worksrmacklem2010-10-191-3/+3
| | | | | | | for architectures like sparc64. Suggested by: kib MFC after: 2 weeks
* Modify the NFS clients and the NLM so that the NLM can be usedrmacklem2010-10-195-12/+43
| | | | | | | | | | | | | 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
* Do not synchronously start the nfsiod threads at all. The r212506kib2010-10-184-80/+48
| | | | | | | | | | | | | | | | | | | fixed the issues with file descriptor locks, but the same problems are present for vnode lock/user map lock. If the nfs_asyncio() cannot find the free nfsiod, schedule task to create new nfsiod and return error. This causes fall back to the synchronous i/o for nfs_strategy(), or does not start read at all in the case of readahead. The caller that holds vnode and potentially user map lock does not wait for kproc_create() to finish, preventing the LORs. The change effectively reverts r203072, because we never hand off the request to newly created nfsiod thread anymore. Reviewed by: jhb Tested by: jhb, pluknet MFC after: 3 weeks
* Do not fork nfsiod directly from the vop methods. This causes LORs betweenkib2010-09-123-2/+48
| | | | | | | | | | | | | vnode lock and several locks needed during fork, like fd lock. Instead, schedule the task to be executed in the taskqueue context. We still waiting for the fork to finish, but the context of the thread executing the task does not make real LORs with our vnode lock. Submitted by: pluknet at gmail com Reviewed by: jhb Tested by: pho MFC after: 3 weeks
* Store the full timestamp when caching timestamps of files andjhb2010-09-072-13/+15
| | | | | | | | | | directories for purposes of validating name cache entries. This closes races where two updates to a file or directory within the same second could result in stale entries in the name cache. While here, remove the 'n_expiry' field as it is no longer used. Reviewed by: rmacklem MFC after: 1 week
* Modify nfs_diskless.c to recognize the environment variablermacklem2010-09-011-45/+120
| | | | | | | | | | | | | | | | | | boot.nfsroot.nfshandlelen and set the diskless root fs to use NFSv3 and this file handle length when it is set. If this environment variable is not set, the diskless root fs will use NFSv2 and the same defaults as before. This fixes the problem where the diskless nfs root fs had to be on a FreeBSD server for NFSv3 to work, because it did not know the correct file handle length and assumed the size used by FreeBSD. Until pxeboot and loader are replaced by ones built from commits coming soon, boot.nfsroot.nfshandlelen will not be set by them and the diskless root fs will use NFSv2 unless the /etc/fstab entry has the "nfsv3" option specified. Tested by: danny at cs.huji.ac.il MFC after: 2 weeks
* Add dedicated routines to toggle lockmgr flags such as LK_NOSHARE andjhb2010-08-201-1/+1
| | | | | | | | | | | | LK_CANRECURSE after a lock is created. Use them to implement macros that otherwise manipulated the flags directly. Assert that the associated lockmgr lock is exclusively locked by the current thread when manipulating these flags to ensure the flag updates are safe. This last change required some minor shuffling in a few filesystems to exclusively lock a brand new vnode slightly earlier. Reviewed by: kib MFC after: 3 days
* Add some mutex locking on the nfsnode to the regular NFS client.rmacklem2010-08-042-5/+10
| | | | Reviewed by: jhb
* Move sys/nfsclient/nfs_lock.c into sys/nfs and build it as a separatermacklem2010-07-245-490/+3
| | | | | | | | | | | module that can be used by both the regular and experimental nfs clients. This fixes the problem reported by jh@ where /dev/nfslock would be registered twice when both nfs clients were used. I also defined the size of the lm_fh field to be the correct value, as it should be the maximum size of an NFSv3 file handle. Reviewed by: jh MFC after: 2 weeks
* Retire the NFS access cache timestamp structure. It was used in VOP_OPEN()jhb2010-07-152-20/+0
| | | | | | | | | to avoid sending multiple ACCESS/GETATTR RPCs during a single open() between VOP_LOOKUP() and VOP_OPEN(). Now we always send the RPC in VOP_LOOKUP() and not VOP_OPEN() in the cases that multiple RPCs could be sent. MFC after: 2 weeks
* A previous change moved the GETATTR RPC for open() calls that hit in thejhb2010-07-121-9/+14
| | | | | | | | | | | | | | | | | name cache up into nfs_lookup() instead of nfs_open(). Continue this trend by flushing the attribute cache for leaf nodes in nfs_lookup() during an open() if we do a LOOKUP RPC. For NFSv3 this should generally be a NOP as the attributes are flushed before fetching the post-op attributes from the LOOKUP RPC which most (all?) NFSv3 servers provide, so the post-op attributes should populate the cache. Now all NFS open() calls will always clear the cached attributes during the nfs_lookup() prior to nfs_open() in the !NMODIFIED case to provide CTOC. As a result, we can remove the conditional flushing of the attribute cache from nfs_open(). Reviewed by: rmacklem, bde MFC after: 2 weeks
* - Add missing locking around flushing of an NFS node's attribute cachejhb2010-07-121-2/+4
| | | | | | | | in the NMODIFIED case of nfs_open(). - Cosmetic tweak to simplify an expression in nfs_lookup(). Reviewed by: rmacklem, bde MFC after: 1 week
* In NFS clients, instead of inconsistently using #ifdefkib2010-06-133-51/+21
| | | | | | | | DIAGNOSTIC and #ifndef DIAGNOSTIC for debug assertions, prefer KASSERT(). Also change one #ifdef DIAGNOSTIC in the new nfs server. Submitted by: Mikolaj Golub <to.my.trociny gmail com> MFC after: 2 weeks
* Fix build: newnp represents newvp so KDTRACE_NFS_ATTRCACHE_FLUSH_DONE()delphij2010-05-271-1/+1
| | | | on newvp instead of vp here.
* More gracefully handle stale file handles and attributes when opening ajhb2010-05-271-3/+20
| | | | | | | | | | | | | | | | | | | | | | file via NFS. Specifically, to satisfy close-to-open-consistency, the NFS client always performs at least one RPC on a file during an open(2) to see if the file has changed. Normally this RPC is an ACCESS or GETATTR RPC that is forced by flushing a file's attribute cache during nfs_open() and then requesting new attributes. However, if the file is noticed to be stale during nfs_open(), the only recourse is to fail the open(2) call with ESTALE. On the other hand, if the ACCESS or GETATTR RPC is sent during nfs_lookup(), then the NFS client can fall back to a LOOKUP RPC to obtain the new file handle in the case that a file has been replaced. This change causes the NFS client to flush the attribute cache during nfs_lookup() when validating a name cache hit if the attributes fetched during nfs_lookup() can be reused in nfs_open(). This allows the client to open a replaced file via the new file handle the first time that it notices a replaced file rather than failing with ESTALE in some cases. Reviewed by: rmacklem, bde Reviewed by: mohans (older version) MFC after: 1 week
* Change the current working directory to be inside the jail created bycperciva2010-05-271-0/+5
| | | | | | | | | | | | | | the jail(8) command. [10:04] Fix a one-NUL-byte buffer overflow in libopie. [10:05] Correctly sanity-check a buffer length in nfs mount. [10:06] Approved by: so (cperciva) Approved by: re (kensmith) Security: FreeBSD-SA-10:04.jail Security: FreeBSD-SA-10:05.opie Security: FreeBSD-SA-10:06.nfsclient
* Push down the page queues lock into vm_page_activate().alc2010-05-071-8/+9
|
* Eliminate page queues locking around most calls to vm_page_free().alc2010-05-061-4/+0
|
* Acquire the page lock around all remaining calls to vm_page_free() onalc2010-05-051-6/+12
| | | | | | | | | | | | | managed pages that didn't already have that lock held. (Freeing an unmanaged page, such as the various pmaps use, doesn't require the page lock.) This allows a change in vm_page_remove()'s locking requirements. It now expects the page lock to be held instead of the page queues lock. Consequently, the page queues lock is no longer required at all by callers to vm_page_rename(). Discussed with: kib
* Move checking against RLIMIT_FSIZE into one place, vn_rlimit_fsize().trasz2010-05-051-13/+2
| | | | Reviewed by: kib
* Lock the page around vm_page_activate() and vm_page_deactivate() callskib2010-05-031-2/+6
| | | | | | | where it was missed. The wrapped fragments now protect wire_count with page lock. Reviewed by: alc
* Simplify code a bit.pjd2010-02-181-5/+1
|
* Factor out the code shared between NFS client and server into its ownmarius2010-02-161-0/+1
| | | | | | | | module. With r203732 it became apparent that creating the sysctl nodes twice causes at least a warning, however the whole code shouldn't be present twice in the first place. Discussed with: rmacklem
* - Move nfs_realign() from the NFS client to the shared NFS code andmarius2010-02-091-66/+1
| | | | | | | | | | | | | | | | | remove the NFS server version in order to reduce code duplication. The shared version now uses a second parameter how, which is passed on to m_get(9) and m_getcl(9) as the server used M_WAIT while the client requires M_DONTWAIT, and replaces the the previously unused parameter hsiz. - Change nfs_realign() to use nfsm_aligned() so as with other NFS code the alignment check isn't actually performed on platforms without strict alignment requirements for performance reasons because as the comment suggests unaligned data only occasionally occurs with TCP. - Change fha_extract_info() to use nfs_realign() with M_DONTWAIT rather than M_WAIT because it's called with the RPC sp_lock held. Reviewed by: jhb, rmacklem MFC after: 1 week
* Some style(9) fixesmarius2010-02-091-52/+51
|
* Fix a race that can occur when nfs nfsiod threads are being created.rmacklem2010-01-276-15/+34
| | | | | | | | | | | | | | | Without this patch it was possible for a different thread that calls nfs_asyncio() to snitch a newly created nfsiod thread that was intended for another caller of nfs_asyncio(), because the nfs_iod_mtx mutex was unlocked while the new nfsiod thread was created. This patch labels the newly created nfsiod, so that it is not taken by another caller of nfs_asyncio(). This is believed to fix the problem reported on the freebsd-stable email list under the subject: FreeBSD NFS client/Linux NFS server issue. Tested by: to DOT my DOT trociny AT gmail DOT com Reviewed by: jhb MFC after: 2 weeks
* Fix a typo in a comment introduced by r202767.rmacklem2010-01-211-1/+0
| | | | MFC after: 2 weeks
OpenPOWER on IntegriCloud