summaryrefslogtreecommitdiffstats
path: root/sys/fs
Commit message (Collapse)AuthorAgeFilesLines
* Remove unneeded ifdefs.trasz2009-12-037-252/+8
| | | | Reviewed by: rmacklem
* Don't use ap->a_td->td_ucred when we were passed ap->a_cred.trasz2009-12-021-1/+1
|
* Modify the experimental nfs server so that it falls back tormacklem2009-11-231-38/+44
| | | | | | | | | | | using VOP_LOOKUP() when VFS_VGET() returns EOPNOTSUPP in the ReaddirPlus RPC. This patch is based upon one by pjd@ for the regular nfs server which has not yet been committed. It is needed when a ZFS volume is exported and ReaddirPlus (which almost always happens for NFSv4) is performed by a client. The patch also simplifies vnode lock handling somewhat. MFC after: 2 weeks
* Patch the experimental NFS server is a manner analagous tormacklem2009-11-203-19/+29
| | | | | | | | | | | | | r197525, so that the creation verifier is handled correctly in va_atime for 64bit architectures. There were two problems. One was that the code incorrectly assumed that sizeof (struct timespec) == 8 and the other was that the tv_sec field needs to be assigned from a signed 32bit integer, so that sign extension occurs on 64bit architectures. This is required for correct operation when exporting ZFS volumes. Reviewed by: pjd MFC after: 2 weeks
* 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)
* - Improve comments about locking of the "struct fifoinfo" which is a bitattilio2009-11-061-8/+9
| | | | | | | | unclear. - Fix a memory leak [0] [0] Diagnosed by: Dorr H. Clark <dclark at engr dot scu dot edu> MFC: 1 week
* There is no need to "busy" a page when the object is locked for the durationalc2009-10-261-2/+1
| | | | of the operation.
* Spell DIAGNOSTIC correctly.ru2009-10-241-1/+1
|
* 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 locking around access to parent node, and bail out when the parentdelphij2009-10-113-8/+115
| | | | | | | | | node is already freed rather than panicking the system. PR: kern/122038 Submitted by: gk Tested by: pho MFC after: 1 week
* Add a special workaround to handle UIO_NOCOPY case. This fixes datadelphij2009-10-071-24/+80
| | | | | | | | corruption observed when sendfile() is being used. PR: kern/127213 Submitted by: gk MFC after: 2 weeks
* Fix a bug that causes the fsx test case of mmap'ed page being out of syncdelphij2009-10-041-2/+6
| | | | | | | | of read/write, inspired by ZFS's counterpart. PR: kern/139312 Submitted by: gk@ MFC after: 1 week
* Provide default implementation for VOP_ACCESS(9), so that filesystems whichtrasz2009-10-011-1/+0
| | | | | | | want to provide VOP_ACCESSX(9) don't have to implement both. Note that this commit makes implementation of either of these two mandatory. Reviewed by: kib
* Fix typo in the comment.trasz2009-09-301-1/+1
|
* Add per-process osrel node to the procfs, to allow read and set p_osrelkib2009-09-233-1/+73
| | | | | | | value for the process. Approved by: des (procfs maintainer) MFC after: 3 weeks
* Use C99 initialization for struct filterops.rwatson2009-09-121-6/+15
| | | | | | Obtained from: Mac OS X Sponsored by: Apple Inc. MFC after: 3 weeks
* 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
* Revert previous commit and add myself to the list of people who shouldphk2009-09-081-1/+0
| | | | know better than to commit with a cat in the area.
* Add necessary include.phk2009-09-081-0/+1
|
* If a race is detected, pfs_vncache_alloc() may reclaim a vnode that hadkib2009-09-071-3/+5
| | | | | | | | | | | | | | | | never been inserted into the pfs_vncache list. Since pfs_vncache_free() does not anticipate this case, it decrements pfs_vncache_entries unconditionally; if the vnode was not in the list, pfs_vncache_entries will no longer reflect the actual number of list entries. This may cause size of the cache to exceed the configured maximum. It may also trigger a panic during module unload or system shutdown. Do not decrement pfs_vncache_entries for the vnode that was not in the list. Submitted by: tegge Reviewed by: des MFC after: 1 week
* insmntque_stddtr() clears vp->v_data and resets vp->v_op tokib2009-09-071-0/+1
| | | | | | | | | dead_vnodeops before calling vgone(). Revert r189706 and corresponding part of the r186560. Noted and reviewed by: tegge Approved by: des (pseudofs part) MFC after: 3 days
* Remove spurious pfs_unlock().kib2009-08-311-1/+0
| | | | | | PR: kern/137310 Reviewed by: des MFC after: 3 days
* Fix poll() on half-closed sockets, while retaining POLLHUP for fifos.jilles2009-08-251-0/+3
| | | | | | | | | | | | | This reverts part of r196460, so that sockets only return POLLHUP if both directions are closed/error. Fifos get POLLHUP by closing the unused direction immediately after creating the sockets. The tools/regression/poll/*poll.c tests now pass except for two other things: - if POLLHUP is returned, POLLIN is always returned as well instead of only when there is data left in the buffer to be read - fifo old/new reader distinction does not work the way POSIX specs it Reviewed by: kib, bde
* 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)
* Merge the remainder of kern_vimage.c and vimage.h into vnet.c andrwatson2009-08-011-1/+0
| | | | | | | | | | vnet.h, we now use jails (rather than vimages) as the abstraction for virtualization management, and what remained was specific to virtual network stacks. Minor cleanups are done in the process, and comments updated to reflect these changes. Reviewed by: bz Approved by: re (vimage blanket)
* Fix some LORs between vnode locks and filedescriptor table locks.jhb2009-07-311-2/+0
| | | | | | | | | | - Don't grab the filedesc lock just to read fd_cmask. - Drop vnode locks earlier when mounting the root filesystem and before sanitizing stdin/out/err file descriptors during execve(). Submitted by: kib Approved by: re (rwatson) MFC after: 1 week
* 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)
* Add a new type of VM object: OBJT_SG. An OBJT_SG object is very similar tojhb2009-07-241-0/+1
| | | | | | | | | | | a device pager (OBJT_DEVICE) object in that it uses fictitious pages to provide aliases to other memory addresses. The primary difference is that it uses an sglist(9) to determine the physical addresses for a given offset into the object instead of invoking the d_mmap() method in a device driver. Reviewed by: alc Approved by: re (kensmith) MFC after: 2 weeks
* 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-223-7/+14
| | | | | | | | 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-143-4/+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)
* Add calls to the experimental nfs client for the case of an "intr" mount,rmacklem2009-07-121-1/+16
| | | | | | | so that signals that aren't supposed to terminate RPCs in progress are masked off during the RPC. Approved by: re (kensmith), kib (mentor)
* 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-093-183/+178
| | | | | | | | | | | | | 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)
* Fix poll(2) and select(2) for named pipes to return "ready for read"kib2009-07-071-20/+14
| | | | | | | | | | | | | | | | | when all writers, observed by reader, exited. Use writer generation counter for fifo, and store the snapshot of the fifo generation in the f_seqcount field of struct file, that is otherwise unused for fifos. Set FreeBSD-undocumented POLLINIGNEOF flag only when file f_seqcount is equal to fifo' fi_wgen, and revert r89376. Fix POLLINIGNEOF for sockets and pipes, and return POLLHUP for them. Note that the patch does not fix not returning POLLHUP for fifos. PR: kern/94772 Submitted by: bde (original version) Reviewed by: rwatson, jilles Approved by: re (kensmith) MFC after: 6 weeks (might be)
* In vn_vget_ino() and their inline equivalents, mnt_ref() the mount pointkib2009-07-021-0/+2
| | | | | | | | | | | around the sequence that drop vnode lock and then busies the mount point. Not having vlocked node or direct reference to the mp allows for the forced unmount to proceed, making mp unmounted or reused. Tested by: pho Reviewed by: jeff Approved by: re (kensmith) MFC after: 2 weeks
* Change the type of uio_resid member of struct uio from int to ssize_t.kib2009-06-253-5/+5
| | | | | | | | Note that this does not actually enable full-range i/o requests for 64 architectures, and is done now to update KBI only. Tested by: pho Reviewed by: jhb, bde (as part of the review of the bigger patch)
* 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
* Implement global and per-uid accounting of the anonymous memory. Addkib2009-06-232-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | rlimit RLIMIT_SWAP that limits the amount of swap that may be reserved for the uid. The accounting information (charge) is associated with either map entry, or vm object backing the entry, assuming the object is the first one in the shadow chain and entry does not require COW. Charge is moved from entry to object on allocation of the object, e.g. during the mmap, assuming the object is allocated, or on the first page fault on the entry. It moves back to the entry on forks due to COW setup. The per-entry granularity of accounting makes the charge process fair for processes that change uid during lifetime, and decrements charge for proper uid when region is unmapped. The interface of vm_pager_allocate(9) is extended by adding struct ucred *, that is used to charge appropriate uid when allocation if performed by kernel, e.g. md(4). Several syscalls, among them is fork(2), may now return ENOMEM when global or per-uid limits are enforced. In collaboration with: pho Reviewed by: alc Approved by: re (kensmith)
* Add explicit struct ucred * argument for VOP_VPTOCNP, to be used bykib2009-06-211-1/+2
| | | | | | | | | | vn_open_cred in default implementation. Valid struct ucred is needed for audit and MAC, and curthread credentials may be wrong. This further requires modifying the interface of vn_fullpath(9), but it is out of scope of this change. Reviewed by: rwatson
* In non-debugging mode make this define (void)0 instead of nothing. Thisrdivacky2009-06-211-3/+3
| | | | | | | | | | helps to catch bugs like the below with clang. if (cond); <--- note the trailing ; something(); Approved by: ed (mentor) Discussed on: current@
* Replace RPCAUTH_UNIXGIDS with NFS_MAXGRPS so that nfscbd.c will build.rmacklem2009-06-202-3/+3
| | | | Approved by: kib (mentor)
* Improve nested jail awareness of devfs by handling credentials.ed2009-06-201-0/+22
| | | | | | | | | | | | | | | | | | Now that we start to use credentials on character devices more often (because of MPSAFE TTY), move the prison-checks that are in place in the TTY code into devfs. Instead of strictly comparing the prisons, use the more common prison_check() function to compare credentials. This means that pseudo-terminals are only visible in devfs by processes within the same jail and parent jails. Even though regular users in parent jails can now interact with pseudo-terminals from child jails, this seems to be the right approach. These processes are also capable of interacting with the jailed processes anyway, through signals for example. Reviewed by: kib, rwatson (older version)
* Change the size of the nfsc_groups[] array in the experimental nfsrmacklem2009-06-202-5/+5
| | | | | | | | 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)
OpenPOWER on IntegriCloud