summaryrefslogtreecommitdiffstats
path: root/sys/fs/tmpfs
Commit message (Collapse)AuthorAgeFilesLines
* - Fix some style bugs in tmpfs_mount(). [1]jh2010-01-132-11/+7
| | | | | | - Remove a stale comment about tmpfs_mem_info() 'total' argument. Reported by: bde [1]
* - Change the type of size_max to u_quad_t because its value is convertedjh2010-01-081-3/+3
| | | | | | | | | | with vfs_scanopt(9) using the "%qu" format string. - Limit the maximum value of size_max to (SIZE_MAX - PAGE_SIZE) to prevent overflow in howmany() macro. PR: kern/141194 Approved by: trasz (mentor) MFC after: 2 weeks
* There is no need to "busy" a page when the object is locked for the durationalc2009-10-261-2/+1
| | | | of the operation.
* 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
* Implement global and per-uid accounting of the anonymous memory. Addkib2009-06-231-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | 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)
* Eliminate unnecessary variables.alc2009-06-131-4/+2
|
* Eliminate redundant setting of a page's valid bits and pointless clearingalc2009-05-271-2/+2
| | | | of the same page's dirty bits.
* Remove the thread argument from the FSD (File-System Dependent) parts ofattilio2009-05-114-27/+23
| | | | | | | | | | | | | | | | | the VFS. Now all the VFS_* functions and relating parts don't want the context as long as it always refers to curthread. In some points, in particular when dealing with VOPs and functions living in the same namespace (eg. vflush) which still need to be converted, pass curthread explicitly in order to retain the old behaviour. Such loose ends will be fixed ASAP. While here fix a bug: now, UFS_EXTATTR can be compiled alone without the UFS_EXTATTR_AUTOSTART option. VFS KPI is heavilly changed by this commit so thirdy parts modules needs to be recompiled. Bump __FreeBSD_version in order to signal such situation.
* Use uiomove_fromphys() instead of the combination of sf_buf and uiomove().alc2009-02-221-34/+11
| | | | | | | This is not only shorter; it also eliminates unnecessary thread pinning on architectures that implement a direct map. MFC after: 3 weeks
* Simplify the unwiring and activation of pages.alc2009-02-221-4/+2
| | | | MFC after: 1 week
* Lookup up the directory entry for the tmpfs node that are deleted bykib2009-02-083-22/+10
| | | | | | | | | both node pointer and name component. This does the right thing for hardlinks to the same node in the same directory. Submitted by: Yoshihiro Ota <ota j email ne jp> PR: kern/131356 MFC after: 2 weeks
* Remove unused local variables.bz2009-01-311-2/+0
| | | | | | Submitted by: Christoph Mallon christoph.mallon@gmx.de Reviewed by: kib MFC after: 2 weeks
* Introduce accmode_t. This is required for NFSv4 ACLs - it will be neccessarytrasz2008-10-281-4/+4
| | | | | | | to add more V* constants, and the variables changed by this patch were often being assigned to mode_t variables, which is 16 bit. Approved by: rwatson (mentor)
* The kernel implemented 'memcmp' is an alias for 'bcmp'. However, memcmpobrien2008-09-233-3/+3
| | | | | | | | | | | and bcmp are not the same thing. 'man bcmp' states that the return is "non-zero" if the two byte strings are not identical. Where as, 'man memcmp' states that the return is the "difference between the first two differing bytes (treated as unsigned char values" if the two byte strings are not identical. So provide a proper memcmp(9), but it is a C implementation not a tuned assembly implementation. Therefore bcmp(9) should be preferred over memcmp(9).
* fdescfs, devfs, mqueuefs, nfs, portalfs, pseudofs, tmpfs and xfskib2008-09-201-2/+0
| | | | | | | | | | | initialize the vattr structure in VOP_GETATTR() with VATTR_NULL(), vattr_null() or by zeroing it. Remove these to allow preinitialization of fields work in vn_stat(). This is needed to get birthtime initialized correctly. Submitted by: Jaakko Heinonen <jh saunalahti fi> Discussed on: freebsd-fs MFC after: 1 month
* Initialize va_rdev to NODEV instead of 0 or VNOVAL in VOP_GETATTR().kib2008-09-201-1/+1
| | | | | | | | | NODEV is more appropriate when va_rdev doesn't have a meaningful value. Submitted by: Jaakko Heinonen <jh saunalahti fi> Suggested by: bde Discussed on: freebsd-fs MFC after: 1 month
* Initialize va_flags and va_filerev properly in VOP_GETATTR(). Don'tkib2008-09-201-3/+1
| | | | | | | | | | initialize va_vaflags and va_spare because they are not part of the VOP_GETATTR() API. Also don't initialize birthtime to ctime or zero. Submitted by: Jaakko Heinonen <jh saunalahti fi> Reviewed by: bde Discussed on: freebsd-fs MFC after: 1 month
* Reflect license change of NetBSD code.delphij2008-09-037-56/+7
| | | | | Obtained from: NetBSD MFC after: 3 days
* Decontextualize the couplet VOP_GETATTR / VOP_SETATTR as the passed threadattilio2008-08-282-8/+7
| | | | | | was always curthread and totally unuseful. Tested by: Giovanni Trematerra <giovanni dot trematerra at gmail dot com>
* Do not redo the vnode tear-down work already done by insmntque() whenkib2008-06-151-4/+1
| | | | | | | | vnode cannot be put on the vnode list for mount. Reported and tested by: marck Guilty party: me MFC after: 3 days
* Move the head of byte-level advisory lock list from thekib2008-04-163-36/+0
| | | | | | | | | | | | | | | | | | | | | | filesystem-specific vnode data to the struct vnode. Provide the default implementation for the vop_advlock and vop_advlockasync. Purge the locks on the vnode reclaim by using the lf_purgelocks(). The default implementation is augmented for the nfs and smbfs. In the nfs_advlock, push the Giant inside the nfs_dolock. Before the change, the vop_advlock and vop_advlockasync have taken the unlocked vnode and dereferenced the fs-private inode data, racing with with the vnode reclamation due to forced unmount. Now, the vop_getattr under the shared vnode lock is used to obtain the inode size, and later, in the lf_advlockasync, after locking the vnode interlock, the VI_DOOMED flag is checked to prevent an operation on the doomed vnode. The implementation of the lf_purgelocks() is submitted by dfr. Reported by: kris Tested by: kris, pho Discussed with: jeff, dfr MFC after: 2 weeks
* Add the new kernel-mode NFS Lock Manager. To use it instead of thedfr2008-03-261-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | user-mode lock manager, build a kernel with the NFSLOCKD option and add '-k' to 'rpc_lockd_flags' in rc.conf. Highlights include: * Thread-safe kernel RPC client - many threads can use the same RPC client handle safely with replies being de-multiplexed at the socket upcall (typically driven directly by the NIC interrupt) and handed off to whichever thread matches the reply. For UDP sockets, many RPC clients can share the same socket. This allows the use of a single privileged UDP port number to talk to an arbitrary number of remote hosts. * Single-threaded kernel RPC server. Adding support for multi-threaded server would be relatively straightforward and would follow approximately the Solaris KPI. A single thread should be sufficient for the NLM since it should rarely block in normal operation. * Kernel mode NLM server supporting cancel requests and granted callbacks. I've tested the NLM server reasonably extensively - it passes both my own tests and the NFS Connectathon locking tests running on Solaris, Mac OS X and Ubuntu Linux. * Userland NLM client supported. While the NLM server doesn't have support for the local NFS client's locking needs, it does have to field async replies and granted callbacks from remote NLMs that the local client has contacted. We relay these replies to the userland rpc.lockd over a local domain RPC socket. * Robust deadlock detection for the local lock manager. In particular it will detect deadlocks caused by a lock request that covers more than one blocking request. As required by the NLM protocol, all deadlock detection happens synchronously - a user is guaranteed that if a lock request isn't rejected immediately, the lock will eventually be granted. The old system allowed for a 'deferred deadlock' condition where a blocked lock request could wake up and find that some other deadlock-causing lock owner had beaten them to the lock. * Since both local and remote locks are managed by the same kernel locking code, local and remote processes can safely use file locks for mutual exclusion. Local processes have no fairness advantage compared to remote processes when contending to lock a region that has just been unlocked - the local lock manager enforces a strict first-come first-served model for both local and remote lockers. Sponsored by: Isilon Systems PR: 95247 107555 115524 116679 MFC after: 2 weeks
* Axe the 'thread' argument from VOP_ISLOCKED() and lockstatus() as it isattilio2008-02-252-30/+30
| | | | | | | | | always curthread. As KPI gets broken by this patch, manpages and __FreeBSD_version will be updated by further commits. Tested by: Andrea Barberio <insomniac at slackware dot it>
* VOP_LOCK1() (and so VOP_LOCK()) and VOP_UNLOCK() are only used inattilio2008-01-132-3/+3
| | | | | | | | | | | conjuction with 'thread' argument passing which is always curthread. Remove the unuseful extra-argument and pass explicitly curthread to lower layer functions, when necessary. KPI results broken by this change, which should affect several ports, so version bumping and manpage update will be further committed. Tested by: kris, pho, Diego Sardina <siarodx at gmail dot com>
* vn_lock() is currently only used with the 'curthread' passed as argument.attilio2008-01-103-4/+4
| | | | | | | | | | | | | | | | Remove this argument and pass curthread directly to underlying VOP_LOCK1() VFS method. This modify makes the code cleaner and in particular remove an annoying dependence helping next lockmgr() cleanup. KPI results, obviously, changed. Manpage and FreeBSD_version will be updated through further commits. As a side note, would be valuable to say that next commits will address a similar cleanup about VFS methods, in particular vop_lock1 and vop_unlock. Tested by: Diego Sardina <siarodx at gmail dot com>, Andrea Di Pasquale <whyx dot it at gmail dot com>
* Turn MPASS(0) into panic with more obvious reason why the assertiondelphij2007-12-071-5/+5
| | | | is failed.
* size_max should be unsigned, as such, use size_t here.delphij2007-12-061-1/+1
|
* Explicitly initialize 'error' to 0 (two places). It lets one to build tmpfswkoszek2007-12-041-1/+3
| | | | | | | from the latest source tree with older compiler--gcc3. Reviewed by: kib@ (on freebsd-current@) Approved by: cognet@ (mentor)
* MFp4: Several fixes to tmpfs which makes it to survive from pho@'sdelphij2007-11-184-33/+46
| | | | | | | | | | | | | | | | | | | | strees2 suite, to quote his letter, this change: 1. It removes the tn_lookup_dirent stuff. I think this cannot be fixed, because nothing protects vnode/tmpfs node between lookup is done, and actual operation is performed, in the case the vnode lock is dropped. At least, this is the case with the from vnode for rename. For now, we do the linear lookup in the parent node. This has its own drawbacks. Not mentioning speed (that could be fixed by using hash), the real problem is the situation where several hardlinks exist in the dvp. But, I think this is fixable. 2. The patch restores the VV_ROOT flag on the root vnode after it became reclaimed and allocated again. This fixes MPASS assertion at the start of the tmpfs_lookup() reported by many. Submitted by: kib
* MFp4: Fix several style(9) bugs.delphij2007-11-181-19/+12
| | | | Submitted by: des
* Correct a stack overflow which will trigger panics whendelphij2007-11-121-1/+1
| | | | | | | | mode= is specified, caused by incorrect format string specified to vfs_scanopt() and subsequently vsscanf(). Pointed out by: kib Submitted by: des
* MFp4: Provide a dummy verb "export" to shut up the messagedelphij2007-10-041-1/+1
| | | | | | | showed up at start when NFS is enabled. Reported by: rafan Approved by: re (tmpfs blanket)
* Additional work is still needed before we can claim that tmpfsdelphij2007-10-041-0/+3
| | | | | | is stable enough for production usage. Warn user upon mount. Approved by: re (tmpfs blanket)
* MFp4: rework tmpfs_readdir() logic in terms of correctness.delphij2007-08-161-12/+15
| | | | | Approved by: re (tmpfs blanket) Tested with: fstest, fsx
* MFp4:delphij2007-08-103-60/+96
| | | | | | | | | | | | | | | - LK_RETRY prohibits vget() and vn_lock() to return error. Remove associated code. [1] - Properly use vhold() and vdrop() instead of their unlocked versions, we are guaranteed to have the vnode's interlock unheld. [1] - Fix a pseudo-infinite loop caused by 64/32-bit arithmetic with the same way used in modern NetBSD versions. [2] - Reorganize tmpfs_readdir to reduce duplicated code. Submitted by: kib [1] Obtained from: NetBSD [2] Approved by: re (tmpfs blanket)
* MFp4:delphij2007-08-104-35/+68
| | | | | | | | | | | | | | | - Respect cnflag and don't lock vnode always as LK_EXCLUSIVE [1] - Properly lock around tn_vnode to avoid NULL deference - Be more careful handling vnodes (*) (*) This is a WIP [1] by pjd via howardsu Thanks kib@ for his valuable VFS related comments. Tested with: fsx, fstest, tmpfs regression test set Found by: pho's stress2 suite Approved by: re (tmpfs blanket)
* MFp4 - Refine locking to eliminate some potential race/panics:delphij2007-08-032-21/+22
| | | | | | | | | | | | | - Copy before testing a pointer. This closes a race window. - Use msleep with the node interlock instead of tsleep. - Do proper locking around access to tn_vpstate. - Assert vnode VOP lock for dir_{atta,de}tach to capture inconsistent locking. Suggested by: kib Submitted by: delphij Reviewed by: Howard Su Approved by: re (tmpfs blanket)
* MFp4: Force 64-bit arithmatic when caculating the maximum file size.delphij2007-07-241-1/+1
| | | | | | | | | This fixes tmpfs caculations on 32-bit systems equipped with more than 4GB swap. Reported by: Craig Boston <craig xfoil gank org> PR: kern/114870 Approved by: re (tmpfs blanket)
* MFp4: When swapping is not enabled, allow creating files by takingdelphij2007-07-231-1/+1
| | | | | | | | physical memory pages into account for tm_maxfilesize. Reported by: Dominique Goncalves <dominique.goncalves gmail.com> Submitted by: Howard Su Approved by: re (tmpfs blanket)
* MFp4: Rework on tmpfs's mapped read/write procedures. Thisdelphij2007-07-191-60/+185
| | | | | | | | | | should finally fix fsx test case. The printf's added here would be eventually turned into assertions. Submitted by: Mingyan Guo (mostly) Approved by: re (tmpfs blanket)
* MFp4: Make use of the kernel unit number allocation facilitydelphij2007-07-113-18/+10
| | | | | | | for tmpfs nodes. Submitted by: Mingyan Guo <guomingyan gmail com> Approved by: re (tmpfs blanket)
* MFp4:delphij2007-07-084-67/+83
| | | | | | | | | | | | | | | | - Plug memory leak. - Respect underlying vnode's properties rather than assuming that the user want root:wheel + 0755. Useful for using tmpfs(5) for /tmp. - Use roundup2 and howmany macros instead of rolling our own version. - Try to fix fsx -W -R foo case. - Instead of blindly zeroing a page, determine whether we need a pagein order to prevent data corruption. - Fix several bugs reported by Coverity. Submitted by: Mingyan Guo <guomingyan gmail com>, Howard Su, delphij Coverity ID: CID 2550, 2551, 2552, 2557 Approved by: re (tmpfs blanket)
* MFp4:delphij2007-06-296-187/+20
| | | | | | | | | | | | | - Remove unnecessary NULL checks after M_WAITOK allocations. - Use VOP_ACCESS instead of hand-rolled suser_cred() calls. [1] - Use malloc(9) KPI to allocate memory for string. The optimization taken from NetBSD is not valid for FreeBSD because our malloc(9) already act that way. [2] Requested by: rwatson [1] Submitted by: Howard Su [2] Approved by: re (tmpfs blanket)
* Space/style cleanups after last set of commits.delphij2007-06-287-72/+71
| | | | Approved by: re (tmpfs blanket)
* Staticify most of fifo/vn operations, they should notdelphij2007-06-284-99/+76
| | | | | | be directly exposed outside. Approved by: re (tmpfs blanket)
* Use vfs_timestamp instead of nanotime when obtainingdelphij2007-06-281-4/+3
| | | | | | a timestamp for use with timekeeping. Approved by: re (tmpfs blanket)
* Reorder tf_gen and tf_id in struct tmpfs_fid. Thisdelphij2007-06-281-2/+2
| | | | | | | saves 8 bytes on amd64 architecture. Obtained from: NetBSD Approved by: re (tmpfs blanket)
* Remove two function prototypes that are no longer used.delphij2007-06-261-4/+0
| | | | Approved by: re (tmpfs blanket)
OpenPOWER on IntegriCloud