summaryrefslogtreecommitdiffstats
path: root/sys/fs/nfsclient
Commit message (Collapse)AuthorAgeFilesLines
* For the experimental NFS client, it should always flush dirtyrmacklem2010-04-281-2/+1
| | | | | | | | | | buffers before closing the NFSv4 opens, as the comment states. This patch deletes the call to nfscl_mustflush() which would return 0 for the case where a delegation still exists, which was incorrect and could cause crashes during recovery from an expired lease. MFC after: 1 week
* Delete a diagnostic statement that is no longer useful fromrmacklem2010-04-281-4/+0
| | | | | | the experimental NFS client. MFC after: 1 week
* An NFSv4 server will reply NFSERR_GRACE for non-recovery RPCsrmacklem2010-04-244-27/+32
| | | | | | | | | | | | during the grace period after startup. This grace period must be at least the lease duration, which is typically 1-2 minutes. It seems prudent for the experimental NFS client to wait a few seconds before retrying such an RPC, so that the server isn't flooded with non-recovery RPCs during recovery. This patch adds an argument to nfs_catnap() to implement a 5 second delay for this case. MFC after: 1 week
* When the experimental NFS client is handling an NFSv4 server rebootrmacklem2010-04-227-34/+89
| | | | | | | | | | | | with delegations enabled, the recovery could fail if the renew thread is trying to return a delegation, since it will not do the recovery. This patch fixes the above by having nfscl_recalldeleg() fail with the I/O operations returning EIO, so that they will be attempted later. Most of the patch consists of adding an argument to various functions to indicate the delegation recall case where this needs to be done. MFC after: 1 week
* For the experimental NFS client doing an NFSv4 mount,rmacklem2010-04-201-3/+6
| | | | | | | | | | set the NFSCLFLAGS_RECVRINPROG while doing recovery from an expired lease in a manner similar to r206818 for server reboot recovery. This will prevent the function that acquires stateids for I/O operations from acquiring out of date stateids during recovery. Also, fix up mutex locking on the nfsc_flags field. MFC after: 1 week
* Avoid extraneous recovery cycles in the experimental NFS clientrmacklem2010-04-181-4/+29
| | | | | | | | | | | | | | when an NFSv4 server reboots, by doing two things. 1 - Make the function that acquires a stateid for I/O operations block until recovery is complete, so that it doesn't acquire out of date stateids. 2 - Only allow a recovery once every 1/2 of a lease duration, since the NFSv4 server must provide a recovery grace period of at least a lease duration. This should avoid recoveries caused by an out of date stateid that was acquired for an I/O op. just before a recovery cycle started. MFC after: 1 week
* Add mutex lock calls to 2 cases in the experimental NFS client'srmacklem2010-04-151-2/+6
| | | | | | renew thread where they were missing. MFC after: 1 week
* The experimental NFS client was not filling in recovery credentialsrmacklem2010-04-153-3/+16
| | | | | | | | | | | for opens done locally in the client when a delegation for the file was held. This could cause the client to crash in crsetgroups() when recovering from a server crash/reboot. This patch fills in the recovery credentials for this case, in order to avoid the client crash. Also, add KASSERT()s to the credential copy functions, to catch any other cases where the credentials aren't filled in correctly. MFC after: 1 week
* Patch the experimental NFS client so that there is a timeoutrmacklem2010-01-314-58/+138
| | | | | | | | | | for negative name cache entries in a manner analogous to r202767 for the regular NFS client. Also, make the code in nfs_lookup() compatible with that of the regular client and replace the sysctl variable that enabled negative name caching with the mount point option. MFC after: 2 weeks
* Patch the experimental NFS client in a manner analogous tormacklem2010-01-285-18/+35
| | | | | | | | r203072 for the regular NFS client. Also, delete two fields of struct nfsmount that are not used by the FreeBSD port of the client. MFC after: 2 weeks
* Fix three related problems in the experimental nfs client whenrmacklem2010-01-031-24/+19
| | | | | | | checking for conflicts w.r.t. byte range locks for NFSv4. 1 - Return 0 instead of EACCES when a conflict is found, for F_GETLK. 2 - Check for "same file" when checking for a conflict. 3 - Don't check for a conflict for the F_UNLCK case.
* Fix the experimental NFS client so that it can create Unixrmacklem2009-12-311-4/+9
| | | | | | | | domain sockets on an NFSv4 mount point. It was generating incorrect XDR in the request for this case. Tested by: infofarmer MFC after: 2 weeks
* When porting the experimental nfs subsystem to the FreeBSD8 krpc,rmacklem2009-12-263-104/+8
| | | | | | | | | I added 3 functions that were already in the experimental client under different names. This patch deletes the functions in the experimental client and renames the calls to use the other set. (This is just removal of duplicated code and does not fix any bug.) MFC after: 2 weeks
* Remove unneeded ifdefs.trasz2009-12-032-27/+3
| | | | Reviewed by: rmacklem
* Create verifier used by FreeBSD NFS client is suboptimal because thejh2009-11-111-14/+25
| | | | | | | | | | | | | | | | | first part of a verifier is set to the first IP address from V_in_ifaddrhead list. This address is typically the loopback address making the first part of the verifier practically non-unique. The second part of the verifier is initialized to zero making its initial value non-unique too. This commit changes the strategy for create verifier initialization: just initialize it to a random value. Also move verifier handling into its own function and use a mutex to protect the variable. This change is a candidate for porting to sys/nfsclient. Reviewed by: jhb, rmacklem Approved by: trasz (mentor)
* Unloading of the nfscl module is unsupported because newnfslock doesn'tjh2009-10-202-0/+14
| | | | | | | | | support unloading. It's not trivial to implement newnfslock unloading so for now just admit that unloading is unsupported and refuse to attempt unload in all nfscl module event handlers. Reviewed by: rmacklem Approved by: trasz (mentor)
* Fix ordering of nfscl_modevent() and ncl_uninit(). nfscl_modevent() mustjh2009-10-201-1/+1
| | | | | | | | be called after ncl_uninit() when unloading the nfscl module because ncl_uninit() uses ncl_iod_mutex which is destroyed in nfscl_modevent(). Reviewed by: rmacklem Approved by: trasz (mentor)
* Fix comment typos.jh2009-10-201-4/+4
| | | | | Reviewed by: rmacklem Approved by: trasz (mentor)
* Add LK_NOWITNESS to the vn_lock() calls done on newly created nfsrmacklem2009-09-092-2/+2
| | | | | | | | | vnodes, since these nodes are not linked into the mount queue and, as such, the vn_lock() cannot cause a deadlock so LORs are harmless. Suggested by: kib Approved by: kib (mentor) MFC after: 3 days
* Fix NFS panics with options VIMAGE kernels by apropriately setting curvnetzec2009-08-241-2/+2
| | | | | | | | | | | | | context inside the RPC code. Temporarily set td's cred to mount's cred before calling socreate() via __rpc_nconf2socket(). Submitted by: rmacklem (in part) Reviewed by: rmacklem, rwatson Discussed with: dfr, bz Approved by: re (rwatson), julian (mentor) MFC after: 3 days
* Apply the same patch as r196205 for nfs_upgrade_lock() andrmacklem2009-08-171-15/+12
| | | | | | nfs_downgrade_lock() to the experimental nfs client. Approved by: re (kensmith), kib (mentor)
* Fix the experimental nfs client so that it only calls ncl_vinvalbuf()rmacklem2009-07-291-5/+11
| | | | | | | | | for NFSv2 and not NFSv4 when nfscl_mustflush() returns 0. Since nfscl_mustflush() only returns 0 when there is a valid write delegation issued to the client, it only affects the case of an NFSv4 mount with callbacks/delegations enabled. Approved by: re (kensmith), kib (mentor)
* When vfs.newnfs.callback_addr is set to an IPv4 address, thermacklem2009-07-221-1/+1
| | | | | | | | experimental NFSv4 client might try and use it as an IPv6 address, breaking callbacks. The fix simply initializes the isinet6 variable for this case. Approved by: re (kensmith), kib (mentor)
* Add changes to the experimental nfs client to use the PBDRY flag forrmacklem2009-07-222-7/+7
| | | | | | | | msleep(9) when a vnode lock or similar may be held. The changes are just a clone of the changes applied to the regular nfs client by r195703. Approved by: re (kensmith), kib (mentor)
* When using an NFSv4 mount in the experimental nfs client with delegationsrmacklem2009-07-221-1/+1
| | | | | | | | | | | being issued from the server, there was a case where an Open issued locally based on the delegation would be released before the associated vnode became inactive. If the delegation was recalled after the open was released, an Open against the server would not have been acquired and subsequent I/O operations would need to use the special stateid of all zeros. This patch fixes that case. Approved by: re (kensmith), kib (mentor)
* Fix two bugs in the experimental nfs client:rmacklem2009-07-191-13/+7
| | | | | | | | | | | | | | | | | | | - When the root vnode was acquired during mounting, mnt_stat.f_iosize was still set to 0, so getnewvnode() would set bo_bsize == 0. This would confuse getblk(), so that it always returned the first block causing the problem when the root directory of the mount point was greater than one block in size. It was fixed by setting mnt_stat.f_iosize to NFS_DIRBLKSIZ before calling ncl_nget() to acquire the root vnode. - NFSMNT_INT was being set temporarily while the initial connect to a server was being done. This erroneously configured the krpc for interruptible RPCs, which caused problems because signals weren't being masked off as they would have been for interruptible mounts. This code was deleted to fix the problem. Since mount_nfs does an NFS null RPC before the mount system call, connections to the server should work ok. Tested by: swell dot k at gmail dot com Approved by: re (kensmith), kib (mentor)
* Fix the experimental nfs client so that it does not cause armacklem2009-07-141-1/+2
| | | | | | | | | "share->excl" panic when doing a lookup of dotdot at the root of a server's file system. The patch avoids calling vn_lock() for that case, since nfscl_nget() has already acquired a lock for the vnode. Approved by: re (kensmith), kib (mentor)
* Build on Jeff Roberson's linker-set based dynamic per-CPU allocatorrwatson2009-07-141-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (DPCPU), as suggested by Peter Wemm, and implement a new per-virtual network stack memory allocator. Modify vnet to use the allocator instead of monolithic global container structures (vinet, ...). This change solves many binary compatibility problems associated with VIMAGE, and restores ELF symbols for virtualized global variables. Each virtualized global variable exists as a "reference copy", and also once per virtual network stack. Virtualized global variables are tagged at compile-time, placing the in a special linker set, which is loaded into a contiguous region of kernel memory. Virtualized global variables in the base kernel are linked as normal, but those in modules are copied and relocated to a reserved portion of the kernel's vnet region with the help of a the kernel linker. Virtualized global variables exist in per-vnet memory set up when the network stack instance is created, and are initialized statically from the reference copy. Run-time access occurs via an accessor macro, which converts from the current vnet and requested symbol to a per-vnet address. When "options VIMAGE" is not compiled into the kernel, normal global ELF symbols will be used instead and indirection is avoided. This change restores static initialization for network stack global variables, restores support for non-global symbols and types, eliminates the need for many subsystem constructors, eliminates large per-subsystem structures that caused many binary compatibility issues both for monitoring applications (netstat) and kernel modules, removes the per-function INIT_VNET_*() macros throughout the stack, eliminates the need for vnet_symmap ksym(2) munging, and eliminates duplicate definitions of virtualized globals under VIMAGE_GLOBALS. Bump __FreeBSD_version and update UPDATING. Portions submitted by: bz Reviewed by: bz, zec Discussed with: gnn, jamie, jeff, jhb, julian, sam Suggested by: peter Approved by: re (kensmith)
* Fix the handling of dotdot in lookup for the experimental nfs clientrmacklem2009-07-121-0/+2
| | | | | | in a manner analagous to the change in r195294 for the regular nfs client. Approved by: re (kensmith), kib (mentor)
* Since the nfscl_getclose() function both decremented open counts and,rmacklem2009-07-092-182/+175
| | | | | | | | | | | | | optionally, created a separate list of NFSv4 opens to be closed, it was possible for the associated OpenOwner to be free'd before the Open was closed. The problem was that the Open was taken off the OpenOwner list before the Close RPC was done and OpenOwners can be free'd once the list is empty. This patch separates out the case of doing the Close RPC into a separate function called nfscl_doclose() and simplifies nfsrpc_doclose() so that it closes a single open instead of a list of them. This avoids removing the Open from the OpenOwner list before doing the Close RPC. Approved by: re (kensmith), kib (mentor)
* Add a new global rwlock, in_ifaddr_lock, which will synchronize use of therwatson2009-06-251-0/+4
| | | | | | | | | | | | | | | | | | | in_ifaddrhead and INADDR_HASH address lists. Previously, these lists were used unsynchronized as they were effectively never changed in steady state, but we've seen increasing reports of writer-writer races on very busy VPN servers as core count has gone up (and similar configurations where address lists change frequently and concurrently). For the time being, use rwlocks rather than rmlocks in order to take advantage of their better lock debugging support. As a result, we don't enable ip_input()'s read-locking of INADDR_HASH until an rmlock conversion is complete and a performance analysis has been done. This means that one class of reader-writer races still exists. MFC after: 6 weeks Reviewed by: bz
* Replace RPCAUTH_UNIXGIDS with NFS_MAXGRPS so that nfscbd.c will build.rmacklem2009-06-201-1/+1
| | | | Approved by: kib (mentor)
* Change the size of the nfsc_groups[] array in the experimental nfsrmacklem2009-06-201-1/+1
| | | | | | | | client to RPCAUTH_UNIXGIDS + 1 (17), since that is what can go on the wire for AUTH_SYS authentication. Reviewed by: brooks Approved by: kib (mentor)
* Rework the credential code to support larger values of NGROUPS andbrooks2009-06-191-5/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | NGROUPS_MAX, eliminate ABI dependencies on them, and raise the to 1024 and 1023 respectively. (Previously they were equal, but under a close reading of POSIX, NGROUPS_MAX was defined to be too large by 1 since it is the number of supplemental groups, not total number of groups.) The bulk of the change consists of converting the struct ucred member cr_groups from a static array to a pointer. Do the equivalent in kinfo_proc. Introduce new interfaces crcopysafe() and crsetgroups() for duplicating a process credential before modifying it and for setting group lists respectively. Both interfaces take care for the details of allocating groups array. crsetgroups() takes care of truncating the group list to the current maximum (NGROUPS) if necessary. In the future, crsetgroups() may be responsible for insuring invariants such as sorting the supplemental groups to allow groupmember() to be implemented as a binary search. Because we can not change struct xucred without breaking application ABIs, we leave it alone and introduce a new XU_NGROUPS value which is always 16 and is to be used or NGRPS as appropriate for things such as NFS which need to use no more than 16 groups. When feasible, truncate the group list rather than generating an error. Minor changes: - Reduce the number of hand rolled versions of groupmember(). - Do not assign to both cr_gid and cr_groups[0]. - Modify ipfw to cache ucreds instead of part of their contents since they are immutable once referenced by more than one entity. Submitted by: Isilon Systems (initial implementation) X-MFC after: never PR: bin/113398 kern/133867
* Fix some of the style errors in *getpages().alc2009-06-181-18/+13
|
* Add the SVC_RELEASE(xprt), as required by r194407.rmacklem2009-06-171-0/+1
| | | | Approved by: kib (mentor)
* Add explicit includes for jail.h to the files that need them andbz2009-06-171-0/+1
| | | | remove the "hidden" one from vimage.h.
* Fix handling of ".." in nfs_lookup() for the forced dismount casermacklem2009-06-171-14/+36
| | | | | | by cribbing the change made to the regular nfs client in r194358. Approved by: kib (mentor)
* Rename the host-related prison fields to be the same as the host.*jamie2009-06-131-1/+2
| | | | | | | parameters they represent, and the variables they replaced, instead of abbreviated versions of them. Approved by: bz (mentor)
* Use getcredhostuuid instead of accessing the prison directly.jamie2009-06-131-5/+1
| | | | Approved by: bz (mentor)
* This commit is analagous to r193952, but for the experimental nfsrmacklem2009-06-101-8/+15
| | | | | | | | | | | subsystem. Add a test for VI_DOOMED just after ncl_upgrade_vnlock() in ncl_bioread_check_cons(). This is required since it is possible for the vnode to be vgonel()'d while in ncl_upgrade_vnlock() when a forced dismount is in progress. Also, move the check for VI_DOOMED in ncl_vinvalbuf() down to after ncl_upgrade_vnlock() and replace the out of date comment for it. Approved by: kib (mentor)
* Since vn_lock() with the LK_RETRY flag never returns an errorrmacklem2009-06-091-7/+11
| | | | | | | | | for FreeBSD-CURRENT, the code that checked for and returned the error was broken. Change it to check for VI_DOOMED set after vn_lock() and return an error for that case. I believe this should only happen for forced dismounts. Approved by: kib (mentor)
* Fix nfscl_getcl() so that it doesn't crash when it is called tormacklem2009-06-081-20/+29
| | | | | | | do an NFSv4 Close operation with the cred argument NULL. Also, clarify what NULL arguments mean in the function's comment. Approved by: kib (mentor)
* nfs_write() can use the recently introduced vfs_bio_set_valid() instead ofalc2009-05-311-1/+1
| | | | | | vfs_bio_set_validclean(), thereby avoiding the page queues lock. Garbage collect vfs_bio_set_validclean(). Nothing uses it any longer.
* Unbreak options VIMAGE kernel builds.zec2009-05-311-1/+1
| | | | Approved by: julian (mentor)
* Add a check to v_type == VREG for the recently modified code thatrmacklem2009-05-301-11/+11
| | | | | | | | does NFSv4 Closes in the experimental client's VOP_INACTIVE(). I also replaced a bunch of ap->a_vp with a local copy of vp, because I thought that made it more readable. Approved by: kib (mentor)
* Place hostnames and similar information fully under the prison system.jamie2009-05-292-11/+13
| | | | | | | | | | | | | | | | | The system hostname is now stored in prison0, and the global variable "hostname" has been removed, as has the hostname_mtx mutex. Jails may have their own host information, or they may inherit it from the parent/system. The proper way to read the hostname is via getcredhostname(), which will copy either the hostname associated with the passed cred, or the system hostname if you pass NULL. The system hostname can still be accessed directly (and without locking) at prison0.pr_host, but that should be avoided where possible. The "similar information" referred to is domainname, hostid, and hostuuid, which have also become prison parameters and had their associated global variables removed. Approved by: bz (mentor)
* Make *getpages()s' assertion on the state of each page's dirty bitsalc2009-05-281-1/+1
| | | | stricter.
* Fix handling of NFSv4 Close operations in ncl_inactive(). Onlyrmacklem2009-05-271-7/+13
| | | | | | | | do them for NFSv4 and flush writes to the server before doing the Close(s), as required. Also, use the a_td argument instead of curthread. Approved by: kib (mentor)
* Fix the experimental nfsv4 client so that it works for thermacklem2009-05-241-10/+10
| | | | | | | | | | case of a kerberized mount without a host based principal name. This will only work for mounts being done by a user other than root. Support for a host based principal name will not work until proposed changes to the rpcsec_gss part of the krpc are committed. It now builds for "options KGSSAPI". Approved by: kib (mentor)
OpenPOWER on IntegriCloud